@libresign/pdf-elements 0.2.0 → 0.2.2

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.
@@ -190,6 +190,74 @@ module.exports = getBuiltIn('document', 'documentElement');
190
190
  module.exports = {};
191
191
 
192
192
 
193
+ /***/ },
194
+
195
+ /***/ 531
196
+ (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
197
+
198
+
199
+ var $ = __webpack_require__(6518);
200
+ var call = __webpack_require__(9565);
201
+ var aCallable = __webpack_require__(9306);
202
+ var anObject = __webpack_require__(8551);
203
+ var getIteratorDirect = __webpack_require__(1767);
204
+ var getIteratorFlattenable = __webpack_require__(8646);
205
+ var createIteratorProxy = __webpack_require__(9462);
206
+ var iteratorClose = __webpack_require__(9539);
207
+ var IS_PURE = __webpack_require__(6395);
208
+ var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684);
209
+ var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
210
+
211
+ var FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE
212
+ && !iteratorHelperThrowsOnInvalidIterator('flatMap', function () { /* empty */ });
213
+ var flatMapWithoutClosingOnEarlyError = !IS_PURE && !FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR
214
+ && iteratorHelperWithoutClosingOnEarlyError('flatMap', TypeError);
215
+
216
+ var FORCED = IS_PURE || FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || flatMapWithoutClosingOnEarlyError;
217
+
218
+ var IteratorProxy = createIteratorProxy(function () {
219
+ var iterator = this.iterator;
220
+ var mapper = this.mapper;
221
+ var result, inner;
222
+
223
+ while (true) {
224
+ if (inner = this.inner) try {
225
+ result = anObject(call(inner.next, inner.iterator));
226
+ if (!result.done) return result.value;
227
+ this.inner = null;
228
+ } catch (error) { iteratorClose(iterator, 'throw', error); }
229
+
230
+ result = anObject(call(this.next, iterator));
231
+
232
+ if (this.done = !!result.done) return;
233
+
234
+ try {
235
+ this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false);
236
+ } catch (error) { iteratorClose(iterator, 'throw', error); }
237
+ }
238
+ });
239
+
240
+ // `Iterator.prototype.flatMap` method
241
+ // https://tc39.es/ecma262/#sec-iterator.prototype.flatmap
242
+ $({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
243
+ flatMap: function flatMap(mapper) {
244
+ anObject(this);
245
+ try {
246
+ aCallable(mapper);
247
+ } catch (error) {
248
+ iteratorClose(this, 'throw', error);
249
+ }
250
+
251
+ if (flatMapWithoutClosingOnEarlyError) return call(flatMapWithoutClosingOnEarlyError, this, mapper);
252
+
253
+ return new IteratorProxy(getIteratorDirect(this), {
254
+ mapper: mapper,
255
+ inner: null
256
+ });
257
+ }
258
+ });
259
+
260
+
193
261
  /***/ },
194
262
 
195
263
  /***/ 616
@@ -2234,6 +2302,24 @@ var WeakMap = globalThis.WeakMap;
2234
2302
  module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
2235
2303
 
2236
2304
 
2305
+ /***/ },
2306
+
2307
+ /***/ 8646
2308
+ (module, __unused_webpack_exports, __webpack_require__) {
2309
+
2310
+
2311
+ var call = __webpack_require__(9565);
2312
+ var anObject = __webpack_require__(8551);
2313
+ var getIteratorDirect = __webpack_require__(1767);
2314
+ var getIteratorMethod = __webpack_require__(851);
2315
+
2316
+ module.exports = function (obj, stringHandling) {
2317
+ if (!stringHandling || typeof obj !== 'string') anObject(obj);
2318
+ var method = getIteratorMethod(obj);
2319
+ return getIteratorDirect(anObject(method !== undefined ? call(method, obj) : obj));
2320
+ };
2321
+
2322
+
2237
2323
  /***/ },
2238
2324
 
2239
2325
  /***/ 8686
@@ -2676,7 +2762,7 @@ __webpack_require__.d(__webpack_exports__, {
2676
2762
  "default": () => (/* binding */ entry_lib)
2677
2763
  });
2678
2764
 
2679
- // UNUSED EXPORTS: PDFElements
2765
+ // UNUSED EXPORTS: PDFElements, setWorkerPath
2680
2766
 
2681
2767
  ;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
2682
2768
  /* eslint-disable no-var */
