diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 07d667f..a5a9117 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -1,7 +1,7 @@ { "permissions": { "allow": [ - "WebFetch(domain:www.beiyuxing.tech)" + "WebFetch(domain:www.wingsemitech.com)" ] } } diff --git a/FPGA.html b/FPGA.html index 0c44f81..4e0635c 100644 --- a/FPGA.html +++ b/FPGA.html @@ -180,7 +180,7 @@
- Wing-M130处理器IP + Wing-M130处理器IP
diff --git a/Wing-M050.html b/Wing-M050.html index 69686f7..92efd2d 100644 --- a/Wing-M050.html +++ b/Wing-M050.html @@ -381,7 +381,7 @@

Wing-M050 处理器IP架构

- Wing-M050 Processor IP架构图
diff --git a/Wing-M050s安全核.html b/Wing-M050s安全核.html index bc1abcf..d2f29e7 100644 --- a/Wing-M050s安全核.html +++ b/Wing-M050s安全核.html @@ -381,7 +381,7 @@

Wing-M050S 处理器IP架构

- Wing-M050 Processor IP架构图
@@ -729,7 +729,7 @@

Wing-M050S的安全特性

- Wing-M050 Processor IP架构图
diff --git a/Wing-M130.html b/Wing-M130.html index 9b91e6f..77618d5 100644 --- a/Wing-M130.html +++ b/Wing-M130.html @@ -382,7 +382,7 @@

Wing-M130 处理器IP架构

- Wing-M130 Processor IP架构图
diff --git a/Wing-M130A.html b/Wing-M130A.html index 753d969..f952986 100644 --- a/Wing-M130A.html +++ b/Wing-M130A.html @@ -381,7 +381,7 @@

Wing-M130A 处理器IP架构

- Wing-M130 Processor IP架构图
@@ -717,7 +717,7 @@

Wing-M130A的车规认证

- Wing-M130A Processor IP架构图
diff --git a/Wing-M130s安全核.html b/Wing-M130s安全核.html index 5e66f69..489ccf2 100644 --- a/Wing-M130s安全核.html +++ b/Wing-M130s安全核.html @@ -381,7 +381,7 @@

Wing-M130S 处理器IP架构

- Wing-M130S Processor IP架构图
@@ -746,7 +746,7 @@

Wing-M130S的安全特性

- Wing-M130S Processor IP架构图
diff --git a/Wing-M510.html b/Wing-M510.html index d244d3e..3879e32 100644 --- a/Wing-M510.html +++ b/Wing-M510.html @@ -381,7 +381,7 @@

Wing-M510 处理器IP架构

- Wing-M510 Processor IP架构图
@@ -719,7 +719,7 @@

性能优势

- Wing-M510 Processor IP架构图
@@ -729,7 +729,7 @@

实时性优势

- Wing-M510 Processor IP架构图
diff --git a/architstudio.html b/architstudio.html index cd63fcc..7a51c2c 100644 --- a/architstudio.html +++ b/architstudio.html @@ -418,7 +418,7 @@
- Logo

ArchitStudio

连接算法与芯片的桥梁

diff --git a/code_compression_intro_V2.html b/code_compression_intro_V2.html index d2763a5..7626cf5 100644 --- a/code_compression_intro_V2.html +++ b/code_compression_intro_V2.html @@ -417,7 +417,7 @@
- Community Contribution Comparison
diff --git a/hand-kimi.html b/hand-kimi.html index 17a2672..7089fcf 100644 --- a/hand-kimi.html +++ b/hand-kimi.html @@ -244,8 +244,8 @@
- - 隼瞻科技 + + 隼瞻科技
@@ -253,7 +253,7 @@
- +
ArchitStudio开发平台
- +
智翼端侧AI解决方案
- +
配套开发工具
- +
@@ -357,18 +357,18 @@
- +
@@ -383,16 +383,16 @@
- 新闻中心 + 新闻中心
- 关于我们 + 关于我们
- 加入我们 + 加入我们 @@ -428,7 +428,7 @@ @@ -503,7 +449,7 @@ class="tablet:hidden bg-gradient-to-b from-darkCard to-darkerBg border-t border-gray-700/50">
-
- Wing-M050 - Wing-M130 - Wing-M510 - Wing-A500
@@ -578,7 +524,7 @@
- Wing-M130A
@@ -594,20 +540,20 @@
- Wing-M050S - Wing-M130S
- ArchitStudio开发平台 - 智翼端侧AI解决方案 @@ -615,54 +561,17 @@ - -
- + 知识中心 + -
- 新闻中心 + 新闻中心
- 关于我们 + 关于我们
- 加入我们 + 加入我们
@@ -419,7 +419,7 @@
@@ -500,17 +500,17 @@ - AI融合技术 + AI融合技术 - 新闻中心 - 关于我们 - 加入我们 + 新闻中心 + 关于我们 + 加入我们 @@ -677,7 +677,7 @@
- 公司Logo + 公司Logo

@@ -702,28 +702,28 @@

产品

技术

关于我们

diff --git a/index_new.html b/index_new.html index e61513d..34b4dc3 100644 --- a/index_new.html +++ b/index_new.html @@ -497,14 +497,6 @@ 全周期可重构,为多维应用场景提供澎湃算力引擎

- -
- - 探索产品 - - -
-
@@ -582,7 +574,7 @@
- + 了解更多 diff --git a/knowledge_center.html b/knowledge_center.html new file mode 100644 index 0000000..b03dea1 --- /dev/null +++ b/knowledge_center.html @@ -0,0 +1,974 @@ + + +
+ + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+
+ +
+
+

+ 知识中心

+
+ 深入解析隼瞻科技底层核心能力 +
+

+ 探索基于 RISC-V 架构的突破性创新,从超越行业标杆的代码密度增强技术,到实现微秒级响应的中断实时性增强技术,我们致力于从底层核心实现极致性能优化。 +

+ + +
+ + 应用案例 + + +
+ + +
+
+
30%
+
代码空间节省
+
+
+
5-20%
+
库体积优于竞品
+
+
+
Xwingc
+
自主研发扩展
+
+
+
WingGCC
+
深度定制编译器
+
+
+
+
+
+ + +
+
+ 核心能力一:代码密度增强技术 +
+
+ + +
+
+
+

技术背景与挑战

+
+
+ +
+
+
+

RISC-V 的双刃剑

+

+ RISC-V 指令集以精简闻名,但在处理相同任务时,相较于 ARM 往往需要执行更多条指令。这种特性导致了代码密度较低,进而要求更大的片上内存(Memory),最终导致芯片成本的增加。 +

+
+
更多指令需求
+
更高内存占用
+
更高硬件成本
+
+
+ +
+
+
+ 高成本痛点
+
+
+
+ CPU
+
+ Memory +
+

普通 RISC-V

+
+
+
+ Wing CPU
+
+ 优化后 Memory +
+

隼瞻方案

+
+
+

通过提高代码密度,显著减少对 Memory 的需求,降低 + Memory 面积与成本。

+
+
+
+
+
+
+ + +
+
+
+

四大技术手段

+

全栈式优化策略,从指令集到工具链

+
+ +
+ +
+
+ 01
+

压缩指令

+

+ 对 RISC-V 社区的 B 扩展、Zc 扩展、Zicond + 等一系列标准扩展提供了有效支持,并进行了进一步优化。 +

+ + +
+ + +
+
+ 02
+

Xwingc 扩展指令集

+

+ 支持将自主研发的代码密度增强指令 Xwingc 扩展加入到处理器核中。 +

