@file-viewer/vue3 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/dist/components/export.js +158 -1
- package/dist/components/export2.js +1165 -1
- package/dist/components/fit.js +486 -1
- package/dist/components/image.js +175 -1
- package/dist/components/messages.js +1888 -1
- package/dist/components/objectSpread2.js +88 -0
- package/dist/components/print-mask.js +214 -1
- package/dist/components/printMask.js +129 -1
- package/dist/index.mjs +7618 -1
- package/dist/src/package/components/FileViewer/hooks/useViewerPreviewLifecycle.d.ts +2 -1
- package/dist/src/package/components/FileViewer/hooks/useViewerRenderSurface.d.ts +2 -1
- package/dist/vue3.css +1 -1
- package/package.json +2 -2
- package/dist/components/asyncToGenerator.js +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/asyncToGenerator.js
|
|
2
|
+
function e(e, t, n, r, i, a, o) {
|
|
3
|
+
try {
|
|
4
|
+
var s = e[a](o), c = s.value;
|
|
5
|
+
} catch (e) {
|
|
6
|
+
n(e);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
s.done ? t(c) : Promise.resolve(c).then(r, i);
|
|
10
|
+
}
|
|
11
|
+
function t(t) {
|
|
12
|
+
return function() {
|
|
13
|
+
var n = this, r = arguments;
|
|
14
|
+
return new Promise(function(i, a) {
|
|
15
|
+
var o = t.apply(n, r);
|
|
16
|
+
function s(t) {
|
|
17
|
+
e(o, i, a, s, c, "next", t);
|
|
18
|
+
}
|
|
19
|
+
function c(t) {
|
|
20
|
+
e(o, i, a, s, c, "throw", t);
|
|
21
|
+
}
|
|
22
|
+
s(void 0);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
|
|
28
|
+
function n(e) {
|
|
29
|
+
"@babel/helpers - typeof";
|
|
30
|
+
return n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
31
|
+
return typeof e;
|
|
32
|
+
} : function(e) {
|
|
33
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
34
|
+
}, n(e);
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
|
|
38
|
+
function r(e, t) {
|
|
39
|
+
if (n(e) != "object" || !e) return e;
|
|
40
|
+
var r = e[Symbol.toPrimitive];
|
|
41
|
+
if (r !== void 0) {
|
|
42
|
+
var i = r.call(e, t || "default");
|
|
43
|
+
if (n(i) != "object") return i;
|
|
44
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
45
|
+
}
|
|
46
|
+
return (t === "string" ? String : Number)(e);
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
|
|
50
|
+
function i(e) {
|
|
51
|
+
var t = r(e, "string");
|
|
52
|
+
return n(t) == "symbol" ? t : t + "";
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
|
|
56
|
+
function a(e, t, n) {
|
|
57
|
+
return (t = i(t)) in e ? Object.defineProperty(e, t, {
|
|
58
|
+
value: n,
|
|
59
|
+
enumerable: !0,
|
|
60
|
+
configurable: !0,
|
|
61
|
+
writable: !0
|
|
62
|
+
}) : e[t] = n, e;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/objectSpread2.js
|
|
66
|
+
function o(e, t) {
|
|
67
|
+
var n = Object.keys(e);
|
|
68
|
+
if (Object.getOwnPropertySymbols) {
|
|
69
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
70
|
+
t && (r = r.filter(function(t) {
|
|
71
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
72
|
+
})), n.push.apply(n, r);
|
|
73
|
+
}
|
|
74
|
+
return n;
|
|
75
|
+
}
|
|
76
|
+
function s(e) {
|
|
77
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
78
|
+
var n = arguments[t] == null ? {} : arguments[t];
|
|
79
|
+
t % 2 ? o(Object(n), !0).forEach(function(t) {
|
|
80
|
+
a(e, t, n[t]);
|
|
81
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : o(Object(n)).forEach(function(t) {
|
|
82
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return e;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { a as n, t as r, s as t };
|
|
@@ -1 +1,214 @@
|
|
|
1
|
-
(function(m,p){const aq=f,q=m();while(!![]){try{const v=-parseInt(aq(0x161))/0x1*(parseInt(aq(0x182))/0x2)+-parseInt(aq(0x15e))/0x3+parseInt(aq(0x190))/0x4*(-parseInt(aq(0x173))/0x5)+parseInt(aq(0x16d))/0x6+parseInt(aq(0x1a3))/0x7*(-parseInt(aq(0x194))/0x8)+-parseInt(aq(0x193))/0x9+-parseInt(aq(0x174))/0xa*(-parseInt(aq(0x18e))/0xb);if(v===p)break;else q['push'](q['shift']());}catch(w){q['push'](q['shift']());}}}(b,0x741dc));import{n as g,t}from'./asyncToGenerator.js';function f(a,c){a=a-0x15b;const d=b();let e=d[a];return e;}import{t as h}from'./messages.js';import{a as j,o as k}from'./printMask.js';var a='\x0a.fv-print-mask-layer{position:absolute;inset:0;z-index:2147483000;pointer-events:none;}\x0a.fv-print-mask-canvas{position:absolute;inset:0;z-index:2147483000;pointer-events:none;cursor:default;}\x0a.fv-print-mask-canvas.is-armed{pointer-events:auto;cursor:crosshair;touch-action:none;}\x0a.fv-print-mask-block{position:absolute;background:#000;box-sizing:border-box;pointer-events:auto;}\x0a.fv-print-mask-block-remove{position:absolute;right:-8px;top:-8px;width:18px;height:18px;border:0;border-radius:999px;background:#111;color:#fff;font:700\x2012px/18px\x20system-ui,sans-serif;cursor:pointer;padding:0;}\x0a.fv-print-stamp{position:absolute;box-sizing:border-box;border:1px\x20dashed\x20rgba(22,119,76,.7);border-radius:4px;pointer-events:auto;touch-action:none;cursor:move;transform-origin:center\x20center;}\x0a.fv-print-stamp\x20img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;user-select:none;}\x0a.fv-print-stamp-resize{position:absolute;right:-7px;bottom:-7px;width:15px;height:15px;border:2px\x20solid\x20#fff;border-radius:4px;background:#16774c;box-shadow:0\x201px\x205px\x20rgba(15,23,42,.22);cursor:nwse-resize;touch-action:none;}\x0a.fv-print-stamp-input{display:none!important;}\x0a.fv-print-mask-toolbar{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);z-index:2147483001;display:inline-flex;align-items:center;gap:6px;padding:6px\x208px;border:1px\x20solid\x20rgba(20,35,53,.12);border-radius:999px;background:rgba(255,255,255,.94);box-shadow:0\x2012px\x2028px\x20rgba(15,23,42,.16);pointer-events:auto;max-width:calc(100%\x20-\x2024px);flex-wrap:wrap;justify-content:center;}\x0a.fv-print-mask-toolbar\x20span{font:600\x2012px/1.2\x20system-ui,sans-serif;color:#40546a;white-space:nowrap;}\x0a.fv-print-mask-toolbar\x20button{min-width:42px;height:30px;padding:0\x2010px;border:0;border-radius:999px;background:transparent;color:#40546a;font:800\x2012px/1\x20system-ui,sans-serif;cursor:pointer;}\x0a.fv-print-mask-toolbar\x20button:hover,.fv-print-mask-toolbar\x20button.is-active{background:rgba(33,163,102,.1);color:#16774c;}\x0a.fv-print-mask-toolbar\x20button.primary{background:#16774c;color:#fff;}\x0a.fv-print-mask-toolbar\x20button.primary:hover{background:#0f5f3c;}\x0a',o=m=>{const ar=f;let p=m['ownerDocument'],q=m['getRootNode'](),v=q===p?p['head']:q;if(v['querySelector']('#fv-print-mask-designer-style'))return;let w=p[ar(0x17d)]('style');w['id']='fv-print-mask-designer-style',w['textContent']=a,v['appendChild'](w);},s=(m,p,q,v)=>{const as=f;if(!q['width']||!q['height'])return null;let w=Math['min'](m['x'],p['x']),x=Math[as(0x18a)](m['y'],p['y']),y=Math['abs'](p['x']-m['x']),z=Math[as(0x17f)](p['y']-m['y']);return y<0x8||z<0x8?null:j({'left':w/q['width']*0x64,'top':x/q[as(0x170)]*0x64,'width':y/q['width']*0x64,'height':z/q['height']*0x64,'pageIndex':v});},c=(m,p)=>{const at=f;let q=m['getBoundingClientRect']();return Math[at(0x166)](0x0,Math['min'](q['right'],p['right'])-Math[at(0x166)](q[at(0x15f)],p['left']))*Math['max'](0x0,Math['min'](q['bottom'],p['bottom'])-Math[at(0x166)](q['top'],p['top']));},l=0xa00000,u=(m,p)=>new Promise((q,v)=>{const au=f;if(!/^image\/(?:png|jpe?g|webp|gif|svg\+xml)$/i['test'](m['type'])||m[au(0x185)]>l){v(Error('Unsupported\x20print\x20stamp\x20image'));return;}let w=new((p==null?void 0x0:p['FileReader'])||globalThis['FileReader'])();w['addEventListener']('load',()=>{const av=au;if(typeof w[av(0x16b)]=='string'&&w['result']['startsWith'](av(0x168))){q(w['result']);return;}v(Error('Invalid\x20print\x20stamp\x20image'));}),w['addEventListener']('error',()=>v(w['error']||Error(au(0x181)))),w['readAsDataURL'](m);}),d=q=>{const aw=f;let w=q[aw(0x19d)],x=w['ownerDocument'],z=h(q['i18n']),A=q['color']||'#000000',B=[...q['initialRegions']||[]]['map'](I=>j(I))['filter'](I=>!!I),C=[...q['initialStamps']||[]]['map'](I=>k(I))['filter'](I=>!!I),D=Array['from'](new Set(q['pages']||[]))['filter'](I=>I===w||w[aw(0x175)](I)),E=D['length']>0x0,F=E?D:[w];o(w);let G=I=>{const ax=aw;var J,K,L;let M=I[ax(0x160)]['position'];return(((L=(K=(J=x['defaultView'])==null?void 0x0:J[ax(0x187)])==null?void 0x0:K['call'](J,I))==null?void 0x0:L['position'])||M||'static')==='static'&&(I['style']['position']=ax(0x195)),M;},H=G(w);return new Promise(J=>{const az=aw;let K=!0x1,Q=null,R=x['createElement']('div');R['className']='fv-print-mask-layer',R['setAttribute']('data-viewer-print-mask-designer','true');let U=(ac,ad)=>{const ay=f;let ae=G(ac),af=x[ay(0x17d)](ay(0x199));return af['className']=ay(0x18c),ac['appendChild'](af),{'element':ac,'pageIndex':ad,'canvas':af,'previousPosition':ae};},V=F['map']((ac,ad)=>U(ac,E?ad:void 0x0)),W=E&&!V['some'](ac=>ac['element']===w)&&(B['some'](ac=>ac['pageIndex']===void 0x0)||C['some'](ac=>ac['pageIndex']===void 0x0))?U(w):null,X=W?[...V,W]:V,Y=x['createElement'](az(0x199));Y['className']='fv-print-mask-toolbar',Y['setAttribute']('role',az(0x16f)),Y['setAttribute'](az(0x184),z(az(0x197)));let Z=x['createElement']('span');Z['textContent']=z('toolbar.printMaskHint');let a0=x['createElement']('button');a0['type']='button',a0['textContent']=z('toolbar.printMaskAdd');let a1=x['createElement']('input');a1['type']='file',a1['accept']='image/png,image/jpeg,image/webp,image/gif,image/svg+xml',a1['className']=az(0x192),a1['setAttribute']('data-viewer-print-stamp-input','true');let a2=x['createElement'](az(0x165));a2[az(0x169)]='button',a2['textContent']=z('toolbar.printStampUpload');let a3=x['createElement']('button');a3[az(0x169)]=az(0x165),a3['textContent']=z(az(0x191));let a4=x['createElement']('button');a4['type']='button',a4['textContent']=z(az(0x18d));let a5=x[az(0x17d)](az(0x165));a5[az(0x169)]='button',a5['className']='primary',a5['textContent']=z('toolbar.printMaskConfirm'),Y['append'](Z,a0,a2,a3,a4,a5),R['append'](a1,Y),w['appendChild'](R);let a6=()=>{const aA=az;V['forEach'](ac=>ac['canvas']['classList']['remove']('is-armed')),a0['classList']['remove'](aA(0x18f));},a7=ac=>{const aC=az;K||(K=!0x0,R['remove'](),X['forEach'](ad=>{const aB=f;ad['canvas'][aB(0x19b)](),ad[aB(0x178)]?ad['element']['style']['position']=ad['previousPosition']:ad[aB(0x183)][aB(0x160)]['removeProperty']('position');}),H?w['style'][aC(0x1a1)]=H:w['style']['removeProperty']('position'),J(ac));},a8=ac=>ac['pageIndex']===void 0x0?W||V[0x0]:V['find'](ad=>ad['pageIndex']===ac['pageIndex'])||null,a9=()=>{const aD=az;X['forEach'](ac=>ac[aD(0x19c)][aD(0x177)]()),B['forEach']((ac,ad)=>{const aE=aD;let ae=a8(ac);if(!ae)return;let af=x[aE(0x17d)]('div');af['className']='fv-print-mask-block',af['style'][aE(0x15f)]=ac['left']+'%',af['style']['top']=ac['top']+'%',af['style']['width']=ac['width']+'%',af['style']['height']=ac['height']+'%',af[aE(0x160)][aE(0x18b)]=A;let ag=x['createElement']('button');ag['type']='button',ag[aE(0x188)]=aE(0x164),ag['title']=z(aE(0x191)),ag['setAttribute']('aria-label',z('toolbar.printMaskClear')),ag['textContent']='−',ag['addEventListener']('click',ah=>{const aF=aE;ah[aF(0x17e)](),ah['stopPropagation'](),B['splice'](ad,0x1),a9();}),af['appendChild'](ag),ae['canvas']['appendChild'](af);}),C['forEach']((ac,ad)=>{const aH=aD;let ae=a8(ac);if(!ae)return;let af=x['createElement']('div');af['className']='fv-print-stamp',af['setAttribute']('data-viewer-print-stamp',String(ad));let ag=()=>{const aG=f;var am,an;af[aG(0x160)]['left']=ac['left']+'%',af['style'][aG(0x15c)]=ac['top']+'%',af['style'][aG(0x167)]=ac['width']+'%',af['style']['height']=ac['height']+'%',af[aG(0x160)]['opacity']=String((am=ac[aG(0x15b)])==null?0x1:am),af[aG(0x160)]['transform']='rotate('+((an=ac[aG(0x19a)])==null?0x0:an)+'deg)';};ag();let ah=x['createElement']('img');ah['src']=ac[aH(0x1a2)],ah['alt']=ac['alt']||'',ah['draggable']=!0x1;let ai=x['createElement']('button');ai['type']=aH(0x165),ai[aH(0x188)]='fv-print-mask-block-remove',ai[aH(0x163)]=z('toolbar.printStampRemove'),ai['setAttribute']('aria-label',z('toolbar.printStampRemove')),ai['textContent']='−',ai['addEventListener']('pointerdown',am=>am['stopPropagation']()),ai['addEventListener']('click',am=>{am['preventDefault'](),am['stopPropagation'](),C['splice'](ad,0x1),a9();});let aj=x['createElement'](aH(0x19e));aj['className']='fv-print-stamp-resize',aj['setAttribute'](aH(0x179),'button'),aj['setAttribute']('aria-label',z(aH(0x180))),aj['title']=z('toolbar.printStampResize');let ak=null;af['addEventListener'](aH(0x19f),am=>{const aI=aH;var an;am['button']!==0x0||am[aI(0x17c)]['closest']('button')||(am['preventDefault'](),am['stopPropagation'](),ak={'pointerId':am['pointerId'],'mode':am['target']===aj?'resize':'move','startX':am['clientX'],'startY':am['clientY'],'left':ac['left'],'top':ac['top'],'width':ac['width'],'height':ac['height']},(an=af['setPointerCapture'])==null||an[aI(0x196)](af,am['pointerId']));}),af['addEventListener']('pointermove',am=>{const aJ=aH;if(!ak||ak['pointerId']!==am['pointerId'])return;am['preventDefault']();let an=ae[aJ(0x19c)]['getBoundingClientRect']();if(!an[aJ(0x167)]||!an[aJ(0x170)])return;let ao=(am[aJ(0x1a0)]-ak['startX'])/an['width']*0x64,ap=(am['clientY']-ak['startY'])/an['height']*0x64;ak[aJ(0x176)]==='move'?(ac[aJ(0x15f)]=Math['max'](0x0,Math['min'](0x64-ac['width'],ak['left']+ao)),ac['top']=Math[aJ(0x166)](0x0,Math[aJ(0x18a)](0x64-ac['height'],ak[aJ(0x15c)]+ap))):(ac['width']=Math['max'](0x4,Math['min'](0x64-ac['left'],ak['width']+ao)),ac['height']=Math['max'](0x4,Math['min'](0x64-ac['top'],ak['height']+ap))),ag();});let al=am=>{var an;if(!(!ak||ak['pointerId']!==am['pointerId'])){try{(an=af['releasePointerCapture'])==null||an['call'](af,ak['pointerId']);}catch(ao){}ak=null;}};af[aH(0x17b)](aH(0x189),al),af[aH(0x17b)]('pointercancel',al),af[aH(0x198)](ah,ai,aj),ae['canvas']['appendChild'](af);});},aa=(ac,ad)=>{const aK=az;let ae=ad['getBoundingClientRect']();return{'x':Math['max'](0x0,Math['min'](ae['width'],ac[aK(0x1a0)]-ae['left'])),'y':Math['max'](0x0,Math['min'](ae['height'],ac['clientY']-ae['top']))};};V['forEach'](ac=>{const aM=az;ac['canvas']['addEventListener']('pointerdown',ad=>{const aL=f;if(ad['button']!==0x0||!ac['canvas'][aL(0x16a)]['contains']('is-armed'))return;ad['preventDefault']();let ae=aa(ad,ac[aL(0x19c)]),af=x['createElement']('div');af[aL(0x188)]='fv-print-mask-block',af['style']['background']=A,af['style']['opacity']='0.72',ac['canvas']['appendChild'](af),Q={'surface':ac,'start':ae,'preview':af,'pointerId':ad['pointerId']},ac['canvas']['setPointerCapture'](ad[aL(0x16c)]);}),ac[aM(0x19c)]['addEventListener'](aM(0x186),ad=>{const aN=aM;if(!Q||Q['surface']!==ac)return;let ae=aa(ad,ac['canvas']),af=Math['min'](Q['start']['x'],ae['x']),ag=Math['min'](Q['start']['y'],ae['y']);Q[aN(0x16e)]['style'][aN(0x15f)]=af+'px',Q[aN(0x16e)][aN(0x160)]['top']=ag+'px',Q['preview']['style']['width']=Math['abs'](ae['x']-Q['start']['x'])+'px',Q['preview']['style']['height']=Math['abs'](ae['y']-Q['start']['y'])+'px';}),ac['canvas']['addEventListener']('pointerup',ad=>{const aO=aM;if(!Q||Q['surface']!==ac)return;let ae=aa(ad,ac[aO(0x19c)]),af=s(Q['start'],ae,ac['canvas']['getBoundingClientRect'](),ac['pageIndex']);Q['preview']['remove']();try{ac[aO(0x19c)]['releasePointerCapture'](Q['pointerId']);}catch(ag){}Q=null,a6(),af&&B['push'](af),a9();}),ac['canvas']['addEventListener']('pointercancel',()=>{!Q||Q['surface']!==ac||(Q['preview']['remove'](),Q=null,a6(),a9());});});let ab=()=>{const aP=az;var ac;let ad=w['getBoundingClientRect']();return((ac=V[aP(0x15d)](ae=>({'surface':ae,'area':c(ae[aP(0x183)],ad)}))[aP(0x172)]((ae,af)=>af['area']-ae['area'])[0x0])==null?void 0x0:ac[aP(0x17a)])||V[0x0];};a0['addEventListener'](az(0x162),()=>{const aQ=az;a6();let ac=ab();ac==null||ac['canvas']['classList']['add']('is-armed'),a0['classList']['toggle'](aQ(0x18f),!!ac);}),a2['addEventListener']('click',()=>{a6(),a1['click']();}),a1['addEventListener']('change',t(function*(){var ac;let ad=(ac=a1['files'])==null?void 0x0:ac[0x0];if(a1['value']='',ad)try{let ae=yield u(ad,x['defaultView']),af=ab();if(!af)return;let ag=k({'src':ae,'alt':ad['name'],'left':0x26,'top':0x26,'width':0x18,'height':0x12,'pageIndex':af['pageIndex']});ag&&(C['push'](ag),a9());}catch(ah){}})),a3['addEventListener']('click',()=>{const aR=az;B['splice'](0x0,B[aR(0x171)]),C['splice'](0x0,C['length']),a6(),a9();}),a4['addEventListener']('click',()=>a7(null)),a5[az(0x17b)](az(0x162),()=>{const aS=az;if(!B['length']&&!C['length']){a7(null);return;}a7({'mask':g(g(g({},B['length']?{'regions':B[aS(0x15d)](ac=>g({},ac))}:{}),C['length']?{'stamps':C['map'](ac=>g({},ac))}:{}),{},{'color':A})});}),a9();});};export{d as openFileViewerPrintMaskDesigner};function b(){const aT=['type','classList','result','pointerId','3569460mSNCtU','preview','toolbar','height','length','sort','15FnXWzD','20665770OIyvuP','contains','mode','replaceChildren','previousPosition','role','surface','addEventListener','target','createElement','preventDefault','abs','toolbar.printStampResize','Failed\x20to\x20read\x20print\x20stamp\x20image','7116yJueRN','element','aria-label','size','pointermove','getComputedStyle','className','pointerup','min','background','fv-print-mask-canvas','toolbar.printMaskCancel','11uicxGH','is-active','945708cUCeXY','toolbar.printMaskClear','fv-print-stamp-input','792621sebwJr','1694368EYXREe','relative','call','toolbar.printMaskTitle','append','div','rotate','remove','canvas','root','span','pointerdown','clientX','position','src','14qgJKzr','opacity','top','map','2265033RGqDxs','left','style','59fUUTXM','click','title','fv-print-mask-block-remove','button','max','width','data:image/'];b=function(){return aT;};return b();}
|
|
1
|
+
import { r as e, t } from "./objectSpread2.js";
|
|
2
|
+
import { t as n } from "./messages.js";
|
|
3
|
+
import { a as r, o as i } from "./printMask.js";
|
|
4
|
+
//#region ../../core/dist/features/printMaskDesigner.js
|
|
5
|
+
var a = "\n.fv-print-mask-layer{position:absolute;inset:0;z-index:2147483000;pointer-events:none;}\n.fv-print-mask-canvas{position:absolute;inset:0;z-index:2147483000;pointer-events:none;cursor:default;}\n.fv-print-mask-canvas.is-armed{pointer-events:auto;cursor:crosshair;touch-action:none;}\n.fv-print-mask-block{position:absolute;background:#000;box-sizing:border-box;pointer-events:auto;}\n.fv-print-mask-block-remove{position:absolute;right:-8px;top:-8px;width:18px;height:18px;border:0;border-radius:999px;background:#111;color:#fff;font:700 12px/18px system-ui,sans-serif;cursor:pointer;padding:0;}\n.fv-print-stamp{position:absolute;box-sizing:border-box;border:1px dashed rgba(22,119,76,.7);border-radius:4px;pointer-events:auto;touch-action:none;cursor:move;transform-origin:center center;}\n.fv-print-stamp img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;user-select:none;}\n.fv-print-stamp-resize{position:absolute;right:-7px;bottom:-7px;width:15px;height:15px;border:2px solid #fff;border-radius:4px;background:#16774c;box-shadow:0 1px 5px rgba(15,23,42,.22);cursor:nwse-resize;touch-action:none;}\n.fv-print-stamp-input{display:none!important;}\n.fv-print-mask-toolbar{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);z-index:2147483001;display:inline-flex;align-items:center;gap:6px;padding:6px 8px;border:1px solid rgba(20,35,53,.12);border-radius:999px;background:rgba(255,255,255,.94);box-shadow:0 12px 28px rgba(15,23,42,.16);pointer-events:auto;max-width:calc(100% - 24px);flex-wrap:wrap;justify-content:center;}\n.fv-print-mask-toolbar span{font:600 12px/1.2 system-ui,sans-serif;color:#40546a;white-space:nowrap;}\n.fv-print-mask-toolbar button{min-width:42px;height:30px;padding:0 10px;border:0;border-radius:999px;background:transparent;color:#40546a;font:800 12px/1 system-ui,sans-serif;cursor:pointer;}\n.fv-print-mask-toolbar button:hover,.fv-print-mask-toolbar button.is-active{background:rgba(33,163,102,.1);color:#16774c;}\n.fv-print-mask-toolbar button.primary{background:#16774c;color:#fff;}\n.fv-print-mask-toolbar button.primary:hover{background:#0f5f3c;}\n", o = (e) => {
|
|
6
|
+
let t = e.ownerDocument, n = e.getRootNode(), r = n === t ? t.head : n;
|
|
7
|
+
if (r.querySelector("#fv-print-mask-designer-style")) return;
|
|
8
|
+
let i = t.createElement("style");
|
|
9
|
+
i.id = "fv-print-mask-designer-style", i.textContent = a, r.appendChild(i);
|
|
10
|
+
}, s = (e, t, n, i) => {
|
|
11
|
+
if (!n.width || !n.height) return null;
|
|
12
|
+
let a = Math.min(e.x, t.x), o = Math.min(e.y, t.y), s = Math.abs(t.x - e.x), c = Math.abs(t.y - e.y);
|
|
13
|
+
return s < 8 || c < 8 ? null : r({
|
|
14
|
+
left: a / n.width * 100,
|
|
15
|
+
top: o / n.height * 100,
|
|
16
|
+
width: s / n.width * 100,
|
|
17
|
+
height: c / n.height * 100,
|
|
18
|
+
pageIndex: i
|
|
19
|
+
});
|
|
20
|
+
}, c = (e, t) => {
|
|
21
|
+
let n = e.getBoundingClientRect();
|
|
22
|
+
return Math.max(0, Math.min(n.right, t.right) - Math.max(n.left, t.left)) * Math.max(0, Math.min(n.bottom, t.bottom) - Math.max(n.top, t.top));
|
|
23
|
+
}, l = 10485760, u = (e, t) => new Promise((n, r) => {
|
|
24
|
+
if (!/^image\/(?:png|jpe?g|webp|gif|svg\+xml)$/i.test(e.type) || e.size > l) {
|
|
25
|
+
r(/* @__PURE__ */ Error("Unsupported print stamp image"));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let i = new ((t == null ? void 0 : t.FileReader) || globalThis.FileReader)();
|
|
29
|
+
i.addEventListener("load", () => {
|
|
30
|
+
if (typeof i.result == "string" && i.result.startsWith("data:image/")) {
|
|
31
|
+
n(i.result);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
r(/* @__PURE__ */ Error("Invalid print stamp image"));
|
|
35
|
+
}), i.addEventListener("error", () => r(i.error || /* @__PURE__ */ Error("Failed to read print stamp image"))), i.readAsDataURL(e);
|
|
36
|
+
}), d = (a) => {
|
|
37
|
+
let l = a.root, d = l.ownerDocument, f = n(a.i18n), p = a.color || "#000000", m = [...a.initialRegions || []].map((e) => r(e)).filter((e) => !!e), h = [...a.initialStamps || []].map((e) => i(e)).filter((e) => !!e), g = Array.from(new Set(a.pages || [])).filter((e) => e === l || l.contains(e)), _ = g.length > 0, v = _ ? g : [l];
|
|
38
|
+
o(l);
|
|
39
|
+
let y = (e) => {
|
|
40
|
+
var t, n, r;
|
|
41
|
+
let i = e.style.position;
|
|
42
|
+
return (((r = (n = (t = d.defaultView) == null ? void 0 : t.getComputedStyle) == null ? void 0 : n.call(t, e)) == null ? void 0 : r.position) || i || "static") === "static" && (e.style.position = "relative"), i;
|
|
43
|
+
}, b = y(l);
|
|
44
|
+
return new Promise((n) => {
|
|
45
|
+
let r = !1, a = null, o = d.createElement("div");
|
|
46
|
+
o.className = "fv-print-mask-layer", o.setAttribute("data-viewer-print-mask-designer", "true");
|
|
47
|
+
let g = (e, t) => {
|
|
48
|
+
let n = y(e), r = d.createElement("div");
|
|
49
|
+
return r.className = "fv-print-mask-canvas", e.appendChild(r), {
|
|
50
|
+
element: e,
|
|
51
|
+
pageIndex: t,
|
|
52
|
+
canvas: r,
|
|
53
|
+
previousPosition: n
|
|
54
|
+
};
|
|
55
|
+
}, x = v.map((e, t) => g(e, _ ? t : void 0)), S = _ && !x.some((e) => e.element === l) && (m.some((e) => e.pageIndex === void 0) || h.some((e) => e.pageIndex === void 0)) ? g(l) : null, C = S ? [...x, S] : x, w = d.createElement("div");
|
|
56
|
+
w.className = "fv-print-mask-toolbar", w.setAttribute("role", "toolbar"), w.setAttribute("aria-label", f("toolbar.printMaskTitle"));
|
|
57
|
+
let T = d.createElement("span");
|
|
58
|
+
T.textContent = f("toolbar.printMaskHint");
|
|
59
|
+
let E = d.createElement("button");
|
|
60
|
+
E.type = "button", E.textContent = f("toolbar.printMaskAdd");
|
|
61
|
+
let D = d.createElement("input");
|
|
62
|
+
D.type = "file", D.accept = "image/png,image/jpeg,image/webp,image/gif,image/svg+xml", D.className = "fv-print-stamp-input", D.setAttribute("data-viewer-print-stamp-input", "true");
|
|
63
|
+
let O = d.createElement("button");
|
|
64
|
+
O.type = "button", O.textContent = f("toolbar.printStampUpload");
|
|
65
|
+
let k = d.createElement("button");
|
|
66
|
+
k.type = "button", k.textContent = f("toolbar.printMaskClear");
|
|
67
|
+
let A = d.createElement("button");
|
|
68
|
+
A.type = "button", A.textContent = f("toolbar.printMaskCancel");
|
|
69
|
+
let j = d.createElement("button");
|
|
70
|
+
j.type = "button", j.className = "primary", j.textContent = f("toolbar.printMaskConfirm"), w.append(T, E, O, k, A, j), o.append(D, w), l.appendChild(o);
|
|
71
|
+
let M = () => {
|
|
72
|
+
x.forEach((e) => e.canvas.classList.remove("is-armed")), E.classList.remove("is-active");
|
|
73
|
+
}, N = (e) => {
|
|
74
|
+
r || (r = !0, o.remove(), C.forEach((e) => {
|
|
75
|
+
e.canvas.remove(), e.previousPosition ? e.element.style.position = e.previousPosition : e.element.style.removeProperty("position");
|
|
76
|
+
}), b ? l.style.position = b : l.style.removeProperty("position"), n(e));
|
|
77
|
+
}, P = (e) => e.pageIndex === void 0 ? S || x[0] : x.find((t) => t.pageIndex === e.pageIndex) || null, F = () => {
|
|
78
|
+
C.forEach((e) => e.canvas.replaceChildren()), m.forEach((e, t) => {
|
|
79
|
+
let n = P(e);
|
|
80
|
+
if (!n) return;
|
|
81
|
+
let r = d.createElement("div");
|
|
82
|
+
r.className = "fv-print-mask-block", r.style.left = `${e.left}%`, r.style.top = `${e.top}%`, r.style.width = `${e.width}%`, r.style.height = `${e.height}%`, r.style.background = p;
|
|
83
|
+
let i = d.createElement("button");
|
|
84
|
+
i.type = "button", i.className = "fv-print-mask-block-remove", i.title = f("toolbar.printMaskClear"), i.setAttribute("aria-label", f("toolbar.printMaskClear")), i.textContent = "−", i.addEventListener("click", (e) => {
|
|
85
|
+
e.preventDefault(), e.stopPropagation(), m.splice(t, 1), F();
|
|
86
|
+
}), r.appendChild(i), n.canvas.appendChild(r);
|
|
87
|
+
}), h.forEach((e, t) => {
|
|
88
|
+
let n = P(e);
|
|
89
|
+
if (!n) return;
|
|
90
|
+
let r = d.createElement("div");
|
|
91
|
+
r.className = "fv-print-stamp", r.setAttribute("data-viewer-print-stamp", String(t));
|
|
92
|
+
let i = () => {
|
|
93
|
+
var t, n;
|
|
94
|
+
r.style.left = `${e.left}%`, r.style.top = `${e.top}%`, r.style.width = `${e.width}%`, r.style.height = `${e.height}%`, r.style.opacity = String((t = e.opacity) == null ? 1 : t), r.style.transform = `rotate(${(n = e.rotate) == null ? 0 : n}deg)`;
|
|
95
|
+
};
|
|
96
|
+
i();
|
|
97
|
+
let a = d.createElement("img");
|
|
98
|
+
a.src = e.src, a.alt = e.alt || "", a.draggable = !1;
|
|
99
|
+
let o = d.createElement("button");
|
|
100
|
+
o.type = "button", o.className = "fv-print-mask-block-remove", o.title = f("toolbar.printStampRemove"), o.setAttribute("aria-label", f("toolbar.printStampRemove")), o.textContent = "−", o.addEventListener("pointerdown", (e) => e.stopPropagation()), o.addEventListener("click", (e) => {
|
|
101
|
+
e.preventDefault(), e.stopPropagation(), h.splice(t, 1), F();
|
|
102
|
+
});
|
|
103
|
+
let s = d.createElement("span");
|
|
104
|
+
s.className = "fv-print-stamp-resize", s.setAttribute("role", "button"), s.setAttribute("aria-label", f("toolbar.printStampResize")), s.title = f("toolbar.printStampResize");
|
|
105
|
+
let c = null;
|
|
106
|
+
r.addEventListener("pointerdown", (t) => {
|
|
107
|
+
var n;
|
|
108
|
+
t.button !== 0 || t.target.closest("button") || (t.preventDefault(), t.stopPropagation(), c = {
|
|
109
|
+
pointerId: t.pointerId,
|
|
110
|
+
mode: t.target === s ? "resize" : "move",
|
|
111
|
+
startX: t.clientX,
|
|
112
|
+
startY: t.clientY,
|
|
113
|
+
left: e.left,
|
|
114
|
+
top: e.top,
|
|
115
|
+
width: e.width,
|
|
116
|
+
height: e.height
|
|
117
|
+
}, (n = r.setPointerCapture) == null || n.call(r, t.pointerId));
|
|
118
|
+
}), r.addEventListener("pointermove", (t) => {
|
|
119
|
+
if (!c || c.pointerId !== t.pointerId) return;
|
|
120
|
+
t.preventDefault();
|
|
121
|
+
let r = n.canvas.getBoundingClientRect();
|
|
122
|
+
if (!r.width || !r.height) return;
|
|
123
|
+
let a = (t.clientX - c.startX) / r.width * 100, o = (t.clientY - c.startY) / r.height * 100;
|
|
124
|
+
c.mode === "move" ? (e.left = Math.max(0, Math.min(100 - e.width, c.left + a)), e.top = Math.max(0, Math.min(100 - e.height, c.top + o))) : (e.width = Math.max(4, Math.min(100 - e.left, c.width + a)), e.height = Math.max(4, Math.min(100 - e.top, c.height + o))), i();
|
|
125
|
+
});
|
|
126
|
+
let l = (e) => {
|
|
127
|
+
var t;
|
|
128
|
+
if (!(!c || c.pointerId !== e.pointerId)) {
|
|
129
|
+
try {
|
|
130
|
+
(t = r.releasePointerCapture) == null || t.call(r, c.pointerId);
|
|
131
|
+
} catch (e) {}
|
|
132
|
+
c = null;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
r.addEventListener("pointerup", l), r.addEventListener("pointercancel", l), r.append(a, o, s), n.canvas.appendChild(r);
|
|
136
|
+
});
|
|
137
|
+
}, I = (e, t) => {
|
|
138
|
+
let n = t.getBoundingClientRect();
|
|
139
|
+
return {
|
|
140
|
+
x: Math.max(0, Math.min(n.width, e.clientX - n.left)),
|
|
141
|
+
y: Math.max(0, Math.min(n.height, e.clientY - n.top))
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
x.forEach((e) => {
|
|
145
|
+
e.canvas.addEventListener("pointerdown", (t) => {
|
|
146
|
+
if (t.button !== 0 || !e.canvas.classList.contains("is-armed")) return;
|
|
147
|
+
t.preventDefault();
|
|
148
|
+
let n = I(t, e.canvas), r = d.createElement("div");
|
|
149
|
+
r.className = "fv-print-mask-block", r.style.background = p, r.style.opacity = "0.72", e.canvas.appendChild(r), a = {
|
|
150
|
+
surface: e,
|
|
151
|
+
start: n,
|
|
152
|
+
preview: r,
|
|
153
|
+
pointerId: t.pointerId
|
|
154
|
+
}, e.canvas.setPointerCapture(t.pointerId);
|
|
155
|
+
}), e.canvas.addEventListener("pointermove", (t) => {
|
|
156
|
+
if (!a || a.surface !== e) return;
|
|
157
|
+
let n = I(t, e.canvas), r = Math.min(a.start.x, n.x), i = Math.min(a.start.y, n.y);
|
|
158
|
+
a.preview.style.left = `${r}px`, a.preview.style.top = `${i}px`, a.preview.style.width = `${Math.abs(n.x - a.start.x)}px`, a.preview.style.height = `${Math.abs(n.y - a.start.y)}px`;
|
|
159
|
+
}), e.canvas.addEventListener("pointerup", (t) => {
|
|
160
|
+
if (!a || a.surface !== e) return;
|
|
161
|
+
let n = I(t, e.canvas), r = s(a.start, n, e.canvas.getBoundingClientRect(), e.pageIndex);
|
|
162
|
+
a.preview.remove();
|
|
163
|
+
try {
|
|
164
|
+
e.canvas.releasePointerCapture(a.pointerId);
|
|
165
|
+
} catch (e) {}
|
|
166
|
+
a = null, M(), r && m.push(r), F();
|
|
167
|
+
}), e.canvas.addEventListener("pointercancel", () => {
|
|
168
|
+
!a || a.surface !== e || (a.preview.remove(), a = null, M(), F());
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
let L = () => {
|
|
172
|
+
var e;
|
|
173
|
+
let t = l.getBoundingClientRect();
|
|
174
|
+
return ((e = x.map((e) => ({
|
|
175
|
+
surface: e,
|
|
176
|
+
area: c(e.element, t)
|
|
177
|
+
})).sort((e, t) => t.area - e.area)[0]) == null ? void 0 : e.surface) || x[0];
|
|
178
|
+
};
|
|
179
|
+
E.addEventListener("click", () => {
|
|
180
|
+
M();
|
|
181
|
+
let e = L();
|
|
182
|
+
e == null || e.canvas.classList.add("is-armed"), E.classList.toggle("is-active", !!e);
|
|
183
|
+
}), O.addEventListener("click", () => {
|
|
184
|
+
M(), D.click();
|
|
185
|
+
}), D.addEventListener("change", e(function* () {
|
|
186
|
+
var e;
|
|
187
|
+
let t = (e = D.files) == null ? void 0 : e[0];
|
|
188
|
+
if (D.value = "", t) try {
|
|
189
|
+
let e = yield u(t, d.defaultView), n = L();
|
|
190
|
+
if (!n) return;
|
|
191
|
+
let r = i({
|
|
192
|
+
src: e,
|
|
193
|
+
alt: t.name,
|
|
194
|
+
left: 38,
|
|
195
|
+
top: 38,
|
|
196
|
+
width: 24,
|
|
197
|
+
height: 18,
|
|
198
|
+
pageIndex: n.pageIndex
|
|
199
|
+
});
|
|
200
|
+
r && (h.push(r), F());
|
|
201
|
+
} catch (e) {}
|
|
202
|
+
})), k.addEventListener("click", () => {
|
|
203
|
+
m.splice(0, m.length), h.splice(0, h.length), M(), F();
|
|
204
|
+
}), A.addEventListener("click", () => N(null)), j.addEventListener("click", () => {
|
|
205
|
+
if (!m.length && !h.length) {
|
|
206
|
+
N(null);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
N({ mask: t(t(t({}, m.length ? { regions: m.map((e) => t({}, e)) } : {}), h.length ? { stamps: h.map((e) => t({}, e)) } : {}), {}, { color: p }) });
|
|
210
|
+
}), F();
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
//#endregion
|
|
214
|
+
export { d as openFileViewerPrintMaskDesigner };
|
|
@@ -1 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as e } from "./objectSpread2.js";
|
|
2
|
+
//#region ../../core/dist/features/printMask.js
|
|
3
|
+
var t = (e) => Math.max(0, Math.min(100, e)), n = (e) => {
|
|
4
|
+
if (typeof e != "string") return "#000000";
|
|
5
|
+
let t = e.trim();
|
|
6
|
+
return /^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t) || /^[a-z]{1,32}$/i.test(t) || /^(?:rgb|rgba|hsl|hsla)\([0-9.,%+\- /]+\)$/i.test(t) ? t : "#000000";
|
|
7
|
+
}, r = (n) => {
|
|
8
|
+
if (!n) return null;
|
|
9
|
+
let r = n.pageIndex;
|
|
10
|
+
if (r !== void 0 && (!Number.isInteger(r) || r < 0)) return null;
|
|
11
|
+
let i = t(Number(n.left) || 0), a = t(Number(n.top) || 0), o = t(Number(n.width) || 0), s = t(Number(n.height) || 0);
|
|
12
|
+
return o <= 0 || s <= 0 ? null : e({
|
|
13
|
+
left: i,
|
|
14
|
+
top: a,
|
|
15
|
+
width: Math.min(o, 100 - i),
|
|
16
|
+
height: Math.min(s, 100 - a)
|
|
17
|
+
}, r === void 0 ? {} : { pageIndex: r });
|
|
18
|
+
}, i = (e) => {
|
|
19
|
+
if (typeof e != "string") return "";
|
|
20
|
+
let t = e.trim();
|
|
21
|
+
return /^data:image\/(?:png|jpe?g|webp|gif|svg\+xml);/i.test(t) || /^(?:blob:|https?:\/\/|\/|\.\.?\/)/i.test(t) ? t : "";
|
|
22
|
+
}, a = (e) => {
|
|
23
|
+
let t = Number(e);
|
|
24
|
+
return Number.isFinite(t) ? Math.max(0, Math.min(1, t)) : 1;
|
|
25
|
+
}, o = (e) => {
|
|
26
|
+
let t = Number(e);
|
|
27
|
+
return Number.isFinite(t) ? (t % 360 + 360) % 360 : 0;
|
|
28
|
+
}, s = (t) => {
|
|
29
|
+
let n = r(t), s = i(t == null ? void 0 : t.src);
|
|
30
|
+
return !n || !s ? null : e(e({}, n), {}, {
|
|
31
|
+
src: s,
|
|
32
|
+
opacity: a(t == null ? void 0 : t.opacity),
|
|
33
|
+
rotate: o(t == null ? void 0 : t.rotate)
|
|
34
|
+
}, typeof (t == null ? void 0 : t.alt) == "string" && t.alt.trim() ? { alt: t.alt.trim() } : {});
|
|
35
|
+
}, c = (t) => {
|
|
36
|
+
if (!t) return null;
|
|
37
|
+
let i = (t.regions || []).map((e) => r(e)).filter((e) => !!e), a = (t.stamps || []).map((e) => s(e)).filter((e) => !!e);
|
|
38
|
+
return !i.length && !a.length ? null : e(e(e({}, i.length ? { regions: i } : {}), a.length ? { stamps: a } : {}), {}, { color: n(t.color) });
|
|
39
|
+
}, l = (e) => e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), u = (e, t = !1) => {
|
|
40
|
+
let n = c(e);
|
|
41
|
+
if (!n) return "";
|
|
42
|
+
let r = n.color || "#000000", i = (n.regions || []).map((e) => `<div class="viewer-export-print-mask-block" style="left:${e.left}%;top:${e.top}%;width:${e.width}%;height:${e.height}%;background:${r};"></div>`).join(""), a = (n.stamps || []).map((e) => {
|
|
43
|
+
var t, n;
|
|
44
|
+
return `<img class="viewer-export-print-stamp" src="${l(e.src)}" alt="${l(e.alt || "")}" draggable="false" style="left:${e.left}%;top:${e.top}%;width:${e.width}%;height:${e.height}%;opacity:${(t = e.opacity) == null ? 1 : t};transform:rotate(${(n = e.rotate) == null ? 0 : n}deg);" />`;
|
|
45
|
+
}).join("");
|
|
46
|
+
return `<div class="${t ? "viewer-export-print-mask viewer-export-print-mask--page" : "viewer-export-print-mask"}" aria-hidden="true">${i}${a}</div>`;
|
|
47
|
+
}, d = "\n .viewer-export-print-mask{position:absolute;inset:0;z-index:15;pointer-events:none;print-color-adjust:exact;-webkit-print-color-adjust:exact;}\n .viewer-export-print-mask--page{z-index:2147483647;}\n .viewer-export-print-mask-block{position:absolute;box-sizing:border-box;print-color-adjust:exact;-webkit-print-color-adjust:exact;}\n .viewer-export-print-stamp{position:absolute;display:block;object-fit:contain;transform-origin:center center;print-color-adjust:exact;-webkit-print-color-adjust:exact;}\n [data-viewer-print-page-index]{position:relative!important;isolation:isolate;}\n", f = (e) => e === " " || e === " " || e === "\n" || e === "\r" || e === "\f", p = (e) => {
|
|
48
|
+
let t = e.charCodeAt(0);
|
|
49
|
+
return t >= 65 && t <= 90 || t >= 97 && t <= 122;
|
|
50
|
+
}, m = (e, t) => {
|
|
51
|
+
let n = "";
|
|
52
|
+
for (let r = t + 1; r < e.length; r += 1) {
|
|
53
|
+
let t = e[r];
|
|
54
|
+
if (n) {
|
|
55
|
+
t === n && (n = "");
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (t === "\"" || t === "'") n = t;
|
|
59
|
+
else if (t === ">") return r;
|
|
60
|
+
}
|
|
61
|
+
return -1;
|
|
62
|
+
}, h = (e) => {
|
|
63
|
+
if (!e) return null;
|
|
64
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
65
|
+
let n = e.charCodeAt(t);
|
|
66
|
+
if (n < 48 || n > 57) return null;
|
|
67
|
+
}
|
|
68
|
+
let t = Number(e);
|
|
69
|
+
return Number.isSafeInteger(t) ? t : null;
|
|
70
|
+
}, g = (e, t, n) => {
|
|
71
|
+
let r = t + 1;
|
|
72
|
+
for (; r < n && !f(e[r]) && e[r] !== "/" && e[r] !== ">";) r += 1;
|
|
73
|
+
for (; r < n;) {
|
|
74
|
+
for (; r < n && f(e[r]);) r += 1;
|
|
75
|
+
if (r >= n || e[r] === "/" || e[r] === ">") return null;
|
|
76
|
+
let t = r;
|
|
77
|
+
for (; r < n && !f(e[r]) && e[r] !== "=" && e[r] !== "/" && e[r] !== ">";) r += 1;
|
|
78
|
+
let i = e.slice(t, r).toLowerCase();
|
|
79
|
+
for (; r < n && f(e[r]);) r += 1;
|
|
80
|
+
if (e[r] !== "=") continue;
|
|
81
|
+
for (r += 1; r < n && f(e[r]);) r += 1;
|
|
82
|
+
let a = e[r];
|
|
83
|
+
if (a !== "\"" && a !== "'") {
|
|
84
|
+
for (; r < n && !f(e[r]) && e[r] !== ">";) r += 1;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
r += 1;
|
|
88
|
+
let o = r;
|
|
89
|
+
for (; r < n && e[r] !== a;) r += 1;
|
|
90
|
+
if (r >= n) return null;
|
|
91
|
+
let s = e.slice(o, r);
|
|
92
|
+
if (r += 1, i === "data-viewer-print-page-index") return h(s);
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}, _ = (e, t) => {
|
|
96
|
+
var n, r;
|
|
97
|
+
let i = c(t);
|
|
98
|
+
if (!i) return e;
|
|
99
|
+
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
100
|
+
if ((n = i.regions) == null || n.forEach((e) => {
|
|
101
|
+
if (e.pageIndex === void 0) return;
|
|
102
|
+
let t = a.get(e.pageIndex) || [];
|
|
103
|
+
t.push(e), a.set(e.pageIndex, t);
|
|
104
|
+
}), (r = i.stamps) == null || r.forEach((e) => {
|
|
105
|
+
if (e.pageIndex === void 0) return;
|
|
106
|
+
let t = o.get(e.pageIndex) || [];
|
|
107
|
+
t.push(e), o.set(e.pageIndex, t);
|
|
108
|
+
}), !a.size && !o.size) return e;
|
|
109
|
+
let s = [], l = 0, d = 0;
|
|
110
|
+
for (; d < e.length;) {
|
|
111
|
+
let t = e.indexOf("<", d);
|
|
112
|
+
if (t < 0) break;
|
|
113
|
+
if (!p(e[t + 1] || "")) {
|
|
114
|
+
d = t + 1;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
let n = m(e, t);
|
|
118
|
+
if (n < 0) break;
|
|
119
|
+
let r = g(e, t, n), c = r === null ? void 0 : a.get(r), f = r === null ? void 0 : o.get(r);
|
|
120
|
+
(c != null && c.length || f != null && f.length) && (s.push(e.slice(l, n + 1), u({
|
|
121
|
+
regions: c || [],
|
|
122
|
+
stamps: f || [],
|
|
123
|
+
color: i.color
|
|
124
|
+
}, !0)), l = n + 1), d = n + 1;
|
|
125
|
+
}
|
|
126
|
+
return s.length ? (s.push(e.slice(l)), s.join("")) : e;
|
|
127
|
+
};
|
|
128
|
+
//#endregion
|
|
129
|
+
export { r as a, c as i, _ as n, s as o, u as r, d as t };
|