@@ -2696,980 +2782,28 @@ if (typeof window !== 'undefined') {
2696
2782
  // Indicate to webpack that this file can be concatenated
2697
2783
  /* harmony default export */ const setPublicPath = (null);
2698
2784
 
2699
- ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=template&id=7a179460&scoped=true
2700
- var render = function render() {
2701
- var _vm = this,
2702
- _c = _vm._self._c;
2703
- return _c('div', {
2704
- staticClass: "pdf-elements-root",
2705
- style: {
2706
- width: _vm.width,
2707
- height: _vm.height
2708
- }
2709
- }, [_vm.pdfDocuments.length ? _c('div', {
2710
- staticClass: "pages-container",
2711
- style: {
2712
- transform: `scale(${_vm.visualScale / _vm.scale})`,
2713
- transformOrigin: 'top center'
2714
- }
2715
- }, _vm._l(_vm.pdfDocuments, function (pdfDoc, docIndex) {
2716
- return _c('div', {
2717
- key: docIndex
2718
- }, _vm._l(pdfDoc.pages, function (page, pIndex) {
2719
- return _c('div', {
2720
- key: `${docIndex}-${pIndex}`,
2721
- staticClass: "page-slot"
2722
- }, [_c('div', {
2723
- staticClass: "page-wrapper",
2724
- on: {
2725
- "mousedown": function ($event) {
2726
- return _vm.selectPage(docIndex, pIndex);
2727
- },
2728
- "touchstart": function ($event) {
2729
- return _vm.selectPage(docIndex, pIndex);
2730
- }
2731
- }
2732
- }, [_c('div', {
2733
- staticClass: "page-canvas",
2734
- class: {
2735
- 'shadow-outline': docIndex === _vm.selectedDocIndex && pIndex === _vm.selectedPageIndex
2736
- }
2737
- }, [_c('PDFPage', {
2738
- ref: `page${docIndex}-${pIndex}`,
2739
- refInFor: true,
2740
- attrs: {
2741
- "page": page,
2742
- "scale": _vm.scale
2743
- },
2744
- on: {
2745
- "onMeasure": function ($event) {
2746
- return _vm.onMeasure($event, docIndex, pIndex);
2747
- }
2748
- }
2749
- }), _c('div', {
2750
- staticClass: "overlay"
2751
- }, [_vm.isAddingMode && _vm.previewPageDocIndex === docIndex && _vm.previewPageIndex === pIndex && _vm.previewElement && _vm.previewVisible ? _c('div', {
2752
- staticClass: "preview-element",
2753
- style: {
2754
- left: `${_vm.previewPosition.x * _vm.previewScale.x}px`,
2755
- top: `${_vm.previewPosition.y * _vm.previewScale.y}px`,
2756
- width: `${_vm.previewElement.width * _vm.previewScale.x}px`,
2757
- height: `${_vm.previewElement.height * _vm.previewScale.y}px`
2758
- }
2759
- }, [_vm._t("custom", null, {
2760
- "object": _vm.previewElement,
2761
- "isSelected": false
2762
- })], 2) : _vm._e(), _vm._l(pdfDoc.allObjects[pIndex], function (object) {
2763
- return _c('DraggableElement', {
2764
- key: object.id,
2765
- ref: `draggable${docIndex}-${pIndex}-${object.id}`,
2766
- refInFor: true,
2767
- attrs: {
2768
- "object": object,
2769
- "pages-scale": _vm.getRenderPageScale(docIndex, pIndex),
2770
- "page-width": _vm.getPageWidth(docIndex, pIndex),
2771
- "page-height": _vm.getPageHeight(docIndex, pIndex),
2772
- "on-update": payload => _vm.updateObject(docIndex, object.id, payload),
2773
- "on-delete": () => _vm.deleteObject(docIndex, object.id),
2774
- "on-drag-start": (mouseX, mouseY, pointerOffset, dragShift) => _vm.startDraggingElement(docIndex, pIndex, object, mouseX, mouseY, pointerOffset, dragShift),
2775
- "on-drag-move": _vm.updateDraggingPosition,
2776
- "on-drag-end": _vm.stopDraggingElement,
2777
- "is-being-dragged-globally": _vm.isDraggingElement && _vm.draggingObject && _vm.draggingObject.id === object.id,
2778
- "dragging-client-pos": _vm.draggingClientPosition,
2779
- "current-doc-index": docIndex,
2780
- "current-page-index": pIndex,
2781
- "global-drag-doc-index": _vm.draggingDocIndex,
2782
- "global-drag-page-index": _vm.draggingPageIndex,
2783
- "show-selection-ui": _vm.showSelectionHandles && !_vm.hideSelectionUI && object.resizable !== false,
2784
- "show-default-actions": _vm.showElementActions && !_vm.hideSelectionUI
2785
- },
2786
- scopedSlots: _vm._u([{
2787
- key: "default",
2788
- fn: function (slotProps) {
2789
- return [_vm._t(slotProps.object.type ? `element-${slotProps.object.type}` : 'custom', function () {
2790
- return [_vm._t("custom", null, {
2791
- "object": slotProps.object,
2792
- "onDelete": slotProps.onDelete,
2793
- "onResize": slotProps.onResize
2794
- })];
2795
- }, {
2796
- "object": slotProps.object,
2797
- "onDelete": slotProps.onDelete,
2798
- "onResize": slotProps.onResize
2799
- })];
2800
- }
2801
- }, {
2802
- key: "actions",
2803
- fn: function (slotProps) {
2804
- return [_vm._t("actions", null, {
2805
- "object": slotProps.object,
2806
- "onDelete": slotProps.onDelete
2807
- })];
2808
- }
2809
- }], null, true)
2810
- });
2811
- })], 2)], 1), _vm.showPageFooter ? _c('div', {
2812
- staticClass: "page-footer"
2813
- }, [_c('span', [_vm._v(_vm._s(pdfDoc.name))]), _c('span', [_vm._v(_vm._s(_vm.formatPageNumber(pIndex + 1, pdfDoc.numPages)))])]) : _vm._e()])]);
2814
- }), 0);
2815
- }), 0) : _vm._e(), _vm.isDraggingElement && _vm.draggingObject ? _c('div', {
2816
- staticClass: "drag-portal",
2817
- style: {
2818
- position: 'fixed',
2819
- left: `${_vm.draggingClientPosition.x}px`,
2820
- top: `${_vm.draggingClientPosition.y}px`,
2821
- width: `${_vm.draggingObject.width * _vm.draggingScale}px`,
2822
- height: `${_vm.draggingObject.height * _vm.draggingScale}px`,
2823
- pointerEvents: 'none'
2824
- }
2825
- }, [_vm._t(_vm.draggingObject.type ? `element-${_vm.draggingObject.type}` : 'custom', function () {
2826
- return [_vm._t("custom", null, {
2827
- "object": _vm.draggingObject,
2828
- "isSelected": false
2829
- })];
2830
- }, {
2831
- "object": _vm.draggingObject,
2832
- "isSelected": false
2833
- })], 2) : _vm._e()]);
2834
- };
2835
- var staticRenderFns = [];
2836
-
2837
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
2838
- var es_array_push = __webpack_require__(4114);
2839
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
2840
- var es_iterator_constructor = __webpack_require__(8111);
2841
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
2842
- var es_iterator_filter = __webpack_require__(2489);
2843
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
2844
- var es_iterator_find = __webpack_require__(116);
2845
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
2846
- var es_iterator_for_each = __webpack_require__(7588);
2847
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
2848
- var es_iterator_map = __webpack_require__(1701);
2849
- ;// ./node_modules/debounce/index.js
2850
- function debounce(function_, wait = 100, options = {}) {
2851
- if (typeof function_ !== 'function') {
2852
- throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
2853
- }
2854
-
2855
- if (wait < 0) {
2856
- throw new RangeError('`wait` must not be negative.');
2857
- }
2858
-
2859
- if (typeof options === 'boolean') {
2860
- throw new TypeError('The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.');
2861
- }
2862
-
2863
- const {immediate} = options;
2864
-
2865
- let storedContext;
2866
- let storedArguments;
2867
- let timeoutId;
2868
- let timestamp;
2869
- let result;
2870
-
2871
- function run() {
2872
- const callContext = storedContext;
2873
- const callArguments = storedArguments;
2874
- storedContext = undefined;
2875
- storedArguments = undefined;
2876
- result = function_.apply(callContext, callArguments);
2877
- return result;
2878
- }
2879
-
2880
- function later() {
2881
- const last = Date.now() - timestamp;
2882
-
2883
- if (last < wait && last >= 0) {
2884
- timeoutId = setTimeout(later, wait - last);
2885
- } else {
2886
- timeoutId = undefined;
2887
-
2888
- if (!immediate) {
2889
- result = run();
2890
- }
2891
- }
2892
- }
2893
-
2894
- const debounced = function (...arguments_) {
2895
- if (
2896
- storedContext
2897
- && this !== storedContext
2898
- && Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)
2899
- ) {
2900
- throw new Error('Debounced method called with different contexts of the same prototype.');
2901
- }
2902
-
2903
- storedContext = this; // eslint-disable-line unicorn/no-this-assignment
2904
- storedArguments = arguments_;
2905
- timestamp = Date.now();
2906
-
2907
- const callNow = immediate && !timeoutId;
2908
-
2909
- if (!timeoutId) {
2910
- timeoutId = setTimeout(later, wait);
2911
- }
2912
-
2913
- if (callNow) {
2914
- result = run();
2915
- return result;
2916
- }
2917
-
2918
- return undefined;
2919
- };
2920
-
2921
- Object.defineProperty(debounced, 'isPending', {
2922
- get() {
2923
- return timeoutId !== undefined;
2924
- },
2925
- });
2926
-
2927
- debounced.clear = () => {
2928
- if (!timeoutId) {
2929
- return;
2930
- }
2931
-
2932
- clearTimeout(timeoutId);
2933
- timeoutId = undefined;
2934
- storedContext = undefined;
2935
- storedArguments = undefined;
2936
- };
2937
-
2938
- debounced.flush = () => {
2939
- if (!timeoutId) {
2940
- return;
2941
- }
2942
-
2943
- debounced.trigger();
2944
- };
2945
-
2946
- debounced.trigger = () => {
2947
- result = run();
2948
-
2949
- debounced.clear();
2950
- };
2951
-
2952
- return debounced;
2953
- }
2954
-
2955
- ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=template&id=2c9e224a&scoped=true
2956
- var PDFPagevue_type_template_id_2c9e224a_scoped_true_render = function render() {
2957
- var _vm = this,
2958
- _c = _vm._self._c;
2959
- return _c('canvas', {
2960
- ref: "canvas"
2961
- });
2962
- };
2963
- var PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns = [];
2964
-
2965
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=script&lang=js
2966
- /* harmony default export */ const PDFPagevue_type_script_lang_js = ({
2967
- name: 'PDFPage',
2968
- props: {
2969
- page: {
2970
- type: Promise,
2971
- required: true
2972
- },
2973
- scale: {
2974
- type: Number,
2975
- default: 1
2976
- }
2977
- },
2978
- data() {
2979
- return {
2980
- dynamicScale: this.scale,
2981
- isRendering: false,
2982
- boundMeasure: null
2983
- };
2984
- },
2985
- watch: {
2986
- scale(newScale) {
2987
- this.dynamicScale = newScale;
2988
- this.render();
2989
- }
2990
- },
2991
- mounted() {
2992
- this.boundMeasure = this.measure.bind(this);
2993
- window.addEventListener('resize', this.boundMeasure);
2994
- this.render();
2995
- },
2996
- beforeUnmount() {
2997
- if (this.boundMeasure) {
2998
- window.removeEventListener('resize', this.boundMeasure);
2999
- }
3000
- },
3001
- methods: {
3002
- getCanvasMeasurement() {
3003
- return {
3004
- canvasWidth: this.$refs.canvas.width,
3005
- canvasHeight: this.$refs.canvas.height
3006
- };
3007
- },
3008
- measure() {
3009
- this.$emit('onMeasure', {
3010
- scale: this.dynamicScale
3011
- });
3012
- },
3013
- async render() {
3014
- if (this.isRendering) return;
3015
- this.isRendering = true;
3016
- try {
3017
- const _page = await this.page;
3018
- const canvas = this.$refs.canvas;
3019
- const context = canvas.getContext('2d');
3020
- const viewport = _page.getViewport({
3021
- scale: this.dynamicScale
3022
- });
3023
- canvas.width = viewport.width;
3024
- canvas.height = viewport.height;
3025
- await _page.render({
3026
- canvasContext: context,
3027
- viewport
3028
- }).promise;
3029
- this.measure();
3030
- } finally {
3031
- this.isRendering = false;
3032
- }
3033
- }
3034
- }
3035
- });
3036
- ;// ./src/components/PDFPage.vue?vue&type=script&lang=js
3037
- /* harmony default export */ const components_PDFPagevue_type_script_lang_js = (PDFPagevue_type_script_lang_js);
3038
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
3039
- // extracted by mini-css-extract-plugin
3040
-
3041
- ;// ./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
3042
-
3043
- ;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
3044
- /* globals __VUE_SSR_CONTEXT__ */
3045
-
3046
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
3047
- // This module is a runtime utility for cleaner component module output and will
3048
- // be included in the final webpack user bundle.
3049
-
3050
- function normalizeComponent(
3051
- scriptExports,
3052
- render,
3053
- staticRenderFns,
3054
- functionalTemplate,
3055
- injectStyles,
3056
- scopeId,
3057
- moduleIdentifier /* server only */,
3058
- shadowMode /* vue-cli only */
3059
- ) {
3060
- // Vue.extend constructor export interop
3061
- var options =
3062
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
3063
-
3064
- // render functions
3065
- if (render) {
3066
- options.render = render
3067
- options.staticRenderFns = staticRenderFns
3068
- options._compiled = true
3069
- }
3070
-
3071
- // functional template
3072
- if (functionalTemplate) {
3073
- options.functional = true
3074
- }
3075
-
3076
- // scopedId
3077
- if (scopeId) {
3078
- options._scopeId = 'data-v-' + scopeId
3079
- }
3080
-
3081
- var hook
3082
- if (moduleIdentifier) {
3083
- // server build
3084
- hook = function (context) {
3085
- // 2.3 injection
3086
- context =
3087
- context || // cached call
3088
- (this.$vnode && this.$vnode.ssrContext) || // stateful
3089
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
3090
- // 2.2 with runInNewContext: true
3091
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
3092
- context = __VUE_SSR_CONTEXT__
3093
- }
3094
- // inject component styles
3095
- if (injectStyles) {
3096
- injectStyles.call(this, context)
3097
- }
3098
- // register component module identifier for async chunk inferrence
3099
- if (context && context._registeredComponents) {
3100
- context._registeredComponents.add(moduleIdentifier)
3101
- }
3102
- }
3103
- // used by ssr in case component is cached and beforeCreate
3104
- // never gets called
3105
- options._ssrRegister = hook
3106
- } else if (injectStyles) {
3107
- hook = shadowMode
3108
- ? function () {
3109
- injectStyles.call(
3110
- this,
3111
- (options.functional ? this.parent : this).$root.$options.shadowRoot
3112
- )
3113
- }
3114
- : injectStyles
3115
- }
3116
-
3117
- if (hook) {
3118
- if (options.functional) {
3119
- // for template-only hot-reload because in that case the render fn doesn't
3120
- // go through the normalizer
3121
- options._injectStyles = hook
3122
- // register for functional component in vue file
3123
- var originalRender = options.render
3124
- options.render = function renderWithStyleInjection(h, context) {
3125
- hook.call(context)
3126
- return originalRender(h, context)
3127
- }
3128
- } else {
3129
- // inject component registration as beforeCreate hook
3130
- var existing = options.beforeCreate
3131
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
3132
- }
3133
- }
3134
-
3135
- return {
3136
- exports: scriptExports,
3137
- options: options
3138
- }
3139
- }
3140
-
3141
- ;// ./src/components/PDFPage.vue
3142
-
3143
-
3144
-
3145
- ;
3146
-
3147
-
3148
- /* normalize component */
3149
-
3150
- var component = normalizeComponent(
3151
- components_PDFPagevue_type_script_lang_js,
3152
- PDFPagevue_type_template_id_2c9e224a_scoped_true_render,
3153
- PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns,
3154
- false,
3155
- null,
3156
- "2c9e224a",
3157
- null
3158
-
3159
- )
3160
-
3161
- /* harmony default export */ const PDFPage = (component.exports);
3162
- ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=template&id=55db89ce&scoped=true
3163
- var DraggableElementvue_type_template_id_55db89ce_scoped_true_render = function render() {
3164
- var _vm = this,
3165
- _c = _vm._self._c;
3166
- return _c('div', {
3167
- staticClass: "draggable-wrapper"
3168
- }, [_vm.isSelected && !_vm.isBeingDraggedGlobally && _vm.showSelectionUi && _vm.showDefaultActions ? _c('div', {
3169
- staticClass: "actions-toolbar",
3170
- style: _vm.toolbarStyle
3171
- }, [_vm._t("actions", function () {
3172
- return [_c('button', {
3173
- staticClass: "action-btn",
3174
- attrs: {
3175
- "type": "button",
3176
- "title": "Delete"
3177
- },
3178
- on: {
3179
- "click": function ($event) {
3180
- $event.stopPropagation();
3181
- return _vm.onDelete.apply(null, arguments);
3182
- }
3183
- }
3184
- }, [_c('svg', {
3185
- attrs: {
3186
- "width": "16",
3187
- "height": "16",
3188
- "viewBox": "0 0 16 16",
3189
- "fill": "currentColor"
3190
- }
3191
- }, [_c('path', {
3192
- attrs: {
3193
- "d": "M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.5a.5.5 0 0 0 0 1h.5v10.5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5V3.5h.5a.5.5 0 0 0 0-1H11Zm1 1v10.5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5V3.5h8Z"
3194
- }
3195
- })])])];
3196
- }, {
3197
- "object": _vm.object,
3198
- "onDelete": _vm.onDelete
3199
- })], 2) : _vm._e(), _c('div', {
3200
- staticClass: "draggable-element",
3201
- class: {
3202
- selected: _vm.isSelected && _vm.showSelectionUi
3203
- },
3204
- style: [_vm.elementStyle, _vm.dragElementStyle],
3205
- attrs: {
3206
- "draggable": "false"
3207
- },
3208
- on: {
3209
- "dragstart": function ($event) {
3210
- $event.preventDefault();
3211
- },
3212
- "mousedown": _vm.handleElementClick,
3213
- "touchstart": _vm.handleElementClick
3214
- }
3215
- }, [_vm._t("default", null, {
3216
- "object": _vm.object,
3217
- "isSelected": _vm.isSelected,
3218
- "onDelete": _vm.onDelete,
3219
- "onResize": _vm.startResizeFromSlot
3220
- }), _vm.isSelected && _vm.showSelectionUi ? _vm._l(_vm.resizeDirections, function (dir) {
3221
- return _c('button', {
3222
- key: dir,
3223
- staticClass: "resize-handle",
3224
- class: `handle-${dir}`,
3225
- attrs: {
3226
- "type": "button"
3227
- },
3228
- on: {
3229
- "mousedown": function ($event) {
3230
- $event.stopPropagation();
3231
- $event.preventDefault();
3232
- return _vm.startResize(dir, $event);
3233
- },
3234
- "touchstart": function ($event) {
3235
- $event.stopPropagation();
3236
- $event.preventDefault();
3237
- return _vm.startResize(dir, $event);
3238
- }
3239
- }
3240
- });
3241
- }) : _vm._e()], 2)]);
3242
- };
3243
- var DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns = [];
3244
-
3245
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=script&lang=js
3246
- /* harmony default export */ const DraggableElementvue_type_script_lang_js = ({
3247
- name: 'DraggableElement',
3248
- props: {
3249
- object: {
3250
- type: Object,
3251
- required: true
3252
- },
3253
- pagesScale: {
3254
- type: Number,
3255
- default: 1
3256
- },
3257
- pageWidth: {
3258
- type: Number,
3259
- required: true
3260
- },
3261
- pageHeight: {
3262
- type: Number,
3263
- required: true
3264
- },
3265
- onUpdate: {
3266
- type: Function,
3267
- default: () => {}
3268
- },
3269
- onDelete: {
3270
- type: Function,
3271
- default: () => {}
3272
- },
3273
- onDragStart: {
3274
- type: Function,
3275
- default: () => {}
3276
- },
3277
- onDragMove: {
3278
- type: Function,
3279
- default: () => {}
3280
- },
3281
- onDragEnd: {
3282
- type: Function,
3283
- default: () => {}
3284
- },
3285
- isBeingDraggedGlobally: {
3286
- type: Boolean,
3287
- default: false
3288
- },
3289
- draggingClientPos: {
3290
- type: Object,
3291
- default: () => ({
3292
- x: 0,
3293
- y: 0
3294
- })
3295
- },
3296
- currentDocIndex: {
3297
- type: Number,
3298
- default: -1
3299
- },
3300
- currentPageIndex: {
3301
- type: Number,
3302
- default: -1
3303
- },
3304
- globalDragDocIndex: {
3305
- type: Number,
3306
- default: -1
3307
- },
3308
- globalDragPageIndex: {
3309
- type: Number,
3310
- default: -1
3311
- },
3312
- showSelectionUi: {
3313
- type: Boolean,
3314
- default: true
3315
- },
3316
- showDefaultActions: {
3317
- type: Boolean,
3318
- default: true
3319
- }
3320
- },
3321
- data() {
3322
- return {
3323
- isSelected: false,
3324
- mode: 'idle',
3325
- direction: '',
3326
- startX: 0,
3327
- startY: 0,
3328
- startLeft: 0,
3329
- startTop: 0,
3330
- startWidth: 0,
3331
- startHeight: 0,
3332
- offsetX: 0,
3333
- offsetY: 0,
3334
- resizeOffsetX: 0,
3335
- resizeOffsetY: 0,
3336
- resizeOffsetW: 0,
3337
- resizeOffsetH: 0,
3338
- aspectRatio: 1,
3339
- lastMouseX: 0,
3340
- lastMouseY: 0,
3341
- pointerOffsetDoc: {
3342
- x: 0,
3343
- y: 0
3344
- },
3345
- currentPageRect: null,
3346
- rafId: null
3347
- };
3348
- },
3349
- computed: {
3350
- resizeDirections() {
3351
- return ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
3352
- },
3353
- elementStyle() {
3354
- const scale = this.pagesScale || 1;
3355
- const currentX = this.object.x + this.offsetX + this.resizeOffsetX;
3356
- const currentY = this.object.y + this.offsetY + this.resizeOffsetY;
3357
- const currentWidth = this.object.width + this.resizeOffsetW;
3358
- const currentHeight = this.object.height + this.resizeOffsetH;
3359
- return {
3360
- left: `${currentX * scale}px`,
3361
- top: `${currentY * scale}px`,
3362
- width: `${currentWidth * scale}px`,
3363
- height: `${currentHeight * scale}px`
3364
- };
3365
- },
3366
- toolbarStyle() {
3367
- const scale = this.pagesScale || 1;
3368
- const x = this.object.x + this.offsetX + this.resizeOffsetX;
3369
- const y = this.object.y + this.offsetY + this.resizeOffsetY;
3370
- const width = this.object.width + this.resizeOffsetW;
3371
- return {
3372
- left: `${(x + width / 2) * scale}px`,
3373
- top: `${(y - 48) * scale}px`,
3374
- transform: 'translateX(-50%)'
3375
- };
3376
- },
3377
- dragElementStyle() {
3378
- if (!this.isBeingDraggedGlobally || !this.draggingClientPos) {
3379
- return {};
3380
- }
3381
- return {
3382
- opacity: 0,
3383
- pointerEvents: 'none'
3384
- };
3385
- }
3386
- },
3387
- mounted() {
3388
- this.handleClickOutside = this.handleClickOutside.bind(this);
3389
- this.boundHandleMove = this.handleMove.bind(this);
3390
- this.boundStopInteraction = this.stopInteraction.bind(this);
3391
- document.addEventListener('mousedown', this.handleClickOutside);
3392
- document.addEventListener('touchstart', this.handleClickOutside);
3393
- },
3394
- beforeUnmount() {
3395
- document.removeEventListener('mousedown', this.handleClickOutside);
3396
- document.removeEventListener('touchstart', this.handleClickOutside);
3397
- window.removeEventListener('mousemove', this.boundHandleMove);
3398
- window.removeEventListener('mouseup', this.boundStopInteraction);
3399
- window.removeEventListener('touchmove', this.boundHandleMove);
3400
- window.removeEventListener('touchend', this.boundStopInteraction);
3401
- if (this.rafId) cancelAnimationFrame(this.rafId);
3402
- },
3403
- methods: {
3404
- handleElementClick(event) {
3405
- if (event.target.closest('.delete-handle') || event.target.closest('[data-stop-drag]') || event.target.closest('.actions-toolbar')) {
3406
- return;
3407
- }
3408
- event.preventDefault();
3409
- this.isSelected = true;
3410
- this.startDrag(event);
3411
- },
3412
- handleClickOutside(event) {
3413
- if (this.$el && !this.$el.contains(event.target)) {
3414
- this.isSelected = false;
3415
- }
3416
- },
3417
- startResizeFromSlot(direction, event) {
3418
- if (!direction || !event) return;
3419
- this.startResize(direction, event);
3420
- },
3421
- startDrag(event) {
3422
- if (event.target.classList.contains('delete')) return;
3423
- if (event.target.classList.contains('resize-handle')) return;
3424
- this.mode = 'drag';
3425
- this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
3426
- this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
3427
- this.startLeft = this.object.x;
3428
- this.startTop = this.object.y;
3429
- this.offsetX = 0;
3430
- this.offsetY = 0;
3431
- this.resetResizeOffsets();
3432
- const elementRect = this.$el.querySelector('.draggable-element').getBoundingClientRect();
3433
- this.pointerOffsetDoc.x = this.startX - elementRect.left;
3434
- this.pointerOffsetDoc.y = this.startY - elementRect.top;
3435
- const pageRect = this.capturePageRect();
3436
- this.currentPageRect = pageRect;
3437
- let dragElementShift = {
3438
- x: 0,
3439
- y: 0
3440
- };
3441
- if (pageRect) {
3442
- const expectedLeft = pageRect.left + this.object.x * this.pagesScale;
3443
- const expectedTop = pageRect.top + this.object.y * this.pagesScale;
3444
- dragElementShift = {
3445
- x: elementRect.left - expectedLeft,
3446
- y: elementRect.top - expectedTop
3447
- };
3448
- }
3449
- this.onDragStart(this.startX, this.startY, {
3450
- ...this.pointerOffsetDoc
3451
- }, dragElementShift);
3452
- window.addEventListener('mousemove', this.boundHandleMove);
3453
- window.addEventListener('mouseup', this.boundStopInteraction);
3454
- window.addEventListener('touchmove', this.boundHandleMove);
3455
- window.addEventListener('touchend', this.boundStopInteraction);
3456
- },
3457
- startResize(direction, event) {
3458
- this.mode = 'resize';
3459
- this.direction = direction;
3460
- this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
3461
- this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
3462
- this.startLeft = this.object.x;
3463
- this.startTop = this.object.y;
3464
- this.startWidth = this.object.width;
3465
- this.startHeight = this.object.height;
3466
- this.aspectRatio = this.startWidth / this.startHeight;
3467
- this.offsetX = 0;
3468
- this.offsetY = 0;
3469
- this.resetResizeOffsets();
3470
- window.addEventListener('mousemove', this.boundHandleMove);
3471
- window.addEventListener('mouseup', this.boundStopInteraction);
3472
- window.addEventListener('touchmove', this.boundHandleMove);
3473
- window.addEventListener('touchend', this.boundStopInteraction);
3474
- },
3475
- handleMove(event) {
3476
- if (this.mode === 'idle') return;
3477
- event.preventDefault();
3478
- if (this.rafId) return;
3479
- this.rafId = requestAnimationFrame(() => {
3480
- const currentX = event.type.includes('touch') ? event.touches[0]?.clientX : event.clientX;
3481
- const currentY = event.type.includes('touch') ? event.touches[0]?.clientY : event.clientY;
3482
- if (currentX === undefined || currentY === undefined) return;
3483
- this.lastMouseX = currentX;
3484
- this.lastMouseY = currentY;
3485
- const deltaX = (currentX - this.startX) / this.pagesScale;
3486
- const deltaY = (currentY - this.startY) / this.pagesScale;
3487
- if (this.mode === 'drag') {
3488
- const pageRect = this.currentPageRect;
3489
- if (pageRect) {
3490
- const newElementLeft = currentX - this.pointerOffsetDoc.x;
3491
- const newElementTop = currentY - this.pointerOffsetDoc.y;
3492
- const newX = (newElementLeft - pageRect.left) / this.pagesScale;
3493
- const newY = (newElementTop - pageRect.top) / this.pagesScale;
3494
- this.offsetX = newX - this.object.x;
3495
- this.offsetY = newY - this.object.y;
3496
- } else {
3497
- this.offsetX = deltaX;
3498
- this.offsetY = deltaY;
3499
- }
3500
- this.onDragMove(currentX, currentY);
3501
- if (this.isBeingDraggedGlobally) {
3502
- this.onUpdate({
3503
- _globalDrag: true,
3504
- _mouseX: currentX,
3505
- _mouseY: currentY
3506
- });
3507
- }
3508
- this.rafId = null;
3509
- return;
3510
- }
3511
- const minSize = 16;
3512
- let newWidth = this.startWidth;
3513
- let newHeight = this.startHeight;
3514
- let newLeft = this.startLeft;
3515
- let newTop = this.startTop;
3516
- const widthChange = this.direction.includes('right') ? deltaX : this.direction.includes('left') ? -deltaX : 0;
3517
- newWidth = this.startWidth + widthChange;
3518
- if (newWidth < minSize) newWidth = minSize;
3519
- newHeight = newWidth / this.aspectRatio;
3520
- if (this.direction.includes('left')) {
3521
- newLeft = this.startLeft + (this.startWidth - newWidth);
3522
- if (newLeft < 0) {
3523
- const overflow = -newLeft;
3524
- newLeft = 0;
3525
- newWidth = newWidth - overflow;
3526
- newHeight = newWidth / this.aspectRatio;
3527
- }
3528
- }
3529
- if (this.direction.includes('top')) {
3530
- newTop = this.startTop + (this.startHeight - newHeight);
3531
- if (newTop < 0) {
3532
- const overflow = -newTop;
3533
- newTop = 0;
3534
- newHeight = newHeight - overflow;
3535
- newWidth = newHeight * this.aspectRatio;
3536
- if (this.direction.includes('left')) {
3537
- newLeft = this.startLeft + (this.startWidth - newWidth);
3538
- }
3539
- }
3540
- }
3541
- if (newLeft + newWidth > this.pageWidth) {
3542
- const excess = newLeft + newWidth - this.pageWidth;
3543
- newWidth -= excess;
3544
- newHeight = newWidth / this.aspectRatio;
3545
- }
3546
- if (newTop + newHeight > this.pageHeight) {
3547
- const excess = newTop + newHeight - this.pageHeight;
3548
- newHeight -= excess;
3549
- newWidth = newHeight * this.aspectRatio;
3550
- if (this.direction.includes('left')) {
3551
- newLeft = this.startLeft + (this.startWidth - newWidth);
3552
- }
3553
- }
3554
- this.resizeOffsetX = newLeft - this.object.x;
3555
- this.resizeOffsetY = newTop - this.object.y;
3556
- this.resizeOffsetW = newWidth - this.object.width;
3557
- this.resizeOffsetH = newHeight - this.object.height;
3558
- this.rafId = null;
3559
- });
3560
- },
3561
- stopInteraction() {
3562
- if (this.mode === 'idle') return;
3563
- if (this.mode === 'drag' && (this.offsetX !== 0 || this.offsetY !== 0)) {
3564
- if (this.isBeingDraggedGlobally) {
3565
- this.onUpdate({
3566
- _globalDrag: true,
3567
- _mouseX: this.lastMouseX,
3568
- _mouseY: this.lastMouseY
3569
- });
3570
- } else {
3571
- const x = Math.max(0, Math.min(this.object.x + this.offsetX, this.pageWidth - this.object.width));
3572
- const y = Math.max(0, Math.min(this.object.y + this.offsetY, this.pageHeight - this.object.height));
3573
- this.onUpdate({
3574
- x,
3575
- y
3576
- });
3577
- }
3578
- }
3579
- if (this.mode === 'resize' && (this.resizeOffsetW !== 0 || this.resizeOffsetH !== 0 || this.resizeOffsetX !== 0 || this.resizeOffsetY !== 0)) {
3580
- const x = this.object.x + this.resizeOffsetX;
3581
- const y = this.object.y + this.resizeOffsetY;
3582
- const width = this.object.width + this.resizeOffsetW;
3583
- const height = this.object.height + this.resizeOffsetH;
3584
- this.onUpdate({
3585
- x,
3586
- y,
3587
- width,
3588
- height
3589
- });
3590
- }
3591
- this.resetOffsets();
3592
- this.onDragEnd();
3593
- window.removeEventListener('mousemove', this.boundHandleMove);
3594
- window.removeEventListener('mouseup', this.boundStopInteraction);
3595
- window.removeEventListener('touchmove', this.boundHandleMove);
3596
- window.removeEventListener('touchend', this.boundStopInteraction);
3597
- },
3598
- capturePageRect() {
3599
- const wrapper = this.$el.closest('.page-wrapper');
3600
- if (!wrapper) return null;
3601
- const canvas = wrapper.querySelector('canvas');
3602
- return canvas ? canvas.getBoundingClientRect() : null;
3603
- },
3604
- resetResizeOffsets() {
3605
- this.resizeOffsetX = 0;
3606
- this.resizeOffsetY = 0;
3607
- this.resizeOffsetW = 0;
3608
- this.resizeOffsetH = 0;
3609
- },
3610
- resetOffsets() {
3611
- this.mode = 'idle';
3612
- this.offsetX = 0;
3613
- this.offsetY = 0;
3614
- this.resetResizeOffsets();
3615
- this.pointerOffsetDoc = {
3616
- x: 0,
3617
- y: 0
3618
- };
3619
- this.currentPageRect = null;
3620
- }
3621
- }
3622
- });
3623
- ;// ./src/components/DraggableElement.vue?vue&type=script&lang=js
3624
- /* harmony default export */ const components_DraggableElementvue_type_script_lang_js = (DraggableElementvue_type_script_lang_js);
3625
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
3626
- // extracted by mini-css-extract-plugin
3627
-
3628
- ;// ./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
3629
-
3630
- ;// ./src/components/DraggableElement.vue
3631
-
3632
-
3633
-
3634
- ;
3635
-
3636
-
3637
- /* normalize component */
3638
-
3639
- var DraggableElement_component = normalizeComponent(
3640
- components_DraggableElementvue_type_script_lang_js,
3641
- DraggableElementvue_type_template_id_55db89ce_scoped_true_render,
3642
- DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns,
3643
- false,
3644
- null,
3645
- "55db89ce",
3646
- null
3647
-
3648
- )
3649
-
3650
- /* harmony default export */ const DraggableElement = (DraggableElement_component.exports);
3651
- ;// ./node_modules/pdfjs-dist/build/pdf.mjs
3652
- /**
3653
- * @licstart The following is the entire license notice for the
3654
- * JavaScript code in this page
3655
- *
3656
- * Copyright 2024 Mozilla Foundation
3657
- *
3658
- * Licensed under the Apache License, Version 2.0 (the "License");
3659
- * you may not use this file except in compliance with the License.
3660
- * You may obtain a copy of the License at
3661
- *
3662
- * http://www.apache.org/licenses/LICENSE-2.0
3663
- *
3664
- * Unless required by applicable law or agreed to in writing, software
3665
- * distributed under the License is distributed on an "AS IS" BASIS,
3666
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3667
- * See the License for the specific language governing permissions and
3668
- * limitations under the License.
3669
- *
3670
- * @licend The above is the entire license notice for the
3671
- * JavaScript code in this page
3672
- */
2785
+ ;// ./node_modules/pdfjs-dist/build/pdf.mjs
2786
+ /**
2787
+ * @licstart The following is the entire license notice for the
2788
+ * JavaScript code in this page
2789
+ *
2790
+ * Copyright 2024 Mozilla Foundation
2791
+ *
2792
+ * Licensed under the Apache License, Version 2.0 (the "License");
2793
+ * you may not use this file except in compliance with the License.
2794
+ * You may obtain a copy of the License at
2795
+ *
2796
+ * http://www.apache.org/licenses/LICENSE-2.0
2797
+ *
2798
+ * Unless required by applicable law or agreed to in writing, software
2799
+ * distributed under the License is distributed on an "AS IS" BASIS,
2800
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2801
+ * See the License for the specific language governing permissions and
2802
+ * limitations under the License.
2803
+ *
2804
+ * @licend The above is the entire license notice for the
2805
+ * JavaScript code in this page
2806
+ */
3673
2807
 
