@file-viewer/vue3 2.2.6 → 2.2.7

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.
@@ -1 +1,498 @@
1
- function a1(a,b){a=a-0x6b;const c=a0();let d=c[a];return d;}const aE=a1;(function(a4,a5){const aB=a1,a6=a4();while(!![]){try{const a7=parseInt(aB(0xa5))/0x1+-parseInt(aB(0x6f))/0x2*(parseInt(aB(0x94))/0x3)+-parseInt(aB(0x9d))/0x4+-parseInt(aB(0x87))/0x5*(-parseInt(aB(0x93))/0x6)+parseInt(aB(0x9b))/0x7*(parseInt(aB(0x7a))/0x8)+-parseInt(aB(0x7b))/0x9*(-parseInt(aB(0x6b))/0xa)+-parseInt(aB(0x7f))/0xb*(parseInt(aB(0xb4))/0xc);if(a7===a5)break;else a6['push'](a6['shift']());}catch(a8){a6['push'](a6['shift']());}}}(a0,0xc9143));import{a as a2,i as a3}from'./messages.js';var n=(a4={})=>{const aC=a1;var a5,a6,a7;let a8=Number['isFinite'](a4['scale'])&&a4['scale']?Number(a4['scale']):0x1;return{'scale':a8,'label':a4[aC(0x81)]||Math['round'](a8*0x64)+'%','canZoomIn':(a5=a4['canZoomIn'])==null?!0x1:a5,'canZoomOut':(a6=a4['canZoomOut'])==null?!0x1:a6,'canReset':(a7=a4['canReset'])==null?!0x1:a7,'minScale':a4['minScale'],'maxScale':a4[aC(0x7c)]};},r=a4=>a4===!0x1?{'enabled':!0x1}:a4===!0x0||a4===void 0x0?{}:a4,i=(a4='')=>({'query':a4,'total':0x0,'currentIndex':-0x1,'current':null,'matches':[]}),a=a4=>a4===!0x1?{'enabled':!0x1,'collectText':!0x1}:a4===!0x0||a4===void 0x0?{}:a4,o=(a4,a5)=>{var a6;let a7=a(a5);if(a7['enabled']===!0x1||a7['collectText']===!0x1)return[];let a8=Math['max'](0xc8,a7['chunkSize']||0x4b0),a9=Math['max'](0x0,Math['min'](a8-0x1,(a6=a7['chunkOverlap'])==null?0xa0:a6)),aa=Math['max'](0x0,a7['maxTextLength']||0x0),ab=[];return a4['forEach'](ac=>{const aD=a1;let ad=aa?ac['text'][aD(0x88)](0x0,aa):ac['text'];if(!ad)return;if(ad['length']<=a8){ab['push']({'id':ac['id']+aD(0x72),'text':ad,'anchor':ac,'startLine':ac['line'],'endLine':ac[aD(0x85)]});return;}let af=0x0,ag=0x1;for(;af<ad['length'];){let ah=ad['slice'](af,af+a8);if(ab[aD(0x6e)]({'id':ac['id']+aD(0xb2)+ag,'text':ah,'anchor':ac,'startLine':ac['line'],'endLine':ac['line']}),af+a8>=ad['length'])break;af+=a8-a9,ag+=0x1;}}),ab;},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',aE(0x77),'.flyfish-search-match']['join'](','),l=a4=>typeof CSS<'u'&&typeof CSS['escape']=='function'?CSS['escape'](a4):a4['replace'](/["\\]/g,aE(0x73)),u=(a4,a5=0xa0)=>{const aF=aE;let a6=a4['replace'](/\s+/g,'\x20')['trim']();return a6['length']>a5?a6[aF(0x88)](0x0,a5-0x1)+'…':a6;},d=a4=>{let a5=a4['getBoundingClientRect']();return a5['width']>0x0||a5['height']>0x0;},f=a4=>!!a4['closest'](c),p=a4=>{const aG=aE;let a5=a4['closest'](aG(0xae)),a6=(a5==null?void 0x0:a5['dataset']['pageNumber'])||(a5==null?void 0x0:a5['dataset'][aG(0xa1)]),a7=a6?Number['parseInt'](a6,0xa):NaN;return Number['isFinite'](a7)?a7:void 0x0;},m=a4=>a4['matches']('.pdfViewer\x20.page,\x20[data-page-number],\x20[data-page]')?'page':a4[aE(0xb1)]('p,\x20li,\x20tr,\x20pre,\x20code')?aE(0x85):'block',h=(a4,a5)=>{const aH=aE;let a6=a4[aH(0xad)];for(;a6;){if(a5['has'](a6))return!0x0;a6=a6['parentElement'];}return!0x1;},g=a4=>{const aI=aE;if(!a4)return[];let a5=a4['getBoundingClientRect'](),a6=new Set(),a7=[];return Array['from'](a4['querySelectorAll'](s))[aI(0x8e)](a8=>{const aJ=aI;if(f(a8)||!d(a8))return;let a9=u(a8['textContent']||'',0x3e8);if(!a9||h(a8,a6)&&!a8['matches']('p,\x20li,\x20tr,\x20pre,\x20code'))return;a6['add'](a8);let aa=a8['dataset']['viewerAnchorId']||'viewer-anchor-'+(a7['length']+0x1);a8['dataset']['viewerAnchorId']=aa,a8['dataset'][aJ(0x96)]=String(a7['length']+0x1);let ab=a8['getBoundingClientRect']();a7['push']({'id':aa,'index':a7[aJ(0x86)],'line':a7[aJ(0x86)]+0x1,'type':m(a8),'label':u(a9,0x60),'text':a9,'page':p(a8),'top':ab['top']-a5['top']+a4['scrollTop'],'left':ab[aJ(0x8f)]-a5[aJ(0x8f)]+a4['scrollLeft'],'width':ab['width'],'height':ab['height']});}),a7;},_=(a4,a5,a6)=>{const aK=aE;if(!a4)return null;let a7=a4['closest'](aK(0x83));if(a7!=null&&a7[aK(0x8c)][aK(0x7e)]){let ab=a5['find'](ac=>ac['id']===a7['dataset'][aK(0x7e)]);if(ab)return ab;}if(!a6)return null;let a8=a6['getBoundingClientRect'](),a9=a4['getBoundingClientRect']()[aK(0x74)]-a8['top']+a6[aK(0x6d)],aa=null;for(let ac of a5){if(ac['top']<=a9+0x1){aa=ac;continue;}break;}return aa;},v=(a4,a5)=>{const aL=aE;if(!a4||!a5['length'])return null;let a6=a4['scrollTop']+a4['clientHeight']*0.42,a7=a5[0x0];for(let a8 of a5){if(a8[aL(0x74)]<=a6){a7=a8;continue;}break;}return a7;},ee=(a4,a5)=>{const aM=aE;if(!a4||a5==null)return!0x1;let a6=typeof a5==aM(0x76)?'[data-viewer-anchor-id=\x22'+l(a5['id'])+'\x22]':typeof a5==aM(0x8d)?'[data-viewer-line=\x22'+a5+'\x22]':'[data-viewer-anchor-id=\x22'+l(a5)+'\x22]',a7=a4['querySelector'](a6);return a7?(a7['scrollIntoView']({'block':'center','inline':aM(0x98)}),!0x0):typeof a5=='object'?(a4['scrollTo']({'top':Math['max'](0x0,a5['top']-a4['clientHeight']*0.18),'left':Math['max'](0x0,Math['min'](a5[aM(0x8f)],a4['scrollWidth']-a4['clientWidth'])),'behavior':'smooth'}),!0x0):!0x1;},y=new WeakMap(),b=new WeakMap(),x=new WeakMap(),S=a4=>!!a4&&a4['nodeType']===0x1,C=(a4,a5)=>{const aN=aE;if(!(a4!=null&&a4['querySelectorAll']))return[];let a6=Array['from'](a4['querySelectorAll'](a5));S(a4)&&a4[aN(0x7d)]&&a6['push'](...C(a4['shadowRoot'],a5));let a7=Array['from'](a4['querySelectorAll']('*'));for(let a8 of a7)a8['shadowRoot']&&a6['push'](...C(a8['shadowRoot'],a5));return a6;},w=a4=>{if(!a4)return null;let a5=S(a4)?y['get'](a4)||a4['__flyfishViewerSearchProvider']:null;if(a5)return a5;let a6=C(a4,'[data-viewer-search-provider]')[0x0];return a6&&(y['get'](a6)||a6['__flyfishViewerSearchProvider'])||null;},T=(a4,a5)=>{const aO=aE;b[aO(0x80)](a4,a5),a4['dataset']['viewerZoomProvider']=a4['dataset'][aO(0xa7)]||'custom',a4['__flyfishViewerZoomProvider']=a5;},E=a4=>{a4&&(b['delete'](a4),delete a4['dataset']['viewerZoomProvider'],delete a4['__flyfishViewerZoomProvider']);},D=a4=>{if(!a4)return null;let a5=S(a4)?b['get'](a4)||a4['__flyfishViewerZoomProvider']:null;if(a5)return a5;let a6=C(a4,'[data-viewer-zoom-provider]')[0x0];return a6&&(b['get'](a6)||a6['__flyfishViewerZoomProvider'])||null;},O=(a4,a5)=>{const aP=aE;x['set'](a4,a5),a4['dataset'][aP(0xa3)]=a4['dataset'][aP(0xa3)]||'custom',a4['__flyfishViewerViewStateProvider']=a5;},k=a4=>{a4&&(x['delete'](a4),delete a4['dataset']['viewerViewStateProvider'],delete a4['__flyfishViewerViewStateProvider']);},A=a4=>{const aQ=aE;if(!a4)return null;let a5=S(a4)?x['get'](a4)||a4['__flyfishViewerViewStateProvider']:null;if(a5&&(!S(a4)||a4['dataset']['viewerViewStateProvider']!=='generic'))return a5;let a6=C(a4,aQ(0x9f)),a7=a6['find'](aa=>aa['dataset'][aQ(0xa3)]!=='generic'),a8=a6['find'](aa=>aa['dataset']['viewerViewStateProvider']==='generic'),a9=a7||a8;return a9?x['get'](a9)||a9[aQ(0x99)]||null:a5||null;},j=['auto',aE(0x8b),'overlay'],M=a4=>Math['max'](0x0,a4['scrollHeight']-a4['clientHeight']),N=(a4,a5={})=>{const aR=aE;var a6,a7;let a8=(a6=a5['minScrollRange'])==null?0x2:a6;if(M(a4)<=a8)return!0x1;let a9=(a7=a4['ownerDocument'])==null?void 0x0:a7['defaultView'],aa=a9!=null&&a9['getComputedStyle']?a9:typeof window<'u'?window:void 0x0;if(!(aa!=null&&aa['getComputedStyle']))return!0x1;let ab=aa['getComputedStyle'](a4),ac=ab['overflowY']||ab[aR(0x90)];return(a5['overflowValues']||j)['includes'](ac);},P=(a4,a5={})=>{const aS=aE;if(!a4)return null;let a6=a5[aS(0xaf)]||aS(0xa6),a7=a5['candidateSelector']||'div,\x20section,\x20article,\x20pre',a8=a4[aS(0x9c)](a6);return a8&&N(a8,a5)?a8:N(a4,a5)?a4:Array['from'](a4['querySelectorAll'](a7))['filter'](a9=>N(a9,a5))['sort']((a9,aa)=>M(aa)-M(a9))[0x0]||a8||a4;},F=a4=>({'scale':a4['scale'],'label':a4['label'],'canZoomIn':a4['canZoomIn'],'canZoomOut':a4[aE(0x78)],'canReset':a4['canReset'],'minScale':a4['minScale'],'maxScale':a4['maxScale']}),I=(a4,a5)=>{const aT=aE;let a6=n(a5||{});return a4['scale']=a6[aT(0xa2)],a4['label']=a6['label'],a4['canZoomIn']=a6['canZoomIn'],a4['canZoomOut']=a6['canZoomOut'],a4[aT(0xb5)]=a6['canReset'],a4['minScale']=a6['minScale'],a4['maxScale']=a6['maxScale'],a4;},te=a4=>F(a4);(function(){var a4=a3(function*(a5,a6){return I(a5,yield a6()),te(a5);});return function(a5,a6){return a4['apply'](this,arguments);};}());var L=()=>{let a4=new Set();return{'emit'(){a4['forEach'](a5=>a5());},'subscribe'(a5){const aU=a1;return a4[aU(0xb6)](a5),()=>{a4['delete'](a5);};}};},R=a4=>{var a5,a6;return((a6=(a5=a4==null?void 0x0:a4['ownerDocument'])==null?void 0x0:a5['defaultView'])==null?void 0x0:a6['MutationObserver'])||(typeof MutationObserver<'u'?MutationObserver:void 0x0);},z=({root:a4,enabled:a5,beforeZoom:a6,onChange:a7})=>{const aX=aE;let a8=null,a9=null,aa=null,ab=!0x1,ac=n(),ad=()=>{a7==null||a7(F(ac));},af=()=>{a9==null||a9(),a9=null,a8=null,I(ac,null);},ag=()=>{var aj,ak;if((a5==null?void 0x0:a5())===!0x1)return af(),null;let al=D(a4());return al!==a8&&(a9==null||a9(),a8=al,a9=((aj=al==null?void 0x0:al['subscribe'])==null?void 0x0:aj['call'](al,()=>{const aV=a1;I(ac,al[aV(0x8a)]()),ab||ad();}))||null),I(ac,((ak=al==null?void 0x0:al['getState'])==null?void 0x0:ak['call'](al))||null),al;},ah=()=>{aa==null||aa['disconnect'](),aa=null;},ai=(function(){var aj=a3(function*(ak,al){let am=ag();if(!am||a6&&(yield a6(ak))===!0x1)return F(ac);ab=!0x0;try{return I(ac,(yield al(am))||am['getState']()),F(ac);}finally{ab=!0x1;}});return function(ak,al){const aW=a1;return aj[aW(0x82)](this,arguments);};}());return{get 'provider'(){return a8;},'state':ac,'hasProvider'(){return!!ag();},'refreshProvider':ag,'observe'(){ah();let aj=a4(),ak=R(aj);if(!aj||!ak){ag();return;}aa=new ak(()=>{ag();}),aa['observe'](aj,{'childList':!0x0,'subtree':!0x0}),ag();},'clearProvider':af,'getState'(){return F(ac);},'zoomIn':()=>ai('zoom-in',aj=>aj['zoomIn']()),'zoomOut':()=>ai('zoom-out',aj=>aj[aX(0x9a)]()),'resetZoom':()=>ai('zoom-reset',aj=>aj[aX(0x84)]()),'destroy'(){ah(),af();}};},B=['auto',aE(0xa9),'cover','width','height','actual','scale-down'],V=['until-interaction','always','initial'],H='until-interaction',U=0x0,W=0x8,G=a4=>!!a4&&typeof a4=='object'&&!Array['isArray'](a4),K=a4=>typeof a4=='string'&&B['includes'](a4),q=a4=>typeof a4=='string'&&V['includes'](a4),J=a4=>{let a5=Number(a4);return Number['isFinite'](a5)&&a5>0x0?a5:void 0x0;},Y=a4=>{let a5=Number(a4);return Number['isFinite'](a5)&&a5>0x0?a5:U;},X=a4=>{if(a4==null||a4===!0x1)return null;if(K(a4))return{'mode':a4,'resize':H,'padding':U};if(!G(a4))return null;let a5=J(a4['minScale']),a6=J(a4['maxScale']),a7=a5!==void 0x0&&a6!==void 0x0&&a6<a5?a5:a6;return{'mode':K(a4['mode'])?a4['mode']:'auto','resize':q(a4['resize'])?a4['resize']:H,'padding':Y(a4['padding']),'minScale':a5,'maxScale':a7};},Z=(a4,a5,a6)=>{let a7=a4;return Number['isFinite'](a5)&&(a7=Math['max'](Number(a5),a7)),Number['isFinite'](a6)&&(a7=Math['min'](Number(a6),a7)),a7;},ne=({mode:a4,viewportWidth:a5,viewportHeight:a6,contentWidth:a7,contentHeight:a8,minScale:a9,maxScale:aa})=>{if(a5<=0x0||a6<=0x0||a7<=0x0||a8<=0x0)return;let ab=a5/a7,ac=a6/a8,ad=Math['min'](ab,ac),af=Math['max'](ab,ac),ag=((()=>{const aY=a1;switch(a4){case'cover':return af;case'width':return ab;case'height':return ac;case aY(0x9e):return 0x1;case'scale-down':return Math['min'](0x1,ad);default:return ad;}})());if(!(!Number['isFinite'](ag)||ag<=0x0))return Z(ag,a9,aa);},re=a4=>{const aZ=aE;var a5,a6;if(!a4)return!0x1;let a7=Number((a5=a4[aZ(0xa2)])==null?(a6=a4[aZ(0xab)])==null?void 0x0:a6['scale']:a5);if(Number['isFinite'](a7)&&a7>0x0||Number['isFinite'](a4['page'])||Number[aZ(0x71)](a4['rotation'])||a4['navigation']&&Object['keys'](a4['navigation'])[aZ(0x86)]>0x0||a4['extra']&&Object['keys'](a4['extra'])['length']>0x0)return!0x0;let a8=a4['scroll']||{};return['top','left','topRatio','leftRatio']['some'](a9=>{let aa=a8[a9];return Number['isFinite'](aa);});},Q=(a4,a5,a6='viewer',a7='none')=>({'applied':!0x1,'mode':a4['mode'],'resize':a4[aE(0xb3)],'source':a6,'reason':a5,'provider':a7}),$=(a4,a5,a6)=>({'applied':!!(a4!=null&&a4['applied']),'mode':(a4==null?void 0x0:a4['mode'])||a5[aE(0xa8)],'resize':(a4==null?void 0x0:a4['resize'])||a5['resize'],'scale':a4==null?void 0x0:a4['scale'],'source':(a4==null?void 0x0:a4['source'])||a5['source'],'reason':a4==null?void 0x0:a4['reason'],'provider':(a4==null?void 0x0:a4['provider'])||a6,'state':a4==null?void 0x0:a4['state']}),ie=a4=>a4==='pending'||a4==='retry'||a4===aE(0x91)||a4==='unmeasurable',ae=a4=>{const b0=aE;var a5;let a6=(a5=a4['getBoundingClientRect'])==null?void 0x0:a5[b0(0x79)](a4);return{'width':Math[b0(0xa0)](0x0,(a6==null?void 0x0:a6['width'])||a4['clientWidth']||0x0),'height':Math['max'](0x0,(a6==null?void 0x0:a6[b0(0x70)])||a4['clientHeight']||0x0)};},oe=({root:a4,enabled:a5,getFit:a6=()=>void 0x0,onFit:a7})=>{let a8=null,a9=null,aa=null,ab=!0x1,ac=0x0,ad=()=>{const b1=a1;var am;let an=a4();return((am=an==null?void 0x0:an['ownerDocument'])==null?void 0x0:am[b1(0x75)])||(typeof window<'u'?window:void 0x0);},af=()=>{if(a9===null)return;let am=ad();am!=null&&am['cancelAnimationFrame']&&am['cancelAnimationFrame'](a9),a9=null;},ag=()=>{aa&&clearTimeout(aa),aa=null;},ah=(am,an)=>{const b2=a1;let ao=am===void 0x0?a6():am;return ao==null?an==='api'?X(b2(0xaa)):null:X(ao);},ai=(am,an,ao)=>{ac>=W||(ag(),ac+=0x1,aa=setTimeout(()=>{aa=null,aj(am,{'source':an,'reason':ao==='api'?'api':'retry'});},0x20*ac));},aj=(function(){var am=a3(function*(an,ao={}){const b3=a1;let ap=ao['source']||b3(0x97),aq=ao['reason']||'api',ar=ah(an,aq);if(!ar)return{'applied':!0x1,'mode':'auto','resize':H,'source':ap,'reason':'not-configured','provider':'none'};if((a5==null?void 0x0:a5())===!0x1)return Q(ar,b3(0x92),ap);let as=a4();if(!as)return ai(an,ap,aq),Q(ar,'no-root',ap);let at=ae(as);if(at['width']<=0x0||at['height']<=0x0)return ai(an,ap,aq),Q(ar,'zero-size',ap);let au=a2(a2({},ar),{},{'source':ap,'reason':aq,'viewportWidth':Math[b3(0xa0)](0x0,at['width']-ar['padding']*0x2),'viewportHeight':Math['max'](0x0,at['height']-ar['padding']*0x2),'container':as}),av=A(as),aw=null;if(av!=null&&av['fit']){let az=$(yield av['fit'](au),au,'view-state');if(az['applied'])return ac=0x0,a7==null||a7(az),az;aw=az;}let ax=D(as);if(ax!=null&&ax['fit']){let aA=$(yield ax['fit'](au),au,'zoom');if(aA[b3(0x89)])return ac=0x0,a7==null||a7(aA),aA;aw=aA;}let ay=Q(ar,av||ax?'unsupported':'no-provider',ap);return(ay['reason']==='no-provider'||ie(aw==null?void 0x0:aw[b3(0x6c)]))&&ai(an,ap,aq),ay;});return function(an){return am['apply'](this,arguments);};}()),ak=(am='resize')=>{const b4=a1;let an=X(a6());if(!an||an[b4(0xb3)]===b4(0xa4)||an[b4(0xb3)]==='until-interaction'&&ab)return;af();let ao=ad(),ap=()=>{a9=null,aj(void 0x0,{'source':'viewer','reason':am});};if(ao!=null&&ao['requestAnimationFrame']){a9=ao[b4(0x95)](ap);return;}a9=setTimeout(ap,0x10);},al=()=>{af(),a8==null||a8['disconnect'](),a8=null;};return{'normalize':X,'fit':(function(){var am=a3(function*(an,ao){return ag(),ab=!0x1,aj(an,{'source':(ao==null?void 0x0:ao['source'])||'api','reason':(ao==null?void 0x0:ao['reason'])||'api'});});return function(an,ao){return am['apply'](this,arguments);};}()),'applyInitialFit':(function(){var am=a3(function*(an={}){const b5=a1;return ag(),ac=0x0,ab=!0x1,an[b5(0xac)]?Q(X(a6())||X('auto'),b5(0xb0),'initial'):aj(void 0x0,{'source':'initial','reason':'initial'});});return function(){return am['apply'](this,arguments);};}()),'scheduleFit':ak,'observe'(){var am,an;al();let ao=a4(),ap=((an=(am=ao==null?void 0x0:ao['ownerDocument'])==null?void 0x0:am['defaultView'])==null?void 0x0:an['ResizeObserver'])||(typeof ResizeObserver<'u'?ResizeObserver:void 0x0);!ao||!ap||(a8=new ap(()=>ak('resize')),a8['observe'](ao));},'markUserInteraction'(){ab=!0x0,ag();},'resetAutoFit'(){ab=!0x1,ac=0x0;},'destroy'(){al(),ag(),ac=0x0;}};};export{ee as _,z as a,r as b,A as c,T as d,k as f,v as g,_ as h,L as i,D as l,g as m,re as n,P as o,E as p,ne as r,w as s,oe as t,O as u,o as v,i as y};function a0(){const b6=['[data-page-number],\x20[data-page]','preferredSelector','initial-view-state','matches','-chunk-','resize','6441252QANsLk','canReset','add','35410nVARkA','reason','scrollTop','push','10iGMQBQ','height','isFinite','-chunk-1','\x5c$&','top','defaultView','object','.pdf-nav-pane','canZoomOut','call','1664008pKLotY','2979ViOWyY','maxScale','shadowRoot','viewerAnchorId','44RevQGk','set','label','apply','[data-viewer-anchor-id]','resetZoom','line','length','35rZGlwi','slice','applied','getState','scroll','dataset','number','forEach','left','overflow','image-not-ready','disabled','270012rMJsUj','137628XcxDlu','requestAnimationFrame','viewerLine','api','nearest','__flyfishViewerViewStateProvider','zoomOut','42GrxNgs','querySelector','3758312lgLkiz','actual','[data-viewer-view-state-provider]','max','page','scale','viewerViewStateProvider','initial','1404570jRMnpo','[data-viewer-scroll-container],\x20.pdf-wrapper','viewerZoomProvider','mode','contain','auto','zoom','skip','parentElement'];a0=function(){return b6;};return a0();}
1
+ import { a as e, i as t } from "./messages.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 ? !1 : t,
9
+ canZoomOut: (n = e.canZoomOut) == null ? !1 : n,
10
+ canReset: (r = e.canReset) == null ? !1 : 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
+ }, ee = (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) : !1;
141
+ }, y = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), S = (e) => !!e && e.nodeType === 1, C = (e, t) => {
142
+ if (!(e != null && e.querySelectorAll)) return [];
143
+ let n = Array.from(e.querySelectorAll(t));
144
+ S(e) && e.shadowRoot && n.push(...C(e.shadowRoot, t));
145
+ let r = Array.from(e.querySelectorAll("*"));
146
+ for (let e of r) e.shadowRoot && n.push(...C(e.shadowRoot, t));
147
+ return n;
148
+ }, w = (e) => {
149
+ if (!e) return null;
150
+ let t = S(e) ? y.get(e) || e.__flyfishViewerSearchProvider : null;
151
+ if (t) return t;
152
+ let n = C(e, "[data-viewer-search-provider]")[0];
153
+ return n && (y.get(n) || n.__flyfishViewerSearchProvider) || null;
154
+ }, T = (e, t) => {
155
+ b.set(e, t), e.dataset.viewerZoomProvider = e.dataset.viewerZoomProvider || "custom", e.__flyfishViewerZoomProvider = t;
156
+ }, E = (e) => {
157
+ e && (b.delete(e), delete e.dataset.viewerZoomProvider, delete e.__flyfishViewerZoomProvider);
158
+ }, D = (e) => {
159
+ if (!e) return null;
160
+ let t = S(e) ? b.get(e) || e.__flyfishViewerZoomProvider : null;
161
+ if (t) return t;
162
+ let n = C(e, "[data-viewer-zoom-provider]")[0];
163
+ return n && (b.get(n) || n.__flyfishViewerZoomProvider) || null;
164
+ }, O = (e, t) => {
165
+ x.set(e, t), e.dataset.viewerViewStateProvider = e.dataset.viewerViewStateProvider || "custom", e.__flyfishViewerViewStateProvider = t;
166
+ }, k = (e) => {
167
+ e && (x.delete(e), delete e.dataset.viewerViewStateProvider, delete e.__flyfishViewerViewStateProvider);
168
+ }, A = (e) => {
169
+ if (!e) return null;
170
+ let t = S(e) ? x.get(e) || e.__flyfishViewerViewStateProvider : null;
171
+ if (t && (!S(e) || e.dataset.viewerViewStateProvider !== "generic")) return t;
172
+ let n = C(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 ? x.get(a) || a.__flyfishViewerViewStateProvider || null : t || null;
174
+ }, j = [
175
+ "auto",
176
+ "scroll",
177
+ "overlay"
178
+ ], M = (e) => Math.max(0, e.scrollHeight - e.clientHeight), N = (e, t = {}) => {
179
+ var n, r;
180
+ let i = (n = t.minScrollRange) == null ? 2 : n;
181
+ if (M(e) <= i) return !1;
182
+ let a = (r = e.ownerDocument) == null ? void 0 : r.defaultView, o = a != null && a.getComputedStyle ? a : typeof window < "u" ? window : void 0;
183
+ if (!(o != null && o.getComputedStyle)) return !1;
184
+ let s = o.getComputedStyle(e), c = s.overflowY || s.overflow;
185
+ return (t.overflowValues || j).includes(c);
186
+ }, P = (e, t = {}) => {
187
+ if (!e) return null;
188
+ let n = t.preferredSelector || "[data-viewer-scroll-container], .pdf-wrapper", r = t.candidateSelector || "div, section, article, pre", i = e.querySelector(n);
189
+ return i && N(i, t) ? i : N(e, t) ? e : Array.from(e.querySelectorAll(r)).filter((e) => N(e, t)).sort((e, t) => M(t) - M(e))[0] || i || e;
190
+ }, F = (e) => ({
191
+ scale: e.scale,
192
+ label: e.label,
193
+ canZoomIn: e.canZoomIn,
194
+ canZoomOut: e.canZoomOut,
195
+ canReset: e.canReset,
196
+ minScale: e.minScale,
197
+ maxScale: e.maxScale
198
+ }), I = (e, t) => {
199
+ let r = n(t || {});
200
+ 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;
201
+ }, te = (e) => F(e);
202
+ (function() {
203
+ var e = t(function* (e, t) {
204
+ return I(e, yield t()), te(e);
205
+ });
206
+ return function(t, n) {
207
+ return e.apply(this, arguments);
208
+ };
209
+ })();
210
+ var L = () => {
211
+ let e = /* @__PURE__ */ new Set();
212
+ return {
213
+ emit() {
214
+ e.forEach((e) => e());
215
+ },
216
+ subscribe(t) {
217
+ return e.add(t), () => {
218
+ e.delete(t);
219
+ };
220
+ }
221
+ };
222
+ }, R = (e) => {
223
+ var t, n;
224
+ 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);
225
+ }, z = ({ root: e, enabled: r, beforeZoom: i, onChange: a }) => {
226
+ let o = null, s = null, c = null, l = !1, u = n(), d = () => {
227
+ a == null || a(F(u));
228
+ }, f = () => {
229
+ s == null || s(), s = null, o = null, I(u, null);
230
+ }, p = () => {
231
+ var t, n;
232
+ if ((r == null ? void 0 : r()) === !1) return f(), null;
233
+ let i = D(e());
234
+ return i !== o && (s == null || s(), o = i, s = ((t = i == null ? void 0 : i.subscribe) == null ? void 0 : t.call(i, () => {
235
+ I(u, i.getState()), l || d();
236
+ })) || null), I(u, ((n = i == null ? void 0 : i.getState) == null ? void 0 : n.call(i)) || null), i;
237
+ }, m = () => {
238
+ c == null || c.disconnect(), c = null;
239
+ }, h = function() {
240
+ var e = t(function* (e, t) {
241
+ let n = p();
242
+ if (!n || i && (yield i(e)) === !1) return F(u);
243
+ l = !0;
244
+ try {
245
+ return I(u, (yield t(n)) || n.getState()), F(u);
246
+ } finally {
247
+ l = !1;
248
+ }
249
+ });
250
+ return function(t, n) {
251
+ return e.apply(this, arguments);
252
+ };
253
+ }();
254
+ return {
255
+ get provider() {
256
+ return o;
257
+ },
258
+ state: u,
259
+ hasProvider() {
260
+ return !!p();
261
+ },
262
+ refreshProvider: p,
263
+ observe() {
264
+ m();
265
+ let t = e(), n = R(t);
266
+ if (!t || !n) {
267
+ p();
268
+ return;
269
+ }
270
+ c = new n(() => {
271
+ p();
272
+ }), c.observe(t, {
273
+ childList: !0,
274
+ subtree: !0
275
+ }), p();
276
+ },
277
+ clearProvider: f,
278
+ getState() {
279
+ return F(u);
280
+ },
281
+ zoomIn: () => h("zoom-in", (e) => e.zoomIn()),
282
+ zoomOut: () => h("zoom-out", (e) => e.zoomOut()),
283
+ resetZoom: () => h("zoom-reset", (e) => e.resetZoom()),
284
+ destroy() {
285
+ m(), f();
286
+ }
287
+ };
288
+ }, B = [
289
+ "auto",
290
+ "contain",
291
+ "cover",
292
+ "width",
293
+ "height",
294
+ "actual",
295
+ "scale-down"
296
+ ], V = [
297
+ "until-interaction",
298
+ "always",
299
+ "initial"
300
+ ], H = "until-interaction", U = 0, W = 8, G = (e) => !!e && typeof e == "object" && !Array.isArray(e), K = (e) => typeof e == "string" && B.includes(e), q = (e) => typeof e == "string" && V.includes(e), J = (e) => {
301
+ let t = Number(e);
302
+ return Number.isFinite(t) && t > 0 ? t : void 0;
303
+ }, Y = (e) => {
304
+ let t = Number(e);
305
+ return Number.isFinite(t) && t > 0 ? t : U;
306
+ }, X = (e) => {
307
+ if (e == null || e === !1) return null;
308
+ if (K(e)) return {
309
+ mode: e,
310
+ resize: H,
311
+ padding: U
312
+ };
313
+ if (!G(e)) return null;
314
+ let t = J(e.minScale), n = J(e.maxScale), r = t !== void 0 && n !== void 0 && n < t ? t : n;
315
+ return {
316
+ mode: K(e.mode) ? e.mode : "auto",
317
+ resize: q(e.resize) ? e.resize : H,
318
+ padding: Y(e.padding),
319
+ minScale: t,
320
+ maxScale: r
321
+ };
322
+ }, Z = (e, t, n) => {
323
+ let r = e;
324
+ return Number.isFinite(t) && (r = Math.max(Number(t), r)), Number.isFinite(n) && (r = Math.min(Number(n), r)), r;
325
+ }, ne = ({ mode: e, viewportWidth: t, viewportHeight: n, contentWidth: r, contentHeight: i, minScale: a, maxScale: o }) => {
326
+ if (t <= 0 || n <= 0 || r <= 0 || i <= 0) return;
327
+ let s = t / r, c = n / i, l = Math.min(s, c), u = Math.max(s, c), d = (() => {
328
+ switch (e) {
329
+ case "cover": return u;
330
+ case "width": return s;
331
+ case "height": return c;
332
+ case "actual": return 1;
333
+ case "scale-down": return Math.min(1, l);
334
+ default: return l;
335
+ }
336
+ })();
337
+ if (!(!Number.isFinite(d) || d <= 0)) return Z(d, a, o);
338
+ }, re = (e) => {
339
+ var t, n;
340
+ if (!e) return !1;
341
+ let r = Number((t = e.scale) == null ? (n = e.zoom) == null ? void 0 : n.scale : t);
342
+ 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;
343
+ let i = e.scroll || {};
344
+ return [
345
+ "top",
346
+ "left",
347
+ "topRatio",
348
+ "leftRatio"
349
+ ].some((e) => {
350
+ let t = i[e];
351
+ return Number.isFinite(t);
352
+ });
353
+ }, Q = (e, t, n = "viewer", r = "none") => ({
354
+ applied: !1,
355
+ mode: e.mode,
356
+ resize: e.resize,
357
+ source: n,
358
+ reason: t,
359
+ provider: r
360
+ }), $ = (e, t, n) => ({
361
+ applied: !!(e != null && e.applied),
362
+ mode: (e == null ? void 0 : e.mode) || t.mode,
363
+ resize: (e == null ? void 0 : e.resize) || t.resize,
364
+ scale: e == null ? void 0 : e.scale,
365
+ source: (e == null ? void 0 : e.source) || t.source,
366
+ reason: e == null ? void 0 : e.reason,
367
+ provider: (e == null ? void 0 : e.provider) || n,
368
+ state: e == null ? void 0 : e.state
369
+ }), ie = (e) => e === "pending" || e === "retry" || e === "image-not-ready" || e === "unmeasurable", ae = (e) => {
370
+ var t;
371
+ let n = (t = e.getBoundingClientRect) == null ? void 0 : t.call(e);
372
+ return {
373
+ width: Math.max(0, (n == null ? void 0 : n.width) || e.clientWidth || 0),
374
+ height: Math.max(0, (n == null ? void 0 : n.height) || e.clientHeight || 0)
375
+ };
376
+ }, oe = ({ root: n, enabled: r, getFit: i = () => void 0, onFit: a }) => {
377
+ let o = null, s = null, c = null, l = !1, u = 0, d = () => {
378
+ var e;
379
+ let t = n();
380
+ return ((e = t == null ? void 0 : t.ownerDocument) == null ? void 0 : e.defaultView) || (typeof window < "u" ? window : void 0);
381
+ }, f = () => {
382
+ if (s === null) return;
383
+ let e = d();
384
+ e != null && e.cancelAnimationFrame && e.cancelAnimationFrame(s), s = null;
385
+ }, p = () => {
386
+ c && clearTimeout(c), c = null;
387
+ }, m = (e, t) => {
388
+ let n = e === void 0 ? i() : e;
389
+ return n == null ? t === "api" ? X("auto") : null : X(n);
390
+ }, h = (e, t, n) => {
391
+ u >= W || (p(), u += 1, c = setTimeout(() => {
392
+ c = null, g(e, {
393
+ source: t,
394
+ reason: n === "api" ? "api" : "retry"
395
+ });
396
+ }, 32 * u));
397
+ }, g = function() {
398
+ var i = t(function* (t, i = {}) {
399
+ let o = i.source || "api", s = i.reason || "api", c = m(t, s);
400
+ if (!c) return {
401
+ applied: !1,
402
+ mode: "auto",
403
+ resize: H,
404
+ source: o,
405
+ reason: "not-configured",
406
+ provider: "none"
407
+ };
408
+ if ((r == null ? void 0 : r()) === !1) return Q(c, "disabled", o);
409
+ let l = n();
410
+ if (!l) return h(t, o, s), Q(c, "no-root", o);
411
+ let d = ae(l);
412
+ if (d.width <= 0 || d.height <= 0) return h(t, o, s), Q(c, "zero-size", o);
413
+ let f = e(e({}, c), {}, {
414
+ source: o,
415
+ reason: s,
416
+ viewportWidth: Math.max(0, d.width - c.padding * 2),
417
+ viewportHeight: Math.max(0, d.height - c.padding * 2),
418
+ container: l
419
+ }), p = A(l), g = null;
420
+ if (p != null && p.fit) {
421
+ let e = $(yield p.fit(f), f, "view-state");
422
+ if (e.applied) return u = 0, a == null || a(e), e;
423
+ g = e;
424
+ }
425
+ let _ = D(l);
426
+ if (_ != null && _.fit) {
427
+ let e = $(yield _.fit(f), f, "zoom");
428
+ if (e.applied) return u = 0, a == null || a(e), e;
429
+ g = e;
430
+ }
431
+ let v = Q(c, p || _ ? "unsupported" : "no-provider", o);
432
+ return (v.reason === "no-provider" || ie(g == null ? void 0 : g.reason)) && h(t, o, s), v;
433
+ });
434
+ return function(e) {
435
+ return i.apply(this, arguments);
436
+ };
437
+ }(), _ = (e = "resize") => {
438
+ let t = X(i());
439
+ if (!t || t.resize === "initial" || t.resize === "until-interaction" && l) return;
440
+ f();
441
+ let n = d(), r = () => {
442
+ s = null, g(void 0, {
443
+ source: "viewer",
444
+ reason: e
445
+ });
446
+ };
447
+ if (n != null && n.requestAnimationFrame) {
448
+ s = n.requestAnimationFrame(r);
449
+ return;
450
+ }
451
+ s = setTimeout(r, 16);
452
+ }, v = () => {
453
+ f(), o == null || o.disconnect(), o = null;
454
+ };
455
+ return {
456
+ normalize: X,
457
+ fit: function() {
458
+ var e = t(function* (e, t) {
459
+ return p(), l = !1, g(e, {
460
+ source: (t == null ? void 0 : t.source) || "api",
461
+ reason: (t == null ? void 0 : t.reason) || "api"
462
+ });
463
+ });
464
+ return function(t, n) {
465
+ return e.apply(this, arguments);
466
+ };
467
+ }(),
468
+ applyInitialFit: function() {
469
+ var e = t(function* (e = {}) {
470
+ return p(), u = 0, l = !1, e.skip ? Q(X(i()) || X("auto"), "initial-view-state", "initial") : g(void 0, {
471
+ source: "initial",
472
+ reason: "initial"
473
+ });
474
+ });
475
+ return function() {
476
+ return e.apply(this, arguments);
477
+ };
478
+ }(),
479
+ scheduleFit: _,
480
+ observe() {
481
+ var e, t;
482
+ v();
483
+ 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);
484
+ !r || !i || (o = new i(() => _("resize")), o.observe(r));
485
+ },
486
+ markUserInteraction() {
487
+ l = !0, p();
488
+ },
489
+ resetAutoFit() {
490
+ l = !1, u = 0;
491
+ },
492
+ destroy() {
493
+ v(), p(), u = 0;
494
+ }
495
+ };
496
+ };
497
+ //#endregion
498
+ export { ee as _, z as a, r as b, A as c, T as d, k as f, v as g, _ as h, L as i, D as l, g as m, re as n, P as o, E as p, ne as r, w as s, oe as t, O as u, o as v, i as y };