+
+
+ Arm: ldr r0, [r0, r1, + lsl #2] +
+
+ 传统RISC-V指令: sll a1, + a1, 2; add aO,
a1; lw a0, O(a0)
+
+
+ Wing Xc: lwr a0, a1(a0) +
+
一条指令完成多条操作,无需额外寄存器分配
+
+
+ + +
+
+ 03
+

WingGCC 编译器

+

+ 解决了 GCC 领域针对性不强的问题。完整匹配各种标准扩展指令和隼瞻自定义扩展指令,同时适配隼瞻专用高效微架构,充分发挥性能。 +

+
+ + +
+
+ 04
+

WingLib 基础库

+
    +
  • 提供标准C库和数学库,专为 code size 和速度优化,优于竞品 5%~20%
  • +
  • 提供优化的 DSP 库,结合 DSA 技术,性能达竞品数倍。
  • +
  • 提供优化的第三方中间件。
  • +
+
+
+
+
+ + +
+
+ +
+ + +
+ +
+
+ +

+ + 极致的密度优化 +

+

+ 我们的优化路径清晰可见。从基础 GCC 出发,叠加 Zc/Zicond 扩展,再引入 Wing 独有的代码密度增强技术,最终实现大幅度的空间节省。 +

+ + +
+

+ + 基于 Wing-M130, Wing IDE v1.0, embench 测试案例 +

+
+
+ + +
+

+ 代码密度百分比 + (数值越小越好) +

+ + +
+ +
+
+ +
+
+
+
+
+
100%
+
GCC
+
+
+ + +
+
+
+
+
+
+
+
80%
+
+ Zc/Zicond Ext
+
+
+ + +
+
+
+
+
+
+
+
75%
+
+ Wing Code Density
+
+
+ + +
+
+
+
+
+
+
+
+ 70%
+
+ 最终优化
+
+
+
+ + +
+
基础编译器
+
+
标准扩展
+
+
Wing 专有扩展
+
+
极致密度
+
+
+
+
+
+ + + +
+
+
+
+
+
+ 核心能力二:中断实时性增强技术 +
+

+ 通过自定义指令集优化压栈出栈,并行处理上下文切换,打破传统 RISC-V 中断响应瓶颈,实现微秒级确定性响应。 +

+
+
+ + +
+
+
+

指令级优化

+

通过增强指令优化压栈和出栈,大幅加速中断响应速度

+
+ +
+ +
+
+
+
+

常规 RISC-V 处理

+ 由于指令多,周期长 +
+
+
+
+ 1
2
3
4
5 +
+
+ csrr a0, mcause     sw a0, + 4*4(sp)
+ csrr a1, mstatus    sw a1, + 3*4(sp)
+ csrr a2, mtval +      sw + a2, 2*4(sp)
+ csrr a3, mepc +       sw a3, + 1*4(sp)
+ addi sp, sp, + -5*4 +
+
+
+
+
+ + + + + +
+
+
+
+
+

隼瞻增强技术

+ 减少5条指令 +
+
+ +
+ 效率提升 +
+
+
+ 1
2
3
4 +
+
+ csr.push + mcause, -16
+ csr.push + mstatus, -12
+ csr.push + mtval, -8
+ csr.push + mepc, -4 +
+
+
+
+
+
+
+
+ + +
+
+
+
+

并行处理与硬件加速

+

+ 在嵌套中断服务中,通过优化中断采样逻辑优化中断接入逻辑,并创造性地实现并行处理上下文切换。 +

+
+ + +
+ +
+
+

常规中断处理步骤 +

+
+
+ 中断发起
跳转时间
+
+ 中断处理
时间
+
上下文切换
时间
+
+
串行执行,耗时累加
+
+ + +
+ + + +
+ +
+

+ 隼瞻增强技术步骤

+
+ +
+
+ 中断发起
跳转时间
+
+ 中断处理
时间
+ + +
+ 大幅减少
处理时间 +
+
+ +
+
+ 并行处理上下文切换 +
+ +
+
+
+
+
+
+ + +
+

+ 绝对时间优势 +

+
+
+ +
+
+ 常规
+
+
+ +
+
+ 增强版
+
+
+ -61.54% +
+ +
+ ↓ +
+
+
+
+

中断响应周期大幅缩减

+
+
+
+
+
+
+ + +
+ + + +
+ + +
+ + \ No newline at end of file diff --git a/merge.py b/merge.py new file mode 100644 index 0000000..437a939 --- /dev/null +++ b/merge.py @@ -0,0 +1,53 @@ +import re + +with open('code_compression_intro_V2.html', 'r', encoding='utf-8') as f: + code_html = f.read() + +with open('interrupt_realtime_wingsemi.html', 'r', encoding='utf-8') as f: + interrupt_html = f.read() + +start_idx = interrupt_html.find(' +
+
+
+ 第二项核心技术 +
+

+ 中断实时性增强技术 +

+

+ 通过自定义指令集优化压栈出栈,并行处理上下文切换,打破传统 RISC-V 中断响应瓶颈,实现微秒级确定性响应。 +

+
+
+''' + +code_html = code_html.replace('代码密度增强技术\n ', '知识中心\n ') +code_html = code_html.replace('超越行业标杆 ARM 的技术突破', '隼瞻科技 核心技术解析') +code_html = re.sub(r'针对 RISC-V 指令集特性深度优化.*代码密度表现。', '探索基于 RISC-V 架构的突破性创新,从超越行业标杆的代码密度增强技术,到实现微秒级响应的中断实时性增强技术,我们致力于从底层架构实现超凡性能优化。', code_html, flags=re.DOTALL) + +# also replace the code compression section start to give it a title +code_html = code_html.replace('', ''' +
+
+ 第一项核心技术 +
+

代码密度增强技术

+
+ + ''') + +target = '' +new_html = code_html.replace(target, transition_html + '\n' + interrupt_sections + '\n' + target) + +with open('knowledge_center.html', 'w', encoding='utf-8') as f: + f.write(new_html) + +print('Merge successful') diff --git a/pdf-preview-site/backend/public/assets/index-CBnsKpxD.js b/pdf-preview-site/backend/public/assets/index-CBnsKpxD.js index f704901..34dc853 100644 --- a/pdf-preview-site/backend/public/assets/index-CBnsKpxD.js +++ b/pdf-preview-site/backend/public/assets/index-CBnsKpxD.js @@ -383,4 +383,4 @@ pdfjs-editor-undo-bar-close-button = .title = Close pdfjs-editor-undo-bar-close-button-label = Close`)},R(hN,lN);var gN=hN,_N=1e3,vN=50,yN=1e3;function bN(){return document.location.hash}var xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN=class{constructor({linkService:e,eventBus:t}){R(this,SN),R(this,xN,null),this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint=``,this.reset(),this.eventBus._on(`pagesinit`,()=>{this._isPagesLoaded=!1,this.eventBus._on(`pagesloaded`,e=>{this._isPagesLoaded=!!e.pagesCount},{once:!0})})}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:n=!1}){if(!e||typeof e!=`string`){console.error(`PDFHistory.initialize: The "fingerprint" must be a non-empty string.`);return}this._initialized&&this.reset();let r=this._fingerprint!==``&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=n===!0,this._initialized=!0,B(this,SN,MN).call(this);let i=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=bN(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!B(this,SN,EN).call(this,i,!0)||t){let{hash:e,page:n,rotation:i}=B(this,SN,ON).call(this,!0);if(!e||r||t){B(this,SN,CN).call(this,null,!0);return}B(this,SN,CN).call(this,{hash:e,page:n,rotation:i},!0);return}let a=i.destination;B(this,SN,DN).call(this,a,i.uid,!0),a.rotation!==void 0&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(B(this,SN,jN).call(this),this._initialized=!1,B(this,SN,NN).call(this)),this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:n}){if(!this._initialized)return;if(e&&typeof e!=`string`){console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}else if(Array.isArray(t)){if(!B(this,SN,TN).call(this,n)&&(n!==null||this._destination)){console.error(`PDFHistory.push: "${n}" is not a valid pageNumber parameter.`);return}}else{console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}let r=e||JSON.stringify(t);if(!r)return;let i=!1;if(this._destination&&(FN(this._destination.hash,r)||IN(this._destination.dest,t))){if(this._destination.page)return;i=!0}this._popStateInProgress&&!i||(B(this,SN,CN).call(this,{dest:t,hash:r,page:n,rotation:this.linkService.rotation},i),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(e){if(this._initialized){if(!B(this,SN,TN).call(this,e)){console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`);return}this._destination?.page!==e&&(this._popStateInProgress||(B(this,SN,CN).call(this,{dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||B(this,SN,wN).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;let e=window.history.state;B(this,SN,EN).call(this,e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;let e=window.history.state;B(this,SN,EN).call(this,e)&&e.uid0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}};xN=new WeakMap,SN=new WeakSet,CN=function(e,t=!1){let n=t||!this._destination,r={fingerprint:this._fingerprint,uid:n?this._uid:this._uid+1,destination:e};B(this,SN,DN).call(this,e,r.uid);let i;if(this._updateUrl&&e!=null&&e.hash){let t=document.location.href.split(`#`,1)[0];t.startsWith(`file://`)||(i=`${t}#${e.hash}`)}n?window.history.replaceState(r,``,i):window.history.pushState(r,``,i)},wN=function(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination){B(this,SN,CN).call(this,t);return}if(this._destination.temporary){B(this,SN,CN).call(this,t,!0);return}if(this._destination.hash===t.hash||!this._destination.page&&this._numPositionUpdates<=vN)return;let n=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(this._destination.dest!==void 0||!this._destination.first)return;n=!0}B(this,SN,CN).call(this,t,n)},TN=function(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount},EN=function(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint)if(t){if(typeof e.fingerprint!=`string`||e.fingerprint.length!==this._fingerprint.length)return!1;let[t]=performance.getEntriesByType(`navigation`);if(t?.type!==`reload`)return!1}else return!1;return!(!Number.isInteger(e.uid)||e.uid<0||e.destination===null||typeof e.destination!=`object`)},DN=function(e,t,n=!1){this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),n&&e!=null&&e.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0},ON=function(e=!1){let t=unescape(bN()).substring(1),n=ZO(t),r=n.get(`nameddest`)||``,i=n.get(`page`)|0;return(!B(this,SN,TN).call(this,i)||e&&r.length>0)&&(i=null),{hash:t,page:i,rotation:this.linkService.rotation}},kN=function({location:e}){this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||B(this,SN,wN).call(this,!0),this._updateViewareaTimeout=null},yN))},AN=function({state:e}){let t=bN(),n=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;let{hash:e,page:t,rotation:n}=B(this,SN,ON).call(this);B(this,SN,CN).call(this,{hash:e,page:t,rotation:n},!0);return}if(!B(this,SN,EN).call(this,e))return;this._popStateInProgress=!0,n&&(this._blockHashChange++,Oj({target:window,name:`hashchange`,delay:_N}).then(()=>{this._blockHashChange--}));let r=e.destination;B(this,SN,DN).call(this,r,e.uid,!0),ak(r.rotation)&&(this.linkService.rotation=r.rotation),r.dest?this.linkService.goToDestination(r.dest):r.hash?this.linkService.setHash(r.hash):r.page&&(this.linkService.page=r.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})},jN=function(){(!this._destination||this._destination.temporary)&&B(this,SN,wN).call(this)},MN=function(){if(L(this,xN))return;z(this,xN,new AbortController);let{signal:e}=L(this,xN);this.eventBus._on(`updateviewarea`,B(this,SN,kN).bind(this),{signal:e}),window.addEventListener(`popstate`,B(this,SN,AN).bind(this),{signal:e}),window.addEventListener(`pagehide`,B(this,SN,jN).bind(this),{signal:e})},NN=function(){var e;(e=L(this,xN))==null||e.abort(),z(this,xN,null)};function FN(e,t){return typeof e!=`string`||typeof t!=`string`?!1:e===t||ZO(e).get(`nameddest`)===t}function IN(e,t){function n(e,t){if(typeof e!=typeof t||Array.isArray(e)||Array.isArray(t))return!1;if(typeof e==`object`&&e&&t!==null){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!n(e[r],t[r]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!(Array.isArray(e)&&Array.isArray(t))||e.length!==t.length)return!1;for(let r=0,i=e.length;r1;(function(){(i||r)&&WN.set(`maxCanvasPixels`,5242880)})(),function(){r&&WN.set(`useSystemFonts`,!1)}()}var $={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},GN={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},KN={allowedGlobalEvents:{value:null,kind:$.BROWSER},canvasMaxAreaInBytes:{value:-1,kind:$.BROWSER+$.API},isInAutomation:{value:!1,kind:$.BROWSER},localeProperties:{value:{lang:navigator.language||`en-US`},kind:$.BROWSER},nimbusDataStr:{value:``,kind:$.BROWSER},supportsCaretBrowsingMode:{value:!1,kind:$.BROWSER},supportsDocumentFonts:{value:!0,kind:$.BROWSER},supportsIntegratedFind:{value:!1,kind:$.BROWSER},supportsMouseWheelZoomCtrlKey:{value:!0,kind:$.BROWSER},supportsMouseWheelZoomMetaKey:{value:!0,kind:$.BROWSER},supportsPinchToZoom:{value:!0,kind:$.BROWSER},toolbarDensity:{value:0,kind:$.BROWSER+$.EVENT_DISPATCH},altTextLearnMoreUrl:{value:``,kind:$.VIEWER+$.PREFERENCE},annotationEditorMode:{value:0,kind:$.VIEWER+$.PREFERENCE},annotationMode:{value:2,kind:$.VIEWER+$.PREFERENCE},cursorToolOnLoad:{value:0,kind:$.VIEWER+$.PREFERENCE},debuggerSrc:{value:`./debugger.mjs`,kind:$.VIEWER},defaultZoomDelay:{value:400,kind:$.VIEWER+$.PREFERENCE},defaultZoomValue:{value:``,kind:$.VIEWER+$.PREFERENCE},disableHistory:{value:!1,kind:$.VIEWER},disablePageLabels:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableAltText:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableAltTextModelDownload:{value:!0,kind:$.VIEWER+$.PREFERENCE+$.EVENT_DISPATCH},enableGuessAltText:{value:!0,kind:$.VIEWER+$.PREFERENCE+$.EVENT_DISPATCH},enableHighlightFloatingButton:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableNewAltTextWhenAddingImage:{value:!0,kind:$.VIEWER+$.PREFERENCE},enablePermissions:{value:!1,kind:$.VIEWER+$.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:$.VIEWER+$.PREFERENCE},enableScripting:{value:!0,kind:$.VIEWER+$.PREFERENCE},enableUpdatedAddImage:{value:!1,kind:$.VIEWER+$.PREFERENCE},externalLinkRel:{value:`noopener noreferrer nofollow`,kind:$.VIEWER},externalLinkTarget:{value:0,kind:$.VIEWER+$.PREFERENCE},highlightEditorColors:{value:`yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F`,kind:$.VIEWER+$.PREFERENCE},historyUpdateUrl:{value:!1,kind:$.VIEWER+$.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:$.VIEWER+$.PREFERENCE},imageResourcesPath:{value:`./images/`,kind:$.VIEWER},maxCanvasPixels:{value:2**25,kind:$.VIEWER},forcePageColors:{value:!1,kind:$.VIEWER+$.PREFERENCE},pageColorsBackground:{value:`Canvas`,kind:$.VIEWER+$.PREFERENCE},pageColorsForeground:{value:`CanvasText`,kind:$.VIEWER+$.PREFERENCE},pdfBugEnabled:{value:!1,kind:$.VIEWER+$.PREFERENCE},printResolution:{value:150,kind:$.VIEWER},sidebarViewOnLoad:{value:-1,kind:$.VIEWER+$.PREFERENCE},scrollModeOnLoad:{value:-1,kind:$.VIEWER+$.PREFERENCE},spreadModeOnLoad:{value:-1,kind:$.VIEWER+$.PREFERENCE},textLayerMode:{value:1,kind:$.VIEWER+$.PREFERENCE},viewOnLoad:{value:0,kind:$.VIEWER+$.PREFERENCE},cMapPacked:{value:!0,kind:$.API},cMapUrl:{value:`../web/cmaps/`,kind:$.API},disableAutoFetch:{value:!1,kind:$.API+$.PREFERENCE},disableFontFace:{value:!1,kind:$.API+$.PREFERENCE},disableRange:{value:!1,kind:$.API+$.PREFERENCE},disableStream:{value:!1,kind:$.API+$.PREFERENCE},docBaseUrl:{value:``,kind:$.API},enableHWA:{value:!0,kind:$.API+$.VIEWER+$.PREFERENCE},enableXfa:{value:!0,kind:$.API+$.PREFERENCE},fontExtraProperties:{value:!1,kind:$.API},isEvalSupported:{value:!0,kind:$.API},isOffscreenCanvasSupported:{value:!0,kind:$.API},maxImageSize:{value:-1,kind:$.API},pdfBug:{value:!1,kind:$.API},standardFontDataUrl:{value:`../web/standard_fonts/`,kind:$.API},useSystemFonts:{value:void 0,kind:$.API,type:GN.BOOLEAN+GN.UNDEFINED},verbosity:{value:1,kind:$.API},workerPort:{value:null,kind:$.WORKER},workerSrc:{value:`../build/pdf.worker.mjs`,kind:$.WORKER}};KN.defaultUrl={value:`compressed.tracemonkey-pldi-09.pdf`,kind:$.VIEWER},KN.sandboxBundleSrc={value:`../build/pdf.sandbox.mjs`,kind:$.VIEWER},KN.viewerCssTheme={value:0,kind:$.VIEWER+$.PREFERENCE},KN.enableFakeMLManager={value:!0,kind:$.VIEWER},KN.disablePreferences={value:!1,kind:$.VIEWER};var qN,JN=class{static get(e){return L(this,qN).get(e)}static getAll(e=null,t=!1){let n=Object.create(null);for(let r in KN){let i=KN[r];e&&!(e&i.kind)||(n[r]=t?i.value:L(this,qN).get(r))}return n}static set(e,t){this.setAll({[e]:t})}static setAll(e,t=!1){this._hasInvokedSet||=!0;let n;for(let r in e){let i=KN[r],a=e[r];if(!i||!(typeof a==typeof i.value||GN[(typeof a).toUpperCase()]&i.type))continue;let{kind:o}=i;t&&!(o&$.BROWSER||o&$.PREFERENCE)||(this.eventBus&&o&$.EVENT_DISPATCH&&(n||=new Map).set(r,a),L(this,qN).set(r,a))}if(n)for(let[e,t]of n)this.eventBus.dispatch(e.toLowerCase(),{source:this,value:t})}};qN=new WeakMap,I(JN,`eventBus`),R(JN,qN,new Map),(()=>{for(let e in KN)L(JN,qN).set(e,KN[e].value);for(let[e,t]of WN)L(JN,qN).set(e,t);JN._hasInvokedSet=!1,JN._checkDisablePreferences=()=>JN.get(`disablePreferences`)?!0:(JN._hasInvokedSet&&console.warn(`The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.`),!1)})();var YN=JN,XN,ZN=class{constructor(e){R(this,XN,null),this.pageIndex=e.pageIndex}async render(e=`display`){e!==`display`||L(this,XN)||this._cancelled||z(this,XN,new zA({pageIndex:this.pageIndex}))}cancel(){this._cancelled=!0,L(this,XN)&&(L(this,XN).destroy(),z(this,XN,null))}setParent(e){var t;(t=L(this,XN))==null||t.setParent(e)}getDrawLayer(){return L(this,XN)}};XN=new WeakMap;var QN={Document:null,DocumentFragment:null,Part:`group`,Sect:`group`,Div:`group`,Aside:`note`,NonStruct:`none`,P:null,H:`heading`,Title:null,FENote:`note`,Sub:`group`,Lbl:null,Span:null,Em:null,Strong:null,Link:`link`,Annot:`note`,Form:`form`,Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:`list`,LI:`listitem`,LBody:null,Table:`table`,TR:`row`,TH:`columnheader`,TD:`cell`,THead:`columnheader`,TBody:null,TFoot:null,Caption:null,Figure:`figure`,Formula:null,Artifact:null},$N=/^H(\d+)$/,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP=class{constructor(e,t){R(this,oP),R(this,eP),R(this,tP,null),R(this,nP),R(this,rP,new Map),R(this,iP),R(this,aP,null),z(this,eP,e.getStructTree()),z(this,iP,t)}async render(){var e;if(L(this,nP))return L(this,nP);let{promise:t,resolve:n,reject:r}=Promise.withResolvers();z(this,nP,t);try{z(this,tP,B(this,oP,lP).call(this,await L(this,eP)))}catch(e){r(e)}return z(this,eP,null),(e=L(this,tP))==null||e.classList.add(`structTree`),n(L(this,tP)),t}async getAriaAttributes(e){try{return await this.render(),L(this,rP).get(e)}catch{}return null}hide(){L(this,tP)&&!L(this,tP).hidden&&(L(this,tP).hidden=!0)}show(){var e;(e=L(this,tP))!=null&&e.hidden&&(L(this,tP).hidden=!1)}addElementsToTextLayer(){var e;if(L(this,aP)){for(let[t,n]of L(this,aP))(e=document.getElementById(t))==null||e.append(n);L(this,aP).clear(),z(this,aP,null)}}};eP=new WeakMap,tP=new WeakMap,nP=new WeakMap,rP=new WeakMap,iP=new WeakMap,aP=new WeakMap,oP=new WeakSet,sP=function(e,t){let{alt:n,id:r,lang:i}=e;if(n!==void 0){let r=!1,i=$O(n);for(let t of e.children)if(t.type===`annotation`){let e=L(this,rP).get(t.id);e||(e=new Map,L(this,rP).set(t.id,e)),e.set(`aria-label`,i),r=!0}r||t.setAttribute(`aria-label`,i)}r!==void 0&&t.setAttribute(`aria-owns`,r),i!==void 0&&t.setAttribute(`lang`,$O(i,!0))},cP=function(e,t){let{alt:n,bbox:r,children:i}=e,a=i?.[0];if(!L(this,iP)||!n||!r||a?.type!==`content`)return!1;let{id:o}=a;if(!o)return!1;t.setAttribute(`aria-owns`,o);let s=document.createElement(`span`);(L(this,aP)||z(this,aP,new Map)).set(o,s),s.setAttribute(`role`,`img`),s.setAttribute(`aria-label`,$O(n));let{pageHeight:c,pageX:l,pageY:u}=L(this,iP),d=`calc(var(--scale-factor)*`,{style:f}=s;return f.width=`${d}${r[2]-r[0]}px)`,f.height=`${d}${r[3]-r[1]}px)`,f.left=`${d}${r[0]-l}px)`,f.top=`${d}${c-r[3]+u}px)`,!0},lP=function(e){if(!e)return null;let t=document.createElement(`span`);if(`role`in e){let{role:n}=e,r=n.match($N);if(r?(t.setAttribute(`role`,`heading`),t.setAttribute(`aria-level`,r[1])):QN[n]&&t.setAttribute(`role`,QN[n]),n===`Figure`&&B(this,oP,cP).call(this,e,t))return t}if(B(this,oP,sP).call(this,e,t),e.children)if(e.children.length===1&&`id`in e.children[0])B(this,oP,sP).call(this,e.children[0],t);else for(let n of e.children)t.append(B(this,oP,lP).call(this,n));return t};var dP,fP,pP,mP,hP,gP,_P,vP,yP=class e{constructor(){R(this,_P),R(this,dP,!1),R(this,fP,null),R(this,pP,new Map),R(this,mP,new Map)}setTextMapping(e){z(this,fP,e)}enable(){if(L(this,dP))throw Error(`TextAccessibilityManager is already enabled.`);if(!L(this,fP))throw Error(`Text divs and strings have not been set.`);if(z(this,dP,!0),z(this,fP,L(this,fP).slice()),L(this,fP).sort(B(e,hP,gP)),L(this,pP).size>0){let e=L(this,fP);for(let[t,n]of L(this,pP)){if(!document.getElementById(t)){L(this,pP).delete(t);continue}B(this,_P,vP).call(this,t,e[n])}}for(let[e,t]of L(this,mP))this.addPointerInTextLayer(e,t);L(this,mP).clear()}disable(){L(this,dP)&&(L(this,mP).clear(),z(this,fP,null),z(this,dP,!1))}removePointerInTextLayer(e){if(!L(this,dP)){L(this,mP).delete(e);return}let t=L(this,fP);if(!t||t.length===0)return;let{id:n}=e,r=L(this,pP).get(n);if(r===void 0)return;let i=t[r];L(this,pP).delete(n);let a=i.getAttribute(`aria-owns`);a!=null&&a.includes(n)&&(a=a.split(` `).filter(e=>e!==n).join(` `),a?i.setAttribute(`aria-owns`,a):(i.removeAttribute(`aria-owns`),i.setAttribute(`role`,`presentation`)))}addPointerInTextLayer(t,n){let{id:r}=t;if(!r)return null;if(!L(this,dP))return L(this,mP).set(t,n),null;n&&this.removePointerInTextLayer(t);let i=L(this,fP);if(!i||i.length===0)return null;let a=ek(i,n=>{var r;return B(r=e,hP,gP).call(r,t,n)<0}),o=Math.max(0,a-1),s=i[o];B(this,_P,vP).call(this,r,s),L(this,pP).set(r,o);let c=s.parentNode;return c!=null&&c.classList.contains(`markedContent`)?c.id:null}moveElementInDOM(t,n,r,i){let a=this.addPointerInTextLayer(r,i);if(!t.hasChildNodes())return t.append(n),a;let o=Array.from(t.childNodes).filter(e=>e!==n);if(o.length===0)return a;let s=r||n,c=ek(o,t=>{var n;return B(n=e,hP,gP).call(n,s,t)<0});return c===0?o[0].before(n):o[c-1].after(n),a}};dP=new WeakMap,fP=new WeakMap,pP=new WeakMap,mP=new WeakMap,hP=new WeakSet,gP=function(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(n.width===0&&n.height===0)return 1;if(r.width===0&&r.height===0)return-1;let i=n.y,a=n.y+n.height,o=n.y+n.height/2,s=r.y,c=r.y+r.height,l=r.y+r.height/2;return o<=s&&l>=a?-1:l<=i&&o>=c?1:n.x+n.width/2-(r.x+r.width/2)},_P=new WeakSet,vP=function(e,t){let n=t.getAttribute(`aria-owns`);n!=null&&n.includes(e)||t.setAttribute(`aria-owns`,n?`${n} ${e}`:e),t.removeAttribute(`role`)},R(yP,hP);var bP=yP,xP,SP=class{constructor({findController:e,eventBus:t,pageIndex:n}){R(this,xP,null),this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=n,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw Error(`Text divs and strings have not been set.`);if(this.enabled)throw Error(`TextHighlighter is already enabled.`);this.enabled=!0,L(this,xP)||(z(this,xP,new AbortController),this.eventBus._on(`updatetextlayermatches`,e=>{(e.pageIndex===this.pageIdx||e.pageIndex===-1)&&this._updateMatches()},{signal:L(this,xP).signal})),this._updateMatches()}disable(){var e;this.enabled&&(this.enabled=!1,(e=L(this,xP))==null||e.abort(),z(this,xP,null),this._updateMatches(!0))}_convertMatches(e,t){if(!e)return[];let{textContentItemsStr:n}=this,r=0,i=0,a=n.length-1,o=[];for(let s=0,c=e.length;s=i+n[r].length;)i+=n[r].length,r++;r===n.length&&console.error(`Could not find a matching mapping`);let l={begin:{divIdx:r,offset:c-i}};for(c+=t[s];r!==a&&c>i+n[r].length;)i+=n[r].length,r++;l.end={divIdx:r,offset:c-i},o.push(l)}return o}_renderMatches(e){if(e.length===0)return;let{findController:t,pageIdx:n}=this,{textContentItemsStr:r,textDivs:i}=this,a=n===t.selected.pageIdx,o=t.selected.matchIdx,s=t.state.highlightAll,c=null,l={divIdx:-1,offset:void 0};function u(e,t){let n=e.divIdx;return i[n].textContent=``,d(n,0,e.offset,t)}function d(e,t,n,a){let o=i[e];if(o.nodeType===Node.TEXT_NODE){let t=document.createElement(`span`);o.before(t),t.append(o),i[e]=t,o=t}let s=r[e].substring(t,n),c=document.createTextNode(s);if(a){let e=document.createElement(`span`);if(e.className=`${a} appended`,e.append(c),o.append(e),a.includes(`selected`)){let{left:t}=e.getClientRects()[0];return t-o.getBoundingClientRect().left}return 0}return o.append(c),0}let f=o,p=f+1;if(s)f=0,p=e.length;else if(!a)return;let m=-1,h=-1;for(let r=f;r{n.classList.add(`selecting`)}),n.addEventListener(`copy`,e=>{if(!L(this,CP)){let t=document.getSelection();e.clipboardData.setData(`text/plain`,$O($A(t.toString())))}dj(e)}),L(PP,DP).set(n,e),B(t=PP,jP,NP).call(t)},jP=new WeakSet,MP=function(e){var t;L(this,DP).delete(e),L(this,DP).size===0&&((t=L(this,OP))==null||t.abort(),z(this,OP,null))},NP=function(){if(L(this,OP))return;z(this,OP,new AbortController);let{signal:e}=L(this,OP),t=(e,t)=>{t.append(e),e.style.width=``,e.style.height=``,t.classList.remove(`selecting`)},n=!1;document.addEventListener(`pointerdown`,()=>{n=!0},{signal:e}),document.addEventListener(`pointerup`,()=>{n=!1,L(this,DP).forEach(t)},{signal:e}),window.addEventListener(`blur`,()=>{n=!1,L(this,DP).forEach(t)},{signal:e}),document.addEventListener(`keyup`,()=>{n||L(this,DP).forEach(t)},{signal:e});var r,i;document.addEventListener(`selectionchange`,()=>{let e=document.getSelection();if(e.rangeCount===0){L(this,DP).forEach(t);return}let n=new Set;for(let t=0;t{t===this._optionalContentConfigPromise&&(L(this,$P).initialOptionalContent=e.hasInitialVisibility)}),e.l10n||this.l10n.translate(this.div)}}get renderingState(){return L(this,ZP)}set renderingState(e){if(e!==L(this,ZP))switch(z(this,ZP,e),L(this,GP)&&(clearTimeout(L(this,GP)),z(this,GP,null)),e){case WO.PAUSED:this.div.classList.remove(`loading`);break;case WO.RUNNING:this.div.classList.add(`loadingIcon`),z(this,GP,setTimeout(()=>{this.div.classList.add(`loading`),z(this,GP,null)},0));break;case WO.INITIAL:case WO.FINISHED:this.div.classList.remove(`loadingIcon`,`loading`);break}}setPdfPage(e){var t,n;this._isStandalone&&(this.pageColors?.foreground===`CanvasText`||this.pageColors?.background===`Canvas`)&&((t=this._container)==null||t.style.setProperty(`--hcm-highlight-filter`,e.filterFactory.addHighlightHCMFilter(`highlight`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`)),(n=this._container)==null||n.style.setProperty(`--hcm-highlight-selected-filter`,e.filterFactory.addHighlightHCMFilter(`highlight_selected`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`))),this.pdfPage=e,this.pdfPageRotate=e.rotate;let r=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*sj.PDF_TO_CSS_UNITS,rotation:r}),B(this,tF,rF).call(this),this.reset()}destroy(){var e;this.reset(),(e=this.pdfPage)==null||e.cleanup()}hasEditableAnnotations(){var e;return!!((e=this.annotationLayer)!=null&&e.hasEditableAnnotations())}get _textHighlighter(){return uj(this,`_textHighlighter`,new SP({pageIndex:this.id-1,eventBus:this.eventBus,findController:L(this,WP).findController}))}reset({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1,keepCanvasWrapper:i=!1}={}){var a;this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:t,keepXfaLayer:n,keepTextLayer:r}),this.renderingState=WO.INITIAL;let o=this.div,s=o.childNodes,c=e&&this.annotationLayer?.div||null,l=t&&this.annotationEditorLayer?.div||null,u=n&&this.xfaLayer?.div||null,d=r&&this.textLayer?.div||null,f=i&&L(this,BP)||null;for(let e=s.length-1;e>=0;e--){let t=s[e];switch(t){case c:case l:case u:case d:case f:continue}t.remove();let n=L(this,eF).indexOf(t);n>=0&&(L(this,eF)[n]=null)}o.removeAttribute(`data-loaded`),c&&this.annotationLayer.hide(),l&&this.annotationEditorLayer.hide(),u&&this.xfaLayer.hide(),d&&this.textLayer.hide(),(a=this.structTreeLayer)==null||a.hide(),!i&&L(this,BP)&&(z(this,BP,null),B(this,tF,fF).call(this))}toggleEditingMode(e){this.hasEditableAnnotations()&&(z(this,UP,e),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0}))}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:n=null,drawingDelay:r=-1}){var i;this.scale=e||this.scale,typeof t==`number`&&(this.rotation=t),n instanceof Promise&&(this._optionalContentConfigPromise=n,n.then(e=>{n===this._optionalContentConfigPromise&&(L(this,$P).initialOptionalContent=e.hasInitialVisibility)})),L(this,$P).directDrawing=!0;let a=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*sj.PDF_TO_CSS_UNITS,rotation:a}),B(this,tF,rF).call(this),this._isStandalone&&((i=this._container)==null||i.style.setProperty(`--scale-factor`,this.viewport.scale)),this.canvas){let e=!1;if(L(this,HP)){if(this.maxCanvasPixels===0)e=!0;else if(this.maxCanvasPixels>0){let{width:t,height:n}=this.viewport,{sx:r,sy:i}=this.outputScale;e=(Math.floor(t)*r|0)*(Math.floor(n)*i|0)>this.maxCanvasPixels}}let t=r>=0&&r<1e3;if(t||e){if(t&&!e&&this.renderingState!==WO.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:r}),this.renderingState=WO.FINISHED,L(this,$P).directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t}),t)return;this.eventBus.dispatch(`pagerendered`,{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:L(this,XP)});return}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1,cancelExtraDelay:i=0}={}){var a;this.renderTask&&=(this.renderTask.cancel(i),null),this.resume=null,this.textLayer&&(!r||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!e||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)&&(this.drawLayer&&=(this.drawLayer.cancel(),null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!n||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,(a=this._textHighlighter)==null||a.disable())}cssTransform({redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:t=!1,redrawXfaLayer:n=!1,redrawTextLayer:r=!1,hideTextLayer:i=!1}){var a;let{canvas:o}=this;if(!o)return;let s=L(this,KP);if(this.viewport!==s){let e=(360+this.viewport.rotation-s.rotation)%360;if(e===90||e===270){let{width:t,height:n}=this.viewport,r=n/t,i=t/n;o.style.transform=`rotate(${e}deg) scale(${r},${i})`}else o.style.transform=e===0?``:`rotate(${e}deg)`}e&&this.annotationLayer&&B(this,tF,aF).call(this),t&&this.annotationEditorLayer&&(this.drawLayer&&B(this,tF,sF).call(this),B(this,tF,oF).call(this)),n&&this.xfaLayer&&B(this,tF,cF).call(this),this.textLayer&&(i?(this.textLayer.hide(),(a=this.structTreeLayer)==null||a.hide()):r&&B(this,tF,lF).call(this))}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}async draw(){this.renderingState!==WO.INITIAL&&(console.error(`Must be in new state before drawing`),this.reset());let{div:e,l10n:t,pageColors:n,pdfPage:r,viewport:i}=this;if(!r)throw this.renderingState=WO.FINISHED,Error(`pdfPage is not loaded`);this.renderingState=WO.RUNNING;let a=L(this,BP);if(a||(a=z(this,BP,document.createElement(`div`)),a.classList.add(`canvasWrapper`),B(this,tF,nF).call(this,a,`canvasWrapper`)),!this.textLayer&&L(this,QP)!==KO.DISABLE&&!r.isPureXfa&&(this._accessibilityManager||=new bP,this.textLayer=new FP({pdfPage:r,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:L(this,QP)===KO.ENABLE_PERMISSIONS,onAppend:e=>{this.l10n.pause(),B(this,tF,nF).call(this,e,`textLayer`),this.l10n.resume()}})),!this.annotationLayer&&L(this,zP)!==PA.DISABLE){let{annotationStorage:e,annotationEditorUIManager:t,downloadManager:n,enableScripting:i,fieldObjectsPromise:a,hasJSActionsPromise:o,linkService:s}=L(this,WP);this._annotationCanvasMap||=new Map,this.annotationLayer=new Cj({pdfPage:r,annotationStorage:e,imageResourcesPath:this.imageResourcesPath,renderForms:L(this,zP)===PA.ENABLE_FORMS,linkService:s,downloadManager:n,enableScripting:i,hasJSActionsPromise:o,fieldObjectsPromise:a,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:t,onAppend:e=>{B(this,tF,nF).call(this,e,`annotationLayer`)}})}let o=e=>{if(p?.(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=WO.PAUSED,this.resume=()=>{this.renderingState=WO.RUNNING,e()};return}e()},{width:s,height:c}=i,l=document.createElement(`canvas`);l.setAttribute(`role`,`presentation`);let u=!!(n!=null&&n.background&&n!=null&&n.foreground),d=this.canvas,f=!d&&!u;this.canvas=l,z(this,KP,i);let p=e=>{if(f){a.prepend(l),p=null;return}e&&(d?(d.replaceWith(l),d.width=d.height=0):a.prepend(l),p=null)},m=l.getContext(`2d`,{alpha:!1,willReadFrequently:!L(this,VP)}),h=this.outputScale=new tj;if(this.maxCanvasPixels===0){let e=1/this.scale;h.sx*=e,h.sy*=e,z(this,HP,!0)}else if(this.maxCanvasPixels>0){let e=s*c,t=Math.sqrt(this.maxCanvasPixels/e);h.sx>t||h.sy>t?(h.sx=t,h.sy=t,z(this,HP,!0)):z(this,HP,!1)}let g=tk(h.sx),_=tk(h.sy),v=l.width=nk(vk(s*h.sx),g[0]),y=l.height=nk(vk(c*h.sy),_[0]),b=nk(vk(s),g[1]),x=nk(vk(c),_[1]);h.sx=v/b,h.sy=y/x,L(this,JP)!==g[1]&&(e.style.setProperty(`--scale-round-x`,`${g[1]}px`),z(this,JP,g[1])),L(this,YP)!==_[1]&&(e.style.setProperty(`--scale-round-y`,`${_[1]}px`),z(this,YP,_[1]));let S={canvasContext:m,transform:h.scaled?[h.sx,0,0,h.sy,0,0]:null,viewport:i,annotationMode:L(this,zP),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:n,isEditing:L(this,UP)},C=this.renderTask=r.render(S);C.onContinue=o;let w=C.promise.then(async()=>{p?.(!0),await B(this,tF,pF).call(this,C),this.structTreeLayer||=new uP(r,i.rawDims),B(this,tF,lF).call(this),this.annotationLayer&&await B(this,tF,aF).call(this);let{annotationEditorUIManager:e}=L(this,WP);e&&(this.drawLayer||=new ZN({pageIndex:this.id}),await B(this,tF,sF).call(this),this.drawLayer.setParent(a),this.annotationEditorLayer||=new UN({uiManager:e,pdfPage:r,l10n:t,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:e=>{B(this,tF,nF).call(this,e,`annotationEditorLayer`)}}),B(this,tF,oF).call(this))},e=>(e instanceof cj?(d?.remove(),B(this,tF,fF).call(this)):p?.(!0),B(this,tF,pF).call(this,C,e)));if(r.isPureXfa){if(!this.xfaLayer){let{annotationStorage:e,linkService:t}=L(this,WP);this.xfaLayer=new IP({pdfPage:r,annotationStorage:e,linkService:t})}B(this,tF,cF).call(this)}return e.setAttribute(`data-loaded`,!0),this.eventBus.dispatch(`pagerender`,{source:this,pageNumber:this.id}),w}setPageLabel(e){this.pageLabel=typeof e==`string`?e:null,this.div.setAttribute(`data-l10n-args`,JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel===null?this.div.removeAttribute(`data-page-label`):this.div.setAttribute(`data-page-label`,this.pageLabel)}get thumbnailCanvas(){let{directDrawing:e,initialOptionalContent:t,regularAnnotations:n}=L(this,$P);return e&&t&&n?this.canvas:null}};zP=new WeakMap,BP=new WeakMap,VP=new WeakMap,HP=new WeakMap,UP=new WeakMap,WP=new WeakMap,GP=new WeakMap,KP=new WeakMap,qP=new WeakMap,JP=new WeakMap,YP=new WeakMap,XP=new WeakMap,ZP=new WeakMap,QP=new WeakMap,$P=new WeakMap,eF=new WeakMap,tF=new WeakSet,nF=function(e,t){let n=RP.get(t),r=L(this,eF)[n];if(L(this,eF)[n]=e,r){r.replaceWith(e);return}for(let t=n-1;t>=0;t--){let n=L(this,eF)[t];if(n){n.after(e);return}}this.div.prepend(e)},rF=function(){let{viewport:e}=this;if(this.pdfPage){if(L(this,qP)===e.rotation)return;z(this,qP,e.rotation)}lj(this.div,e,!0,!1)},iF=function(e,t){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:t})},aF=async function(){let e=null;try{await this.annotationLayer.render(this.viewport,{structTreeLayer:this.structTreeLayer},`display`)}catch(t){console.error(`#renderAnnotationLayer:`,t),e=t}finally{B(this,tF,iF).call(this,`annotationlayerrendered`,e)}},oF=async function(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,`display`)}catch(t){console.error(`#renderAnnotationEditorLayer:`,t),e=t}finally{B(this,tF,iF).call(this,`annotationeditorlayerrendered`,e)}},sF=async function(){try{await this.drawLayer.render(`display`)}catch(e){console.error(`#renderDrawLayer:`,e)}},cF=async function(){var e;let t=null;try{let e=await this.xfaLayer.render(this.viewport,`display`);e!=null&&e.textDivs&&this._textHighlighter&&B(this,tF,dF).call(this,e.textDivs)}catch(e){console.error(`#renderXfaLayer:`,e),t=e}finally{(e=this.xfaLayer)!=null&&e.div&&(this.l10n.pause(),B(this,tF,nF).call(this,this.xfaLayer.div,`xfaLayer`),this.l10n.resume()),B(this,tF,iF).call(this,`xfalayerrendered`,t)}},lF=async function(){if(!this.textLayer)return;let e=null;try{await this.textLayer.render(this.viewport)}catch(t){if(t instanceof OA)return;console.error(`#renderTextLayer:`,t),e=t}B(this,tF,iF).call(this,`textlayerrendered`,e),B(this,tF,uF).call(this)},uF=async function(){var e,t;if(!this.textLayer)return;let n=await this.structTreeLayer?.render();n&&(this.l10n.pause(),(e=this.structTreeLayer)==null||e.addElementsToTextLayer(),this.canvas&&n.parentNode!==this.canvas&&this.canvas.append(n),this.l10n.resume()),(t=this.structTreeLayer)==null||t.show()},dF=async function(e){let t=await this.pdfPage.getTextContent(),n=[];for(let e of t.items)n.push(e.str);this._textHighlighter.setTextMapping(e,n),this._textHighlighter.enable()},fF=function(){let{canvas:e}=this;e&&(e.remove(),e.width=e.height=0,this.canvas=null,z(this,KP,null))},pF=async function(e,t=null){if(e===this.renderTask&&(this.renderTask=null),t instanceof cj){z(this,XP,null);return}if(z(this,XP,t),this.renderingState=WO.FINISHED,L(this,$P).regularAnnotations=!e.separateAnnots,this.eventBus.dispatch(`pagerendered`,{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:L(this,XP)}),t)throw t};async function hF(e){let t=``.split(`#`,1)[0],{info:n,metadata:r,contentDispositionFilename:i,contentLength:a}=await e.getMetadata();if(!a){let{length:t}=await e.getDownloadInfo();a=t}return{...n,baseURL:t,filesize:a,filename:i||WA(``),metadata:r?.getRaw(),authors:r?.get(`dc:creator`),numPages:e.numPages,URL:``}}var gF=class{constructor(e){this._ready=new Promise((t,n)=>{Ef(()=>import(e).then(e=>{t(e.QuickJSSandbox())}),[]).catch(n)})}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){let t=await this._ready;setTimeout(()=>t.dispatchEvent(e),0)}async destroySandbox(){(await this._ready).nukeSandbox()}},_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF,NF,PF=class{constructor({eventBus:e,externalServices:t=null,docProperties:n=null}){R(this,OF),R(this,_F,null),R(this,vF,null),R(this,yF,null),R(this,bF,null),R(this,xF,null),R(this,SF,null),R(this,CF,null),R(this,wF,null),R(this,TF,!1),R(this,EF,null),R(this,DF,null),z(this,xF,e),z(this,SF,t),z(this,yF,n)}setViewer(e){z(this,wF,e)}async setDocument(e){if(L(this,CF)&&await B(this,OF,NF).call(this),z(this,CF,e),!e)return;let[t,n,r]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(!t&&!r){await B(this,OF,NF).call(this);return}if(e!==L(this,CF))return;try{z(this,EF,B(this,OF,MF).call(this))}catch(e){console.error(`setDocument:`,e),await B(this,OF,NF).call(this);return}let i=L(this,xF);z(this,bF,new AbortController);let{signal:a}=L(this,bF);i._on(`updatefromsandbox`,e=>{e?.source===window&&B(this,OF,kF).call(this,e.detail)},{signal:a}),i._on(`dispatcheventinsandbox`,e=>{var t;(t=L(this,EF))==null||t.dispatchEventInSandbox(e.detail)},{signal:a}),i._on(`pagechanging`,({pageNumber:e,previous:t})=>{e!==t&&(B(this,OF,jF).call(this,t),B(this,OF,AF).call(this,e))},{signal:a}),i._on(`pagerendered`,({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===L(this,wF).currentPageNumber&&B(this,OF,AF).call(this,e)},{signal:a}),i._on(`pagesdestroy`,async()=>{var e;await B(this,OF,jF).call(this,L(this,wF).currentPageNumber),await L(this,EF)?.dispatchEventInSandbox({id:`doc`,name:`WillClose`}),(e=L(this,_F))==null||e.resolve()},{signal:a});try{let a=await L(this,yF).call(this,e);if(e!==L(this,CF))return;await L(this,EF).createSandbox({objects:t,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...a,actions:r}}),i.dispatch(`sandboxcreated`,{source:this})}catch(e){console.error(`setDocument:`,e),await B(this,OF,NF).call(this);return}await L(this,EF)?.dispatchEventInSandbox({id:`doc`,name:`Open`}),await B(this,OF,AF).call(this,L(this,wF).currentPageNumber,!0),Promise.resolve().then(()=>{e===L(this,CF)&&z(this,TF,!0)})}async dispatchWillSave(){return L(this,EF)?.dispatchEventInSandbox({id:`doc`,name:`WillSave`})}async dispatchDidSave(){return L(this,EF)?.dispatchEventInSandbox({id:`doc`,name:`DidSave`})}async dispatchWillPrint(){if(L(this,EF)){await L(this,DF)?.promise,z(this,DF,Promise.withResolvers());try{await L(this,EF).dispatchEventInSandbox({id:`doc`,name:`WillPrint`})}catch(e){throw L(this,DF).resolve(),z(this,DF,null),e}await L(this,DF).promise}}async dispatchDidPrint(){return L(this,EF)?.dispatchEventInSandbox({id:`doc`,name:`DidPrint`})}get destroyPromise(){return L(this,vF)?.promise||null}get ready(){return L(this,TF)}get _pageOpenPending(){return uj(this,`_pageOpenPending`,new Set)}get _visitedPages(){return uj(this,`_visitedPages`,new Map)}};_F=new WeakMap,vF=new WeakMap,yF=new WeakMap,bF=new WeakMap,xF=new WeakMap,SF=new WeakMap,CF=new WeakMap,wF=new WeakMap,TF=new WeakMap,EF=new WeakMap,DF=new WeakMap,OF=new WeakSet,kF=async function(e){var t,n;let r=L(this,wF),i=r.isInPresentationMode||r.isChangingPresentationMode,{id:a,siblings:o,command:s,value:c}=e;if(!a){switch(s){case`clear`:console.clear();break;case`error`:console.error(c);break;case`layout`:i||(r.spreadMode=_k(c).spreadMode);break;case`page-num`:r.currentPageNumber=c+1;break;case`print`:await r.pagesPromise,L(this,xF).dispatch(`print`,{source:this});break;case`println`:console.log(c);break;case`zoom`:i||(r.currentScaleValue=c);break;case`SaveAs`:L(this,xF).dispatch(`download`,{source:this});break;case`FirstPage`:r.currentPageNumber=1;break;case`LastPage`:r.currentPageNumber=r.pagesCount;break;case`NextPage`:r.nextPage();break;case`PrevPage`:r.previousPage();break;case`ZoomViewIn`:i||r.increaseScale();break;case`ZoomViewOut`:i||r.decreaseScale();break;case`WillPrintFinished`:(t=L(this,DF))==null||t.resolve(),z(this,DF,null);break}return}if(i&&e.focus)return;delete e.id,delete e.siblings;let l=o?[a,...o]:[a];for(let t of l){let r=document.querySelector(`[data-element-id="${t}"]`);r?r.dispatchEvent(new CustomEvent(`updatefromsandbox`,{detail:e})):(n=L(this,CF))==null||n.annotationStorage.setValue(t,e)}},AF=async function(e,t=!1){let n=L(this,CF),r=this._visitedPages;if(t&&z(this,_F,Promise.withResolvers()),!L(this,_F))return;let i=L(this,wF).getPageView(e-1);if(i?.renderingState!==WO.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);let a=(async()=>{let t=await(r.has(e)?null:i.pdfPage?.getJSActions());n===L(this,CF)&&await L(this,EF)?.dispatchEventInSandbox({id:`page`,name:`PageOpen`,pageNumber:e,actions:t})})();r.set(e,a)},jF=async function(e){let t=L(this,CF),n=this._visitedPages;if(!L(this,_F)||this._pageOpenPending.has(e))return;let r=n.get(e);r&&(n.set(e,null),await r,t===L(this,CF)&&await L(this,EF)?.dispatchEventInSandbox({id:`page`,name:`PageClose`,pageNumber:e}))},MF=function(){if(z(this,vF,Promise.withResolvers()),L(this,EF))throw Error(`#initScripting: Scripting already exists.`);return L(this,SF).createScripting()},NF=async function(){var e,t,n,r;if(!L(this,EF)){z(this,CF,null),(e=L(this,vF))==null||e.resolve();return}L(this,_F)&&(await Promise.race([L(this,_F).promise,new Promise(e=>{setTimeout(e,1e3)})]).catch(()=>{}),z(this,_F,null)),z(this,CF,null);try{await L(this,EF).destroySandbox()}catch{}(t=L(this,DF))==null||t.reject(Error(`Scripting destroyed.`)),z(this,DF,null),(n=L(this,bF))==null||n.abort(),z(this,bF,null),this._pageOpenPending.clear(),this._visitedPages.clear(),z(this,EF,null),z(this,TF,!1),(r=L(this,vF))==null||r.resolve()};var FF=class extends PF{constructor(e){e.externalServices||window.addEventListener(`updatefromsandbox`,t=>{e.eventBus.dispatch(`updatefromsandbox`,{source:window,detail:t.detail})}),e.externalServices||={createScripting:()=>new gF(e.sandboxBundleSrc)},e.docProperties||=e=>hF(e),super(e)}};NO(3215);var IF=3e4,LF=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,`hasViewer`,{value:()=>!!this.pdfViewer})}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}renderHighestPriority(e){var t;this.idleTimeout&&=(clearTimeout(this.idleTimeout),null),!this.pdfViewer.forceRendering(e)&&(this.isThumbnailViewEnabled&&(t=this.pdfThumbnailViewer)!=null&&t.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),IF)))}getHighestPriority(e,t,n,r=!1){let i=e.views,a=i.length;if(a===0)return null;for(let e=0;ea){let r=e.ids;for(let e=1,i=s-o;e{this.renderHighestPriority()}).catch(e=>{e instanceof cj||console.error(`renderView:`,e)});break}return!0}},RF=10,zF={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function BF(e){return Object.values(jA).includes(e)&&e!==jA.DISABLE}var VF,HF,UF,WF,GF=class{constructor(e){R(this,UF),R(this,VF,new Set),R(this,HF,0),z(this,HF,e)}push(e){let t=L(this,VF);t.has(e)&&t.delete(e),t.add(e),t.size>L(this,HF)&&B(this,UF,WF).call(this)}resize(e,t=null){z(this,HF,e);let n=L(this,VF);if(t){let e=n.size,r=1;for(let i of n)if(t.has(i.id)&&(n.delete(i),n.add(i)),++r>e)break}for(;n.size>L(this,HF);)B(this,UF,WF).call(this)}has(e){return L(this,VF).has(e)}[Symbol.iterator](){return L(this,VF).keys()}};VF=new WeakMap,HF=new WeakMap,UF=new WeakSet,WF=function(){let e=L(this,VF).keys().next().value;e?.destroy(),L(this,VF).delete(e)};var KF,qF,JF,YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI,cI,lI,uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI,FI=class{constructor(e){R(this,vI),R(this,KF,null),R(this,qF,null),R(this,JF,null),R(this,YF,jA.NONE),R(this,XF,null),R(this,ZF,PA.ENABLE_FORMS),R(this,QF,null),R(this,$F,null),R(this,eI,!1),R(this,tI,!1),R(this,nI,!1),R(this,rI,!1),R(this,iI,!1),R(this,aI,null),R(this,oI,null),R(this,sI,null),R(this,cI,null),R(this,lI,!1),R(this,uI,null),R(this,dI,!1),R(this,fI,0),R(this,pI,new ResizeObserver(B(this,vI,NI).bind(this))),R(this,mI,null),R(this,hI,null),R(this,gI,!0),R(this,_I,KO.ENABLE);let t=`4.10.38`;if(_j!==t)throw Error(`The API version "${_j}" does not match the Viewer version "${t}".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,this.container?.tagName!==`DIV`||this.viewer?.tagName!==`DIV`)throw Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!==`absolute`)throw Error("The `container` must be absolutely positioned.");L(this,pI).observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new DA,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,z(this,qF,e.altTextManager||null),z(this,$F,e.editorUndoBar||null),this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e)),this._scriptingManager=e.scriptingManager||null,z(this,_I,e.textLayerMode??KO.ENABLE),z(this,ZF,e.annotationMode??PA.ENABLE_FORMS),z(this,YF,e.annotationEditorMode??jA.NONE),z(this,JF,e.annotationEditorHighlightColors||null),z(this,tI,e.enableHighlightFloatingButton===!0),z(this,rI,e.enableUpdatedAddImage===!0),z(this,iI,e.enableNewAltTextWhenAddingImage===!0),this.imageResourcesPath=e.imageResourcesPath||``,this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,this.maxCanvasPixels=e.maxCanvasPixels,this.l10n=e.l10n,this.l10n||=new gN,z(this,nI,e.enablePermissions||!1),this.pageColors=e.pageColors||null,z(this,oI,e.mlManager||null),z(this,eI,e.enableHWA||!1),z(this,gI,e.supportsPinchToZoom!==!1),this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new LF,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue;let{abortSignal:n}=e;n?.addEventListener(`abort`,()=>{L(this,pI).disconnect(),z(this,pI,null)},{once:!0}),this.scroll=XO(this.container,this._scrollUpdate.bind(this),n),this.presentationModeState=GO.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add(`removePageBorders`),B(this,vI,MI).call(this),this.eventBus._on(`thumbnailrendered`,({pageNumber:e,pdfPage:t})=>{let n=this._pages[e-1];L(this,KF).has(n)||t==null||t.cleanup()}),e.l10n||this.l10n.translate(this.container)}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(L(this,KF))}get pageViewsReady(){return this._pages.every(e=>e?.pdfPage)}get renderForms(){return L(this,ZF)===PA.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw Error(`Invalid page number.`);this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&B(this,vI,OI).call(this),!0;if(!(0=0&&(t=n+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale===BO?IO:this._currentScale}set currentScale(e){if(isNaN(e))throw Error(`Invalid numeric scale.`);this.pdfDocument&&B(this,vI,DI).call(this,e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&B(this,vI,DI).call(this,e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!ak(e))throw Error(`Invalid pages rotation angle.`);if(!this.pdfDocument||(e%=360,e<0&&(e+=360),this._pagesRotation===e))return;this._pagesRotation=e;let t=this._currentPageNumber;this.refresh(!0,{rotation:e}),this._currentScaleValue&&B(this,vI,DI).call(this,this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch(`rotationchanging`,{source:this,pagesRotation:e,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){let e=this;return uj(this,`_layerProperties`,{get annotationEditorUIManager(){return L(e,XF)},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}})}async getAllText(){let e=[],t=[];for(let n=1,r=this.pdfDocument.numPages;n<=r;++n){if(L(this,dI))return null;t.length=0;let{items:r}=await(await this.pdfDocument.getPage(n)).getTextContent();for(let e of r)e.str&&t.push(e.str),e.hasEOL&&t.push(` `);e.push($O(t.join(``)))}return e.join(` -`)}setDocument(e){var t,n,r;if(this.pdfDocument&&(this.eventBus.dispatch(`pagesdestroy`,{source:this}),this._cancelRendering(),this._resetView(),(t=this.findController)==null||t.setDocument(null),(n=this._scriptingManager)==null||n.setDocument(null),(r=L(this,XF))==null||r.destroy(),z(this,XF,null)),this.pdfDocument=e,!e)return;let i=e.numPages,a=e.getPage(1),o=e.getOptionalContentConfig({intent:`display`}),s=L(this,nI)?e.getPermissions():Promise.resolve(),{eventBus:c,pageColors:l,viewer:u}=this;z(this,aI,new AbortController);let{signal:d}=L(this,aI);if(i>zF.FORCE_SCROLL_MODE_PAGE){console.warn(`Forcing PAGE-scrolling for performance reasons, given the length of the document.`);let e=this._scrollMode=qO.PAGE;c.dispatch(`scrollmodechanged`,{source:this,mode:e})}this._pagesCapability.promise.then(()=>{c.dispatch(`pagesloaded`,{source:this,pagesCount:i})},()=>{}),c._on(`pagerender`,e=>{let t=this._pages[e.pageNumber-1];t&&L(this,KF).push(t)},{signal:d});let f=e=>{e.cssTransform||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),c._off(`pagerendered`,f))};c._on(`pagerendered`,f,{signal:d}),Promise.all([a,s]).then(([t,n])=>{var r,a;if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(t),this._optionalContentConfigPromise=o;let{annotationEditorMode:s,annotationMode:f,textLayerMode:p}=B(this,vI,yI).call(this,n);if(p!==KO.DISABLE){let e=z(this,uI,document.createElement(`div`));e.id=`hiddenCopyElement`,u.before(e)}if(typeof AbortSignal.any==`function`&&s!==jA.DISABLE){let t=s;e.isPureXfa?console.warn(`Warning: XFA-editing is not implemented.`):BF(t)?(z(this,XF,new MA(this.container,u,L(this,qF),c,e,l,L(this,JF),L(this,tI),L(this,rI),L(this,iI),L(this,oI),L(this,$F),L(this,gI))),c.dispatch(`annotationeditoruimanager`,{source:this,uiManager:L(this,XF)}),t!==jA.NONE&&(t===jA.STAMP&&((r=L(this,oI))==null||r.loadModel(`altText`)),L(this,XF).updateMode(t))):console.error(`Invalid AnnotationEditor mode: ${t}`)}let m=this._scrollMode===qO.PAGE?null:u,h=this.currentScale,g=t.getViewport({scale:h*sj.PDF_TO_CSS_UNITS});u.style.setProperty(`--scale-factor`,g.scale),l!=null&&l.background&&u.style.setProperty(`--page-bg-color`,l.background),(l?.foreground===`CanvasText`||l?.background===`Canvas`)&&(u.style.setProperty(`--hcm-highlight-filter`,e.filterFactory.addHighlightHCMFilter(`highlight`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`)),u.style.setProperty(`--hcm-highlight-selected-filter`,e.filterFactory.addHighlightHCMFilter(`highlight_selected`,`CanvasText`,`Canvas`,`HighlightText`,`ButtonText`)));for(let e=1;e<=i;++e){let t=new mF({container:m,eventBus:c,id:e,scale:h,defaultViewport:g.clone(),optionalContentConfigPromise:o,renderingQueue:this.renderingQueue,textLayerMode:p,annotationMode:f,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,pageColors:l,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:L(this,eI)});this._pages.push(t)}(a=this._pages[0])==null||a.setPdfPage(t),this._scrollMode===qO.PAGE?B(this,vI,SI).call(this):this._spreadMode!==JO.NONE&&this._updateSpreadMode(),B(this,vI,bI).call(this,d).then(async()=>{var t,n;if(e!==this.pdfDocument)return;if((t=this.findController)==null||t.setDocument(e),(n=this._scriptingManager)==null||n.setDocument(e),L(this,uI)&&document.addEventListener(`copy`,B(this,vI,xI).bind(this,p),{signal:d}),L(this,XF)&&c.dispatch(`annotationeditormodechanged`,{source:this,mode:L(this,YF)}),e.loadingParams.disableAutoFetch||i>zF.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let r=i-1;if(r<=0){this._pagesCapability.resolve();return}for(let t=2;t<=i;++t){let n=e.getPage(t).then(e=>{let n=this._pages[t-1];n.pdfPage||n.setPdfPage(e),--r===0&&this._pagesCapability.resolve()},e=>{console.error(`Unable to get page ${t} to initialize viewer`,e),--r===0&&this._pagesCapability.resolve()});t%zF.PAUSE_EAGER_PAGE_INIT===0&&await n}}),c.dispatch(`pagesinit`,{source:this}),e.getMetadata().then(({info:t})=>{e===this.pdfDocument&&t.Language&&(u.lang=t.Language)}),this.defaultRenderingQueue&&this.update()}).catch(e=>{console.error(`Unable to initialize viewer`,e),this._pagesCapability.reject(e)})}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error(`setPageLabels: Invalid page labels.`)):this._pageLabels=null;for(let e=0,t=this._pages.length;ethis.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){let e=this._scrollMode===qO.PAGE?L(this,mI).pages:this._pages,t=this._scrollMode===qO.HORIZONTAL,n=t&&this._isContainerRtl;return ik({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:n})}cleanup(){for(let e of this._pages)e.renderingState!==WO.FINISHED&&e.reset()}_cancelRendering(){for(let e of this._pages)e.cancelRendering()}forceRendering(e){let t=e||this._getVisiblePages(),n=B(this,vI,jI).call(this,t),r=this._spreadMode!==JO.NONE&&this._scrollMode!==qO.HORIZONTAL,i=this.renderingQueue.getHighestPriority(t,this._pages,n,r);return i?(B(this,vI,AI).call(this,i).then(()=>{this.renderingQueue.renderView(i)}),!0):!1}get hasEqualPageSizes(){let e=this._pages[0];for(let t=1,n=this._pages.length;t{let n=t.pdfPage.getViewport({scale:1}),r=ck(n);if(e===void 0)e=r;else if(this.enablePrintAutoRotate&&r!==e)return{width:n.height,height:n.width,rotation:(n.rotation-90)%360};return{width:n.width,height:n.height,rotation:n.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error(`optionalContentConfigPromise: Not initialized yet.`),this.pdfDocument.getOptionalContentConfig({intent:`display`})):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw Error(`Invalid optionalContentConfigPromise: ${e}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch(`optionalcontentconfigchanged`,{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!ok(e))throw Error(`Invalid scroll mode: ${e}`);this.pagesCount>zF.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch(`scrollmodechanged`,{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){let t=this._scrollMode,n=this.viewer;n.classList.toggle(`scrollHorizontal`,t===qO.HORIZONTAL),n.classList.toggle(`scrollWrapped`,t===qO.WRAPPED),!(!this.pdfDocument||!e)&&(t===qO.PAGE?B(this,vI,SI).call(this):this._previousScrollMode===qO.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&B(this,vI,DI).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!sk(e))throw Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch(`spreadmodechanged`,{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;let t=this.viewer,n=this._pages;if(this._scrollMode===qO.PAGE)B(this,vI,SI).call(this);else if(t.textContent=``,this._spreadMode===JO.NONE)for(let e of this._pages)t.append(e.div);else{let e=this._spreadMode-1,r=null;for(let i=0,a=n.length;i=0;t--){let r=n[t],i=n[t+1]-1;if(ri)return i-e}if(t){let t=n[0];if(te)return t-e+1}break}break}case qO.HORIZONTAL:break;case qO.PAGE:case qO.VERTICAL:{if(this._spreadMode===JO.NONE)break;let n=this._spreadMode-1;if(t&&e%2!==n||!t&&e%2===n)break;let{views:r}=this._getVisiblePages(),i=t?e-1:e+1;for(let{id:e,percent:t,widthPercent:n}of r)if(e===i){if(t>0&&n===100)return 2;break}break}}return 1}nextPage(){let e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;let n=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+n,t),!0}previousPage(){let e=this._currentPageNumber;if(e<=1)return!1;let t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}updateScale({drawingDelay:e,scaleFactor:t=null,steps:n=null,origin:r}){if(n===null&&t===null)throw Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let i=this._currentScale;if(t>0&&t!==1)i=Math.round(i*t*100)/100;else if(n){let e=n>0?LO:1/LO,t=n>0?Math.ceil:Math.floor;n=Math.abs(n);do i=t((i*e).toFixed(2)*10)/10;while(--n>0)}i=Math.max(RO,Math.min(zO,i)),B(this,vI,DI).call(this,i,{noScroll:!1,drawingDelay:e,origin:r})}increaseScale(e={}){this.updateScale({...e,steps:e.steps??1})}decreaseScale(e={}){this.updateScale({...e,steps:-(e.steps??1)})}get containerTopLeft(){return L(this,QF)||z(this,QF,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return L(this,XF)?L(this,YF):jA.DISABLE}set annotationEditorMode({mode:e,editId:t=null,isFromKeyboard:n=!1}){var r;if(!L(this,XF))throw Error(`The AnnotationEditor is not enabled.`);if(L(this,YF)===e)return;if(!BF(e))throw Error(`Invalid AnnotationEditor mode: ${e}`);if(!this.pdfDocument)return;e===jA.STAMP&&((r=L(this,oI))==null||r.loadModel(`altText`));let{eventBus:i}=this,a=()=>{B(this,vI,PI).call(this),z(this,YF,e),L(this,XF).updateMode(e,t,n),i.dispatch(`annotationeditormodechanged`,{source:this,mode:e})};if(e===jA.NONE||L(this,YF)===jA.NONE){let t=e!==jA.NONE;t||this.pdfDocument.annotationStorage.resetModifiedIds();for(let e of this._pages)e.toggleEditingMode(t);let n=B(this,vI,kI).call(this);if(t&&n){B(this,vI,PI).call(this),z(this,sI,new AbortController);let e=AbortSignal.any([L(this,aI).signal,L(this,sI).signal]);i._on(`pagerendered`,({pageNumber:e})=>{n.delete(e),n.size===0&&z(this,cI,setTimeout(a,0))},{signal:e});return}}a()}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(let e of this._pages)e.update(t);L(this,hI)!==null&&(clearTimeout(L(this,hI)),z(this,hI,null)),e||this.update()}}};KF=new WeakMap,qF=new WeakMap,JF=new WeakMap,YF=new WeakMap,XF=new WeakMap,ZF=new WeakMap,QF=new WeakMap,$F=new WeakMap,eI=new WeakMap,tI=new WeakMap,nI=new WeakMap,rI=new WeakMap,iI=new WeakMap,aI=new WeakMap,oI=new WeakMap,sI=new WeakMap,cI=new WeakMap,lI=new WeakMap,uI=new WeakMap,dI=new WeakMap,fI=new WeakMap,pI=new WeakMap,mI=new WeakMap,hI=new WeakMap,gI=new WeakMap,_I=new WeakMap,vI=new WeakSet,yI=function(e){let t={annotationEditorMode:L(this,YF),annotationMode:L(this,ZF),textLayerMode:L(this,_I)};return e&&(!e.includes(oj.COPY)&&L(this,_I)===KO.ENABLE&&(t.textLayerMode=KO.ENABLE_PERMISSIONS),e.includes(oj.MODIFY_CONTENTS)||(t.annotationEditorMode=jA.DISABLE),!e.includes(oj.MODIFY_ANNOTATIONS)&&!e.includes(oj.FILL_INTERACTIVE_FORMS)&&L(this,ZF)===PA.ENABLE_FORMS&&(t.annotationMode=PA.ENABLE)),t},bI=async function(e){if(document.visibilityState===`hidden`||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;let t=Promise.withResolvers(),n=new AbortController;document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&t.resolve()},{signal:typeof AbortSignal.any==`function`?AbortSignal.any([e,n.signal]):e}),await Promise.race([this._onePageRenderedCapability.promise,t.promise]),n.abort()},xI=function(e,t){let n=document.getSelection(),{focusNode:r,anchorNode:i}=n;if(i&&r&&n.containsNode(L(this,uI))){if(L(this,lI)||e===KO.ENABLE_PERMISSIONS){dj(t);return}z(this,lI,!0);let{classList:n}=this.viewer;n.add(`copyAll`);let r=new AbortController;window.addEventListener(`keydown`,e=>z(this,dI,e.key===`Escape`),{signal:r.signal}),this.getAllText().then(async e=>{e!==null&&await navigator.clipboard.writeText(e)}).catch(e=>{console.warn(`Something goes wrong when extracting the text: ${e.message}`)}).finally(()=>{z(this,lI,!1),z(this,dI,!1),r.abort(),n.remove(`copyAll`)}),dj(t)}},SI=function(){if(this._scrollMode!==qO.PAGE)throw Error(`#ensurePageViewVisible: Invalid scrollMode value.`);let e=this._currentPageNumber,t=L(this,mI),n=this.viewer;if(n.textContent=``,t.pages.length=0,this._spreadMode===JO.NONE&&!this.isInPresentationMode){let r=this._pages[e-1];n.append(r.div),t.pages.push(r)}else{let r=new Set,i=this._spreadMode-1;i===-1?r.add(e-1):e%2===i?(r.add(e-2),r.add(e-1)):(r.add(e-1),r.add(e));let a=document.createElement(`div`);if(a.className=`spread`,this.isInPresentationMode){let e=document.createElement(`div`);e.className=`dummyPage`,a.append(e)}for(let e of r){let n=this._pages[e];n&&(a.append(n.div),t.pages.push(n))}n.append(a)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e},CI=function(e,t=null){let{div:n,id:r}=e;if(this._currentPageNumber!==r&&this._setCurrentPageNumber(r),this._scrollMode===qO.PAGE&&(B(this,vI,SI).call(this),this.update()),!t&&!this.isInPresentationMode){let e=n.offsetLeft+n.clientLeft,r=e+n.clientWidth,{scrollLeft:i,clientWidth:a}=this.container;(this._scrollMode===qO.HORIZONTAL||ei+a)&&(t={left:0,top:0})}YO(n,t),!this._currentScaleValue&&this._location&&(this._location=null)},wI=function(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15},TI=function(e,t,{noScroll:n=!1,preset:r=!1,drawingDelay:i=-1,origin:a=null}){if(this._currentScaleValue=t.toString(),B(this,vI,wI).call(this,e)){r&&this.eventBus.dispatch(`scalechanging`,{source:this,scale:e,presetValue:t});return}this.viewer.style.setProperty(`--scale-factor`,e*sj.PDF_TO_CSS_UNITS);let o=i>=0&&i<1e3;this.refresh(!0,{scale:e,drawingDelay:o?i:-1}),o&&z(this,hI,setTimeout(()=>{z(this,hI,null),this.refresh()},i));let s=this._currentScale;if(this._currentScale=e,!n){let t=this._currentPageNumber,n;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(t=this._location.pageNumber,n=[null,{name:`XYZ`},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:t,destArray:n,allowNegativeOffset:!0}),Array.isArray(a)){let t=e/s-1,[n,r]=this.containerTopLeft;this.container.scrollLeft+=(a[0]-r)*t,this.container.scrollTop+=(a[1]-n)*t}}this.eventBus.dispatch(`scalechanging`,{source:this,scale:e,presetValue:r?t:void 0}),this.defaultRenderingQueue&&this.update()},EI=function(){return this._spreadMode!==JO.NONE&&this._scrollMode!==qO.HORIZONTAL?2:1},DI=function(e,t){let n=parseFloat(e);if(n>0)t.preset=!1,B(this,vI,TI).call(this,n,e,t);else{let r=this._pages[this._currentPageNumber-1];if(!r)return;let i=HO,a=UO;this.isInPresentationMode?(i=a=4,this._spreadMode!==JO.NONE&&(i*=2)):this.removePageBorders?i=a=0:this._scrollMode===qO.HORIZONTAL&&([i,a]=[a,i]);let o=(this.container.clientWidth-i)/r.width*r.scale/L(this,vI,EI),s=(this.container.clientHeight-a)/r.height*r.scale;switch(e){case`page-actual`:n=1;break;case`page-width`:n=o;break;case`page-height`:n=s;break;case`page-fit`:n=Math.min(o,s);break;case`auto`:let t=ck(r)?o:Math.min(s,o);n=Math.min(VO,t);break;default:console.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0,B(this,vI,TI).call(this,n,e,t)}},OI=function(){let e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&B(this,vI,DI).call(this,this._currentScaleValue,{noScroll:!0}),B(this,vI,CI).call(this,e)},kI=function(){let e=this._getVisiblePages(),t=[],{ids:n,views:r}=e;for(let e of r){let{view:r}=e;if(!r.hasEditableAnnotations()){n.delete(r.id);continue}t.push(e)}return t.length===0?null:(this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,ids:n}),n)},AI=async function(e){if(e.pdfPage)return e.pdfPage;try{let t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),t}catch(e){return console.error(`Unable to get page for page view`,e),null}},jI=function(e){if(e.first?.id===1)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case qO.PAGE:return L(this,mI).scrollDown;case qO.HORIZONTAL:return this.scroll.right}return this.scroll.down},MI=function(e=this.container.clientHeight){e!==L(this,fI)&&(z(this,fI,e),lk.setProperty(`--viewer-container-height`,`${e}px`))},NI=function(e){for(let t of e)if(t.target===this.container){B(this,vI,MI).call(this,Math.floor(t.borderBoxSize[0].blockSize)),z(this,QF,null);break}},PI=function(){var e;(e=L(this,sI))==null||e.abort(),z(this,sI,null),L(this,cI)!==null&&(clearTimeout(L(this,cI)),z(this,cI,null))};var II=class extends FI{_resetView(){super._resetView(),this._scrollMode=qO.PAGE,this._spreadMode=JO.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}};PO.AnnotationLayerBuilder,PO.DownloadManager,PO.EventBus,PO.FindState,PO.GenericL10n,PO.LinkTarget,PO.PDFFindController,PO.PDFHistory;var LI=PO.PDFLinkService;PO.PDFPageView,PO.PDFScriptingManager,PO.PDFSinglePageViewer,PO.PDFViewer,PO.ProgressBar,PO.RenderingStates,PO.ScrollMode,PO.SimpleLinkService,PO.SpreadMode,PO.StructTreeLayerBuilder,PO.TextLayerBuilder,PO.XfaLayerBuilder,PO.parseQueryString;var RI=[`id`],zI=[`id`],BI={key:0,class:`textLayer`},VI={key:1,class:`annotationLayer`},HI=nr({__name:`VuePdfEmbed`,props:{annotationLayer:{type:Boolean},height:{},id:{},imageResourcesPath:{},linkService:{},page:{},rotation:{default:0},scale:{default:1},source:{},textLayer:{type:Boolean},width:{}},emits:[`internal-link-clicked`,`loaded`,`loading-failed`,`password-requested`,`progress`,`rendered`,`rendering-failed`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=Zt([]),o=Xt([]),s=Zt(null),c=null,{doc:l,download:u,print:d}=AO({onError:e=>{a.value=[],i(`loading-failed`,e)},onPasswordRequest({callback:e,isWrongPassword:t}){i(`password-requested`,{callback:e,isWrongPassword:t})},onProgress:e=>{i(`progress`,e)},source:sn(r,`source`)}),f=Ua(()=>{if(!l.value||!r.annotationLayer)return null;if(r.linkService)return r.linkService;let e=new LI;return e.setDocument(l.value),e.setViewer({scrollPageIntoView:({pageNumber:e})=>{i(`internal-link-clicked`,e)}}),e}),p=e=>{let t,n;return r.height&&!r.width?(n=r.height,t=n/e):(t=r.width??s.value.clientWidth,n=t*e),[t,n]},m=async()=>{if(!(!l.value||c!=null&&c.isAborted))try{a.value=r.page?Array.isArray(r.page)?r.page:[r.page]:[...Array(l.value.numPages+1).keys()].slice(1),o.value=Array(a.value.length).fill(1),await Promise.all(a.value.map(async(e,t)=>{let n=await l.value.getPage(e);if(c!=null&&c.isAborted)return;let i=((r.rotation%90==0?r.rotation:0)+n.rotate)%360,[a,u,d]=Array.from(s.value.getElementsByClassName(`vue-pdf-embed__page`)[t].children),f=!!(i/90%2),m=n.view[2]-n.view[0],v=n.view[3]-n.view[1],[y,b]=p(f?m/v:v/m),x=`${Math.floor(y)}px`,S=`${Math.floor(b)}px`,C=y/(f?v:m),w=n.getViewport({scale:C,rotation:i});o.value[t]=C,a.style.display=`block`,a.style.width=x,a.style.height=S;let T=[h(n,w.clone({scale:w.scale*window.devicePixelRatio*r.scale}),a)];return r.textLayer&&T.push(_(n,w.clone({dontFlip:!0}),u)),r.annotationLayer&&T.push(g(n,w.clone({dontFlip:!0}),d||u)),Promise.all(T)})),c!=null&&c.isAborted||i(`rendered`)}catch(e){a.value=[],o.value=[],c!=null&&c.isAborted||i(`rendering-failed`,e)}},h=async(e,t,n)=>{n.width=t.width,n.height=t.height,await e.render({canvasContext:n.getContext(`2d`),viewport:t}).promise},g=async(e,t,n)=>{EO(n),await new _O({accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:n,page:e,structTreeLayer:null,viewport:t}).render({annotations:await e.getAnnotations(),div:n,imageResourcesPath:r.imageResourcesPath,linkService:f.value,page:e,renderForms:!1,viewport:t})},_=async(e,t,n)=>{EO(n),await new bO({container:n,textContentSource:await e.getTextContent(),viewport:t}).render()};return Jn(l,e=>{e&&i(`loaded`,e)},{immediate:!0}),Jn(()=>[l.value,r.annotationLayer,r.height,r.imageResourcesPath,r.page,r.rotation,r.scale,r.textLayer,r.width],async([e])=>{e&&(c&&(c.isAborted=!0,await c.promise),kO(s.value),c={isAborted:!1,promise:m()},await c.promise,c=null)},{immediate:!0}),br(()=>{kO(s.value)}),t({doc:l,download:u,print:(e,t,n=!1)=>d(e,t,n?void 0:r.page)}),(e,t)=>($i(),ia(`div`,{id:e.id,ref_key:`root`,ref:s,class:`vue-pdf-embed`},[($i(!0),ia(qi,null,jr(a.value,(n,r)=>($i(),ia(`div`,{key:n},[Mr(e.$slots,`before-page`,{page:n}),N(`div`,{id:e.id&&`${e.id}-${n}`,class:`vue-pdf-embed__page`,style:ce({"--scale-factor":o.value[r],position:`relative`})},[t[0]||=N(`canvas`,null,null,-1),e.textLayer?($i(),ia(`div`,BI)):ha(``,!0),e.annotationLayer?($i(),ia(`div`,VI)):ha(``,!0)],12,zI),Mr(e.$slots,`after-page`,{page:n})]))),128))],8,RI))}});window!=null&&window.Vue&&(window.VuePdfEmbed=HI,window.useVuePdfEmbed=AO),vO!=null&&vO.workerSrc||(vO.workerSrc=SO);var UI={class:`preview-container`},WI={class:`text-center mb-2`},GI={class:`pdf-render-wrapper`},KI={key:1,class:`loading-state text-center`,style:{padding:`3rem`}},qI={class:`modal-content`},JI={class:`modal-header`},YI=Ko({__name:`DocumentPreview`,props:{url:String,title:String},setup(e){let t=Xt(!1),n=Xt(!1),r=()=>{n.value=!0};return(i,a)=>($i(),ia(`div`,UI,[N(`div`,WI,[N(`h2`,null,be(e.title||`文档预览`),1),a[3]||=N(`p`,{style:{color:`var(--text-muted)`,"margin-top":`0.5rem`}},`当前展示前 2 页。`,-1)]),N(`div`,GI,[e.url?($i(),aa(en(HI),{key:0,source:e.url,class:`pdf-viewer`,onRendered:r},null,8,[`source`])):ha(``,!0),n.value?ha(``,!0):($i(),ia(`div`,KI,` 正在安全地解析文档... `))]),n.value?($i(),ia(`div`,{key:0,class:`blur-placeholder pointer`,onClick:a[0]||=e=>t.value=!0},[...a[4]||=[N(`div`,{class:`blur-content text-center`},[N(`h3`,{style:{"font-size":`1.8rem`,"margin-bottom":`0.5rem`,"text-shadow":`0 2px 10px rgba(0,0,0,0.8)`}},`完整文档已被锁定`),N(`p`,{style:{"text-shadow":`0 1px 5px rgba(0,0,0,0.8)`,"margin-bottom":`1.5rem`}},`请联系我们获取完整文档。`),N(`button`,{class:`btn btn-accent`,style:{"font-size":`1.1rem`,padding:`1rem 2rem`}},`立即联系我们`)],-1)]])):ha(``,!0),t.value?($i(),ia(`div`,{key:1,class:`modal-overlay`,onClick:a[2]||=zo(e=>t.value=!1,[`self`])},[N(`div`,qI,[N(`div`,JI,[a[5]||=N(`span`,{class:`modal-title`},`获取完整文档`,-1),N(`button`,{class:`modal-close`,onClick:a[1]||=e=>t.value=!1},`×`)]),a[6]||=N(`div`,{class:`modal-body`},[N(`iframe`,{src:`https://www.beiyuxing.tech/form-only/`,class:`modal-iframe`,title:`联系表单`})],-1)])])):ha(``,!0)]))}},[[`__scopeId`,`data-v-6ca9a707`]]),XI={key:0,class:`text-center`},ZI={key:1,class:`text-center`,style:{color:`#ef4444`}},QI=[{path:`/`,component:cf},{path:`/admin`,component:Sf},{path:`/preview/:id`,component:{__name:`Preview`,setup(e){let t=gs(),n=hs(),r=Xt(null),i=Xt(!0),a=Xt(``);_r(async()=>{try{let e=t.params.id,n=(await ef.get(`/api/documents/${e}`)).data;n.url&&n.url.startsWith(`/`)&&(n.url=`${n.url}`),r.value=n}catch{a.value=`文档未找到或无法访问。`}finally{i.value=!1}});let o=()=>{n.push(`/`)};return(e,t)=>($i(),ia(`div`,null,[N(`div`,{class:`mb-2`},[N(`button`,{class:`btn`,style:{background:`rgba(255,255,255,0.1)`,border:`1px solid var(--glass-border)`},onClick:o},` ← 返回列表 `)]),i.value?($i(),ia(`div`,XI,[...t[0]||=[N(`p`,null,`正在加载文档信息...`,-1)]])):a.value?($i(),ia(`div`,ZI,[N(`p`,null,be(a.value),1)])):($i(),aa(YI,{key:2,url:r.value.url,title:r.value.title},null,8,[`url`,`title`]))]))}},props:!0}],$I=rl({history:Sc(),routes:QI}),eL=Uo(Zo);eL.use($I),eL.mount(`#app`); \ No newline at end of file +`)}setDocument(e){var t,n,r;if(this.pdfDocument&&(this.eventBus.dispatch(`pagesdestroy`,{source:this}),this._cancelRendering(),this._resetView(),(t=this.findController)==null||t.setDocument(null),(n=this._scriptingManager)==null||n.setDocument(null),(r=L(this,XF))==null||r.destroy(),z(this,XF,null)),this.pdfDocument=e,!e)return;let i=e.numPages,a=e.getPage(1),o=e.getOptionalContentConfig({intent:`display`}),s=L(this,nI)?e.getPermissions():Promise.resolve(),{eventBus:c,pageColors:l,viewer:u}=this;z(this,aI,new AbortController);let{signal:d}=L(this,aI);if(i>zF.FORCE_SCROLL_MODE_PAGE){console.warn(`Forcing PAGE-scrolling for performance reasons, given the length of the document.`);let e=this._scrollMode=qO.PAGE;c.dispatch(`scrollmodechanged`,{source:this,mode:e})}this._pagesCapability.promise.then(()=>{c.dispatch(`pagesloaded`,{source:this,pagesCount:i})},()=>{}),c._on(`pagerender`,e=>{let t=this._pages[e.pageNumber-1];t&&L(this,KF).push(t)},{signal:d});let f=e=>{e.cssTransform||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),c._off(`pagerendered`,f))};c._on(`pagerendered`,f,{signal:d}),Promise.all([a,s]).then(([t,n])=>{var r,a;if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(t),this._optionalContentConfigPromise=o;let{annotationEditorMode:s,annotationMode:f,textLayerMode:p}=B(this,vI,yI).call(this,n);if(p!==KO.DISABLE){let e=z(this,uI,document.createElement(`div`));e.id=`hiddenCopyElement`,u.before(e)}if(typeof AbortSignal.any==`function`&&s!==jA.DISABLE){let t=s;e.isPureXfa?console.warn(`Warning: XFA-editing is not implemented.`):BF(t)?(z(this,XF,new MA(this.container,u,L(this,qF),c,e,l,L(this,JF),L(this,tI),L(this,rI),L(this,iI),L(this,oI),L(this,$F),L(this,gI))),c.dispatch(`annotationeditoruimanager`,{source:this,uiManager:L(this,XF)}),t!==jA.NONE&&(t===jA.STAMP&&((r=L(this,oI))==null||r.loadModel(`altText`)),L(this,XF).updateMode(t))):console.error(`Invalid AnnotationEditor mode: ${t}`)}let m=this._scrollMode===qO.PAGE?null:u,h=this.currentScale,g=t.getViewport({scale:h*sj.PDF_TO_CSS_UNITS});u.style.setProperty(`--scale-factor`,g.scale),l!=null&&l.background&&u.style.setProperty(`--page-bg-color`,l.background),(l?.foreground===`CanvasText`||l?.background===`Canvas`)&&(u.style.setProperty(`--hcm-highlight-filter`,e.filterFactory.addHighlightHCMFilter(`highlight`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`)),u.style.setProperty(`--hcm-highlight-selected-filter`,e.filterFactory.addHighlightHCMFilter(`highlight_selected`,`CanvasText`,`Canvas`,`HighlightText`,`ButtonText`)));for(let e=1;e<=i;++e){let t=new mF({container:m,eventBus:c,id:e,scale:h,defaultViewport:g.clone(),optionalContentConfigPromise:o,renderingQueue:this.renderingQueue,textLayerMode:p,annotationMode:f,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,pageColors:l,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:L(this,eI)});this._pages.push(t)}(a=this._pages[0])==null||a.setPdfPage(t),this._scrollMode===qO.PAGE?B(this,vI,SI).call(this):this._spreadMode!==JO.NONE&&this._updateSpreadMode(),B(this,vI,bI).call(this,d).then(async()=>{var t,n;if(e!==this.pdfDocument)return;if((t=this.findController)==null||t.setDocument(e),(n=this._scriptingManager)==null||n.setDocument(e),L(this,uI)&&document.addEventListener(`copy`,B(this,vI,xI).bind(this,p),{signal:d}),L(this,XF)&&c.dispatch(`annotationeditormodechanged`,{source:this,mode:L(this,YF)}),e.loadingParams.disableAutoFetch||i>zF.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let r=i-1;if(r<=0){this._pagesCapability.resolve();return}for(let t=2;t<=i;++t){let n=e.getPage(t).then(e=>{let n=this._pages[t-1];n.pdfPage||n.setPdfPage(e),--r===0&&this._pagesCapability.resolve()},e=>{console.error(`Unable to get page ${t} to initialize viewer`,e),--r===0&&this._pagesCapability.resolve()});t%zF.PAUSE_EAGER_PAGE_INIT===0&&await n}}),c.dispatch(`pagesinit`,{source:this}),e.getMetadata().then(({info:t})=>{e===this.pdfDocument&&t.Language&&(u.lang=t.Language)}),this.defaultRenderingQueue&&this.update()}).catch(e=>{console.error(`Unable to initialize viewer`,e),this._pagesCapability.reject(e)})}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error(`setPageLabels: Invalid page labels.`)):this._pageLabels=null;for(let e=0,t=this._pages.length;ethis.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){let e=this._scrollMode===qO.PAGE?L(this,mI).pages:this._pages,t=this._scrollMode===qO.HORIZONTAL,n=t&&this._isContainerRtl;return ik({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:n})}cleanup(){for(let e of this._pages)e.renderingState!==WO.FINISHED&&e.reset()}_cancelRendering(){for(let e of this._pages)e.cancelRendering()}forceRendering(e){let t=e||this._getVisiblePages(),n=B(this,vI,jI).call(this,t),r=this._spreadMode!==JO.NONE&&this._scrollMode!==qO.HORIZONTAL,i=this.renderingQueue.getHighestPriority(t,this._pages,n,r);return i?(B(this,vI,AI).call(this,i).then(()=>{this.renderingQueue.renderView(i)}),!0):!1}get hasEqualPageSizes(){let e=this._pages[0];for(let t=1,n=this._pages.length;t{let n=t.pdfPage.getViewport({scale:1}),r=ck(n);if(e===void 0)e=r;else if(this.enablePrintAutoRotate&&r!==e)return{width:n.height,height:n.width,rotation:(n.rotation-90)%360};return{width:n.width,height:n.height,rotation:n.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error(`optionalContentConfigPromise: Not initialized yet.`),this.pdfDocument.getOptionalContentConfig({intent:`display`})):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw Error(`Invalid optionalContentConfigPromise: ${e}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch(`optionalcontentconfigchanged`,{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!ok(e))throw Error(`Invalid scroll mode: ${e}`);this.pagesCount>zF.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch(`scrollmodechanged`,{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){let t=this._scrollMode,n=this.viewer;n.classList.toggle(`scrollHorizontal`,t===qO.HORIZONTAL),n.classList.toggle(`scrollWrapped`,t===qO.WRAPPED),!(!this.pdfDocument||!e)&&(t===qO.PAGE?B(this,vI,SI).call(this):this._previousScrollMode===qO.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&B(this,vI,DI).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!sk(e))throw Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch(`spreadmodechanged`,{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;let t=this.viewer,n=this._pages;if(this._scrollMode===qO.PAGE)B(this,vI,SI).call(this);else if(t.textContent=``,this._spreadMode===JO.NONE)for(let e of this._pages)t.append(e.div);else{let e=this._spreadMode-1,r=null;for(let i=0,a=n.length;i=0;t--){let r=n[t],i=n[t+1]-1;if(ri)return i-e}if(t){let t=n[0];if(te)return t-e+1}break}break}case qO.HORIZONTAL:break;case qO.PAGE:case qO.VERTICAL:{if(this._spreadMode===JO.NONE)break;let n=this._spreadMode-1;if(t&&e%2!==n||!t&&e%2===n)break;let{views:r}=this._getVisiblePages(),i=t?e-1:e+1;for(let{id:e,percent:t,widthPercent:n}of r)if(e===i){if(t>0&&n===100)return 2;break}break}}return 1}nextPage(){let e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;let n=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+n,t),!0}previousPage(){let e=this._currentPageNumber;if(e<=1)return!1;let t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}updateScale({drawingDelay:e,scaleFactor:t=null,steps:n=null,origin:r}){if(n===null&&t===null)throw Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let i=this._currentScale;if(t>0&&t!==1)i=Math.round(i*t*100)/100;else if(n){let e=n>0?LO:1/LO,t=n>0?Math.ceil:Math.floor;n=Math.abs(n);do i=t((i*e).toFixed(2)*10)/10;while(--n>0)}i=Math.max(RO,Math.min(zO,i)),B(this,vI,DI).call(this,i,{noScroll:!1,drawingDelay:e,origin:r})}increaseScale(e={}){this.updateScale({...e,steps:e.steps??1})}decreaseScale(e={}){this.updateScale({...e,steps:-(e.steps??1)})}get containerTopLeft(){return L(this,QF)||z(this,QF,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return L(this,XF)?L(this,YF):jA.DISABLE}set annotationEditorMode({mode:e,editId:t=null,isFromKeyboard:n=!1}){var r;if(!L(this,XF))throw Error(`The AnnotationEditor is not enabled.`);if(L(this,YF)===e)return;if(!BF(e))throw Error(`Invalid AnnotationEditor mode: ${e}`);if(!this.pdfDocument)return;e===jA.STAMP&&((r=L(this,oI))==null||r.loadModel(`altText`));let{eventBus:i}=this,a=()=>{B(this,vI,PI).call(this),z(this,YF,e),L(this,XF).updateMode(e,t,n),i.dispatch(`annotationeditormodechanged`,{source:this,mode:e})};if(e===jA.NONE||L(this,YF)===jA.NONE){let t=e!==jA.NONE;t||this.pdfDocument.annotationStorage.resetModifiedIds();for(let e of this._pages)e.toggleEditingMode(t);let n=B(this,vI,kI).call(this);if(t&&n){B(this,vI,PI).call(this),z(this,sI,new AbortController);let e=AbortSignal.any([L(this,aI).signal,L(this,sI).signal]);i._on(`pagerendered`,({pageNumber:e})=>{n.delete(e),n.size===0&&z(this,cI,setTimeout(a,0))},{signal:e});return}}a()}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(let e of this._pages)e.update(t);L(this,hI)!==null&&(clearTimeout(L(this,hI)),z(this,hI,null)),e||this.update()}}};KF=new WeakMap,qF=new WeakMap,JF=new WeakMap,YF=new WeakMap,XF=new WeakMap,ZF=new WeakMap,QF=new WeakMap,$F=new WeakMap,eI=new WeakMap,tI=new WeakMap,nI=new WeakMap,rI=new WeakMap,iI=new WeakMap,aI=new WeakMap,oI=new WeakMap,sI=new WeakMap,cI=new WeakMap,lI=new WeakMap,uI=new WeakMap,dI=new WeakMap,fI=new WeakMap,pI=new WeakMap,mI=new WeakMap,hI=new WeakMap,gI=new WeakMap,_I=new WeakMap,vI=new WeakSet,yI=function(e){let t={annotationEditorMode:L(this,YF),annotationMode:L(this,ZF),textLayerMode:L(this,_I)};return e&&(!e.includes(oj.COPY)&&L(this,_I)===KO.ENABLE&&(t.textLayerMode=KO.ENABLE_PERMISSIONS),e.includes(oj.MODIFY_CONTENTS)||(t.annotationEditorMode=jA.DISABLE),!e.includes(oj.MODIFY_ANNOTATIONS)&&!e.includes(oj.FILL_INTERACTIVE_FORMS)&&L(this,ZF)===PA.ENABLE_FORMS&&(t.annotationMode=PA.ENABLE)),t},bI=async function(e){if(document.visibilityState===`hidden`||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;let t=Promise.withResolvers(),n=new AbortController;document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&t.resolve()},{signal:typeof AbortSignal.any==`function`?AbortSignal.any([e,n.signal]):e}),await Promise.race([this._onePageRenderedCapability.promise,t.promise]),n.abort()},xI=function(e,t){let n=document.getSelection(),{focusNode:r,anchorNode:i}=n;if(i&&r&&n.containsNode(L(this,uI))){if(L(this,lI)||e===KO.ENABLE_PERMISSIONS){dj(t);return}z(this,lI,!0);let{classList:n}=this.viewer;n.add(`copyAll`);let r=new AbortController;window.addEventListener(`keydown`,e=>z(this,dI,e.key===`Escape`),{signal:r.signal}),this.getAllText().then(async e=>{e!==null&&await navigator.clipboard.writeText(e)}).catch(e=>{console.warn(`Something goes wrong when extracting the text: ${e.message}`)}).finally(()=>{z(this,lI,!1),z(this,dI,!1),r.abort(),n.remove(`copyAll`)}),dj(t)}},SI=function(){if(this._scrollMode!==qO.PAGE)throw Error(`#ensurePageViewVisible: Invalid scrollMode value.`);let e=this._currentPageNumber,t=L(this,mI),n=this.viewer;if(n.textContent=``,t.pages.length=0,this._spreadMode===JO.NONE&&!this.isInPresentationMode){let r=this._pages[e-1];n.append(r.div),t.pages.push(r)}else{let r=new Set,i=this._spreadMode-1;i===-1?r.add(e-1):e%2===i?(r.add(e-2),r.add(e-1)):(r.add(e-1),r.add(e));let a=document.createElement(`div`);if(a.className=`spread`,this.isInPresentationMode){let e=document.createElement(`div`);e.className=`dummyPage`,a.append(e)}for(let e of r){let n=this._pages[e];n&&(a.append(n.div),t.pages.push(n))}n.append(a)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e},CI=function(e,t=null){let{div:n,id:r}=e;if(this._currentPageNumber!==r&&this._setCurrentPageNumber(r),this._scrollMode===qO.PAGE&&(B(this,vI,SI).call(this),this.update()),!t&&!this.isInPresentationMode){let e=n.offsetLeft+n.clientLeft,r=e+n.clientWidth,{scrollLeft:i,clientWidth:a}=this.container;(this._scrollMode===qO.HORIZONTAL||ei+a)&&(t={left:0,top:0})}YO(n,t),!this._currentScaleValue&&this._location&&(this._location=null)},wI=function(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15},TI=function(e,t,{noScroll:n=!1,preset:r=!1,drawingDelay:i=-1,origin:a=null}){if(this._currentScaleValue=t.toString(),B(this,vI,wI).call(this,e)){r&&this.eventBus.dispatch(`scalechanging`,{source:this,scale:e,presetValue:t});return}this.viewer.style.setProperty(`--scale-factor`,e*sj.PDF_TO_CSS_UNITS);let o=i>=0&&i<1e3;this.refresh(!0,{scale:e,drawingDelay:o?i:-1}),o&&z(this,hI,setTimeout(()=>{z(this,hI,null),this.refresh()},i));let s=this._currentScale;if(this._currentScale=e,!n){let t=this._currentPageNumber,n;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(t=this._location.pageNumber,n=[null,{name:`XYZ`},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:t,destArray:n,allowNegativeOffset:!0}),Array.isArray(a)){let t=e/s-1,[n,r]=this.containerTopLeft;this.container.scrollLeft+=(a[0]-r)*t,this.container.scrollTop+=(a[1]-n)*t}}this.eventBus.dispatch(`scalechanging`,{source:this,scale:e,presetValue:r?t:void 0}),this.defaultRenderingQueue&&this.update()},EI=function(){return this._spreadMode!==JO.NONE&&this._scrollMode!==qO.HORIZONTAL?2:1},DI=function(e,t){let n=parseFloat(e);if(n>0)t.preset=!1,B(this,vI,TI).call(this,n,e,t);else{let r=this._pages[this._currentPageNumber-1];if(!r)return;let i=HO,a=UO;this.isInPresentationMode?(i=a=4,this._spreadMode!==JO.NONE&&(i*=2)):this.removePageBorders?i=a=0:this._scrollMode===qO.HORIZONTAL&&([i,a]=[a,i]);let o=(this.container.clientWidth-i)/r.width*r.scale/L(this,vI,EI),s=(this.container.clientHeight-a)/r.height*r.scale;switch(e){case`page-actual`:n=1;break;case`page-width`:n=o;break;case`page-height`:n=s;break;case`page-fit`:n=Math.min(o,s);break;case`auto`:let t=ck(r)?o:Math.min(s,o);n=Math.min(VO,t);break;default:console.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0,B(this,vI,TI).call(this,n,e,t)}},OI=function(){let e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&B(this,vI,DI).call(this,this._currentScaleValue,{noScroll:!0}),B(this,vI,CI).call(this,e)},kI=function(){let e=this._getVisiblePages(),t=[],{ids:n,views:r}=e;for(let e of r){let{view:r}=e;if(!r.hasEditableAnnotations()){n.delete(r.id);continue}t.push(e)}return t.length===0?null:(this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,ids:n}),n)},AI=async function(e){if(e.pdfPage)return e.pdfPage;try{let t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),t}catch(e){return console.error(`Unable to get page for page view`,e),null}},jI=function(e){if(e.first?.id===1)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case qO.PAGE:return L(this,mI).scrollDown;case qO.HORIZONTAL:return this.scroll.right}return this.scroll.down},MI=function(e=this.container.clientHeight){e!==L(this,fI)&&(z(this,fI,e),lk.setProperty(`--viewer-container-height`,`${e}px`))},NI=function(e){for(let t of e)if(t.target===this.container){B(this,vI,MI).call(this,Math.floor(t.borderBoxSize[0].blockSize)),z(this,QF,null);break}},PI=function(){var e;(e=L(this,sI))==null||e.abort(),z(this,sI,null),L(this,cI)!==null&&(clearTimeout(L(this,cI)),z(this,cI,null))};var II=class extends FI{_resetView(){super._resetView(),this._scrollMode=qO.PAGE,this._spreadMode=JO.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}};PO.AnnotationLayerBuilder,PO.DownloadManager,PO.EventBus,PO.FindState,PO.GenericL10n,PO.LinkTarget,PO.PDFFindController,PO.PDFHistory;var LI=PO.PDFLinkService;PO.PDFPageView,PO.PDFScriptingManager,PO.PDFSinglePageViewer,PO.PDFViewer,PO.ProgressBar,PO.RenderingStates,PO.ScrollMode,PO.SimpleLinkService,PO.SpreadMode,PO.StructTreeLayerBuilder,PO.TextLayerBuilder,PO.XfaLayerBuilder,PO.parseQueryString;var RI=[`id`],zI=[`id`],BI={key:0,class:`textLayer`},VI={key:1,class:`annotationLayer`},HI=nr({__name:`VuePdfEmbed`,props:{annotationLayer:{type:Boolean},height:{},id:{},imageResourcesPath:{},linkService:{},page:{},rotation:{default:0},scale:{default:1},source:{},textLayer:{type:Boolean},width:{}},emits:[`internal-link-clicked`,`loaded`,`loading-failed`,`password-requested`,`progress`,`rendered`,`rendering-failed`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=Zt([]),o=Xt([]),s=Zt(null),c=null,{doc:l,download:u,print:d}=AO({onError:e=>{a.value=[],i(`loading-failed`,e)},onPasswordRequest({callback:e,isWrongPassword:t}){i(`password-requested`,{callback:e,isWrongPassword:t})},onProgress:e=>{i(`progress`,e)},source:sn(r,`source`)}),f=Ua(()=>{if(!l.value||!r.annotationLayer)return null;if(r.linkService)return r.linkService;let e=new LI;return e.setDocument(l.value),e.setViewer({scrollPageIntoView:({pageNumber:e})=>{i(`internal-link-clicked`,e)}}),e}),p=e=>{let t,n;return r.height&&!r.width?(n=r.height,t=n/e):(t=r.width??s.value.clientWidth,n=t*e),[t,n]},m=async()=>{if(!(!l.value||c!=null&&c.isAborted))try{a.value=r.page?Array.isArray(r.page)?r.page:[r.page]:[...Array(l.value.numPages+1).keys()].slice(1),o.value=Array(a.value.length).fill(1),await Promise.all(a.value.map(async(e,t)=>{let n=await l.value.getPage(e);if(c!=null&&c.isAborted)return;let i=((r.rotation%90==0?r.rotation:0)+n.rotate)%360,[a,u,d]=Array.from(s.value.getElementsByClassName(`vue-pdf-embed__page`)[t].children),f=!!(i/90%2),m=n.view[2]-n.view[0],v=n.view[3]-n.view[1],[y,b]=p(f?m/v:v/m),x=`${Math.floor(y)}px`,S=`${Math.floor(b)}px`,C=y/(f?v:m),w=n.getViewport({scale:C,rotation:i});o.value[t]=C,a.style.display=`block`,a.style.width=x,a.style.height=S;let T=[h(n,w.clone({scale:w.scale*window.devicePixelRatio*r.scale}),a)];return r.textLayer&&T.push(_(n,w.clone({dontFlip:!0}),u)),r.annotationLayer&&T.push(g(n,w.clone({dontFlip:!0}),d||u)),Promise.all(T)})),c!=null&&c.isAborted||i(`rendered`)}catch(e){a.value=[],o.value=[],c!=null&&c.isAborted||i(`rendering-failed`,e)}},h=async(e,t,n)=>{n.width=t.width,n.height=t.height,await e.render({canvasContext:n.getContext(`2d`),viewport:t}).promise},g=async(e,t,n)=>{EO(n),await new _O({accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:n,page:e,structTreeLayer:null,viewport:t}).render({annotations:await e.getAnnotations(),div:n,imageResourcesPath:r.imageResourcesPath,linkService:f.value,page:e,renderForms:!1,viewport:t})},_=async(e,t,n)=>{EO(n),await new bO({container:n,textContentSource:await e.getTextContent(),viewport:t}).render()};return Jn(l,e=>{e&&i(`loaded`,e)},{immediate:!0}),Jn(()=>[l.value,r.annotationLayer,r.height,r.imageResourcesPath,r.page,r.rotation,r.scale,r.textLayer,r.width],async([e])=>{e&&(c&&(c.isAborted=!0,await c.promise),kO(s.value),c={isAborted:!1,promise:m()},await c.promise,c=null)},{immediate:!0}),br(()=>{kO(s.value)}),t({doc:l,download:u,print:(e,t,n=!1)=>d(e,t,n?void 0:r.page)}),(e,t)=>($i(),ia(`div`,{id:e.id,ref_key:`root`,ref:s,class:`vue-pdf-embed`},[($i(!0),ia(qi,null,jr(a.value,(n,r)=>($i(),ia(`div`,{key:n},[Mr(e.$slots,`before-page`,{page:n}),N(`div`,{id:e.id&&`${e.id}-${n}`,class:`vue-pdf-embed__page`,style:ce({"--scale-factor":o.value[r],position:`relative`})},[t[0]||=N(`canvas`,null,null,-1),e.textLayer?($i(),ia(`div`,BI)):ha(``,!0),e.annotationLayer?($i(),ia(`div`,VI)):ha(``,!0)],12,zI),Mr(e.$slots,`after-page`,{page:n})]))),128))],8,RI))}});window!=null&&window.Vue&&(window.VuePdfEmbed=HI,window.useVuePdfEmbed=AO),vO!=null&&vO.workerSrc||(vO.workerSrc=SO);var UI={class:`preview-container`},WI={class:`text-center mb-2`},GI={class:`pdf-render-wrapper`},KI={key:1,class:`loading-state text-center`,style:{padding:`3rem`}},qI={class:`modal-content`},JI={class:`modal-header`},YI=Ko({__name:`DocumentPreview`,props:{url:String,title:String},setup(e){let t=Xt(!1),n=Xt(!1),r=()=>{n.value=!0};return(i,a)=>($i(),ia(`div`,UI,[N(`div`,WI,[N(`h2`,null,be(e.title||`文档预览`),1),a[3]||=N(`p`,{style:{color:`var(--text-muted)`,"margin-top":`0.5rem`}},`当前展示前 2 页。`,-1)]),N(`div`,GI,[e.url?($i(),aa(en(HI),{key:0,source:e.url,class:`pdf-viewer`,onRendered:r},null,8,[`source`])):ha(``,!0),n.value?ha(``,!0):($i(),ia(`div`,KI,` 正在安全地解析文档... `))]),n.value?($i(),ia(`div`,{key:0,class:`blur-placeholder pointer`,onClick:a[0]||=e=>t.value=!0},[...a[4]||=[N(`div`,{class:`blur-content text-center`},[N(`h3`,{style:{"font-size":`1.8rem`,"margin-bottom":`0.5rem`,"text-shadow":`0 2px 10px rgba(0,0,0,0.8)`}},`完整文档已被锁定`),N(`p`,{style:{"text-shadow":`0 1px 5px rgba(0,0,0,0.8)`,"margin-bottom":`1.5rem`}},`请联系我们获取完整文档。`),N(`button`,{class:`btn btn-accent`,style:{"font-size":`1.1rem`,padding:`1rem 2rem`}},`立即联系我们`)],-1)]])):ha(``,!0),t.value?($i(),ia(`div`,{key:1,class:`modal-overlay`,onClick:a[2]||=zo(e=>t.value=!1,[`self`])},[N(`div`,qI,[N(`div`,JI,[a[5]||=N(`span`,{class:`modal-title`},`获取完整文档`,-1),N(`button`,{class:`modal-close`,onClick:a[1]||=e=>t.value=!1},`×`)]),a[6]||=N(`div`,{class:`modal-body`},[N(`iframe`,{src:`https://www.wingsemitech.com/form-only/`,class:`modal-iframe`,title:`联系表单`})],-1)])])):ha(``,!0)]))}},[[`__scopeId`,`data-v-6ca9a707`]]),XI={key:0,class:`text-center`},ZI={key:1,class:`text-center`,style:{color:`#ef4444`}},QI=[{path:`/`,component:cf},{path:`/admin`,component:Sf},{path:`/preview/:id`,component:{__name:`Preview`,setup(e){let t=gs(),n=hs(),r=Xt(null),i=Xt(!0),a=Xt(``);_r(async()=>{try{let e=t.params.id,n=(await ef.get(`/api/documents/${e}`)).data;n.url&&n.url.startsWith(`/`)&&(n.url=`${n.url}`),r.value=n}catch{a.value=`文档未找到或无法访问。`}finally{i.value=!1}});let o=()=>{n.push(`/`)};return(e,t)=>($i(),ia(`div`,null,[N(`div`,{class:`mb-2`},[N(`button`,{class:`btn`,style:{background:`rgba(255,255,255,0.1)`,border:`1px solid var(--glass-border)`},onClick:o},` ← 返回列表 `)]),i.value?($i(),ia(`div`,XI,[...t[0]||=[N(`p`,null,`正在加载文档信息...`,-1)]])):a.value?($i(),ia(`div`,ZI,[N(`p`,null,be(a.value),1)])):($i(),aa(YI,{key:2,url:r.value.url,title:r.value.title},null,8,[`url`,`title`]))]))}},props:!0}],$I=rl({history:Sc(),routes:QI}),eL=Uo(Zo);eL.use($I),eL.mount(`#app`); \ No newline at end of file diff --git a/pdf-preview-site/frontend/src/components/DocumentPreview.vue b/pdf-preview-site/frontend/src/components/DocumentPreview.vue index 88e8fc7..9aa3989 100644 --- a/pdf-preview-site/frontend/src/components/DocumentPreview.vue +++ b/pdf-preview-site/frontend/src/components/DocumentPreview.vue @@ -36,7 +36,7 @@