@file-viewer/vue3 3.0.2 → 3.1.0
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 +4 -3
- package/README.md +4 -3
- 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 +8011 -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 +5 -5
- package/dist/components/asyncToGenerator.js +0 -1
package/dist/components/fit.js
CHANGED
|
@@ -1 +1,486 @@
|
|
|
1
|
-
const aD=a1;(function(a3,a4){const az=a1,a5=a3();while(!![]){try{const a6=parseInt(az(0x114))/0x1*(parseInt(az(0x124))/0x2)+parseInt(az(0x12c))/0x3+-parseInt(az(0x118))/0x4+parseInt(az(0x137))/0x5+parseInt(az(0x115))/0x6+parseInt(az(0x12d))/0x7*(parseInt(az(0x101))/0x8)+parseInt(az(0x129))/0x9*(-parseInt(az(0x108))/0xa);if(a6===a4)break;else a5['push'](a5['shift']());}catch(a7){a5['push'](a5['shift']());}}}(a0,0x979ca));import{n as a2,t}from'./asyncToGenerator.js';var n=(a3={})=>{const aA=a1;var a4,a5,a6;let a7=Number['isFinite'](a3['scale'])&&a3['scale']?Number(a3['scale']):0x1;return{'scale':a7,'label':a3[aA(0x106)]||Math['round'](a7*0x64)+'%','canZoomIn':(a4=a3['canZoomIn'])!=null&&a4,'canZoomOut':(a5=a3['canZoomOut'])!=null&&a5,'canReset':(a6=a3[aA(0x104)])!=null&&a6,'minScale':a3[aA(0x13e)],'maxScale':a3[aA(0x10e)]};},r=a3=>a3===!0x1?{'enabled':!0x1}:a3===!0x0||a3===void 0x0?{}:a3,i=(a3='')=>({'query':a3,'total':0x0,'currentIndex':-0x1,'current':null,'matches':[]}),a=a3=>a3===!0x1?{'enabled':!0x1,'collectText':!0x1}:a3===!0x0||a3===void 0x0?{}:a3,o=(a3,a4)=>{const aB=a1;var a5;let a6=a(a4);if(a6['enabled']===!0x1||a6[aB(0x107)]===!0x1)return[];let a7=Math['max'](0xc8,a6['chunkSize']||0x4b0),a8=Math['max'](0x0,Math['min'](a7-0x1,(a5=a6[aB(0x11f)])==null?0xa0:a5)),a9=Math['max'](0x0,a6[aB(0x139)]||0x0),aa=[];return a3['forEach'](ab=>{const aC=aB;let ac=a9?ab['text']['slice'](0x0,a9):ab['text'];if(!ac)return;if(ac['length']<=a7){aa['push']({'id':ab['id']+aC(0x10d),'text':ac,'anchor':ab,'startLine':ab[aC(0x120)],'endLine':ab['line']});return;}let ad=0x0,ae=0x1;for(;ad<ac['length'];){let af=ac['slice'](ad,ad+a7);if(aa['push']({'id':ab['id']+'-chunk-'+ae,'text':af,'anchor':ab,'startLine':ab['line'],'endLine':ab['line']}),ad+a7>=ac['length'])break;ad+=a7-a8,ae+=0x1;}}),aa;},s='[data-viewer-anchor-id],.pdfViewer\x20.page,.docx-wrapper\x20section,.docx\x20p,.docx\x20li,.docx\x20table,.markdown-body\x20h1,.markdown-body\x20h2,.markdown-body\x20h3,.markdown-body\x20h4,.markdown-body\x20h5,.markdown-body\x20h6,.markdown-body\x20p,.markdown-body\x20li,.markdown-body\x20pre,.markdown-body\x20table,article\x20h1,article\x20h2,article\x20h3,article\x20h4,article\x20h5,article\x20h6,article\x20p,article\x20li,article\x20pre,article\x20table,pre\x20code,p,li,tr,h1,h2,h3,h4,h5,h6,pre,table'['split'](',')['join'](','),c=['.viewer-actions','.viewer-watermark','.state-panel','.pdf-toolbar','.pdf-nav-pane','.flyfish-search-match']['join'](','),l=a3=>typeof CSS<'u'&&typeof CSS['escape']==aD(0x11e)?CSS['escape'](a3):a3['replace'](/["\\]/g,'\x5c$&'),u=(a3,a4=0xa0)=>{let a5=a3['replace'](/\s+/g,'\x20')['trim']();return a5['length']>a4?a5['slice'](0x0,a4-0x1)+'…':a5;},d=a3=>{let a4=a3['getBoundingClientRect']();return a4['width']>0x0||a4['height']>0x0;},f=a3=>!!a3['closest'](c),p=a3=>{const aE=aD;let a4=a3['closest']('[data-page-number],\x20[data-page]'),a5=(a4==null?void 0x0:a4[aE(0x125)]['pageNumber'])||(a4==null?void 0x0:a4['dataset']['page']),a6=a5?Number['parseInt'](a5,0xa):NaN;return Number['isFinite'](a6)?a6:void 0x0;},m=a3=>a3[aD(0x117)]('.pdfViewer\x20.page,\x20[data-page-number],\x20[data-page]')?'page':a3['matches']('p,\x20li,\x20tr,\x20pre,\x20code')?'line':'block',h=(a3,a4)=>{const aF=aD;let a5=a3['parentElement'];for(;a5;){if(a4['has'](a5))return!0x0;a5=a5[aF(0x10c)];}return!0x1;},g=a3=>{const aG=aD;if(!a3)return[];let a4=a3['getBoundingClientRect'](),a5=new Set(),a6=[];return Array[aG(0x111)](a3['querySelectorAll'](s))['forEach'](a7=>{const aH=aG;if(f(a7)||!d(a7))return;let a8=u(a7[aH(0x112)]||'',0x3e8);if(!a8||h(a7,a5)&&!a7['matches']('p,\x20li,\x20tr,\x20pre,\x20code'))return;a5['add'](a7);let a9=a7['dataset']['viewerAnchorId']||aH(0x10f)+(a6['length']+0x1);a7['dataset']['viewerAnchorId']=a9,a7['dataset']['viewerLine']=String(a6[aH(0x131)]+0x1);let aa=a7[aH(0x11c)]();a6['push']({'id':a9,'index':a6['length'],'line':a6[aH(0x131)]+0x1,'type':m(a7),'label':u(a8,0x60),'text':a8,'page':p(a7),'top':aa['top']-a4['top']+a3['scrollTop'],'left':aa['left']-a4['left']+a3['scrollLeft'],'width':aa['width'],'height':aa['height']});}),a6;},_=(a3,a4,a5)=>{const aI=aD;if(!a3)return null;let a6=a3['closest']('[data-viewer-anchor-id]');if(a6!=null&&a6['dataset']['viewerAnchorId']){let aa=a4['find'](ab=>ab['id']===a6[aI(0x125)]['viewerAnchorId']);if(aa)return aa;}if(!a5)return null;let a7=a5['getBoundingClientRect'](),a8=a3['getBoundingClientRect']()['top']-a7['top']+a5['scrollTop'],a9=null;for(let ab of a4){if(ab['top']<=a8+0x1){a9=ab;continue;}break;}return a9;},v=(a3,a4)=>{const aJ=aD;if(!a3||!a4['length'])return null;let a5=a3['scrollTop']+a3['clientHeight']*0.42,a6=a4[0x0];for(let a7 of a4){if(a7[aJ(0x133)]<=a5){a6=a7;continue;}break;}return a6;},y=(a3,a4)=>{const aK=aD;if(!a3||a4==null)return!0x1;let a5=typeof a4=='object'?aK(0x121)+l(a4['id'])+'\x22]':typeof a4==aK(0x12e)?'[data-viewer-line=\x22'+a4+'\x22]':'[data-viewer-anchor-id=\x22'+l(a4)+'\x22]',a6=a3[aK(0x135)](a5);return a6?(a6['scrollIntoView']({'block':'center','inline':'nearest'}),!0x0):typeof a4==aK(0x13a)&&(a3['scrollTo']({'top':Math['max'](0x0,a4['top']-a3[aK(0x11a)]*0.18),'left':Math['max'](0x0,Math['min'](a4['left'],a3['scrollWidth']-a3['clientWidth'])),'behavior':'smooth'}),!0x0);},b=new WeakMap(),x=new WeakMap(),S=new WeakMap(),C=a3=>!!a3&&a3['nodeType']===0x1,w=(a3,a4)=>{const aL=aD;if(!(a3!=null&&a3[aL(0x110)]))return[];let a5=Array[aL(0x111)](a3['querySelectorAll'](a4));C(a3)&&a3['shadowRoot']&&a5['push'](...w(a3['shadowRoot'],a4));let a6=Array['from'](a3['querySelectorAll']('*'));for(let a7 of a6)a7['shadowRoot']&&a5[aL(0x128)](...w(a7['shadowRoot'],a4));return a5;},T=a3=>{const aM=aD;if(!a3)return null;let a4=C(a3)?b[aM(0x13f)](a3)||a3['__flyfishViewerSearchProvider']:null;if(a4)return a4;let a5=w(a3,aM(0x13c))[0x0];return a5&&(b['get'](a5)||a5['__flyfishViewerSearchProvider'])||null;},E=(a3,a4)=>{x['set'](a3,a4),a3['dataset']['viewerZoomProvider']=a3['dataset']['viewerZoomProvider']||'custom',a3['__flyfishViewerZoomProvider']=a4;},D=a3=>{a3&&(x['delete'](a3),delete a3['dataset']['viewerZoomProvider'],delete a3['__flyfishViewerZoomProvider']);},O=a3=>{const aN=aD;if(!a3)return null;let a4=C(a3)?x['get'](a3)||a3['__flyfishViewerZoomProvider']:null;if(a4)return a4;let a5=w(a3,aN(0x116))[0x0];return a5&&(x['get'](a5)||a5['__flyfishViewerZoomProvider'])||null;},k=(a3,a4)=>{S['set'](a3,a4),a3['dataset']['viewerViewStateProvider']=a3['dataset']['viewerViewStateProvider']||'custom',a3['__flyfishViewerViewStateProvider']=a4;},A=a3=>{const aO=aD;a3&&(S['delete'](a3),delete a3['dataset'][aO(0x109)],delete a3['__flyfishViewerViewStateProvider']);},j=a3=>{const aP=aD;if(!a3)return null;let a4=C(a3)?S[aP(0x13f)](a3)||a3['__flyfishViewerViewStateProvider']:null;if(a4&&(!C(a3)||a3[aP(0x125)]['viewerViewStateProvider']!==aP(0x130)))return a4;let a5=w(a3,'[data-viewer-view-state-provider]'),a6=a5['find'](a9=>a9['dataset']['viewerViewStateProvider']!=='generic'),a7=a5['find'](a9=>a9[aP(0x125)]['viewerViewStateProvider']==='generic'),a8=a6||a7;return a8?S['get'](a8)||a8['__flyfishViewerViewStateProvider']||null:a4||null;},M=a3=>({'scale':a3['scale'],'label':a3['label'],'canZoomIn':a3['canZoomIn'],'canZoomOut':a3['canZoomOut'],'canReset':a3['canReset'],'minScale':a3['minScale'],'maxScale':a3[aD(0x10e)]}),N=(a3,a4)=>{const aQ=aD;let a5=n(a4||{});return a3['scale']=a5['scale'],a3[aQ(0x106)]=a5['label'],a3['canZoomIn']=a5['canZoomIn'],a3[aQ(0x126)]=a5['canZoomOut'],a3['canReset']=a5['canReset'],a3['minScale']=a5[aQ(0x13e)],a3['maxScale']=a5['maxScale'],a3;},P=a3=>M(a3);(function(){var a3=t(function*(a4,a5){return N(a4,yield a5()),P(a4);});return function(a4,a5){const aR=a1;return a3[aR(0x136)](this,arguments);};}());var F=()=>{let a3=new Set();return{'emit'(){a3['forEach'](a4=>a4());},'subscribe'(a4){return a3['add'](a4),()=>{a3['delete'](a4);};},'clear'(){a3['clear']();}};},I=a3=>{var a4,a5;return((a5=(a4=a3==null?void 0x0:a3['ownerDocument'])==null?void 0x0:a4['defaultView'])==null?void 0x0:a5['MutationObserver'])||(typeof MutationObserver<'u'?MutationObserver:void 0x0);},L=({root:a3,enabled:a4,beforeZoom:a5,onChange:a6})=>{const aU=aD;let a7=null,a8=null,a9=null,aa=!0x1,ab=n(),ac=()=>{a6==null||a6(M(ab));},ad=()=>{a8==null||a8(),a8=null,a7=null,N(ab,null);},ae=()=>{var ah,ai;if((a4==null?void 0x0:a4())===!0x1)return ad(),null;let aj=O(a3());return aj!==a7&&(a8==null||a8(),a7=aj,a8=((ah=aj==null?void 0x0:aj['subscribe'])==null?void 0x0:ah['call'](aj,()=>{N(ab,aj['getState']()),aa||ac();}))||null),N(ab,((ai=aj==null?void 0x0:aj['getState'])==null?void 0x0:ai['call'](aj))||null),aj;},af=()=>{a9==null||a9['disconnect'](),a9=null;},ag=(function(){var ah=t(function*(ai,aj){const aS=a1;let ak=ae();if(!ak||a5&&(yield a5(ai))===!0x1)return M(ab);aa=!0x0;try{let al=yield aj(ak);return N(ab,al||ak[aS(0x100)]()),M(ab);}finally{aa=!0x1;}});return function(ai,aj){return ah['apply'](this,arguments);};}());return{get 'provider'(){return a7;},'state':ab,'hasProvider'(){return!!ae();},'refreshProvider':ae,'observe'(){const aT=a1;af();let ah=a3(),ai=I(ah);if(!ah||!ai){ae();return;}a9=new ai(()=>{ae();}),a9[aT(0x12b)](ah,{'childList':!0x0,'subtree':!0x0}),ae();},'clearProvider':ad,'getState'(){return M(ab);},'zoomIn':()=>ag('zoom-in',ah=>ah['zoomIn']()),'zoomOut':()=>ag(aU(0x119),ah=>ah[aU(0xff)]()),'resetZoom':()=>ag('zoom-reset',ah=>ah['resetZoom']()),'destroy'(){af(),ad();}};},R=['auto','contain',aD(0x123),aD(0x10a),'height','actual','scale-down'],z=['until-interaction',aD(0x103),aD(0x132)],B='until-interaction',V=0x0,H=0x8,U=a3=>!!a3&&typeof a3==aD(0x13a)&&!Array[aD(0x105)](a3),W=a3=>typeof a3=='string'&&R['includes'](a3),G=a3=>typeof a3=='string'&&z['includes'](a3),K=a3=>{let a4=Number(a3);return Number['isFinite'](a4)&&a4>0x0?a4:void 0x0;},q=a3=>{let a4=Number(a3);return Number['isFinite'](a4)&&a4>0x0?a4:V;},J=a3=>{if(a3==null||a3===!0x1)return null;if(W(a3))return{'mode':a3,'resize':B,'padding':V};if(!U(a3))return null;let a4=K(a3['minScale']),a5=K(a3['maxScale']),a6=a4!==void 0x0&&a5!==void 0x0&&a5<a4?a4:a5;return{'mode':W(a3['mode'])?a3['mode']:'auto','resize':G(a3['resize'])?a3['resize']:B,'padding':q(a3['padding']),'minScale':a4,'maxScale':a6};},Y=(a3,a4,a5)=>{const aV=aD;let a6=a3;return Number['isFinite'](a4)&&(a6=Math[aV(0x113)](Number(a4),a6)),Number['isFinite'](a5)&&(a6=Math['min'](Number(a5),a6)),a6;},X=({mode:a3,viewportWidth:a4,viewportHeight:a5,contentWidth:a6,contentHeight:a7,minScale:a8,maxScale:a9})=>{const aX=aD;if(a4<=0x0||a5<=0x0||a6<=0x0||a7<=0x0)return;let aa=a4/a6,ab=a5/a7,ac=Math['min'](aa,ab),ad=Math['max'](aa,ab),ae=((()=>{const aW=a1;switch(a3){case aW(0x123):return ad;case'width':return aa;case'height':return ab;case'actual':return 0x1;case'scale-down':return Math['min'](0x1,ac);default:return ac;}})());if(!(!Number[aX(0xfe)](ae)||ae<=0x0))return Y(ae,a8,a9);},Z=a3=>{const aY=aD;var a4,a5;if(!a3)return!0x1;let a6=Number((a4=a3['scale'])==null?(a5=a3['zoom'])==null?void 0x0:a5['scale']:a4);if(Number['isFinite'](a6)&&a6>0x0||Number['isFinite'](a3[aY(0x138)])||Number['isFinite'](a3['rotation'])||a3['navigation']&&Object['keys'](a3['navigation'])['length']>0x0||a3['extra']&&Object['keys'](a3['extra'])[aY(0x131)]>0x0)return!0x0;let a7=a3['scroll']||{};return['top','left','topRatio','leftRatio']['some'](a8=>{const aZ=aY;let a9=a7[a8];return Number[aZ(0xfe)](a9);});},Q=(a3,a4,a5='viewer',a6='none')=>({'applied':!0x1,'mode':a3[aD(0x122)],'resize':a3['resize'],'source':a5,'reason':a4,'provider':a6}),$=(a3,a4,a5)=>({'applied':!!(a3!=null&&a3['applied']),'mode':(a3==null?void 0x0:a3['mode'])||a4['mode'],'resize':(a3==null?void 0x0:a3['resize'])||a4[aD(0x127)],'scale':a3==null?void 0x0:a3['scale'],'source':(a3==null?void 0x0:a3['source'])||a4[aD(0x12a)],'reason':a3==null?void 0x0:a3[aD(0x10b)],'provider':(a3==null?void 0x0:a3['provider'])||a5,'state':a3==null?void 0x0:a3[aD(0x13d)]}),ee=a3=>a3==='pending'||a3==='retry'||a3==='image-not-ready'||a3==='unmeasurable',te=a3=>{const b0=aD;var a4;let a5=(a4=a3[b0(0x11c)])==null?void 0x0:a4['call'](a3);return{'width':Math['max'](0x0,(a5==null?void 0x0:a5['width'])||a3['clientWidth']||0x0),'height':Math['max'](0x0,(a5==null?void 0x0:a5['height'])||a3['clientHeight']||0x0)};},ne=({root:a3,enabled:a4,getFit:a5=()=>void 0x0,onFit:a6})=>{let a7=null,a8=null,a9=null,aa=!0x1,ab=0x0,ac=()=>{const b1=a1;var ak;let al=a3();return((ak=al==null?void 0x0:al[b1(0x12f)])==null?void 0x0:ak['defaultView'])||(typeof window<'u'?window:void 0x0);},ad=()=>{if(a8===null)return;let ak=ac();ak!=null&&ak['cancelAnimationFrame']&&ak['cancelAnimationFrame'](a8),a8=null;},ae=()=>{a9&&clearTimeout(a9),a9=null;},af=(ak,al)=>{let am=ak===void 0x0?a5():ak;return am==null?al==='api'?J('auto'):null:J(am);},ag=(ak,al,am)=>{ab>=H||(ae(),ab+=0x1,a9=setTimeout(()=>{a9=null,ah(ak,{'source':al,'reason':am==='api'?'api':'retry'});},0x20*ab));},ah=(function(){var ak=t(function*(al,am={}){const b2=a1;let an=am[b2(0x12a)]||'api',ao=am['reason']||'api',ap=af(al,ao);if(!ap)return{'applied':!0x1,'mode':'auto','resize':B,'source':an,'reason':'not-configured','provider':'none'};if((a4==null?void 0x0:a4())===!0x1)return Q(ap,'disabled',an);let aq=a3();if(!aq)return ag(al,an,ao),Q(ap,'no-root',an);let ar=te(aq);if(ar['width']<=0x0||ar['height']<=0x0)return ag(al,an,ao),Q(ap,'zero-size',an);let as=a2(a2({},ap),{},{'source':an,'reason':ao,'viewportWidth':Math['max'](0x0,ar['width']-ap['padding']*0x2),'viewportHeight':Math[b2(0x113)](0x0,ar['height']-ap['padding']*0x2),'container':aq}),at=j(aq),au=null;if(at!=null&&at['fit']){let ax=$(yield at['fit'](as),as,b2(0x134));if(ax['applied'])return ab=0x0,a6==null||a6(ax),ax;au=ax;}let av=O(aq);if(av!=null&&av['fit']){let ay=$(yield av['fit'](as),as,'zoom');if(ay['applied'])return ab=0x0,a6==null||a6(ay),ay;au=ay;}let aw=Q(ap,at||av?b2(0x13b):'no-provider',an);return(aw[b2(0x10b)]==='no-provider'||ee(au==null?void 0x0:au[b2(0x10b)]))&&ag(al,an,ao),aw;});return function(al){return ak['apply'](this,arguments);};}()),ai=(ak='resize')=>{const b4=a1;let al=J(a5());if(!al||al['resize']==='initial'||al['resize']==='until-interaction'&&aa)return;ad();let am=ac(),an=()=>{const b3=a1;a8=null,ah(void 0x0,{'source':b3(0x11b),'reason':ak});};if(am!=null&&am[b4(0x11d)]){a8=am['requestAnimationFrame'](an);return;}a8=setTimeout(an,0x10);},aj=()=>{ad(),a7==null||a7['disconnect'](),a7=null;};return{'normalize':J,'fit':(function(){var ak=t(function*(al,am){const b5=a1;return ae(),aa=!0x1,ah(al,{'source':(am==null?void 0x0:am[b5(0x12a)])||'api','reason':(am==null?void 0x0:am['reason'])||'api'});});return function(al,am){const b6=a1;return ak[b6(0x136)](this,arguments);};}()),'applyInitialFit':(function(){var ak=t(function*(al={}){const b7=a1;return ae(),ab=0x0,aa=!0x1,al['skip']?Q(J(a5())||J('auto'),'initial-view-state',b7(0x132)):ah(void 0x0,{'source':'initial','reason':b7(0x132)});});return function(){return ak['apply'](this,arguments);};}()),'scheduleFit':ai,'observe'(){const b8=a1;var ak,al;aj();let am=a3(),an=((al=(ak=am==null?void 0x0:am[b8(0x12f)])==null?void 0x0:ak['defaultView'])==null?void 0x0:al[b8(0x102)])||(typeof ResizeObserver<'u'?ResizeObserver:void 0x0);!am||!an||(a7=new an(()=>ai('resize')),a7['observe'](am));},'markUserInteraction'(){aa=!0x0,ae();},'resetAutoFit'(){aa=!0x1,ab=0x0;},'destroy'(){aj(),ae(),ab=0x0;}};};function a1(a,b){a=a-0xfe;const c=a0();let d=c[a];return d;}function a0(){const b9=['generic','length','initial','top','view-state','querySelector','apply','4714275yqOuCd','page','maxTextLength','object','unsupported','[data-viewer-search-provider]','state','minScale','get','isFinite','zoomOut','getState','8UcGequ','ResizeObserver','always','canReset','isArray','label','collectText','220rNWsTD','viewerViewStateProvider','width','reason','parentElement','-chunk-1','maxScale','viewer-anchor-','querySelectorAll','from','textContent','max','197235MmZAFU','3869100ilxDeF','[data-viewer-zoom-provider]','matches','4159652oNlySF','zoom-out','clientHeight','viewer','getBoundingClientRect','requestAnimationFrame','function','chunkOverlap','line','[data-viewer-anchor-id=\x22','mode','cover','4HijVdb','dataset','canZoomOut','resize','push','663849jsONJk','source','observe','2187687eGYDoC','4005771PrKOti','number','ownerDocument'];a0=function(){return b9;};return a0();}export{o as _,L as a,O as c,A as d,D as f,y as g,v as h,F as i,k as l,_ as m,Z as n,T as o,g as p,X as r,j as s,ne as t,E as u,i as v,r as y};
|
|
1
|
+
import { r as e, t } from "./objectSpread2.js";
|
|
2
|
+
var n = (e = {}) => {
|
|
3
|
+
var t, n, r;
|
|
4
|
+
let i = Number.isFinite(e.scale) && e.scale ? Number(e.scale) : 1;
|
|
5
|
+
return {
|
|
6
|
+
scale: i,
|
|
7
|
+
label: e.label || `${Math.round(i * 100)}%`,
|
|
8
|
+
canZoomIn: (t = e.canZoomIn) != null && t,
|
|
9
|
+
canZoomOut: (n = e.canZoomOut) != null && n,
|
|
10
|
+
canReset: (r = e.canReset) != null && r,
|
|
11
|
+
minScale: e.minScale,
|
|
12
|
+
maxScale: e.maxScale
|
|
13
|
+
};
|
|
14
|
+
}, r = (e) => e === !1 ? { enabled: !1 } : e === !0 || e === void 0 ? {} : e, i = (e = "") => ({
|
|
15
|
+
query: e,
|
|
16
|
+
total: 0,
|
|
17
|
+
currentIndex: -1,
|
|
18
|
+
current: null,
|
|
19
|
+
matches: []
|
|
20
|
+
}), a = (e) => e === !1 ? {
|
|
21
|
+
enabled: !1,
|
|
22
|
+
collectText: !1
|
|
23
|
+
} : e === !0 || e === void 0 ? {} : e, o = (e, t) => {
|
|
24
|
+
var n;
|
|
25
|
+
let r = a(t);
|
|
26
|
+
if (r.enabled === !1 || r.collectText === !1) return [];
|
|
27
|
+
let i = Math.max(200, r.chunkSize || 1200), o = Math.max(0, Math.min(i - 1, (n = r.chunkOverlap) == null ? 160 : n)), s = Math.max(0, r.maxTextLength || 0), c = [];
|
|
28
|
+
return e.forEach((e) => {
|
|
29
|
+
let t = s ? e.text.slice(0, s) : e.text;
|
|
30
|
+
if (!t) return;
|
|
31
|
+
if (t.length <= i) {
|
|
32
|
+
c.push({
|
|
33
|
+
id: `${e.id}-chunk-1`,
|
|
34
|
+
text: t,
|
|
35
|
+
anchor: e,
|
|
36
|
+
startLine: e.line,
|
|
37
|
+
endLine: e.line
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let n = 0, r = 1;
|
|
42
|
+
for (; n < t.length;) {
|
|
43
|
+
let a = t.slice(n, n + i);
|
|
44
|
+
if (c.push({
|
|
45
|
+
id: `${e.id}-chunk-${r}`,
|
|
46
|
+
text: a,
|
|
47
|
+
anchor: e,
|
|
48
|
+
startLine: e.line,
|
|
49
|
+
endLine: e.line
|
|
50
|
+
}), n + i >= t.length) break;
|
|
51
|
+
n += i - o, r += 1;
|
|
52
|
+
}
|
|
53
|
+
}), c;
|
|
54
|
+
}, s = (/* @__PURE__ */ "[data-viewer-anchor-id],.pdfViewer .page,.docx-wrapper section,.docx p,.docx li,.docx table,.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6,.markdown-body p,.markdown-body li,.markdown-body pre,.markdown-body table,article h1,article h2,article h3,article h4,article h5,article h6,article p,article li,article pre,article table,pre code,p,li,tr,h1,h2,h3,h4,h5,h6,pre,table".split(",")).join(","), c = [
|
|
55
|
+
".viewer-actions",
|
|
56
|
+
".viewer-watermark",
|
|
57
|
+
".state-panel",
|
|
58
|
+
".pdf-toolbar",
|
|
59
|
+
".pdf-nav-pane",
|
|
60
|
+
".flyfish-search-match"
|
|
61
|
+
].join(","), l = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), u = (e, t = 160) => {
|
|
62
|
+
let n = e.replace(/\s+/g, " ").trim();
|
|
63
|
+
return n.length > t ? `${n.slice(0, t - 1)}…` : n;
|
|
64
|
+
}, d = (e) => {
|
|
65
|
+
let t = e.getBoundingClientRect();
|
|
66
|
+
return t.width > 0 || t.height > 0;
|
|
67
|
+
}, f = (e) => !!e.closest(c), p = (e) => {
|
|
68
|
+
let t = e.closest("[data-page-number], [data-page]"), n = (t == null ? void 0 : t.dataset.pageNumber) || (t == null ? void 0 : t.dataset.page), r = n ? Number.parseInt(n, 10) : NaN;
|
|
69
|
+
return Number.isFinite(r) ? r : void 0;
|
|
70
|
+
}, m = (e) => e.matches(".pdfViewer .page, [data-page-number], [data-page]") ? "page" : e.matches("p, li, tr, pre, code") ? "line" : "block", h = (e, t) => {
|
|
71
|
+
let n = e.parentElement;
|
|
72
|
+
for (; n;) {
|
|
73
|
+
if (t.has(n)) return !0;
|
|
74
|
+
n = n.parentElement;
|
|
75
|
+
}
|
|
76
|
+
return !1;
|
|
77
|
+
}, g = (e) => {
|
|
78
|
+
if (!e) return [];
|
|
79
|
+
let t = e.getBoundingClientRect(), n = /* @__PURE__ */ new Set(), r = [];
|
|
80
|
+
return Array.from(e.querySelectorAll(s)).forEach((i) => {
|
|
81
|
+
if (f(i) || !d(i)) return;
|
|
82
|
+
let a = u(i.textContent || "", 1e3);
|
|
83
|
+
if (!a || h(i, n) && !i.matches("p, li, tr, pre, code")) return;
|
|
84
|
+
n.add(i);
|
|
85
|
+
let o = i.dataset.viewerAnchorId || `viewer-anchor-${r.length + 1}`;
|
|
86
|
+
i.dataset.viewerAnchorId = o, i.dataset.viewerLine = String(r.length + 1);
|
|
87
|
+
let s = i.getBoundingClientRect();
|
|
88
|
+
r.push({
|
|
89
|
+
id: o,
|
|
90
|
+
index: r.length,
|
|
91
|
+
line: r.length + 1,
|
|
92
|
+
type: m(i),
|
|
93
|
+
label: u(a, 96),
|
|
94
|
+
text: a,
|
|
95
|
+
page: p(i),
|
|
96
|
+
top: s.top - t.top + e.scrollTop,
|
|
97
|
+
left: s.left - t.left + e.scrollLeft,
|
|
98
|
+
width: s.width,
|
|
99
|
+
height: s.height
|
|
100
|
+
});
|
|
101
|
+
}), r;
|
|
102
|
+
}, _ = (e, t, n) => {
|
|
103
|
+
if (!e) return null;
|
|
104
|
+
let r = e.closest("[data-viewer-anchor-id]");
|
|
105
|
+
if (r != null && r.dataset.viewerAnchorId) {
|
|
106
|
+
let e = t.find((e) => e.id === r.dataset.viewerAnchorId);
|
|
107
|
+
if (e) return e;
|
|
108
|
+
}
|
|
109
|
+
if (!n) return null;
|
|
110
|
+
let i = n.getBoundingClientRect(), a = e.getBoundingClientRect().top - i.top + n.scrollTop, o = null;
|
|
111
|
+
for (let e of t) {
|
|
112
|
+
if (e.top <= a + 1) {
|
|
113
|
+
o = e;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
return o;
|
|
119
|
+
}, v = (e, t) => {
|
|
120
|
+
if (!e || !t.length) return null;
|
|
121
|
+
let n = e.scrollTop + e.clientHeight * .42, r = t[0];
|
|
122
|
+
for (let e of t) {
|
|
123
|
+
if (e.top <= n) {
|
|
124
|
+
r = e;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
return r;
|
|
130
|
+
}, y = (e, t) => {
|
|
131
|
+
if (!e || t == null) return !1;
|
|
132
|
+
let n = typeof t == "object" ? `[data-viewer-anchor-id="${l(t.id)}"]` : typeof t == "number" ? `[data-viewer-line="${t}"]` : `[data-viewer-anchor-id="${l(t)}"]`, r = e.querySelector(n);
|
|
133
|
+
return r ? (r.scrollIntoView({
|
|
134
|
+
block: "center",
|
|
135
|
+
inline: "nearest"
|
|
136
|
+
}), !0) : typeof t == "object" && (e.scrollTo({
|
|
137
|
+
top: Math.max(0, t.top - e.clientHeight * .18),
|
|
138
|
+
left: Math.max(0, Math.min(t.left, e.scrollWidth - e.clientWidth)),
|
|
139
|
+
behavior: "smooth"
|
|
140
|
+
}), !0);
|
|
141
|
+
}, b = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), C = (e) => !!e && e.nodeType === 1, w = (e, t) => {
|
|
142
|
+
if (!(e != null && e.querySelectorAll)) return [];
|
|
143
|
+
let n = Array.from(e.querySelectorAll(t));
|
|
144
|
+
C(e) && e.shadowRoot && n.push(...w(e.shadowRoot, t));
|
|
145
|
+
let r = Array.from(e.querySelectorAll("*"));
|
|
146
|
+
for (let e of r) e.shadowRoot && n.push(...w(e.shadowRoot, t));
|
|
147
|
+
return n;
|
|
148
|
+
}, T = (e) => {
|
|
149
|
+
if (!e) return null;
|
|
150
|
+
let t = C(e) ? b.get(e) || e.__flyfishViewerSearchProvider : null;
|
|
151
|
+
if (t) return t;
|
|
152
|
+
let n = w(e, "[data-viewer-search-provider]")[0];
|
|
153
|
+
return n && (b.get(n) || n.__flyfishViewerSearchProvider) || null;
|
|
154
|
+
}, E = (e, t) => {
|
|
155
|
+
x.set(e, t), e.dataset.viewerZoomProvider = e.dataset.viewerZoomProvider || "custom", e.__flyfishViewerZoomProvider = t;
|
|
156
|
+
}, D = (e) => {
|
|
157
|
+
e && (x.delete(e), delete e.dataset.viewerZoomProvider, delete e.__flyfishViewerZoomProvider);
|
|
158
|
+
}, O = (e) => {
|
|
159
|
+
if (!e) return null;
|
|
160
|
+
let t = C(e) ? x.get(e) || e.__flyfishViewerZoomProvider : null;
|
|
161
|
+
if (t) return t;
|
|
162
|
+
let n = w(e, "[data-viewer-zoom-provider]")[0];
|
|
163
|
+
return n && (x.get(n) || n.__flyfishViewerZoomProvider) || null;
|
|
164
|
+
}, k = (e, t) => {
|
|
165
|
+
S.set(e, t), e.dataset.viewerViewStateProvider = e.dataset.viewerViewStateProvider || "custom", e.__flyfishViewerViewStateProvider = t;
|
|
166
|
+
}, A = (e) => {
|
|
167
|
+
e && (S.delete(e), delete e.dataset.viewerViewStateProvider, delete e.__flyfishViewerViewStateProvider);
|
|
168
|
+
}, j = (e) => {
|
|
169
|
+
if (!e) return null;
|
|
170
|
+
let t = C(e) ? S.get(e) || e.__flyfishViewerViewStateProvider : null;
|
|
171
|
+
if (t && (!C(e) || e.dataset.viewerViewStateProvider !== "generic")) return t;
|
|
172
|
+
let n = w(e, "[data-viewer-view-state-provider]"), r = n.find((e) => e.dataset.viewerViewStateProvider !== "generic"), i = n.find((e) => e.dataset.viewerViewStateProvider === "generic"), a = r || i;
|
|
173
|
+
return a ? S.get(a) || a.__flyfishViewerViewStateProvider || null : t || null;
|
|
174
|
+
}, M = (e) => ({
|
|
175
|
+
scale: e.scale,
|
|
176
|
+
label: e.label,
|
|
177
|
+
canZoomIn: e.canZoomIn,
|
|
178
|
+
canZoomOut: e.canZoomOut,
|
|
179
|
+
canReset: e.canReset,
|
|
180
|
+
minScale: e.minScale,
|
|
181
|
+
maxScale: e.maxScale
|
|
182
|
+
}), N = (e, t) => {
|
|
183
|
+
let r = n(t || {});
|
|
184
|
+
return e.scale = r.scale, e.label = r.label, e.canZoomIn = r.canZoomIn, e.canZoomOut = r.canZoomOut, e.canReset = r.canReset, e.minScale = r.minScale, e.maxScale = r.maxScale, e;
|
|
185
|
+
}, P = (e) => M(e);
|
|
186
|
+
(function() {
|
|
187
|
+
var t = e(function* (e, t) {
|
|
188
|
+
return N(e, yield t()), P(e);
|
|
189
|
+
});
|
|
190
|
+
return function(e, n) {
|
|
191
|
+
return t.apply(this, arguments);
|
|
192
|
+
};
|
|
193
|
+
})();
|
|
194
|
+
var F = () => {
|
|
195
|
+
let e = /* @__PURE__ */ new Set();
|
|
196
|
+
return {
|
|
197
|
+
emit() {
|
|
198
|
+
e.forEach((e) => e());
|
|
199
|
+
},
|
|
200
|
+
subscribe(t) {
|
|
201
|
+
return e.add(t), () => {
|
|
202
|
+
e.delete(t);
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
clear() {
|
|
206
|
+
e.clear();
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}, I = (e) => {
|
|
210
|
+
var t, n;
|
|
211
|
+
return ((n = (t = e == null ? void 0 : e.ownerDocument) == null ? void 0 : t.defaultView) == null ? void 0 : n.MutationObserver) || (typeof MutationObserver < "u" ? MutationObserver : void 0);
|
|
212
|
+
}, L = ({ root: t, enabled: r, beforeZoom: i, onChange: a }) => {
|
|
213
|
+
let o = null, s = null, c = null, l = !1, u = n(), d = () => {
|
|
214
|
+
a == null || a(M(u));
|
|
215
|
+
}, f = () => {
|
|
216
|
+
s == null || s(), s = null, o = null, N(u, null);
|
|
217
|
+
}, p = () => {
|
|
218
|
+
var e, n;
|
|
219
|
+
if ((r == null ? void 0 : r()) === !1) return f(), null;
|
|
220
|
+
let i = O(t());
|
|
221
|
+
return i !== o && (s == null || s(), o = i, s = ((e = i == null ? void 0 : i.subscribe) == null ? void 0 : e.call(i, () => {
|
|
222
|
+
N(u, i.getState()), l || d();
|
|
223
|
+
})) || null), N(u, ((n = i == null ? void 0 : i.getState) == null ? void 0 : n.call(i)) || null), i;
|
|
224
|
+
}, m = () => {
|
|
225
|
+
c == null || c.disconnect(), c = null;
|
|
226
|
+
}, h = function() {
|
|
227
|
+
var t = e(function* (e, t) {
|
|
228
|
+
let n = p();
|
|
229
|
+
if (!n || i && (yield i(e)) === !1) return M(u);
|
|
230
|
+
l = !0;
|
|
231
|
+
try {
|
|
232
|
+
let e = yield t(n);
|
|
233
|
+
return N(u, e || n.getState()), M(u);
|
|
234
|
+
} finally {
|
|
235
|
+
l = !1;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
return function(e, n) {
|
|
239
|
+
return t.apply(this, arguments);
|
|
240
|
+
};
|
|
241
|
+
}();
|
|
242
|
+
return {
|
|
243
|
+
get provider() {
|
|
244
|
+
return o;
|
|
245
|
+
},
|
|
246
|
+
state: u,
|
|
247
|
+
hasProvider() {
|
|
248
|
+
return !!p();
|
|
249
|
+
},
|
|
250
|
+
refreshProvider: p,
|
|
251
|
+
observe() {
|
|
252
|
+
m();
|
|
253
|
+
let e = t(), n = I(e);
|
|
254
|
+
if (!e || !n) {
|
|
255
|
+
p();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
c = new n(() => {
|
|
259
|
+
p();
|
|
260
|
+
}), c.observe(e, {
|
|
261
|
+
childList: !0,
|
|
262
|
+
subtree: !0
|
|
263
|
+
}), p();
|
|
264
|
+
},
|
|
265
|
+
clearProvider: f,
|
|
266
|
+
getState() {
|
|
267
|
+
return M(u);
|
|
268
|
+
},
|
|
269
|
+
zoomIn: () => h("zoom-in", (e) => e.zoomIn()),
|
|
270
|
+
zoomOut: () => h("zoom-out", (e) => e.zoomOut()),
|
|
271
|
+
resetZoom: () => h("zoom-reset", (e) => e.resetZoom()),
|
|
272
|
+
destroy() {
|
|
273
|
+
m(), f();
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}, R = [
|
|
277
|
+
"auto",
|
|
278
|
+
"contain",
|
|
279
|
+
"cover",
|
|
280
|
+
"width",
|
|
281
|
+
"height",
|
|
282
|
+
"actual",
|
|
283
|
+
"scale-down"
|
|
284
|
+
], z = [
|
|
285
|
+
"until-interaction",
|
|
286
|
+
"always",
|
|
287
|
+
"initial"
|
|
288
|
+
], B = "until-interaction", V = 0, H = 8, U = (e) => !!e && typeof e == "object" && !Array.isArray(e), W = (e) => typeof e == "string" && R.includes(e), G = (e) => typeof e == "string" && z.includes(e), K = (e) => {
|
|
289
|
+
let t = Number(e);
|
|
290
|
+
return Number.isFinite(t) && t > 0 ? t : void 0;
|
|
291
|
+
}, q = (e) => {
|
|
292
|
+
let t = Number(e);
|
|
293
|
+
return Number.isFinite(t) && t > 0 ? t : V;
|
|
294
|
+
}, J = (e) => {
|
|
295
|
+
if (e == null || e === !1) return null;
|
|
296
|
+
if (W(e)) return {
|
|
297
|
+
mode: e,
|
|
298
|
+
resize: B,
|
|
299
|
+
padding: V
|
|
300
|
+
};
|
|
301
|
+
if (!U(e)) return null;
|
|
302
|
+
let t = K(e.minScale), n = K(e.maxScale), r = t !== void 0 && n !== void 0 && n < t ? t : n;
|
|
303
|
+
return {
|
|
304
|
+
mode: W(e.mode) ? e.mode : "auto",
|
|
305
|
+
resize: G(e.resize) ? e.resize : B,
|
|
306
|
+
padding: q(e.padding),
|
|
307
|
+
minScale: t,
|
|
308
|
+
maxScale: r
|
|
309
|
+
};
|
|
310
|
+
}, Y = (e, t, n) => {
|
|
311
|
+
let r = e;
|
|
312
|
+
return Number.isFinite(t) && (r = Math.max(Number(t), r)), Number.isFinite(n) && (r = Math.min(Number(n), r)), r;
|
|
313
|
+
}, X = ({ mode: e, viewportWidth: t, viewportHeight: n, contentWidth: r, contentHeight: i, minScale: a, maxScale: o }) => {
|
|
314
|
+
if (t <= 0 || n <= 0 || r <= 0 || i <= 0) return;
|
|
315
|
+
let s = t / r, c = n / i, l = Math.min(s, c), u = Math.max(s, c), d = (() => {
|
|
316
|
+
switch (e) {
|
|
317
|
+
case "cover": return u;
|
|
318
|
+
case "width": return s;
|
|
319
|
+
case "height": return c;
|
|
320
|
+
case "actual": return 1;
|
|
321
|
+
case "scale-down": return Math.min(1, l);
|
|
322
|
+
default: return l;
|
|
323
|
+
}
|
|
324
|
+
})();
|
|
325
|
+
if (!(!Number.isFinite(d) || d <= 0)) return Y(d, a, o);
|
|
326
|
+
}, Z = (e) => {
|
|
327
|
+
var t, n;
|
|
328
|
+
if (!e) return !1;
|
|
329
|
+
let r = Number((t = e.scale) == null ? (n = e.zoom) == null ? void 0 : n.scale : t);
|
|
330
|
+
if (Number.isFinite(r) && r > 0 || Number.isFinite(e.page) || Number.isFinite(e.rotation) || e.navigation && Object.keys(e.navigation).length > 0 || e.extra && Object.keys(e.extra).length > 0) return !0;
|
|
331
|
+
let i = e.scroll || {};
|
|
332
|
+
return [
|
|
333
|
+
"top",
|
|
334
|
+
"left",
|
|
335
|
+
"topRatio",
|
|
336
|
+
"leftRatio"
|
|
337
|
+
].some((e) => {
|
|
338
|
+
let t = i[e];
|
|
339
|
+
return Number.isFinite(t);
|
|
340
|
+
});
|
|
341
|
+
}, Q = (e, t, n = "viewer", r = "none") => ({
|
|
342
|
+
applied: !1,
|
|
343
|
+
mode: e.mode,
|
|
344
|
+
resize: e.resize,
|
|
345
|
+
source: n,
|
|
346
|
+
reason: t,
|
|
347
|
+
provider: r
|
|
348
|
+
}), $ = (e, t, n) => ({
|
|
349
|
+
applied: !!(e != null && e.applied),
|
|
350
|
+
mode: (e == null ? void 0 : e.mode) || t.mode,
|
|
351
|
+
resize: (e == null ? void 0 : e.resize) || t.resize,
|
|
352
|
+
scale: e == null ? void 0 : e.scale,
|
|
353
|
+
source: (e == null ? void 0 : e.source) || t.source,
|
|
354
|
+
reason: e == null ? void 0 : e.reason,
|
|
355
|
+
provider: (e == null ? void 0 : e.provider) || n,
|
|
356
|
+
state: e == null ? void 0 : e.state
|
|
357
|
+
}), ee = (e) => e === "pending" || e === "retry" || e === "image-not-ready" || e === "unmeasurable", te = (e) => {
|
|
358
|
+
var t;
|
|
359
|
+
let n = (t = e.getBoundingClientRect) == null ? void 0 : t.call(e);
|
|
360
|
+
return {
|
|
361
|
+
width: Math.max(0, (n == null ? void 0 : n.width) || e.clientWidth || 0),
|
|
362
|
+
height: Math.max(0, (n == null ? void 0 : n.height) || e.clientHeight || 0)
|
|
363
|
+
};
|
|
364
|
+
}, ne = ({ root: n, enabled: r, getFit: i = () => void 0, onFit: a }) => {
|
|
365
|
+
let o = null, s = null, c = null, l = !1, u = 0, d = () => {
|
|
366
|
+
var e;
|
|
367
|
+
let t = n();
|
|
368
|
+
return ((e = t == null ? void 0 : t.ownerDocument) == null ? void 0 : e.defaultView) || (typeof window < "u" ? window : void 0);
|
|
369
|
+
}, f = () => {
|
|
370
|
+
if (s === null) return;
|
|
371
|
+
let e = d();
|
|
372
|
+
e != null && e.cancelAnimationFrame && e.cancelAnimationFrame(s), s = null;
|
|
373
|
+
}, p = () => {
|
|
374
|
+
c && clearTimeout(c), c = null;
|
|
375
|
+
}, m = (e, t) => {
|
|
376
|
+
let n = e === void 0 ? i() : e;
|
|
377
|
+
return n == null ? t === "api" ? J("auto") : null : J(n);
|
|
378
|
+
}, h = (e, t, n) => {
|
|
379
|
+
u >= H || (p(), u += 1, c = setTimeout(() => {
|
|
380
|
+
c = null, g(e, {
|
|
381
|
+
source: t,
|
|
382
|
+
reason: n === "api" ? "api" : "retry"
|
|
383
|
+
});
|
|
384
|
+
}, 32 * u));
|
|
385
|
+
}, g = function() {
|
|
386
|
+
var i = e(function* (e, i = {}) {
|
|
387
|
+
let o = i.source || "api", s = i.reason || "api", c = m(e, s);
|
|
388
|
+
if (!c) return {
|
|
389
|
+
applied: !1,
|
|
390
|
+
mode: "auto",
|
|
391
|
+
resize: B,
|
|
392
|
+
source: o,
|
|
393
|
+
reason: "not-configured",
|
|
394
|
+
provider: "none"
|
|
395
|
+
};
|
|
396
|
+
if ((r == null ? void 0 : r()) === !1) return Q(c, "disabled", o);
|
|
397
|
+
let l = n();
|
|
398
|
+
if (!l) return h(e, o, s), Q(c, "no-root", o);
|
|
399
|
+
let d = te(l);
|
|
400
|
+
if (d.width <= 0 || d.height <= 0) return h(e, o, s), Q(c, "zero-size", o);
|
|
401
|
+
let f = t(t({}, c), {}, {
|
|
402
|
+
source: o,
|
|
403
|
+
reason: s,
|
|
404
|
+
viewportWidth: Math.max(0, d.width - c.padding * 2),
|
|
405
|
+
viewportHeight: Math.max(0, d.height - c.padding * 2),
|
|
406
|
+
container: l
|
|
407
|
+
}), p = j(l), g = null;
|
|
408
|
+
if (p != null && p.fit) {
|
|
409
|
+
let e = $(yield p.fit(f), f, "view-state");
|
|
410
|
+
if (e.applied) return u = 0, a == null || a(e), e;
|
|
411
|
+
g = e;
|
|
412
|
+
}
|
|
413
|
+
let _ = O(l);
|
|
414
|
+
if (_ != null && _.fit) {
|
|
415
|
+
let e = $(yield _.fit(f), f, "zoom");
|
|
416
|
+
if (e.applied) return u = 0, a == null || a(e), e;
|
|
417
|
+
g = e;
|
|
418
|
+
}
|
|
419
|
+
let v = Q(c, p || _ ? "unsupported" : "no-provider", o);
|
|
420
|
+
return (v.reason === "no-provider" || ee(g == null ? void 0 : g.reason)) && h(e, o, s), v;
|
|
421
|
+
});
|
|
422
|
+
return function(e) {
|
|
423
|
+
return i.apply(this, arguments);
|
|
424
|
+
};
|
|
425
|
+
}(), _ = (e = "resize") => {
|
|
426
|
+
let t = J(i());
|
|
427
|
+
if (!t || t.resize === "initial" || t.resize === "until-interaction" && l) return;
|
|
428
|
+
f();
|
|
429
|
+
let n = d(), r = () => {
|
|
430
|
+
s = null, g(void 0, {
|
|
431
|
+
source: "viewer",
|
|
432
|
+
reason: e
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
if (n != null && n.requestAnimationFrame) {
|
|
436
|
+
s = n.requestAnimationFrame(r);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
s = setTimeout(r, 16);
|
|
440
|
+
}, v = () => {
|
|
441
|
+
f(), o == null || o.disconnect(), o = null;
|
|
442
|
+
};
|
|
443
|
+
return {
|
|
444
|
+
normalize: J,
|
|
445
|
+
fit: function() {
|
|
446
|
+
var t = e(function* (e, t) {
|
|
447
|
+
return p(), l = !1, g(e, {
|
|
448
|
+
source: (t == null ? void 0 : t.source) || "api",
|
|
449
|
+
reason: (t == null ? void 0 : t.reason) || "api"
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
return function(e, n) {
|
|
453
|
+
return t.apply(this, arguments);
|
|
454
|
+
};
|
|
455
|
+
}(),
|
|
456
|
+
applyInitialFit: function() {
|
|
457
|
+
var t = e(function* (e = {}) {
|
|
458
|
+
return p(), u = 0, l = !1, e.skip ? Q(J(i()) || J("auto"), "initial-view-state", "initial") : g(void 0, {
|
|
459
|
+
source: "initial",
|
|
460
|
+
reason: "initial"
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
return function() {
|
|
464
|
+
return t.apply(this, arguments);
|
|
465
|
+
};
|
|
466
|
+
}(),
|
|
467
|
+
scheduleFit: _,
|
|
468
|
+
observe() {
|
|
469
|
+
var e, t;
|
|
470
|
+
v();
|
|
471
|
+
let r = n(), i = ((t = (e = r == null ? void 0 : r.ownerDocument) == null ? void 0 : e.defaultView) == null ? void 0 : t.ResizeObserver) || (typeof ResizeObserver < "u" ? ResizeObserver : void 0);
|
|
472
|
+
!r || !i || (o = new i(() => _("resize")), o.observe(r));
|
|
473
|
+
},
|
|
474
|
+
markUserInteraction() {
|
|
475
|
+
l = !0, p();
|
|
476
|
+
},
|
|
477
|
+
resetAutoFit() {
|
|
478
|
+
l = !1, u = 0;
|
|
479
|
+
},
|
|
480
|
+
destroy() {
|
|
481
|
+
v(), p(), u = 0;
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
//#endregion
|
|
486
|
+
export { o as _, L as a, O as c, A as d, D as f, y as g, v as h, F as i, k as l, _ as m, Z as n, T as o, g as p, X as r, j as s, ne as t, E as u, i as v, r as y };
|