3674
2808
  /**
3675
2809
  * pdfjsVersion = 5.4.530
@@ -15986,7 +15120,7 @@ for (const op in OPS) {
15986
15120
  }
15987
15121
 
15988
15122
  ;// ./src/display/worker_options.js
15989
- class GlobalWorkerOptions {
15123
+ class pdf_GlobalWorkerOptions {
15990
15124
  static #port = null;
15991
15125
  static #src = "";
15992
15126
  static get workerPort() {
@@ -18118,7 +17252,7 @@ function getDocument(src = {}) {
18118
17252
  if (!worker) {
18119
17253
  worker = PDFWorker.create({
18120
17254
  verbosity,
18121
- port: GlobalWorkerOptions.workerPort
17255
+ port: pdf_GlobalWorkerOptions.workerPort
18122
17256
  });
18123
17257
  task._worker = worker;
18124
17258
  }
@@ -18871,7 +18005,7 @@ class PDFWorker {
18871
18005
  static {
18872
18006
  if (isNodeJS) {
18873
18007
  this.#isWorkerDisabled = true;
18874
- GlobalWorkerOptions.workerSrc ||= "./pdf.worker.mjs";
18008
+ pdf_GlobalWorkerOptions.workerSrc ||= "./pdf.worker.mjs";
18875
18009
  }
18876
18010
  this._isSameOrigin = (baseUrl, otherUrl) => {
18877
18011
  const base = URL.parse(baseUrl);
@@ -19043,8 +18177,8 @@ class PDFWorker {
19043
18177
  return new PDFWorker(params);
19044
18178
  }
19045
18179
  static get workerSrc() {
19046
- if (GlobalWorkerOptions.workerSrc) {
19047
- return GlobalWorkerOptions.workerSrc;
18180
+ if (pdf_GlobalWorkerOptions.workerSrc) {
18181
+ return pdf_GlobalWorkerOptions.workerSrc;
19048
18182
  }
19049
18183
  throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
19050
18184
  }
@@ -29579,476 +28713,1433 @@ class AnnotationEditorLayer {
29579
28713
  if (this.#currentEditorType?.isDrawer && this.#currentEditorType.supportMultipleDrawings) {
29580
28714
  return;
29581
28715
  }
29582
- if (!this.#allowClick) {
29583
- this.#allowClick = true;
29584
- return;
28716
+ if (!this.#allowClick) {
28717
+ this.#allowClick = true;
28718
+ return;
28719
+ }
28720
+ const currentMode = this.#uiManager.getMode();
28721
+ if (currentMode === AnnotationEditorType.STAMP || currentMode === AnnotationEditorType.SIGNATURE) {
28722
+ this.#uiManager.unselectAll();
28723
+ return;
28724
+ }
28725
+ this.createAndAddNewEditor(event, false);
28726
+ }
28727
+ pointerdown(event) {
28728
+ if (this.#uiManager.getMode() === AnnotationEditorType.HIGHLIGHT) {
28729
+ this.enableTextSelection();
28730
+ }
28731
+ if (this.#hadPointerDown) {
28732
+ this.#hadPointerDown = false;
28733
+ return;
28734
+ }
28735
+ const {
28736
+ isMac
28737
+ } = util_FeatureTest.platform;
28738
+ if (event.button !== 0 || event.ctrlKey && isMac) {
28739
+ return;
28740
+ }
28741
+ if (event.target !== this.div) {
28742
+ return;
28743
+ }
28744
+ this.#hadPointerDown = true;
28745
+ if (this.#currentEditorType?.isDrawer) {
28746
+ this.startDrawingSession(event);
28747
+ return;
28748
+ }
28749
+ const editor = this.#uiManager.getActive();
28750
+ this.#allowClick = !editor || editor.isEmpty();
28751
+ }
28752
+ startDrawingSession(event) {
28753
+ this.div.focus({
28754
+ preventScroll: true
28755
+ });
28756
+ if (this.#drawingAC) {
28757
+ this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
28758
+ return;
28759
+ }
28760
+ this.#uiManager.setCurrentDrawingSession(this);
28761
+ this.#drawingAC = new AbortController();
28762
+ const signal = this.#uiManager.combinedSignal(this.#drawingAC);
28763
+ this.div.addEventListener("blur", ({
28764
+ relatedTarget
28765
+ }) => {
28766
+ if (relatedTarget && !this.div.contains(relatedTarget)) {
28767
+ this.#focusedElement = null;
28768
+ this.commitOrRemove();
28769
+ }
28770
+ }, {
28771
+ signal
28772
+ });
28773
+ this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
28774
+ }
28775
+ pause(on) {
28776
+ if (on) {
28777
+ const {
28778
+ activeElement
28779
+ } = document;
28780
+ if (this.div.contains(activeElement)) {
28781
+ this.#focusedElement = activeElement;
28782
+ }
28783
+ return;
28784
+ }
28785
+ if (this.#focusedElement) {
28786
+ setTimeout(() => {
28787
+ this.#focusedElement?.focus();
28788
+ this.#focusedElement = null;
28789
+ }, 0);
28790
+ }
28791
+ }
28792
+ endDrawingSession(isAborted = false) {
28793
+ if (!this.#drawingAC) {
28794
+ return null;
28795
+ }
28796
+ this.#uiManager.setCurrentDrawingSession(null);
28797
+ this.#drawingAC.abort();
28798
+ this.#drawingAC = null;
28799
+ this.#focusedElement = null;
28800
+ return this.#currentEditorType.endDrawing(isAborted);
28801
+ }
28802
+ findNewParent(editor, x, y) {
28803
+ const layer = this.#uiManager.findParent(x, y);
28804
+ if (layer === null || layer === this) {
28805
+ return false;
28806
+ }
28807
+ layer.changeParent(editor);
28808
+ return true;
28809
+ }
28810
+ commitOrRemove() {
28811
+ if (this.#drawingAC) {
28812
+ this.endDrawingSession();
28813
+ return true;
28814
+ }
28815
+ return false;
28816
+ }
28817
+ onScaleChanging() {
28818
+ if (!this.#drawingAC) {
28819
+ return;
28820
+ }
28821
+ this.#currentEditorType.onScaleChangingWhenDrawing(this);
28822
+ }
28823
+ destroy() {
28824
+ this.commitOrRemove();
28825
+ if (this.#uiManager.getActive()?.parent === this) {
28826
+ this.#uiManager.commitOrRemove();
28827
+ this.#uiManager.setActiveEditor(null);
28828
+ }
28829
+ if (this.#editorFocusTimeoutId) {
28830
+ clearTimeout(this.#editorFocusTimeoutId);
28831
+ this.#editorFocusTimeoutId = null;
28832
+ }
28833
+ for (const editor of this.#editors.values()) {
28834
+ this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
28835
+ editor.setParent(null);
28836
+ editor.isAttachedToDOM = false;
28837
+ editor.div.remove();
28838
+ }
28839
+ this.div = null;
28840
+ this.#editors.clear();
28841
+ this.#uiManager.removeLayer(this);
28842
+ }
28843
+ #cleanup() {
28844
+ for (const editor of this.#editors.values()) {
28845
+ if (editor.isEmpty()) {
28846
+ editor.remove();
28847
+ }
28848
+ }
28849
+ }
28850
+ render({
28851
+ viewport
28852
+ }) {
28853
+ this.viewport = viewport;
28854
+ setLayerDimensions(this.div, viewport);
28855
+ for (const editor of this.#uiManager.getEditors(this.pageIndex)) {
28856
+ this.add(editor);
28857
+ editor.rebuild();
28858
+ }
28859
+ this.updateMode();
28860
+ }
28861
+ update({
28862
+ viewport
28863
+ }) {
28864
+ this.#uiManager.commitOrRemove();
28865
+ this.#cleanup();
28866
+ const oldRotation = this.viewport.rotation;
28867
+ const rotation = viewport.rotation;
28868
+ this.viewport = viewport;
28869
+ setLayerDimensions(this.div, {
28870
+ rotation
28871
+ });
28872
+ if (oldRotation !== rotation) {
28873
+ for (const editor of this.#editors.values()) {
28874
+ editor.rotate(rotation);
28875
+ }
28876
+ }
28877
+ }
28878
+ get pageDimensions() {
28879
+ const {
28880
+ pageWidth,
28881
+ pageHeight
28882
+ } = this.viewport.rawDims;
28883
+ return [pageWidth, pageHeight];
28884
+ }
28885
+ get scale() {
28886
+ return this.#uiManager.viewParameters.realScale;
28887
+ }
28888
+ }
28889
+
28890
+ ;// ./src/display/draw_layer.js
28891
+
28892
+
28893
+ class DrawLayer {
28894
+ #parent = null;
28895
+ #mapping = new Map();
28896
+ #toUpdate = new Map();
28897
+ static #id = 0;
28898
+ constructor({
28899
+ pageIndex
28900
+ }) {
28901
+ this.pageIndex = pageIndex;
28902
+ }
28903
+ setParent(parent) {
28904
+ if (!this.#parent) {
28905
+ this.#parent = parent;
28906
+ return;
28907
+ }
28908
+ if (this.#parent !== parent) {
28909
+ if (this.#mapping.size > 0) {
28910
+ for (const root of this.#mapping.values()) {
28911
+ root.remove();
28912
+ parent.append(root);
28913
+ }
28914
+ }
28915
+ this.#parent = parent;
28916
+ }
28917
+ }
28918
+ static get _svgFactory() {
28919
+ return shadow(this, "_svgFactory", new DOMSVGFactory());
28920
+ }
28921
+ static #setBox(element, [x, y, width, height]) {
28922
+ const {
28923
+ style
28924
+ } = element;
28925
+ style.top = `${100 * y}%`;
28926
+ style.left = `${100 * x}%`;
28927
+ style.width = `${100 * width}%`;
28928
+ style.height = `${100 * height}%`;
28929
+ }
28930
+ #createSVG() {
28931
+ const svg = DrawLayer._svgFactory.create(1, 1, true);
28932
+ this.#parent.append(svg);
28933
+ svg.setAttribute("aria-hidden", true);
28934
+ return svg;
28935
+ }
28936
+ #createClipPath(defs, pathId) {
28937
+ const clipPath = DrawLayer._svgFactory.createElement("clipPath");
28938
+ defs.append(clipPath);
28939
+ const clipPathId = `clip_${pathId}`;
28940
+ clipPath.setAttribute("id", clipPathId);
28941
+ clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
28942
+ const clipPathUse = DrawLayer._svgFactory.createElement("use");
28943
+ clipPath.append(clipPathUse);
28944
+ clipPathUse.setAttribute("href", `#${pathId}`);
28945
+ clipPathUse.classList.add("clip");
28946
+ return clipPathId;
28947
+ }
28948
+ #updateProperties(element, properties) {
28949
+ for (const [key, value] of Object.entries(properties)) {
28950
+ if (value === null) {
28951
+ element.removeAttribute(key);
28952
+ } else {
28953
+ element.setAttribute(key, value);
28954
+ }
28955
+ }
28956
+ }
28957
+ draw(properties, isPathUpdatable = false, hasClip = false) {
28958
+ const id = DrawLayer.#id++;
28959
+ const root = this.#createSVG();
28960
+ const defs = DrawLayer._svgFactory.createElement("defs");
28961
+ root.append(defs);
28962
+ const path = DrawLayer._svgFactory.createElement("path");
28963
+ defs.append(path);
28964
+ const pathId = `path_p${this.pageIndex}_${id}`;
28965
+ path.setAttribute("id", pathId);
28966
+ path.setAttribute("vector-effect", "non-scaling-stroke");
28967
+ if (isPathUpdatable) {
28968
+ this.#toUpdate.set(id, path);
28969
+ }
28970
+ const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
28971
+ const use = DrawLayer._svgFactory.createElement("use");
28972
+ root.append(use);
28973
+ use.setAttribute("href", `#${pathId}`);
28974
+ this.updateProperties(root, properties);
28975
+ this.#mapping.set(id, root);
28976
+ return {
28977
+ id,
28978
+ clipPathId: `url(#${clipPathId})`
28979
+ };
28980
+ }
28981
+ drawOutline(properties, mustRemoveSelfIntersections) {
28982
+ const id = DrawLayer.#id++;
28983
+ const root = this.#createSVG();
28984
+ const defs = DrawLayer._svgFactory.createElement("defs");
28985
+ root.append(defs);
28986
+ const path = DrawLayer._svgFactory.createElement("path");
28987
+ defs.append(path);
28988
+ const pathId = `path_p${this.pageIndex}_${id}`;
28989
+ path.setAttribute("id", pathId);
28990
+ path.setAttribute("vector-effect", "non-scaling-stroke");
28991
+ let maskId;
28992
+ if (mustRemoveSelfIntersections) {
28993
+ const mask = DrawLayer._svgFactory.createElement("mask");
28994
+ defs.append(mask);
28995
+ maskId = `mask_p${this.pageIndex}_${id}`;
28996
+ mask.setAttribute("id", maskId);
28997
+ mask.setAttribute("maskUnits", "objectBoundingBox");
28998
+ const rect = DrawLayer._svgFactory.createElement("rect");
28999
+ mask.append(rect);
29000
+ rect.setAttribute("width", "1");
29001
+ rect.setAttribute("height", "1");
29002
+ rect.setAttribute("fill", "white");
29003
+ const use = DrawLayer._svgFactory.createElement("use");
29004
+ mask.append(use);
29005
+ use.setAttribute("href", `#${pathId}`);
29006
+ use.setAttribute("stroke", "none");
29007
+ use.setAttribute("fill", "black");
29008
+ use.setAttribute("fill-rule", "nonzero");
29009
+ use.classList.add("mask");
29585
29010
  }
29586
- const currentMode = this.#uiManager.getMode();
29587
- if (currentMode === AnnotationEditorType.STAMP || currentMode === AnnotationEditorType.SIGNATURE) {
29588
- this.#uiManager.unselectAll();
29589
- return;
29011
+ const use1 = DrawLayer._svgFactory.createElement("use");
29012
+ root.append(use1);
29013
+ use1.setAttribute("href", `#${pathId}`);
29014
+ if (maskId) {
29015
+ use1.setAttribute("mask", `url(#${maskId})`);
29590
29016
  }
29591
- this.createAndAddNewEditor(event, false);
29017
+ const use2 = use1.cloneNode();
29018
+ root.append(use2);
29019
+ use1.classList.add("mainOutline");
29020
+ use2.classList.add("secondaryOutline");
29021
+ this.updateProperties(root, properties);
29022
+ this.#mapping.set(id, root);
29023
+ return id;
29592
29024
  }
29593
- pointerdown(event) {
29594
- if (this.#uiManager.getMode() === AnnotationEditorType.HIGHLIGHT) {
29595
- this.enableTextSelection();
29596
- }
29597
- if (this.#hadPointerDown) {
29598
- this.#hadPointerDown = false;
29025
+ finalizeDraw(id, properties) {
29026
+ this.#toUpdate.delete(id);
29027
+ this.updateProperties(id, properties);
29028
+ }
29029
+ updateProperties(elementOrId, properties) {
29030
+ if (!properties) {
29599
29031
  return;
29600
29032
  }
29601
29033
  const {
29602
- isMac
29603
- } = util_FeatureTest.platform;
29604
- if (event.button !== 0 || event.ctrlKey && isMac) {
29605
- return;
29606
- }
29607
- if (event.target !== this.div) {
29034
+ root,
29035
+ bbox,
29036
+ rootClass,
29037
+ path
29038
+ } = properties;
29039
+ const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
29040
+ if (!element) {
29608
29041
  return;
29609
29042
  }
29610
- this.#hadPointerDown = true;
29611
- if (this.#currentEditorType?.isDrawer) {
29612
- this.startDrawingSession(event);
29613
- return;
29043
+ if (root) {
29044
+ this.#updateProperties(element, root);
29614
29045
  }
29615
- const editor = this.#uiManager.getActive();
29616
- this.#allowClick = !editor || editor.isEmpty();
29617
- }
29618
- startDrawingSession(event) {
29619
- this.div.focus({
29620
- preventScroll: true
29621
- });
29622
- if (this.#drawingAC) {
29623
- this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
29624
- return;
29046
+ if (bbox) {
29047
+ DrawLayer.#setBox(element, bbox);
29625
29048
  }
29626
- this.#uiManager.setCurrentDrawingSession(this);
29627
- this.#drawingAC = new AbortController();
29628
- const signal = this.#uiManager.combinedSignal(this.#drawingAC);
29629
- this.div.addEventListener("blur", ({
29630
- relatedTarget
29631
- }) => {
29632
- if (relatedTarget && !this.div.contains(relatedTarget)) {
29633
- this.#focusedElement = null;
29634
- this.commitOrRemove();
29635
- }
29636
- }, {
29637
- signal
29638
- });
29639
- this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
29640
- }
29641
- pause(on) {
29642
- if (on) {
29049
+ if (rootClass) {
29643
29050
  const {
29644
- activeElement
29645
- } = document;
29646
- if (this.div.contains(activeElement)) {
29647
- this.#focusedElement = activeElement;
29051
+ classList
29052
+ } = element;
29053
+ for (const [className, value] of Object.entries(rootClass)) {
29054
+ classList.toggle(className, value);
29648
29055
  }
29649
- return;
29650
29056
  }
29651
- if (this.#focusedElement) {
29652
- setTimeout(() => {
29653
- this.#focusedElement?.focus();
29654
- this.#focusedElement = null;
29655
- }, 0);
29057
+ if (path) {
29058
+ const defs = element.firstElementChild;
29059
+ const pathElement = defs.firstElementChild;
29060
+ this.#updateProperties(pathElement, path);
29656
29061
  }
29657
29062
  }
29658
- endDrawingSession(isAborted = false) {
29659
- if (!this.#drawingAC) {
29660
- return null;
29063
+ updateParent(id, layer) {
29064
+ if (layer === this) {
29065
+ return;
29661
29066
  }
29662
- this.#uiManager.setCurrentDrawingSession(null);
29663
- this.#drawingAC.abort();
29664
- this.#drawingAC = null;
29665
- this.#focusedElement = null;
29666
- return this.#currentEditorType.endDrawing(isAborted);
29067
+ const root = this.#mapping.get(id);
29068
+ if (!root) {
29069
+ return;
29070
+ }
29071
+ layer.#parent.append(root);
29072
+ this.#mapping.delete(id);
29073
+ layer.#mapping.set(id, root);
29667
29074
  }
29668
- findNewParent(editor, x, y) {
29669
- const layer = this.#uiManager.findParent(x, y);
29670
- if (layer === null || layer === this) {
29671
- return false;
29075
+ remove(id) {
29076
+ this.#toUpdate.delete(id);
29077
+ if (this.#parent === null) {
29078
+ return;
29672
29079
  }
29673
- layer.changeParent(editor);
29674
- return true;
29080
+ this.#mapping.get(id).remove();
29081
+ this.#mapping.delete(id);
29675
29082
  }
29676
- commitOrRemove() {
29677
- if (this.#drawingAC) {
29678
- this.endDrawingSession();
29679
- return true;
29083
+ destroy() {
29084
+ this.#parent = null;
29085
+ for (const root of this.#mapping.values()) {
29086
+ root.remove();
29680
29087
  }
29681
- return false;
29088
+ this.#mapping.clear();
29089
+ this.#toUpdate.clear();
29682
29090
  }
29683
- onScaleChanging() {
29684
- if (!this.#drawingAC) {
29685
- return;
29091
+ }
29092
+
29093
+ ;// ./src/pdf.js
29094
+
29095
+
29096
+
29097
+
29098
+
29099
+
29100
+
29101
+
29102
+
29103
+
29104
+
29105
+
29106
+
29107
+
29108
+
29109
+
29110
+ {
29111
+ globalThis._pdfjsTestingUtils = {
29112
+ HighlightOutliner: HighlightOutliner
29113
+ };
29114
+ }
29115
+ globalThis.pdfjsLib = {
29116
+ AbortException: AbortException,
29117
+ AnnotationEditorLayer: AnnotationEditorLayer,
29118
+ AnnotationEditorParamsType: AnnotationEditorParamsType,
29119
+ AnnotationEditorType: AnnotationEditorType,
29120
+ AnnotationEditorUIManager: AnnotationEditorUIManager,
29121
+ AnnotationLayer: AnnotationLayer,
29122
+ AnnotationMode: AnnotationMode,
29123
+ AnnotationType: AnnotationType,
29124
+ applyOpacity: applyOpacity,
29125
+ build: build,
29126
+ ColorPicker: ColorPicker,
29127
+ createValidAbsoluteUrl: createValidAbsoluteUrl,
29128
+ CSSConstants: CSSConstants,
29129
+ DOMSVGFactory: DOMSVGFactory,
29130
+ DrawLayer: DrawLayer,
29131
+ FeatureTest: util_FeatureTest,
29132
+ fetchData: fetchData,
29133
+ findContrastColor: findContrastColor,
29134
+ getDocument: getDocument,
29135
+ getFilenameFromUrl: getFilenameFromUrl,
29136
+ getPdfFilenameFromUrl: getPdfFilenameFromUrl,
29137
+ getRGB: getRGB,
29138
+ getUuid: getUuid,
29139
+ getXfaPageViewport: getXfaPageViewport,
29140
+ GlobalWorkerOptions: pdf_GlobalWorkerOptions,
29141
+ ImageKind: util_ImageKind,
29142
+ InvalidPDFException: InvalidPDFException,
29143
+ isDataScheme: isDataScheme,
29144
+ isPdfFile: isPdfFile,
29145
+ isValidExplicitDest: isValidExplicitDest,
29146
+ MathClamp: MathClamp,
29147
+ noContextMenu: noContextMenu,
29148
+ normalizeUnicode: normalizeUnicode,
29149
+ OPS: OPS,
29150
+ OutputScale: OutputScale,
29151
+ PasswordResponses: PasswordResponses,
29152
+ PDFDataRangeTransport: PDFDataRangeTransport,
29153
+ PDFDateString: PDFDateString,
29154
+ PDFWorker: PDFWorker,
29155
+ PermissionFlag: PermissionFlag,
29156
+ PixelsPerInch: PixelsPerInch,
29157
+ RenderingCancelledException: RenderingCancelledException,
29158
+ renderRichText: renderRichText,
29159
+ ResponseException: ResponseException,
29160
+ setLayerDimensions: setLayerDimensions,
29161
+ shadow: shadow,
29162
+ SignatureExtractor: SignatureExtractor,
29163
+ stopEvent: stopEvent,
29164
+ SupportedImageMimeTypes: SupportedImageMimeTypes,
29165
+ TextLayer: TextLayer,
29166
+ TouchManager: TouchManager,
29167
+ updateUrlHash: updateUrlHash,
29168
+ Util: Util,
29169
+ VerbosityLevel: VerbosityLevel,
29170
+ version: version,
29171
+ XfaLayer: XfaLayer
29172
+ };
29173
+
29174
+
29175
+
29176
+ //# sourceMappingURL=pdf.mjs.map
29177
+ ;// ./node_modules/pdfjs-dist/build/pdf.worker.min.mjs
29178
+ const pdf_worker_min_namespaceObject = __webpack_require__.p + "pdf.worker.min.mjs";
29179
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=template&id=ddd8aa14&scoped=true
29180
+ var render = function render() {
29181
+ var _vm = this,
29182
+ _c = _vm._self._c;
29183
+ return _c('div', {
29184
+ staticClass: "pdf-elements-root",
29185
+ style: {
29186
+ width: _vm.width,
29187
+ height: _vm.height
29686
29188
  }
29687
- this.#currentEditorType.onScaleChangingWhenDrawing(this);
29688
- }
29689
- destroy() {
29690
- this.commitOrRemove();
29691
- if (this.#uiManager.getActive()?.parent === this) {
29692
- this.#uiManager.commitOrRemove();
29693
- this.#uiManager.setActiveEditor(null);
29189
+ }, [_vm.pdfDocuments.length ? _c('div', {
29190
+ staticClass: "pages-container",
29191
+ style: {
29192
+ transform: `scale(${_vm.visualScale / _vm.scale})`,
29193
+ transformOrigin: 'top center'
29694
29194
  }
29695
- if (this.#editorFocusTimeoutId) {
29696
- clearTimeout(this.#editorFocusTimeoutId);
29697
- this.#editorFocusTimeoutId = null;
29195
+ }, _vm._l(_vm.pdfDocuments, function (pdfDoc, docIndex) {
29196
+ return _c('div', {
29197
+ key: docIndex
29198
+ }, _vm._l(pdfDoc.pages, function (page, pIndex) {
29199
+ return _c('div', {
29200
+ key: `${docIndex}-${pIndex}`,
29201
+ staticClass: "page-slot"
29202
+ }, [_c('div', {
29203
+ staticClass: "page-wrapper",
29204
+ on: {
29205
+ "mousedown": function ($event) {
29206
+ return _vm.selectPage(docIndex, pIndex);
29207
+ },
29208
+ "touchstart": function ($event) {
29209
+ return _vm.selectPage(docIndex, pIndex);
29210
+ }
29211
+ }
29212
+ }, [_c('div', {
29213
+ staticClass: "page-canvas",
29214
+ class: {
29215
+ 'shadow-outline': docIndex === _vm.selectedDocIndex && pIndex === _vm.selectedPageIndex
29216
+ }
29217
+ }, [_c('PDFPage', {
29218
+ ref: `page${docIndex}-${pIndex}`,
29219
+ refInFor: true,
29220
+ attrs: {
29221
+ "page": page,
29222
+ "scale": _vm.scale
29223
+ },
29224
+ on: {
29225
+ "onMeasure": function ($event) {
29226
+ return _vm.onMeasure($event, docIndex, pIndex);
29227
+ }
29228
+ }
29229
+ }), _c('div', {
29230
+ staticClass: "overlay"
29231
+ }, [_vm.isAddingMode && _vm.previewPageDocIndex === docIndex && _vm.previewPageIndex === pIndex && _vm.previewElement && _vm.previewVisible ? _c('div', {
29232
+ staticClass: "preview-element",
29233
+ style: {
29234
+ left: `${_vm.previewPosition.x * _vm.previewScale.x}px`,
29235
+ top: `${_vm.previewPosition.y * _vm.previewScale.y}px`,
29236
+ width: `${_vm.previewElement.width * _vm.previewScale.x}px`,
29237
+ height: `${_vm.previewElement.height * _vm.previewScale.y}px`
29238
+ }
29239
+ }, [_vm._t("custom", null, {
29240
+ "object": _vm.previewElement,
29241
+ "isSelected": false
29242
+ })], 2) : _vm._e(), _vm._l(pdfDoc.allObjects[pIndex], function (object) {
29243
+ return _c('DraggableElement', {
29244
+ key: object.id,
29245
+ ref: `draggable${docIndex}-${pIndex}-${object.id}`,
29246
+ refInFor: true,
29247
+ attrs: {
29248
+ "object": object,
29249
+ "pages-scale": _vm.getRenderPageScale(docIndex, pIndex),
29250
+ "page-width": _vm.getPageWidth(docIndex, pIndex),
29251
+ "page-height": _vm.getPageHeight(docIndex, pIndex),
29252
+ "on-update": payload => _vm.updateObject(docIndex, object.id, payload),
29253
+ "on-delete": () => _vm.deleteObject(docIndex, object.id),
29254
+ "on-drag-start": (mouseX, mouseY, pointerOffset, dragShift) => _vm.startDraggingElement(docIndex, pIndex, object, mouseX, mouseY, pointerOffset, dragShift),
29255
+ "on-drag-move": _vm.updateDraggingPosition,
29256
+ "on-drag-end": _vm.stopDraggingElement,
29257
+ "is-being-dragged-globally": _vm.isDraggingElement && _vm.draggingObject && _vm.draggingObject.id === object.id,
29258
+ "dragging-client-pos": _vm.draggingClientPosition,
29259
+ "current-doc-index": docIndex,
29260
+ "current-page-index": pIndex,
29261
+ "global-drag-doc-index": _vm.draggingDocIndex,
29262
+ "global-drag-page-index": _vm.draggingPageIndex,
29263
+ "show-selection-ui": _vm.showSelectionHandles && !_vm.hideSelectionUI && object.resizable !== false,
29264
+ "show-default-actions": _vm.showElementActions && !_vm.hideSelectionUI
29265
+ },
29266
+ scopedSlots: _vm._u([{
29267
+ key: "default",
29268
+ fn: function (slotProps) {
29269
+ return [_vm._t(slotProps.object.type ? `element-${slotProps.object.type}` : 'custom', function () {
29270
+ return [_vm._t("custom", null, {
29271
+ "object": slotProps.object,
29272
+ "onDelete": slotProps.onDelete,
29273
+ "onResize": slotProps.onResize
29274
+ })];
29275
+ }, {
29276
+ "object": slotProps.object,
29277
+ "onDelete": slotProps.onDelete,
29278
+ "onResize": slotProps.onResize
29279
+ })];
29280
+ }
29281
+ }, {
29282
+ key: "actions",
29283
+ fn: function (slotProps) {
29284
+ return [_vm._t("actions", null, {
29285
+ "object": slotProps.object,
29286
+ "onDelete": slotProps.onDelete
29287
+ })];
29288
+ }
29289
+ }], null, true)
29290
+ });
29291
+ })], 2)], 1), _vm.showPageFooter ? _c('div', {
29292
+ staticClass: "page-footer"
29293
+ }, [_c('span', [_vm._v(_vm._s(pdfDoc.name))]), _c('span', [_vm._v(_vm._s(_vm.formatPageNumber(pIndex + 1, pdfDoc.numPages)))])]) : _vm._e()])]);
29294
+ }), 0);
29295
+ }), 0) : _vm._e(), _vm.isDraggingElement && _vm.draggingObject ? _c('div', {
29296
+ staticClass: "drag-portal",
29297
+ style: {
29298
+ position: 'fixed',
29299
+ left: `${_vm.draggingClientPosition.x}px`,
29300
+ top: `${_vm.draggingClientPosition.y}px`,
29301
+ width: `${_vm.draggingObject.width * _vm.draggingScale}px`,
29302
+ height: `${_vm.draggingObject.height * _vm.draggingScale}px`,
29303
+ pointerEvents: 'none'
29698
29304
  }
29699
- for (const editor of this.#editors.values()) {
29700
- this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
29701
- editor.setParent(null);
29702
- editor.isAttachedToDOM = false;
29703
- editor.div.remove();
29305
+ }, [_vm._t(_vm.draggingObject.type ? `element-${_vm.draggingObject.type}` : 'custom', function () {
29306
+ return [_vm._t("custom", null, {
29307
+ "object": _vm.draggingObject,
29308
+ "isSelected": false
29309
+ })];
29310
+ }, {
29311
+ "object": _vm.draggingObject,
29312
+ "isSelected": false
29313
+ })], 2) : _vm._e()]);
29314
+ };
29315
+ var staticRenderFns = [];
29316
+
29317
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
29318
+ var es_array_push = __webpack_require__(4114);
29319
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
29320
+ var es_iterator_constructor = __webpack_require__(8111);
29321
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
29322
+ var es_iterator_filter = __webpack_require__(2489);
29323
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
29324
+ var es_iterator_find = __webpack_require__(116);
29325
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.flat-map.js
29326
+ var es_iterator_flat_map = __webpack_require__(531);
29327
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
29328
+ var es_iterator_for_each = __webpack_require__(7588);
29329
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
29330
+ var es_iterator_map = __webpack_require__(1701);
29331
+ ;// ./node_modules/debounce/index.js
29332
+ function debounce(function_, wait = 100, options = {}) {
29333
+ if (typeof function_ !== 'function') {
29334
+ throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
29335
+ }
29336
+
29337
+ if (wait < 0) {
29338
+ throw new RangeError('`wait` must not be negative.');
29339
+ }
29340
+
29341
+ if (typeof options === 'boolean') {
29342
+ throw new TypeError('The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.');
29343
+ }
29344
+
29345
+ const {immediate} = options;
29346
+
29347
+ let storedContext;
29348
+ let storedArguments;
29349
+ let timeoutId;
29350
+ let timestamp;
29351
+ let result;
29352
+
29353
+ function run() {
29354
+ const callContext = storedContext;
29355
+ const callArguments = storedArguments;
29356
+ storedContext = undefined;
29357
+ storedArguments = undefined;
29358
+ result = function_.apply(callContext, callArguments);
29359
+ return result;
29360
+ }
29361
+
29362
+ function later() {
29363
+ const last = Date.now() - timestamp;
29364
+
29365
+ if (last < wait && last >= 0) {
29366
+ timeoutId = setTimeout(later, wait - last);
29367
+ } else {
29368
+ timeoutId = undefined;
29369
+
29370
+ if (!immediate) {
29371
+ result = run();
29372
+ }
29373
+ }
29374
+ }
29375
+
29376
+ const debounced = function (...arguments_) {
29377
+ if (
29378
+ storedContext
29379
+ && this !== storedContext
29380
+ && Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)
29381
+ ) {
29382
+ throw new Error('Debounced method called with different contexts of the same prototype.');
29383
+ }
29384
+
29385
+ storedContext = this; // eslint-disable-line unicorn/no-this-assignment
29386
+ storedArguments = arguments_;
29387
+ timestamp = Date.now();
29388
+
29389
+ const callNow = immediate && !timeoutId;
29390
+
29391
+ if (!timeoutId) {
29392
+ timeoutId = setTimeout(later, wait);
29393
+ }
29394
+
29395
+ if (callNow) {
29396
+ result = run();
29397
+ return result;
29398
+ }
29399
+
29400
+ return undefined;
29401
+ };
29402
+
29403
+ Object.defineProperty(debounced, 'isPending', {
29404
+ get() {
29405
+ return timeoutId !== undefined;
29406
+ },
29407
+ });
29408
+
29409
+ debounced.clear = () => {
29410
+ if (!timeoutId) {
29411
+ return;
29412
+ }
29413
+
29414
+ clearTimeout(timeoutId);
29415
+ timeoutId = undefined;
29416
+ storedContext = undefined;
29417
+ storedArguments = undefined;
29418
+ };
29419
+
29420
+ debounced.flush = () => {
29421
+ if (!timeoutId) {
29422
+ return;
29423
+ }
29424
+
29425
+ debounced.trigger();
29426
+ };
29427
+
29428
+ debounced.trigger = () => {
29429
+ result = run();
29430
+
29431
+ debounced.clear();
29432
+ };
29433
+
29434
+ return debounced;
29435
+ }
29436
+
29437
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=template&id=2c9e224a&scoped=true
29438
+ var PDFPagevue_type_template_id_2c9e224a_scoped_true_render = function render() {
29439
+ var _vm = this,
29440
+ _c = _vm._self._c;
29441
+ return _c('canvas', {
29442
+ ref: "canvas"
29443
+ });
29444
+ };
29445
+ var PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns = [];
29446
+
29447
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=script&lang=js
29448
+ /* harmony default export */ const PDFPagevue_type_script_lang_js = ({
29449
+ name: 'PDFPage',
29450
+ props: {
29451
+ page: {
29452
+ type: Promise,
29453
+ required: true
29454
+ },
29455
+ scale: {
29456
+ type: Number,
29457
+ default: 1
29704
29458
  }
29705
- this.div = null;
29706
- this.#editors.clear();
29707
- this.#uiManager.removeLayer(this);
29708
- }
29709
- #cleanup() {
29710
- for (const editor of this.#editors.values()) {
29711
- if (editor.isEmpty()) {
29712
- editor.remove();
29713
- }
29459
+ },
29460
+ data() {
29461
+ return {
29462
+ dynamicScale: this.scale,
29463
+ isRendering: false,
29464
+ boundMeasure: null
29465
+ };
29466
+ },
29467
+ watch: {
29468
+ scale(newScale) {
29469
+ this.dynamicScale = newScale;
29470
+ this.render();
29714
29471
  }
29715
- }
29716
- render({
29717
- viewport
29718
- }) {
29719
- this.viewport = viewport;
29720
- setLayerDimensions(this.div, viewport);
29721
- for (const editor of this.#uiManager.getEditors(this.pageIndex)) {
29722
- this.add(editor);
29723
- editor.rebuild();
29472
+ },
29473
+ mounted() {
29474
+ this.boundMeasure = this.measure.bind(this);
29475
+ window.addEventListener('resize', this.boundMeasure);
29476
+ this.render();
29477
+ },
29478
+ beforeUnmount() {
29479
+ if (this.boundMeasure) {
29480
+ window.removeEventListener('resize', this.boundMeasure);
29724
29481
  }
29725
- this.updateMode();
29726
- }
29727
- update({
29728
- viewport
29729
- }) {
29730
- this.#uiManager.commitOrRemove();
29731
- this.#cleanup();
29732
- const oldRotation = this.viewport.rotation;
29733
- const rotation = viewport.rotation;
29734
- this.viewport = viewport;
29735
- setLayerDimensions(this.div, {
29736
- rotation
29737
- });
29738
- if (oldRotation !== rotation) {
29739
- for (const editor of this.#editors.values()) {
29740
- editor.rotate(rotation);
29482
+ },
29483
+ methods: {
29484
+ getCanvasMeasurement() {
29485
+ return {
29486
+ canvasWidth: this.$refs.canvas.width,
29487
+ canvasHeight: this.$refs.canvas.height
29488
+ };
29489
+ },
29490
+ measure() {
29491
+ this.$emit('onMeasure', {
29492
+ scale: this.dynamicScale
29493
+ });
29494
+ },
29495
+ async render() {
29496
+ if (this.isRendering) return;
29497
+ this.isRendering = true;
29498
+ try {
29499
+ const _page = await this.page;
29500
+ const canvas = this.$refs.canvas;
29501
+ const context = canvas.getContext('2d');
29502
+ const viewport = _page.getViewport({
29503
+ scale: this.dynamicScale
29504
+ });
29505
+ canvas.width = viewport.width;
29506
+ canvas.height = viewport.height;
29507
+ await _page.render({
29508
+ canvasContext: context,
29509
+ viewport
29510
+ }).promise;
29511
+ this.measure();
29512
+ } finally {
29513
+ this.isRendering = false;
29741
29514
  }
29742
29515
  }
29743
29516
  }
29744
- get pageDimensions() {
29745
- const {
29746
- pageWidth,
29747
- pageHeight
29748
- } = this.viewport.rawDims;
29749
- return [pageWidth, pageHeight];
29750
- }
29751
- get scale() {
29752
- return this.#uiManager.viewParameters.realScale;
29753
- }
29754
- }
29517
+ });
29518
+ ;// ./src/components/PDFPage.vue?vue&type=script&lang=js
29519
+ /* harmony default export */ const components_PDFPagevue_type_script_lang_js = (PDFPagevue_type_script_lang_js);
29520
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
29521
+ // extracted by mini-css-extract-plugin
29755
29522
 
29756
- ;// ./src/display/draw_layer.js
29523
+ ;// ./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
29757
29524
 
29525
+ ;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
29526
+ /* globals __VUE_SSR_CONTEXT__ */
29758
29527
 
29759
- class DrawLayer {
29760
- #parent = null;
29761
- #mapping = new Map();
29762
- #toUpdate = new Map();
29763
- static #id = 0;
29764
- constructor({
29765
- pageIndex
29766
- }) {
29767
- this.pageIndex = pageIndex;
29768
- }
29769
- setParent(parent) {
29770
- if (!this.#parent) {
29771
- this.#parent = parent;
29772
- return;
29773
- }
29774
- if (this.#parent !== parent) {
29775
- if (this.#mapping.size > 0) {
29776
- for (const root of this.#mapping.values()) {
29777
- root.remove();
29778
- parent.append(root);
29779
- }
29780
- }
29781
- this.#parent = parent;
29782
- }
29783
- }
29784
- static get _svgFactory() {
29785
- return shadow(this, "_svgFactory", new DOMSVGFactory());
29786
- }
29787
- static #setBox(element, [x, y, width, height]) {
29788
- const {
29789
- style
29790
- } = element;
29791
- style.top = `${100 * y}%`;
29792
- style.left = `${100 * x}%`;
29793
- style.width = `${100 * width}%`;
29794
- style.height = `${100 * height}%`;
29528
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
29529
+ // This module is a runtime utility for cleaner component module output and will
29530
+ // be included in the final webpack user bundle.
29531
+
29532
+ function normalizeComponent(
29533
+ scriptExports,
29534
+ render,
29535
+ staticRenderFns,
29536
+ functionalTemplate,
29537
+ injectStyles,
29538
+ scopeId,
29539
+ moduleIdentifier /* server only */,
29540
+ shadowMode /* vue-cli only */
29541
+ ) {
29542
+ // Vue.extend constructor export interop
29543
+ var options =
29544
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
29545
+
29546
+ // render functions
29547
+ if (render) {
29548
+ options.render = render
29549
+ options.staticRenderFns = staticRenderFns
29550
+ options._compiled = true
29795
29551
  }
29796
- #createSVG() {
29797
- const svg = DrawLayer._svgFactory.create(1, 1, true);
29798
- this.#parent.append(svg);
29799
- svg.setAttribute("aria-hidden", true);
29800
- return svg;
29552
+
29553
+ // functional template
29554
+ if (functionalTemplate) {
29555
+ options.functional = true
29801
29556
  }
29802
- #createClipPath(defs, pathId) {
29803
- const clipPath = DrawLayer._svgFactory.createElement("clipPath");
29804
- defs.append(clipPath);
29805
- const clipPathId = `clip_${pathId}`;
29806
- clipPath.setAttribute("id", clipPathId);
29807
- clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
29808
- const clipPathUse = DrawLayer._svgFactory.createElement("use");
29809
- clipPath.append(clipPathUse);
29810
- clipPathUse.setAttribute("href", `#${pathId}`);
29811
- clipPathUse.classList.add("clip");
29812
- return clipPathId;
29557
+
29558
+ // scopedId
29559
+ if (scopeId) {
29560
+ options._scopeId = 'data-v-' + scopeId
29813
29561
  }
29814
- #updateProperties(element, properties) {
29815
- for (const [key, value] of Object.entries(properties)) {
29816
- if (value === null) {
29817
- element.removeAttribute(key);
29818
- } else {
29819
- element.setAttribute(key, value);
29562
+
29563
+ var hook
29564
+ if (moduleIdentifier) {
29565
+ // server build
29566
+ hook = function (context) {
29567
+ // 2.3 injection
29568
+ context =
29569
+ context || // cached call
29570
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
29571
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
29572
+ // 2.2 with runInNewContext: true
29573
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
29574
+ context = __VUE_SSR_CONTEXT__
29575
+ }
29576
+ // inject component styles
29577
+ if (injectStyles) {
29578
+ injectStyles.call(this, context)
29579
+ }
29580
+ // register component module identifier for async chunk inferrence
29581
+ if (context && context._registeredComponents) {
29582
+ context._registeredComponents.add(moduleIdentifier)
29820
29583
  }
29821
29584
  }
29585
+ // used by ssr in case component is cached and beforeCreate
29586
+ // never gets called
29587
+ options._ssrRegister = hook
29588
+ } else if (injectStyles) {
29589
+ hook = shadowMode
29590
+ ? function () {
29591
+ injectStyles.call(
29592
+ this,
29593
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
29594
+ )
29595
+ }
29596
+ : injectStyles
29822
29597
  }
29823
- draw(properties, isPathUpdatable = false, hasClip = false) {
29824
- const id = DrawLayer.#id++;
29825
- const root = this.#createSVG();
29826
- const defs = DrawLayer._svgFactory.createElement("defs");
29827
- root.append(defs);
29828
- const path = DrawLayer._svgFactory.createElement("path");
29829
- defs.append(path);
29830
- const pathId = `path_p${this.pageIndex}_${id}`;
29831
- path.setAttribute("id", pathId);
29832
- path.setAttribute("vector-effect", "non-scaling-stroke");
29833
- if (isPathUpdatable) {
29834
- this.#toUpdate.set(id, path);
29835
- }
29836
- const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
29837
- const use = DrawLayer._svgFactory.createElement("use");
29838
- root.append(use);
29839
- use.setAttribute("href", `#${pathId}`);
29840
- this.updateProperties(root, properties);
29841
- this.#mapping.set(id, root);
29842
- return {
29843
- id,
29844
- clipPathId: `url(#${clipPathId})`
29845
- };
29846
- }
29847
- drawOutline(properties, mustRemoveSelfIntersections) {
29848
- const id = DrawLayer.#id++;
29849
- const root = this.#createSVG();
29850
- const defs = DrawLayer._svgFactory.createElement("defs");
29851
- root.append(defs);
29852
- const path = DrawLayer._svgFactory.createElement("path");
29853
- defs.append(path);
29854
- const pathId = `path_p${this.pageIndex}_${id}`;
29855
- path.setAttribute("id", pathId);
29856
- path.setAttribute("vector-effect", "non-scaling-stroke");
29857
- let maskId;
29858
- if (mustRemoveSelfIntersections) {
29859
- const mask = DrawLayer._svgFactory.createElement("mask");
29860
- defs.append(mask);
29861
- maskId = `mask_p${this.pageIndex}_${id}`;
29862
- mask.setAttribute("id", maskId);
29863
- mask.setAttribute("maskUnits", "objectBoundingBox");
29864
- const rect = DrawLayer._svgFactory.createElement("rect");
29865
- mask.append(rect);
29866
- rect.setAttribute("width", "1");
29867
- rect.setAttribute("height", "1");
29868
- rect.setAttribute("fill", "white");
29869
- const use = DrawLayer._svgFactory.createElement("use");
29870
- mask.append(use);
29871
- use.setAttribute("href", `#${pathId}`);
29872
- use.setAttribute("stroke", "none");
29873
- use.setAttribute("fill", "black");
29874
- use.setAttribute("fill-rule", "nonzero");
29875
- use.classList.add("mask");
29876
- }
29877
- const use1 = DrawLayer._svgFactory.createElement("use");
29878
- root.append(use1);
29879
- use1.setAttribute("href", `#${pathId}`);
29880
- if (maskId) {
29881
- use1.setAttribute("mask", `url(#${maskId})`);
29598
+
29599
+ if (hook) {
29600
+ if (options.functional) {
29601
+ // for template-only hot-reload because in that case the render fn doesn't
29602
+ // go through the normalizer
29603
+ options._injectStyles = hook
29604
+ // register for functional component in vue file
29605
+ var originalRender = options.render
29606
+ options.render = function renderWithStyleInjection(h, context) {
29607
+ hook.call(context)
29608
+ return originalRender(h, context)
29609
+ }
29610
+ } else {
29611
+ // inject component registration as beforeCreate hook
29612
+ var existing = options.beforeCreate
29613
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
29882
29614
  }
29883
- const use2 = use1.cloneNode();
29884
- root.append(use2);
29885
- use1.classList.add("mainOutline");
29886
- use2.classList.add("secondaryOutline");
29887
- this.updateProperties(root, properties);
29888
- this.#mapping.set(id, root);
29889
- return id;
29890
29615
  }
29891
- finalizeDraw(id, properties) {
29892
- this.#toUpdate.delete(id);
29893
- this.updateProperties(id, properties);
29616
+
29617
+ return {
29618
+ exports: scriptExports,
29619
+ options: options
29894
29620
  }
29895
- updateProperties(elementOrId, properties) {
29896
- if (!properties) {
29897
- return;
29898
- }
29899
- const {
29900
- root,
29901
- bbox,
29902
- rootClass,
29903
- path
29904
- } = properties;
29905
- const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
29906
- if (!element) {
29907
- return;
29621
+ }
29622
+
29623
+ ;// ./src/components/PDFPage.vue
29624
+
29625
+
29626
+
29627
+ ;
29628
+
29629
+
29630
+ /* normalize component */
29631
+
29632
+ var component = normalizeComponent(
29633
+ components_PDFPagevue_type_script_lang_js,
29634
+ PDFPagevue_type_template_id_2c9e224a_scoped_true_render,
29635
+ PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns,
29636
+ false,
29637
+ null,
29638
+ "2c9e224a",
29639
+ null
29640
+
29641
+ )
29642
+
29643
+ /* harmony default export */ const PDFPage = (component.exports);
29644
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=template&id=55db89ce&scoped=true
29645
+ var DraggableElementvue_type_template_id_55db89ce_scoped_true_render = function render() {
29646
+ var _vm = this,
29647
+ _c = _vm._self._c;
29648
+ return _c('div', {
29649
+ staticClass: "draggable-wrapper"
29650
+ }, [_vm.isSelected && !_vm.isBeingDraggedGlobally && _vm.showSelectionUi && _vm.showDefaultActions ? _c('div', {
29651
+ staticClass: "actions-toolbar",
29652
+ style: _vm.toolbarStyle
29653
+ }, [_vm._t("actions", function () {
29654
+ return [_c('button', {
29655
+ staticClass: "action-btn",
29656
+ attrs: {
29657
+ "type": "button",
29658
+ "title": "Delete"
29659
+ },
29660
+ on: {
29661
+ "click": function ($event) {
29662
+ $event.stopPropagation();
29663
+ return _vm.onDelete.apply(null, arguments);
29664
+ }
29665
+ }
29666
+ }, [_c('svg', {
29667
+ attrs: {
29668
+ "width": "16",
29669
+ "height": "16",
29670
+ "viewBox": "0 0 16 16",
29671
+ "fill": "currentColor"
29672
+ }
29673
+ }, [_c('path', {
29674
+ attrs: {
29675
+ "d": "M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.5a.5.5 0 0 0 0 1h.5v10.5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5V3.5h.5a.5.5 0 0 0 0-1H11Zm1 1v10.5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5V3.5h8Z"
29676
+ }
29677
+ })])])];
29678
+ }, {
29679
+ "object": _vm.object,
29680
+ "onDelete": _vm.onDelete
29681
+ })], 2) : _vm._e(), _c('div', {
29682
+ staticClass: "draggable-element",
29683
+ class: {
29684
+ selected: _vm.isSelected && _vm.showSelectionUi
29685
+ },
29686
+ style: [_vm.elementStyle, _vm.dragElementStyle],
29687
+ attrs: {
29688
+ "draggable": "false"
29689
+ },
29690
+ on: {
29691
+ "dragstart": function ($event) {
29692
+ $event.preventDefault();
29693
+ },
29694
+ "mousedown": _vm.handleElementClick,
29695
+ "touchstart": _vm.handleElementClick
29908
29696
  }
29909
- if (root) {
29910
- this.#updateProperties(element, root);
29697
+ }, [_vm._t("default", null, {
29698
+ "object": _vm.object,
29699
+ "isSelected": _vm.isSelected,
29700
+ "onDelete": _vm.onDelete,
29701
+ "onResize": _vm.startResizeFromSlot
29702
+ }), _vm.isSelected && _vm.showSelectionUi ? _vm._l(_vm.resizeDirections, function (dir) {
29703
+ return _c('button', {
29704
+ key: dir,
29705
+ staticClass: "resize-handle",
29706
+ class: `handle-${dir}`,
29707
+ attrs: {
29708
+ "type": "button"
29709
+ },
29710
+ on: {
29711
+ "mousedown": function ($event) {
29712
+ $event.stopPropagation();
29713
+ $event.preventDefault();
29714
+ return _vm.startResize(dir, $event);
29715
+ },
29716
+ "touchstart": function ($event) {
29717
+ $event.stopPropagation();
29718
+ $event.preventDefault();
29719
+ return _vm.startResize(dir, $event);
29720
+ }
29721
+ }
29722
+ });
29723
+ }) : _vm._e()], 2)]);
29724
+ };
29725
+ var DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns = [];
29726
+
29727
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=script&lang=js
29728
+ /* harmony default export */ const DraggableElementvue_type_script_lang_js = ({
29729
+ name: 'DraggableElement',
29730
+ props: {
29731
+ object: {
29732
+ type: Object,
29733
+ required: true
29734
+ },
29735
+ pagesScale: {
29736
+ type: Number,
29737
+ default: 1
29738
+ },
29739
+ pageWidth: {
29740
+ type: Number,
29741
+ required: true
29742
+ },
29743
+ pageHeight: {
29744
+ type: Number,
29745
+ required: true
29746
+ },
29747
+ onUpdate: {
29748
+ type: Function,
29749
+ default: () => {}
29750
+ },
29751
+ onDelete: {
29752
+ type: Function,
29753
+ default: () => {}
29754
+ },
29755
+ onDragStart: {
29756
+ type: Function,
29757
+ default: () => {}
29758
+ },
29759
+ onDragMove: {
29760
+ type: Function,
29761
+ default: () => {}
29762
+ },
29763
+ onDragEnd: {
29764
+ type: Function,
29765
+ default: () => {}
29766
+ },
29767
+ isBeingDraggedGlobally: {
29768
+ type: Boolean,
29769
+ default: false
29770
+ },
29771
+ draggingClientPos: {
29772
+ type: Object,
29773
+ default: () => ({
29774
+ x: 0,
29775
+ y: 0
29776
+ })
29777
+ },
29778
+ currentDocIndex: {
29779
+ type: Number,
29780
+ default: -1
29781
+ },
29782
+ currentPageIndex: {
29783
+ type: Number,
29784
+ default: -1
29785
+ },
29786
+ globalDragDocIndex: {
29787
+ type: Number,
29788
+ default: -1
29789
+ },
29790
+ globalDragPageIndex: {
29791
+ type: Number,
29792
+ default: -1
29793
+ },
29794
+ showSelectionUi: {
29795
+ type: Boolean,
29796
+ default: true
29797
+ },
29798
+ showDefaultActions: {
29799
+ type: Boolean,
29800
+ default: true
29911
29801
  }
29912
- if (bbox) {
29913
- DrawLayer.#setBox(element, bbox);
29802
+ },
29803
+ data() {
29804
+ return {
29805
+ isSelected: false,
29806
+ mode: 'idle',
29807
+ direction: '',
29808
+ startX: 0,
29809
+ startY: 0,
29810
+ startLeft: 0,
29811
+ startTop: 0,
29812
+ startWidth: 0,
29813
+ startHeight: 0,
29814
+ offsetX: 0,
29815
+ offsetY: 0,
29816
+ resizeOffsetX: 0,
29817
+ resizeOffsetY: 0,
29818
+ resizeOffsetW: 0,
29819
+ resizeOffsetH: 0,
29820
+ aspectRatio: 1,
29821
+ lastMouseX: 0,
29822
+ lastMouseY: 0,
29823
+ pointerOffsetDoc: {
29824
+ x: 0,
29825
+ y: 0
29826
+ },
29827
+ currentPageRect: null,
29828
+ rafId: null
29829
+ };
29830
+ },
29831
+ computed: {
29832
+ resizeDirections() {
29833
+ return ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
29834
+ },
29835
+ elementStyle() {
29836
+ const scale = this.pagesScale || 1;
29837
+ const currentX = this.object.x + this.offsetX + this.resizeOffsetX;
29838
+ const currentY = this.object.y + this.offsetY + this.resizeOffsetY;
29839
+ const currentWidth = this.object.width + this.resizeOffsetW;
29840
+ const currentHeight = this.object.height + this.resizeOffsetH;
29841
+ return {
29842
+ left: `${currentX * scale}px`,
29843
+ top: `${currentY * scale}px`,
29844
+ width: `${currentWidth * scale}px`,
29845
+ height: `${currentHeight * scale}px`
29846
+ };
29847
+ },
29848
+ toolbarStyle() {
29849
+ const scale = this.pagesScale || 1;
29850
+ const x = this.object.x + this.offsetX + this.resizeOffsetX;
29851
+ const y = this.object.y + this.offsetY + this.resizeOffsetY;
29852
+ const width = this.object.width + this.resizeOffsetW;
29853
+ return {
29854
+ left: `${(x + width / 2) * scale}px`,
29855
+ top: `${(y - 48) * scale}px`,
29856
+ transform: 'translateX(-50%)'
29857
+ };
29858
+ },
29859
+ dragElementStyle() {
29860
+ if (!this.isBeingDraggedGlobally || !this.draggingClientPos) {
29861
+ return {};
29862
+ }
29863
+ return {
29864
+ opacity: 0,
29865
+ pointerEvents: 'none'
29866
+ };
29914
29867
  }
29915
- if (rootClass) {
29916
- const {
29917
- classList
29918
- } = element;
29919
- for (const [className, value] of Object.entries(rootClass)) {
29920
- classList.toggle(className, value);
29868
+ },
29869
+ mounted() {
29870
+ this.handleClickOutside = this.handleClickOutside.bind(this);
29871
+ this.boundHandleMove = this.handleMove.bind(this);
29872
+ this.boundStopInteraction = this.stopInteraction.bind(this);
29873
+ document.addEventListener('mousedown', this.handleClickOutside);
29874
+ document.addEventListener('touchstart', this.handleClickOutside);
29875
+ },
29876
+ beforeUnmount() {
29877
+ document.removeEventListener('mousedown', this.handleClickOutside);
29878
+ document.removeEventListener('touchstart', this.handleClickOutside);
29879
+ window.removeEventListener('mousemove', this.boundHandleMove);
29880
+ window.removeEventListener('mouseup', this.boundStopInteraction);
29881
+ window.removeEventListener('touchmove', this.boundHandleMove);
29882
+ window.removeEventListener('touchend', this.boundStopInteraction);
29883
+ if (this.rafId) cancelAnimationFrame(this.rafId);
29884
+ },
29885
+ methods: {
29886
+ handleElementClick(event) {
29887
+ if (event.target.closest('.delete-handle') || event.target.closest('[data-stop-drag]') || event.target.closest('.actions-toolbar')) {
29888
+ return;
29889
+ }
29890
+ event.preventDefault();
29891
+ this.isSelected = true;
29892
+ this.startDrag(event);
29893
+ },
29894
+ handleClickOutside(event) {
29895
+ if (this.$el && !this.$el.contains(event.target)) {
29896
+ this.isSelected = false;
29897
+ }
29898
+ },
29899
+ startResizeFromSlot(direction, event) {
29900
+ if (!direction || !event) return;
29901
+ this.startResize(direction, event);
29902
+ },
29903
+ startDrag(event) {
29904
+ if (event.target.classList.contains('delete')) return;
29905
+ if (event.target.classList.contains('resize-handle')) return;
29906
+ this.mode = 'drag';
29907
+ this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
29908
+ this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
29909
+ this.startLeft = this.object.x;
29910
+ this.startTop = this.object.y;
29911
+ this.offsetX = 0;
29912
+ this.offsetY = 0;
29913
+ this.resetResizeOffsets();
29914
+ const elementRect = this.$el.querySelector('.draggable-element').getBoundingClientRect();
29915
+ this.pointerOffsetDoc.x = this.startX - elementRect.left;
29916
+ this.pointerOffsetDoc.y = this.startY - elementRect.top;
29917
+ const pageRect = this.capturePageRect();
29918
+ this.currentPageRect = pageRect;
29919
+ let dragElementShift = {
29920
+ x: 0,
29921
+ y: 0
29922
+ };
29923
+ if (pageRect) {
29924
+ const expectedLeft = pageRect.left + this.object.x * this.pagesScale;
29925
+ const expectedTop = pageRect.top + this.object.y * this.pagesScale;
29926
+ dragElementShift = {
29927
+ x: elementRect.left - expectedLeft,
29928
+ y: elementRect.top - expectedTop
29929
+ };
29930
+ }
29931
+ this.onDragStart(this.startX, this.startY, {
29932
+ ...this.pointerOffsetDoc
29933
+ }, dragElementShift);
29934
+ window.addEventListener('mousemove', this.boundHandleMove);
29935
+ window.addEventListener('mouseup', this.boundStopInteraction);
29936
+ window.addEventListener('touchmove', this.boundHandleMove);
29937
+ window.addEventListener('touchend', this.boundStopInteraction);
29938
+ },
29939
+ startResize(direction, event) {
29940
+ this.mode = 'resize';
29941
+ this.direction = direction;
29942
+ this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
29943
+ this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
29944
+ this.startLeft = this.object.x;
29945
+ this.startTop = this.object.y;
29946
+ this.startWidth = this.object.width;
29947
+ this.startHeight = this.object.height;
29948
+ this.aspectRatio = this.startWidth / this.startHeight;
29949
+ this.offsetX = 0;
29950
+ this.offsetY = 0;
29951
+ this.resetResizeOffsets();
29952
+ window.addEventListener('mousemove', this.boundHandleMove);
29953
+ window.addEventListener('mouseup', this.boundStopInteraction);
29954
+ window.addEventListener('touchmove', this.boundHandleMove);
29955
+ window.addEventListener('touchend', this.boundStopInteraction);
29956
+ },
29957
+ handleMove(event) {
29958
+ if (this.mode === 'idle') return;
29959
+ event.preventDefault();
29960
+ if (this.rafId) return;
29961
+ this.rafId = requestAnimationFrame(() => {
29962
+ const currentX = event.type.includes('touch') ? event.touches[0]?.clientX : event.clientX;
29963
+ const currentY = event.type.includes('touch') ? event.touches[0]?.clientY : event.clientY;
29964
+ if (currentX === undefined || currentY === undefined) return;
29965
+ this.lastMouseX = currentX;
29966
+ this.lastMouseY = currentY;
29967
+ const deltaX = (currentX - this.startX) / this.pagesScale;
29968
+ const deltaY = (currentY - this.startY) / this.pagesScale;
29969
+ if (this.mode === 'drag') {
29970
+ const pageRect = this.currentPageRect;
29971
+ if (pageRect) {
29972
+ const newElementLeft = currentX - this.pointerOffsetDoc.x;
29973
+ const newElementTop = currentY - this.pointerOffsetDoc.y;
29974
+ const newX = (newElementLeft - pageRect.left) / this.pagesScale;
29975
+ const newY = (newElementTop - pageRect.top) / this.pagesScale;
29976
+ this.offsetX = newX - this.object.x;
29977
+ this.offsetY = newY - this.object.y;
29978
+ } else {
29979
+ this.offsetX = deltaX;
29980
+ this.offsetY = deltaY;
29981
+ }
29982
+ this.onDragMove(currentX, currentY);
29983
+ if (this.isBeingDraggedGlobally) {
29984
+ this.onUpdate({
29985
+ _globalDrag: true,
29986
+ _mouseX: currentX,
29987
+ _mouseY: currentY
29988
+ });
29989
+ }
29990
+ this.rafId = null;
29991
+ return;
29992
+ }
29993
+ const minSize = 16;
29994
+ let newWidth = this.startWidth;
29995
+ let newHeight = this.startHeight;
29996
+ let newLeft = this.startLeft;
29997
+ let newTop = this.startTop;
29998
+ const widthChange = this.direction.includes('right') ? deltaX : this.direction.includes('left') ? -deltaX : 0;
29999
+ newWidth = this.startWidth + widthChange;
30000
+ if (newWidth < minSize) newWidth = minSize;
30001
+ newHeight = newWidth / this.aspectRatio;
30002
+ if (this.direction.includes('left')) {
30003
+ newLeft = this.startLeft + (this.startWidth - newWidth);
30004
+ if (newLeft < 0) {
30005
+ const overflow = -newLeft;
30006
+ newLeft = 0;
30007
+ newWidth = newWidth - overflow;
30008
+ newHeight = newWidth / this.aspectRatio;
30009
+ }
30010
+ }
30011
+ if (this.direction.includes('top')) {
30012
+ newTop = this.startTop + (this.startHeight - newHeight);
30013
+ if (newTop < 0) {
30014
+ const overflow = -newTop;
30015
+ newTop = 0;
30016
+ newHeight = newHeight - overflow;
30017
+ newWidth = newHeight * this.aspectRatio;
30018
+ if (this.direction.includes('left')) {
30019
+ newLeft = this.startLeft + (this.startWidth - newWidth);
30020
+ }
30021
+ }
30022
+ }
30023
+ if (newLeft + newWidth > this.pageWidth) {
30024
+ const excess = newLeft + newWidth - this.pageWidth;
30025
+ newWidth -= excess;
30026
+ newHeight = newWidth / this.aspectRatio;
30027
+ }
30028
+ if (newTop + newHeight > this.pageHeight) {
30029
+ const excess = newTop + newHeight - this.pageHeight;
30030
+ newHeight -= excess;
30031
+ newWidth = newHeight * this.aspectRatio;
30032
+ if (this.direction.includes('left')) {
30033
+ newLeft = this.startLeft + (this.startWidth - newWidth);
30034
+ }
30035
+ }
30036
+ this.resizeOffsetX = newLeft - this.object.x;
30037
+ this.resizeOffsetY = newTop - this.object.y;
30038
+ this.resizeOffsetW = newWidth - this.object.width;
30039
+ this.resizeOffsetH = newHeight - this.object.height;
30040
+ this.rafId = null;
30041
+ });
30042
+ },
30043
+ stopInteraction() {
30044
+ if (this.mode === 'idle') return;
30045
+ if (this.mode === 'drag' && (this.offsetX !== 0 || this.offsetY !== 0)) {
30046
+ if (this.isBeingDraggedGlobally) {
30047
+ this.onUpdate({
30048
+ _globalDrag: true,
30049
+ _mouseX: this.lastMouseX,
30050
+ _mouseY: this.lastMouseY
30051
+ });
30052
+ } else {
30053
+ const x = Math.max(0, Math.min(this.object.x + this.offsetX, this.pageWidth - this.object.width));
30054
+ const y = Math.max(0, Math.min(this.object.y + this.offsetY, this.pageHeight - this.object.height));
30055
+ this.onUpdate({
30056
+ x,
30057
+ y
30058
+ });
30059
+ }
29921
30060
  }
30061
+ if (this.mode === 'resize' && (this.resizeOffsetW !== 0 || this.resizeOffsetH !== 0 || this.resizeOffsetX !== 0 || this.resizeOffsetY !== 0)) {
30062
+ const x = this.object.x + this.resizeOffsetX;
30063
+ const y = this.object.y + this.resizeOffsetY;
30064
+ const width = this.object.width + this.resizeOffsetW;
30065
+ const height = this.object.height + this.resizeOffsetH;
30066
+ this.onUpdate({
30067
+ x,
30068
+ y,
30069
+ width,
30070
+ height
30071
+ });
30072
+ }
30073
+ this.resetOffsets();
30074
+ this.onDragEnd();
30075
+ window.removeEventListener('mousemove', this.boundHandleMove);
30076
+ window.removeEventListener('mouseup', this.boundStopInteraction);
30077
+ window.removeEventListener('touchmove', this.boundHandleMove);
30078
+ window.removeEventListener('touchend', this.boundStopInteraction);
30079
+ },
30080
+ capturePageRect() {
30081
+ const wrapper = this.$el.closest('.page-wrapper');
30082
+ if (!wrapper) return null;
30083
+ const canvas = wrapper.querySelector('canvas');
30084
+ return canvas ? canvas.getBoundingClientRect() : null;
30085
+ },
30086
+ resetResizeOffsets() {
30087
+ this.resizeOffsetX = 0;
30088
+ this.resizeOffsetY = 0;
30089
+ this.resizeOffsetW = 0;
30090
+ this.resizeOffsetH = 0;
30091
+ },
30092
+ resetOffsets() {
30093
+ this.mode = 'idle';
30094
+ this.offsetX = 0;
30095
+ this.offsetY = 0;
30096
+ this.resetResizeOffsets();
30097
+ this.pointerOffsetDoc = {
30098
+ x: 0,
30099
+ y: 0
30100
+ };
30101
+ this.currentPageRect = null;
29922
30102
  }
29923
- if (path) {
29924
- const defs = element.firstElementChild;
29925
- const pathElement = defs.firstElementChild;
29926
- this.#updateProperties(pathElement, path);
29927
- }
29928
- }
29929
- updateParent(id, layer) {
29930
- if (layer === this) {
29931
- return;
29932
- }
29933
- const root = this.#mapping.get(id);
29934
- if (!root) {
29935
- return;
29936
- }
29937
- layer.#parent.append(root);
29938
- this.#mapping.delete(id);
29939
- layer.#mapping.set(id, root);
29940
- }
29941
- remove(id) {
29942
- this.#toUpdate.delete(id);
29943
- if (this.#parent === null) {
29944
- return;
29945
- }
29946
- this.#mapping.get(id).remove();
29947
- this.#mapping.delete(id);
29948
- }
29949
- destroy() {
29950
- this.#parent = null;
29951
- for (const root of this.#mapping.values()) {
29952
- root.remove();
29953
- }
29954
- this.#mapping.clear();
29955
- this.#toUpdate.clear();
29956
30103
  }
29957
- }
29958
-
29959
- ;// ./src/pdf.js
29960
-
29961
-
29962
-
29963
-
29964
-
29965
-
29966
-
29967
-
29968
-
29969
-
30104
+ });
30105
+ ;// ./src/components/DraggableElement.vue?vue&type=script&lang=js
30106
+ /* harmony default export */ const components_DraggableElementvue_type_script_lang_js = (DraggableElementvue_type_script_lang_js);
30107
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
30108
+ // extracted by mini-css-extract-plugin
29970
30109
 
30110
+ ;// ./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
29971
30111
 
30112
+ ;// ./src/components/DraggableElement.vue
29972
30113
 
29973
30114
 
29974
30115
 
30116
+ ;
29975
30117
 
29976
- {
29977
- globalThis._pdfjsTestingUtils = {
29978
- HighlightOutliner: HighlightOutliner
29979
- };
29980
- }
29981
- globalThis.pdfjsLib = {
29982
- AbortException: AbortException,
29983
- AnnotationEditorLayer: AnnotationEditorLayer,
29984
- AnnotationEditorParamsType: AnnotationEditorParamsType,
29985
- AnnotationEditorType: AnnotationEditorType,
29986
- AnnotationEditorUIManager: AnnotationEditorUIManager,
29987
- AnnotationLayer: AnnotationLayer,
29988
- AnnotationMode: AnnotationMode,
29989
- AnnotationType: AnnotationType,
29990
- applyOpacity: applyOpacity,
29991
- build: build,
29992
- ColorPicker: ColorPicker,
29993
- createValidAbsoluteUrl: createValidAbsoluteUrl,
29994
- CSSConstants: CSSConstants,
29995
- DOMSVGFactory: DOMSVGFactory,
29996
- DrawLayer: DrawLayer,
29997
- FeatureTest: util_FeatureTest,
29998
- fetchData: fetchData,
29999
- findContrastColor: findContrastColor,
30000
- getDocument: getDocument,
30001
- getFilenameFromUrl: getFilenameFromUrl,
30002
- getPdfFilenameFromUrl: getPdfFilenameFromUrl,
30003
- getRGB: getRGB,
30004
- getUuid: getUuid,
30005
- getXfaPageViewport: getXfaPageViewport,
30006
- GlobalWorkerOptions: GlobalWorkerOptions,
30007
- ImageKind: util_ImageKind,
30008
- InvalidPDFException: InvalidPDFException,
30009
- isDataScheme: isDataScheme,
30010
- isPdfFile: isPdfFile,
30011
- isValidExplicitDest: isValidExplicitDest,
30012
- MathClamp: MathClamp,
30013
- noContextMenu: noContextMenu,
30014
- normalizeUnicode: normalizeUnicode,
30015
- OPS: OPS,
30016
- OutputScale: OutputScale,
30017
- PasswordResponses: PasswordResponses,
30018
- PDFDataRangeTransport: PDFDataRangeTransport,
30019
- PDFDateString: PDFDateString,
30020
- PDFWorker: PDFWorker,
30021
- PermissionFlag: PermissionFlag,
30022
- PixelsPerInch: PixelsPerInch,
30023
- RenderingCancelledException: RenderingCancelledException,
30024
- renderRichText: renderRichText,
30025
- ResponseException: ResponseException,
30026
- setLayerDimensions: setLayerDimensions,
30027
- shadow: shadow,
30028
- SignatureExtractor: SignatureExtractor,
30029
- stopEvent: stopEvent,
30030
- SupportedImageMimeTypes: SupportedImageMimeTypes,
30031
- TextLayer: TextLayer,
30032
- TouchManager: TouchManager,
30033
- updateUrlHash: updateUrlHash,
30034
- Util: Util,
30035
- VerbosityLevel: VerbosityLevel,
30036
- version: version,
30037
- XfaLayer: XfaLayer
30038
- };
30039
30118
 
30119
+ /* normalize component */
30040
30120
 
30121
+ var DraggableElement_component = normalizeComponent(
30122
+ components_DraggableElementvue_type_script_lang_js,
30123
+ DraggableElementvue_type_template_id_55db89ce_scoped_true_render,
30124
+ DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns,
30125
+ false,
30126
+ null,
30127
+ "55db89ce",
30128
+ null
30129
+
30130
+ )
30041
30131
 
30042
- //# sourceMappingURL=pdf.mjs.map
30043
- ;// ./node_modules/pdfjs-dist/build/pdf.worker.min.mjs
30044
- const pdf_worker_min_namespaceObject = __webpack_require__.p + "pdf.worker.min.mjs";
30132
+ /* harmony default export */ const DraggableElement = (DraggableElement_component.exports);
30045
30133
  ;// ./src/utils/asyncReader.js
30046
30134
  // SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
30047
30135
  // SPDX-License-Identifier: AGPL-3.0-or-later
30048
30136
 
30049
30137
 
30050
30138
 
30051
- GlobalWorkerOptions.workerSrc = pdf_worker_min_namespaceObject;
30139
+ pdf_GlobalWorkerOptions.workerSrc = pdf_worker_min_namespaceObject;
30140
+ function setWorkerPath(path) {
30141
+ GlobalWorkerOptions.workerSrc = path;
30142
+ }
30052
30143
  function readAsArrayBuffer(file) {
30053
30144
  return new Promise((resolve, reject) => {
30054
30145
  const reader = new FileReader();
@@ -30071,6 +30162,7 @@ function readAsPDF(file) {
30071
30162
 
30072
30163
 
30073
30164
 
30165
+
30074
30166
  /* harmony default export */ const PDFElementsvue_type_script_lang_js = ({
30075
30167
  name: 'PDFElements',
30076
30168
  components: {
@@ -30169,7 +30261,8 @@ function readAsPDF(file) {
30169
30261
  zoomRafId: null,
30170
30262
  boundHandleWheel: null,
30171
30263
  debouncedApplyZoom: null,
30172
- visualScale: this.initialScale
30264
+ visualScale: this.initialScale,
30265
+ resizeObserver: null
30173
30266
  };
30174
30267
  },
30175
30268
  mounted() {
@@ -30195,6 +30288,14 @@ function readAsPDF(file) {
30195
30288
  });
30196
30289
  if (this.autoFitZoom) {
30197
30290
  window.addEventListener('resize', this.adjustZoomToFit);
30291
+ if (typeof ResizeObserver !== 'undefined') {
30292
+ this.resizeObserver = new ResizeObserver(() => {
30293
+ this.scheduleAutoFitZoom();
30294
+ });
30295
+ if (this.$el) {
30296
+ this.resizeObserver.observe(this.$el);
30297
+ }
30298
+ }
30198
30299
  }
30199
30300
  },
30200
30301
  beforeUnmount() {
@@ -30215,6 +30316,10 @@ function readAsPDF(file) {
30215
30316
  this.$el?.removeEventListener('scroll', this.onViewportScroll);
30216
30317
  if (this.autoFitZoom) {
30217
30318
  window.removeEventListener('resize', this.adjustZoomToFit);
30319
+ if (this.resizeObserver) {
30320
+ this.resizeObserver.disconnect();
30321
+ this.resizeObserver = null;
30322
+ }
30218
30323
  }
30219
30324
  if (this.viewportRafId) {
30220
30325
  window.cancelAnimationFrame(this.viewportRafId);
@@ -30238,8 +30343,18 @@ function readAsPDF(file) {
30238
30343
  pdfDoc = await readAsPDF(file);
30239
30344
  }
30240
30345
  const pages = [];
30346
+ const pageWidths = Array(pdfDoc.numPages).fill(0);
30241
30347
  for (let p = 1; p <= pdfDoc.numPages; p++) {
30242
- pages.push(pdfDoc.getPage(p));
30348
+ const pagePromise = pdfDoc.getPage(p);
30349
+ pagePromise.then(page => {
30350
+ pageWidths[p - 1] = page.getViewport({
30351
+ scale: 1
30352
+ }).width;
30353
+ if (this.autoFitZoom) {
30354
+ this.scheduleAutoFitZoom();
30355
+ }
30356
+ });
30357
+ pages.push(pagePromise);
30243
30358
  }
30244
30359
  docs.push({
30245
30360
  name,
@@ -30247,6 +30362,7 @@ function readAsPDF(file) {
30247
30362
  pdfDoc,
30248
30363
  numPages: pdfDoc.numPages,
30249
30364
  pages,
30365
+ pageWidths,
30250
30366
  pagesScale: Array(pdfDoc.numPages).fill(this.scale),
30251
30367
  allObjects: Array(pdfDoc.numPages).fill(0).map(() => [])
30252
30368
  });
@@ -30258,6 +30374,11 @@ function readAsPDF(file) {
30258
30374
  this.$emit('pdf-elements:end-init', {
30259
30375
  docsCount: docs.length
30260
30376
  });
30377
+ this.$nextTick(() => {
30378
+ if (this.autoFitZoom) {
30379
+ this.scheduleAutoFitZoom();
30380
+ }
30381
+ });
30261
30382
  }
30262
30383
  },
30263
30384
  selectPage(docIndex, pageIndex) {
@@ -30677,6 +30798,9 @@ function readAsPDF(file) {
30677
30798
  if (docIndex < 0 || docIndex >= this.pdfDocuments.length) return;
30678
30799
  this.pdfDocuments[docIndex].pagesScale[pageIndex] = e.scale;
30679
30800
  this.cachePageBounds();
30801
+ if (this.autoFitZoom) {
30802
+ this.scheduleAutoFitZoom();
30803
+ }
30680
30804
  },
30681
30805
  formatPageNumber(currentPage, totalPages) {
30682
30806
  return this.pageCountFormat.replace('{currentPage}', currentPage).replace('{totalPages}', totalPages);
@@ -30701,25 +30825,46 @@ function readAsPDF(file) {
30701
30825
  const availableWidth = containerWidth - 40;
30702
30826
  return Math.max(0.1, Math.min(2, availableWidth / maxPageWidth));
30703
30827
  },
30828
+ scheduleAutoFitZoom() {
30829
+ if (this.zoomRafId) return;
30830
+ this.zoomRafId = window.requestAnimationFrame(() => {
30831
+ this.zoomRafId = 0;
30832
+ this.adjustZoomToFit();
30833
+ });
30834
+ },
30704
30835
  adjustZoomToFit() {
30705
30836
  if (!this.autoFitZoom || !this.pdfDocuments.length) return;
30706
- const canvases = this.$el?.querySelectorAll('canvas');
30707
- if (!canvases?.length) return;
30708
- const maxCanvasWidth = Math.max(...Array.from(canvases).map(canvas => canvas.width / (this.scale || 1)));
30837
+ const widths = this.pdfDocuments.flatMap(doc => doc.pageWidths || []).filter(width => width > 0);
30838
+ let maxCanvasWidth = 0;
30839
+ if (widths.length) {
30840
+ maxCanvasWidth = Math.max(...widths);
30841
+ } else {
30842
+ if (this.autoFitZoom) {
30843
+ this.scheduleAutoFitZoom();
30844
+ return;
30845
+ }
30846
+ const canvases = this.$el?.querySelectorAll('canvas');
30847
+ if (!canvases?.length) return;
30848
+ maxCanvasWidth = Math.max(...Array.from(canvases).map(canvas => canvas.width / (this.scale || 1)));
30849
+ }
30709
30850
  const optimalScale = this.calculateOptimalScale(maxCanvasWidth);
30710
30851
  if (Math.abs(optimalScale - this.scale) > 0.01) {
30711
30852
  this.scale = optimalScale;
30712
30853
  this.visualScale = optimalScale;
30854
+ this.pdfDocuments.forEach(doc => {
30855
+ doc.pagesScale = doc.pagesScale.map(() => this.scale);
30856
+ });
30857
+ this.cachePageBounds();
30713
30858
  }
30714
30859
  }
30715
30860
  }
30716
30861
  });
30717
30862
  ;// ./src/components/PDFElements.vue?vue&type=script&lang=js
30718
30863
  /* harmony default export */ const components_PDFElementsvue_type_script_lang_js = (PDFElementsvue_type_script_lang_js);
30719
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=style&index=0&id=7a179460&prod&scoped=true&lang=css
30864
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=style&index=0&id=ddd8aa14&prod&scoped=true&lang=css
30720
30865
  // extracted by mini-css-extract-plugin
30721
30866
 
30722
- ;// ./src/components/PDFElements.vue?vue&type=style&index=0&id=7a179460&prod&scoped=true&lang=css
30867
+ ;// ./src/components/PDFElements.vue?vue&type=style&index=0&id=ddd8aa14&prod&scoped=true&lang=css
30723
30868
 
30724
30869
  ;// ./src/components/PDFElements.vue
30725
30870
 
@@ -30736,7 +30881,7 @@ var PDFElements_component = normalizeComponent(
30736
30881
  staticRenderFns,
30737
30882
  false,
30738
30883
  null,
30739
- "7a179460",
30884
+ "ddd8aa14",
30740
30885
  null
30741
30886
 
30742
30887
  )
@@ -30747,6 +30892,10 @@ var PDFElements_component = normalizeComponent(
30747
30892
  // SPDX-License-Identifier: AGPL-3.0-or-later
30748
30893
 
30749
30894
 
30895
+
30896
+ pdf_GlobalWorkerOptions.workerSrc = pdf_worker_min_namespaceObject;
30897
+
30898
+
30750
30899
  PDFElements.install = function (Vue) {
30751
30900
  if (PDFElements.install.installed) return;
30752
30901
  Vue.component(PDFElements.name, PDFElements);