@gientech/modual 1.8.8 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +643 -643
- package/assets/GientechStreamReader-DqJjNXCO.js +449 -0
- package/assets/{mysql.svg → MySQL.svg} +14 -14
- package/assets/database.svg +11 -11
- package/assets/database_add.svg +53 -53
- package/assets/database_connect.svg +66 -66
- package/assets/database_upload.svg +29 -29
- package/assets/databse.svg +6 -6
- package/assets/defaultWeLogo.svg +14 -14
- package/assets/graph.svg +4 -4
- package/assets/{index-CPOAXITM.js → index-BKe5FgcC.js} +1 -1
- package/assets/{index-BbpyNfEd.js → index-BO-w4FPz.js} +1 -1
- package/assets/index-CIwaLPGb.js +6 -0
- package/assets/{index-DnJqVq9Q.js → index-D72cKELw.js} +1 -1
- package/assets/index-DdVFXD_y.js +6 -0
- package/assets/{index-CuySCBtZ.js → index-DwoTKC3G.js} +1 -1
- package/assets/{index-CCjG4bD0.js → index-FiuM-Chj.js} +1 -1
- package/assets/{index-BbHMAb8g.js → index-g-SUxfJH.js} +1 -1
- package/assets/{index-Wjs4Vb6x.js → index-j0kQJd0a.js} +1 -1
- package/assets/{index-fhKUis2J.js → index-x8IlxRuv.js} +2 -2
- package/assets/knowledge.svg +4 -4
- package/assets/{plus-Dmpl3gd8.js → plus-V9zUoSq6.js} +1 -1
- package/assets/sensitive.svg +5 -5
- package/assets/{style-CNIDlcUL.js → style-CGmZ5osp.js} +1 -1
- package/assets/{x-BjRa5XLp.js → x-CnaaLGJF.js} +1 -1
- package/assistantConfig.js +1 -1
- package/chat.js +2 -2
- package/database.js +2 -2
- package/databaseId.js +1 -1
- package/databaseTable.js +1 -1
- package/index.js +1 -1
- package/modelManage.js +1 -1
- package/package.json +6 -6
- package/sensitive.js +1 -1
- package/streamFilesReader.js +1 -1
- package/worker/pdf.worker.min.js +21 -21
- package/assets/GientechStreamReader-CNnsTqyV.js +0 -449
- package/assets/index-BH8au9G9.js +0 -11
- package/assets/index-Dkwp9YpO.js +0 -1
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
var zn=Object.defineProperty;var Sn=m=>{throw TypeError(m)};var Gn=(m,a,A)=>a in m?zn(m,a,{enumerable:!0,configurable:!0,writable:!0,value:A}):m[a]=A;var ee=(m,a,A)=>Gn(m,typeof a!="symbol"?a+"":a,A),an=(m,a,A)=>a.has(m)||Sn("Cannot "+A);var R=(m,a,A)=>(an(m,a,"read from private field"),A?A.call(m):a.get(m)),Ot=(m,a,A)=>a.has(m)?Sn("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(m):a.set(m,A),It=(m,a,A,f)=>(an(m,a,"write to private field"),f?f.call(m,A):a.set(m,A),A),Dt=(m,a,A)=>(an(m,a,"access private method"),A);var on=(m,a,A,f)=>({set _(_){It(m,a,_,A)},get _(){return R(m,a,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import React__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{a as createLucideIcon,Z as getAugmentedNamespace,d as dt$1,b as axios}from"./index-BbHMAb8g.js";import{H as Hv,l as la}from"./index-BbpyNfEd.js";import{C as ChevronRight}from"./index-fhKUis2J.js";import{X}from"./x-BjRa5XLp.js";/**
|
|
2
|
-
* @license lucide-react v0.456.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ChevronLeft=createLucideIcon("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
7
|
-
* @license lucide-react v0.456.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Download=createLucideIcon("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
12
|
-
* @license lucide-react v0.456.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Pencil=createLucideIcon("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
17
|
-
* @license lucide-react v0.456.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const RotateCcw=createLucideIcon("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
22
|
-
* @license lucide-react v0.456.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const RotateCw=createLucideIcon("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
27
|
-
* @license lucide-react v0.456.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const ZoomIn=createLucideIcon("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
|
|
32
|
-
* @license lucide-react v0.456.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const ZoomOut=createLucideIcon("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function commonjsRequire(m){throw new Error('Could not dynamically require "'+m+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(__viteBrowserExternal$1);var hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports){(function(a,A){module.exports=A()})(globalThis,()=>(()=>{var __webpack_modules__=[,((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.VerbosityLevel=a.Util=a.UnknownErrorException=a.UnexpectedResponseException=a.UNSUPPORTED_FEATURES=a.TextRenderingMode=a.StreamType=a.RenderingIntentFlag=a.PermissionFlag=a.PasswordResponses=a.PasswordException=a.PageActionEventType=a.OPS=a.MissingPDFException=a.LINE_FACTOR=a.LINE_DESCENT_FACTOR=a.InvalidPDFException=a.ImageKind=a.IDENTITY_MATRIX=a.FormatError=a.FontType=a.FeatureTest=a.FONT_IDENTITY_MATRIX=a.DocumentActionEventType=a.CMapCompressionType=a.BaseException=a.AnnotationType=a.AnnotationStateModelType=a.AnnotationReviewState=a.AnnotationReplyType=a.AnnotationMode=a.AnnotationMarkedState=a.AnnotationFlag=a.AnnotationFieldFlag=a.AnnotationEditorType=a.AnnotationEditorPrefix=a.AnnotationEditorParamsType=a.AnnotationBorderStyleType=a.AnnotationActionEventType=a.AbortException=void 0,a.arrayByteLength=B,a.arraysToBytes=_t,a.assert=h,a.bytesToString=D,a.createPromiseCapability=de,a.createValidAbsoluteUrl=T,a.escapeString=Gt,a.getModificationDate=ce,a.getVerbosityLevel=bt,a.info=wt,a.isArrayBuffer=Jt,a.isArrayEqual=oe,a.isAscii=Zt,a.objectFromMap=At,a.objectSize=Q,a.setVerbosityLevel=G,a.shadow=I,a.string32=z,a.stringToBytes=p,a.stringToPDFString=Xt,a.stringToUTF16BEString=zt,a.stringToUTF8String=Vt,a.unreachable=H,a.utf8StringToString=Yt,a.warn=Mt,A(2);const f=[1,0,0,1,0,0];a.IDENTITY_MATRIX=f;const _=[.001,0,0,.001,0,0];a.FONT_IDENTITY_MATRIX=_;const V=1.35;a.LINE_FACTOR=V;const q=.35;a.LINE_DESCENT_FACTOR=q;const Y={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};a.RenderingIntentFlag=Y;const M={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};a.AnnotationMode=M;const b="pdfjs_internal_editor_";a.AnnotationEditorPrefix=b;const w={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};a.AnnotationEditorType=w;const P={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};a.AnnotationEditorParamsType=P;const F={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};a.PermissionFlag=F;const S={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};a.TextRenderingMode=S;const c={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};a.ImageKind=c;const t={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};a.AnnotationType=t;const s={MARKED:"Marked",REVIEW:"Review"};a.AnnotationStateModelType=s;const o={MARKED:"Marked",UNMARKED:"Unmarked"};a.AnnotationMarkedState=o;const v={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};a.AnnotationReviewState=v;const g={GROUP:"Group",REPLY:"R"};a.AnnotationReplyType=g;const l={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};a.AnnotationFlag=l;const n={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};a.AnnotationFieldFlag=n;const r={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};a.AnnotationBorderStyleType=r;const e={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};a.AnnotationActionEventType=e;const E={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};a.DocumentActionEventType=E;const x={O:"PageOpen",C:"PageClose"};a.PageActionEventType=x;const L={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};a.StreamType=L;const O={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};a.FontType=O;const yt={ERRORS:0,WARNINGS:1,INFOS:5};a.VerbosityLevel=yt;const St={NONE:0,BINARY:1,STREAM:2};a.CMapCompressionType=St;const pt={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};a.OPS=pt;const K={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};a.UNSUPPORTED_FEATURES=K;const N={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};a.PasswordResponses=N;let U=yt.WARNINGS;function G(Pt){Number.isInteger(Pt)&&(U=Pt)}function bt(){return U}function wt(Pt){U>=yt.INFOS&&console.log(`Info: ${Pt}`)}function Mt(Pt){U>=yt.WARNINGS&&console.log(`Warning: ${Pt}`)}function H(Pt){throw new Error(Pt)}function h(Pt,J){Pt||H(J)}function u(Pt){if(!Pt)return!1;switch(Pt.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function T(Pt,J=null,Z=null){if(!Pt)return null;try{if(Z&&typeof Pt=="string"){if(Z.addDefaultProtocol&&Pt.startsWith("www.")){const qt=Pt.match(/\./g);qt&&qt.length>=2&&(Pt=`http://${Pt}`)}if(Z.tryConvertEncoding)try{Pt=Vt(Pt)}catch{}}const Lt=J?new URL(Pt,J):new URL(Pt);if(u(Lt))return Lt}catch{}return null}function I(Pt,J,Z){return Object.defineProperty(Pt,J,{value:Z,enumerable:!0,configurable:!0,writable:!1}),Z}const $=(function(){function J(Z,Lt){this.constructor===J&&H("Cannot initialize BaseException."),this.message=Z,this.name=Lt}return J.prototype=new Error,J.constructor=J,J})();a.BaseException=$;class W extends ${constructor(J,Z){super(J,"PasswordException"),this.code=Z}}a.PasswordException=W;class i extends ${constructor(J,Z){super(J,"UnknownErrorException"),this.details=Z}}a.UnknownErrorException=i;class d extends ${constructor(J){super(J,"InvalidPDFException")}}a.InvalidPDFException=d;class C extends ${constructor(J){super(J,"MissingPDFException")}}a.MissingPDFException=C;class y extends ${constructor(J,Z){super(J,"UnexpectedResponseException"),this.status=Z}}a.UnexpectedResponseException=y;class k extends ${constructor(J){super(J,"FormatError")}}a.FormatError=k;class j extends ${constructor(J){super(J,"AbortException")}}a.AbortException=j;function D(Pt){(typeof Pt!="object"||Pt===null||Pt.length===void 0)&&H("Invalid argument for bytesToString");const J=Pt.length,Z=8192;if(J<Z)return String.fromCharCode.apply(null,Pt);const Lt=[];for(let qt=0;qt<J;qt+=Z){const Ct=Math.min(qt+Z,J),Tt=Pt.subarray(qt,Ct);Lt.push(String.fromCharCode.apply(null,Tt))}return Lt.join("")}function p(Pt){typeof Pt!="string"&&H("Invalid argument for stringToBytes");const J=Pt.length,Z=new Uint8Array(J);for(let Lt=0;Lt<J;++Lt)Z[Lt]=Pt.charCodeAt(Lt)&255;return Z}function B(Pt){if(Pt.length!==void 0)return Pt.length;if(Pt.byteLength!==void 0)return Pt.byteLength;H("Invalid argument for arrayByteLength")}function _t(Pt){const J=Pt.length;if(J===1&&Pt[0]instanceof Uint8Array)return Pt[0];let Z=0;for(let Ct=0;Ct<J;Ct++)Z+=B(Pt[Ct]);let Lt=0;const qt=new Uint8Array(Z);for(let Ct=0;Ct<J;Ct++){let Tt=Pt[Ct];Tt instanceof Uint8Array||(typeof Tt=="string"?Tt=p(Tt):Tt=new Uint8Array(Tt));const $t=Tt.byteLength;qt.set(Tt,Lt),Lt+=$t}return qt}function z(Pt){return String.fromCharCode(Pt>>24&255,Pt>>16&255,Pt>>8&255,Pt&255)}function Q(Pt){return Object.keys(Pt).length}function At(Pt){const J=Object.create(null);for(const[Z,Lt]of Pt)J[Z]=Lt;return J}function kt(){const Pt=new Uint8Array(4);return Pt[0]=1,new Uint32Array(Pt.buffer,0,1)[0]===1}function Rt(){try{return new Function(""),!0}catch{return!1}}class xt{static get isLittleEndian(){return I(this,"isLittleEndian",kt())}static get isEvalSupported(){return I(this,"isEvalSupported",Rt())}static get isOffscreenCanvasSupported(){return I(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}}a.FeatureTest=xt;const Ht=[...Array(256).keys()].map(Pt=>Pt.toString(16).padStart(2,"0"));class Ut{static makeHexColor(J,Z,Lt){return`#${Ht[J]}${Ht[Z]}${Ht[Lt]}`}static scaleMinMax(J,Z){let Lt;J[0]?(J[0]<0&&(Lt=Z[0],Z[0]=Z[1],Z[1]=Lt),Z[0]*=J[0],Z[1]*=J[0],J[3]<0&&(Lt=Z[2],Z[2]=Z[3],Z[3]=Lt),Z[2]*=J[3],Z[3]*=J[3]):(Lt=Z[0],Z[0]=Z[2],Z[2]=Lt,Lt=Z[1],Z[1]=Z[3],Z[3]=Lt,J[1]<0&&(Lt=Z[2],Z[2]=Z[3],Z[3]=Lt),Z[2]*=J[1],Z[3]*=J[1],J[2]<0&&(Lt=Z[0],Z[0]=Z[1],Z[1]=Lt),Z[0]*=J[2],Z[1]*=J[2]),Z[0]+=J[4],Z[1]+=J[4],Z[2]+=J[5],Z[3]+=J[5]}static transform(J,Z){return[J[0]*Z[0]+J[2]*Z[1],J[1]*Z[0]+J[3]*Z[1],J[0]*Z[2]+J[2]*Z[3],J[1]*Z[2]+J[3]*Z[3],J[0]*Z[4]+J[2]*Z[5]+J[4],J[1]*Z[4]+J[3]*Z[5]+J[5]]}static applyTransform(J,Z){const Lt=J[0]*Z[0]+J[1]*Z[2]+Z[4],qt=J[0]*Z[1]+J[1]*Z[3]+Z[5];return[Lt,qt]}static applyInverseTransform(J,Z){const Lt=Z[0]*Z[3]-Z[1]*Z[2],qt=(J[0]*Z[3]-J[1]*Z[2]+Z[2]*Z[5]-Z[4]*Z[3])/Lt,Ct=(-J[0]*Z[1]+J[1]*Z[0]+Z[4]*Z[1]-Z[5]*Z[0])/Lt;return[qt,Ct]}static getAxialAlignedBoundingBox(J,Z){const Lt=Ut.applyTransform(J,Z),qt=Ut.applyTransform(J.slice(2,4),Z),Ct=Ut.applyTransform([J[0],J[3]],Z),Tt=Ut.applyTransform([J[2],J[1]],Z);return[Math.min(Lt[0],qt[0],Ct[0],Tt[0]),Math.min(Lt[1],qt[1],Ct[1],Tt[1]),Math.max(Lt[0],qt[0],Ct[0],Tt[0]),Math.max(Lt[1],qt[1],Ct[1],Tt[1])]}static inverseTransform(J){const Z=J[0]*J[3]-J[1]*J[2];return[J[3]/Z,-J[1]/Z,-J[2]/Z,J[0]/Z,(J[2]*J[5]-J[4]*J[3])/Z,(J[4]*J[1]-J[5]*J[0])/Z]}static apply3dTransform(J,Z){return[J[0]*Z[0]+J[1]*Z[1]+J[2]*Z[2],J[3]*Z[0]+J[4]*Z[1]+J[5]*Z[2],J[6]*Z[0]+J[7]*Z[1]+J[8]*Z[2]]}static singularValueDecompose2dScale(J){const Z=[J[0],J[2],J[1],J[3]],Lt=J[0]*Z[0]+J[1]*Z[2],qt=J[0]*Z[1]+J[1]*Z[3],Ct=J[2]*Z[0]+J[3]*Z[2],Tt=J[2]*Z[1]+J[3]*Z[3],$t=(Lt+Tt)/2,jt=Math.sqrt((Lt+Tt)**2-4*(Lt*Tt-Ct*qt))/2,Wt=$t+jt||1,Qt=$t-jt||1;return[Math.sqrt(Wt),Math.sqrt(Qt)]}static normalizeRect(J){const Z=J.slice(0);return J[0]>J[2]&&(Z[0]=J[2],Z[2]=J[0]),J[1]>J[3]&&(Z[1]=J[3],Z[3]=J[1]),Z}static intersect(J,Z){const Lt=Math.max(Math.min(J[0],J[2]),Math.min(Z[0],Z[2])),qt=Math.min(Math.max(J[0],J[2]),Math.max(Z[0],Z[2]));if(Lt>qt)return null;const Ct=Math.max(Math.min(J[1],J[3]),Math.min(Z[1],Z[3])),Tt=Math.min(Math.max(J[1],J[3]),Math.max(Z[1],Z[3]));return Ct>Tt?null:[Lt,Ct,qt,Tt]}static bezierBoundingBox(J,Z,Lt,qt,Ct,Tt,$t,jt){const Wt=[],Qt=[[],[]];let se,Kt,ae,te,ge,he,nn,sn;for(let rn=0;rn<2;++rn){if(rn===0?(Kt=6*J-12*Lt+6*Ct,se=-3*J+9*Lt-9*Ct+3*$t,ae=3*Lt-3*J):(Kt=6*Z-12*qt+6*Tt,se=-3*Z+9*qt-9*Tt+3*jt,ae=3*qt-3*Z),Math.abs(se)<1e-12){if(Math.abs(Kt)<1e-12)continue;te=-ae/Kt,0<te&&te<1&&Wt.push(te);continue}nn=Kt*Kt-4*ae*se,sn=Math.sqrt(nn),!(nn<0)&&(ge=(-Kt+sn)/(2*se),0<ge&&ge<1&&Wt.push(ge),he=(-Kt-sn)/(2*se),0<he&&he<1&&Wt.push(he))}let me=Wt.length,ie;const ye=me;for(;me--;)te=Wt[me],ie=1-te,Qt[0][me]=ie*ie*ie*J+3*ie*ie*te*Lt+3*ie*te*te*Ct+te*te*te*$t,Qt[1][me]=ie*ie*ie*Z+3*ie*ie*te*qt+3*ie*te*te*Tt+te*te*te*jt;return Qt[0][ye]=J,Qt[1][ye]=Z,Qt[0][ye+1]=$t,Qt[1][ye+1]=jt,Qt[0].length=Qt[1].length=ye+2,[Math.min(...Qt[0]),Math.min(...Qt[1]),Math.max(...Qt[0]),Math.max(...Qt[1])]}}a.Util=Ut;const Nt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function Xt(Pt){if(Pt[0]>="\xEF"){let Z;if(Pt[0]==="\xFE"&&Pt[1]==="\xFF"?Z="utf-16be":Pt[0]==="\xFF"&&Pt[1]==="\xFE"?Z="utf-16le":Pt[0]==="\xEF"&&Pt[1]==="\xBB"&&Pt[2]==="\xBF"&&(Z="utf-8"),Z)try{const Lt=new TextDecoder(Z,{fatal:!0}),qt=p(Pt);return Lt.decode(qt)}catch(Lt){Mt(`stringToPDFString: "${Lt}".`)}}const J=[];for(let Z=0,Lt=Pt.length;Z<Lt;Z++){const qt=Nt[Pt.charCodeAt(Z)];J.push(qt?String.fromCharCode(qt):Pt.charAt(Z))}return J.join("")}function Gt(Pt){return Pt.replace(/([()\\\n\r])/g,J=>J===`
|
|
37
|
-
`?"\\n":J==="\r"?"\\r":`\\${J}`)}function Zt(Pt){return/^[\x00-\x7F]*$/.test(Pt)}function zt(Pt){const J=["\xFE\xFF"];for(let Z=0,Lt=Pt.length;Z<Lt;Z++){const qt=Pt.charCodeAt(Z);J.push(String.fromCharCode(qt>>8&255),String.fromCharCode(qt&255))}return J.join("")}function Vt(Pt){return decodeURIComponent(escape(Pt))}function Yt(Pt){return unescape(encodeURIComponent(Pt))}function Jt(Pt){return typeof Pt=="object"&&Pt!==null&&Pt.byteLength!==void 0}function oe(Pt,J){if(Pt.length!==J.length)return!1;for(let Z=0,Lt=Pt.length;Z<Lt;Z++)if(Pt[Z]!==J[Z])return!1;return!0}function ce(Pt=new Date){return[Pt.getUTCFullYear().toString(),(Pt.getUTCMonth()+1).toString().padStart(2,"0"),Pt.getUTCDate().toString().padStart(2,"0"),Pt.getUTCHours().toString().padStart(2,"0"),Pt.getUTCMinutes().toString().padStart(2,"0"),Pt.getUTCSeconds().toString().padStart(2,"0")].join("")}function de(){const Pt=Object.create(null);let J=!1;return Object.defineProperty(Pt,"settled",{get(){return J}}),Pt.promise=new Promise(function(Z,Lt){Pt.resolve=function(qt){J=!0,Z(qt)},Pt.reject=function(qt){J=!0,Lt(qt)}}),Pt}}),((m,a,A)=>{A(3)}),((m,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isNodeJS=void 0;const A=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");a.isNodeJS=A}),((__unused_webpack_module,exports,__w_pdfjs_require__)=>{var m,A,f,_,V,q,Y,M,b,ln,P,F;Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,exports.getDocument=getDocument,exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(5),_display_utils=__w_pdfjs_require__(8),_font_loader=__w_pdfjs_require__(11),_canvas=__w_pdfjs_require__(12),_worker_options=__w_pdfjs_require__(15),_is_node=__w_pdfjs_require__(3),_message_handler=__w_pdfjs_require__(16),_metadata=__w_pdfjs_require__(17),_optional_content_config=__w_pdfjs_require__(18),_transport_stream=__w_pdfjs_require__(19),_xfa_text=__w_pdfjs_require__(20);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100;let DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory;if(exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory,_is_node.isNodeJS){const{NodeCanvasFactory:c,NodeCMapReaderFactory:t,NodeStandardFontDataFactory:s}=__w_pdfjs_require__(21);exports.DefaultCanvasFactory=DefaultCanvasFactory=c,exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=t,exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=s}let createPDFNetworkStream;function setPDFNetworkStreamFactory(c){createPDFNetworkStream=c}function getDocument(c){const t=new PDFDocumentLoadingTask;let s;if(typeof c=="string"||c instanceof URL)s={url:c};else if((0,_util.isArrayBuffer)(c))s={data:c};else if(c instanceof PDFDataRangeTransport)s={range:c};else{if(typeof c!="object")throw new Error("Invalid parameter in getDocument, need either string, URL, TypedArray, or parameter object.");if(!c.url&&!c.data&&!c.range)throw new Error("Invalid parameter object: need either .data, .range or .url");s=c}const o=Object.create(null);let v=null,g=null;for(const n in s){const r=s[n];switch(n){case"url":if(typeof window<"u")try{o[n]=new URL(r,window.location).href;continue}catch(e){(0,_util.warn)(`Cannot create valid URL: "${e}".`)}else if(typeof r=="string"||r instanceof URL){o[n]=r.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":v=r;continue;case"worker":g=r;continue;case"data":if(_is_node.isNodeJS&&typeof Buffer<"u"&&r instanceof Buffer)o[n]=new Uint8Array(r);else{if(r instanceof Uint8Array)break;if(typeof r=="string")o[n]=(0,_util.stringToBytes)(r);else if(typeof r=="object"&&r!==null&&!isNaN(r.length))o[n]=new Uint8Array(r);else if((0,_util.isArrayBuffer)(r))o[n]=new Uint8Array(r);else throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}continue}o[n]=r}if(o.CMapReaderFactory=o.CMapReaderFactory||DefaultCMapReaderFactory,o.StandardFontDataFactory=o.StandardFontDataFactory||DefaultStandardFontDataFactory,o.ignoreErrors=o.stopAtErrors!==!0,o.fontExtraProperties=o.fontExtraProperties===!0,o.pdfBug=o.pdfBug===!0,o.enableXfa=o.enableXfa===!0,(!Number.isInteger(o.rangeChunkSize)||o.rangeChunkSize<1)&&(o.rangeChunkSize=DEFAULT_RANGE_CHUNK_SIZE),(typeof o.docBaseUrl!="string"||(0,_display_utils.isDataScheme)(o.docBaseUrl))&&(o.docBaseUrl=null),(!Number.isInteger(o.maxImageSize)||o.maxImageSize<-1)&&(o.maxImageSize=-1),typeof o.cMapUrl!="string"&&(o.cMapUrl=null),typeof o.standardFontDataUrl!="string"&&(o.standardFontDataUrl=null),typeof o.useWorkerFetch!="boolean"&&(o.useWorkerFetch=o.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&o.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory),typeof o.isEvalSupported!="boolean"&&(o.isEvalSupported=!0),typeof o.disableFontFace!="boolean"&&(o.disableFontFace=_is_node.isNodeJS),typeof o.useSystemFonts!="boolean"&&(o.useSystemFonts=!_is_node.isNodeJS&&!o.disableFontFace),(typeof o.ownerDocument!="object"||o.ownerDocument===null)&&(o.ownerDocument=globalThis.document),typeof o.disableRange!="boolean"&&(o.disableRange=!1),typeof o.disableStream!="boolean"&&(o.disableStream=!1),typeof o.disableAutoFetch!="boolean"&&(o.disableAutoFetch=!1),(0,_util.setVerbosityLevel)(o.verbosity),!g){const n={verbosity:o.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};g=n.port?PDFWorker.fromPort(n):new PDFWorker(n),t._worker=g}const l=t.docId;return g.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");const n=_fetchDocument(g,o,v,l),r=new Promise(function(e){let E;v?E=new _transport_stream.PDFDataTransportStream({length:o.length,initialData:o.initialData,progressiveDone:o.progressiveDone,contentDispositionFilename:o.contentDispositionFilename,disableRange:o.disableRange,disableStream:o.disableStream},v):o.data||(E=createPDFNetworkStream({url:o.url,length:o.length,httpHeaders:o.httpHeaders,withCredentials:o.withCredentials,rangeChunkSize:o.rangeChunkSize,disableRange:o.disableRange,disableStream:o.disableStream})),e(E)});return Promise.all([n,r]).then(function([e,E]){if(t.destroyed)throw new Error("Loading aborted");const x=new _message_handler.MessageHandler(l,e,g.port),L=new WorkerTransport(x,t,E,o);t._transport=L,x.send("Ready",null)})}).catch(t._capability.reject),t}async function _fetchDocument(c,t,s,o){if(c.destroyed)throw new Error("Worker was destroyed");s&&(t.length=s.length,t.initialData=s.initialData,t.progressiveDone=s.progressiveDone,t.contentDispositionFilename=s.contentDispositionFilename);const v=await c.messageHandler.sendWithPromise("GetDocRequest",{docId:o,apiVersion:"2.16.105",source:{data:t.data,url:t.url,password:t.password,disableAutoFetch:t.disableAutoFetch,rangeChunkSize:t.rangeChunkSize,length:t.length},maxImageSize:t.maxImageSize,disableFontFace:t.disableFontFace,docBaseUrl:t.docBaseUrl,ignoreErrors:t.ignoreErrors,isEvalSupported:t.isEvalSupported,fontExtraProperties:t.fontExtraProperties,enableXfa:t.enableXfa,useSystemFonts:t.useSystemFonts,cMapUrl:t.useWorkerFetch?t.cMapUrl:null,standardFontDataUrl:t.useWorkerFetch?t.standardFontDataUrl:null});if(t.data&&(t.data=null),c.destroyed)throw new Error("Worker was destroyed");return v}const a=class a{constructor(){this._capability=(0,_util.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId=`d${on(a,m)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}get promise(){return this._capability.promise}async destroy(){var t;this.destroyed=!0,await((t=this._transport)==null?void 0:t.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};m=new WeakMap,Ot(a,m,0);let PDFDocumentLoadingTask=a;exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(t,s,o=!1,v=null){this.length=t,this.initialData=s,this.progressiveDone=o,this.contentDispositionFilename=v,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,s){for(const o of this._rangeListeners)o(t,s)}onDataProgress(t,s){this._readyCapability.promise.then(()=>{for(const o of this._progressListeners)o(t,s)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const s of this._progressiveReadListeners)s(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,s){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(t,s){this._pdfInfo=t,this._transport=s,Object.defineProperty(this,"fingerprint",{get(){return(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead."),this.fingerprints[0]}}),Object.defineProperty(this,"getStats",{value:async()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getStats`, please use the `PDFDocumentProxy.stats`-getter instead."),this.stats||{streamTypes:{},fontTypes:{}})})}get annotationStorage(){return this._transport.annotationStorage}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get stats(){return this._transport.stats}get isPureXfa(){return!!this._transport._htmlForXfa}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}saveDocument(){return this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this._transport.saveDocument()}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(t,s,o,v,g=!1){this._pageIndex=t,this._pageInfo=s,this._ownerDocument=v,this._transport=o,this._stats=g?new _display_utils.StatTimer:null,this._pdfBug=g,this.commonObjs=o.commonObjs,this.objs=new PDFObjects,this._bitmaps=new Set,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this._intentStates=new Map,this._annotationPromises=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:s=this.rotate,offsetX:o=0,offsetY:v=0,dontFlip:g=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:t,rotation:s,offsetX:o,offsetY:v,dontFlip:g})}getAnnotations({intent:t="display"}={}){const s=this._transport.getRenderingIntent(t);let o=this._annotationPromises.get(s.cacheKey);return o||(o=this._transport.getAnnotations(this._pageIndex,s.renderingIntent),this._annotationPromises.set(s.cacheKey,o),o=o.then(v=>{for(const g of v)g.titleObj!==void 0&&Object.defineProperty(g,"title",{get(){return(0,_display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead."),g.titleObj.str}}),g.contentsObj!==void 0&&Object.defineProperty(g,"contents",{get(){return(0,_display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead."),g.contentsObj.str}});return v})),o}getJSActions(){return this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex))}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:s,intent:o="display",annotationMode:v=_util.AnnotationMode.ENABLE,transform:g=null,imageLayer:l=null,canvasFactory:n=null,background:r=null,optionalContentConfigPromise:e=null,annotationCanvasMap:E=null,pageColors:x=null,printAnnotationStorage:L=null}){var G,bt;((G=arguments[0])==null?void 0:G.renderInteractiveForms)!==void 0&&((0,_display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead."),arguments[0].renderInteractiveForms===!0&&v===_util.AnnotationMode.ENABLE&&(v=_util.AnnotationMode.ENABLE_FORMS)),((bt=arguments[0])==null?void 0:bt.includeAnnotationStorage)!==void 0&&((0,_display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead."),arguments[0].includeAnnotationStorage===!0&&v===_util.AnnotationMode.ENABLE&&(v=_util.AnnotationMode.ENABLE_STORAGE)),this._stats&&this._stats.time("Overall");const O=this._transport.getRenderingIntent(o,v,L);this.pendingCleanup=!1,e||(e=this._transport.getOptionalContentConfig());let yt=this._intentStates.get(O.cacheKey);yt||(yt=Object.create(null),this._intentStates.set(O.cacheKey,yt)),yt.streamReaderCancelTimeout&&(clearTimeout(yt.streamReaderCancelTimeout),yt.streamReaderCancelTimeout=null);const St=n||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),pt=!!(O.renderingIntent&_util.RenderingIntentFlag.PRINT);yt.displayReadyCapability||(yt.displayReadyCapability=(0,_util.createPromiseCapability)(),yt.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(O));const K=wt=>{yt.renderTasks.delete(N),(this.cleanupAfterRender||pt)&&(this.pendingCleanup=!0),this._tryCleanup(),wt?(N.capability.reject(wt),this._abortOperatorList({intentState:yt,reason:wt instanceof Error?wt:new Error(wt)})):N.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},N=new InternalRenderTask({callback:K,params:{canvasContext:t,viewport:s,transform:g,imageLayer:l,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:E,operatorList:yt.operatorList,pageIndex:this._pageIndex,canvasFactory:St,useRequestAnimationFrame:!pt,pdfBug:this._pdfBug,pageColors:x});(yt.renderTasks||(yt.renderTasks=new Set)).add(N);const U=N.task;return Promise.all([yt.displayReadyCapability.promise,e]).then(([wt,Mt])=>{if(this.pendingCleanup){K();return}this._stats&&this._stats.time("Rendering"),N.initializeGraphics({transparency:wt,optionalContentConfig:Mt}),N.operatorListChanged()}).catch(K),U}getOperatorList({intent:t="display",annotationMode:s=_util.AnnotationMode.ENABLE,printAnnotationStorage:o=null}={}){function v(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(n))}const g=this._transport.getRenderingIntent(t,s,o,!0);let l=this._intentStates.get(g.cacheKey);l||(l=Object.create(null),this._intentStates.set(g.cacheKey,l));let n;return l.opListReadCapability||(n=Object.create(null),n.operatorListChanged=v,l.opListReadCapability=(0,_util.createPromiseCapability)(),(l.renderTasks||(l.renderTasks=new Set)).add(n),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(g)),l.opListReadCapability.promise}streamTextContent({disableCombineTextItems:t=!1,includeMarkedContent:s=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:t!==!0,includeMarkedContent:s===!0},{highWaterMark:100,size(v){return v.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(o=>_xfa_text.XfaText.textContent(o));const s=this.streamTextContent(t);return new Promise(function(o,v){function g(){l.read().then(function({value:r,done:e}){if(e){o(n);return}Object.assign(n.styles,r.styles),n.items.push(...r.items),g()},v)}const l=s.getReader(),n={items:[],styles:Object.create(null)};g()})}getStructTree(){return this._structTreePromise||(this._structTreePromise=this._transport.getStructTree(this._pageIndex))}_destroy(){this.destroyed=!0;const t=[];for(const s of this._intentStates.values())if(this._abortOperatorList({intentState:s,reason:new Error("Page was destroyed."),force:!0}),!s.opListReadCapability)for(const o of s.renderTasks)t.push(o.completed),o.cancel();this.objs.clear();for(const s of this._bitmaps)s.close();return this._bitmaps.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,this.pendingCleanup=!1,Promise.all(t)}cleanup(t=!1){return this.pendingCleanup=!0,this._tryCleanup(t)}_tryCleanup(t=!1){if(!this.pendingCleanup)return!1;for(const{renderTasks:s,operatorList:o}of this._intentStates.values())if(s.size>0||!o.lastChunk)return!1;this._intentStates.clear(),this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,t&&this._stats&&(this._stats=new _display_utils.StatTimer);for(const s of this._bitmaps)s.close();return this._bitmaps.clear(),this.pendingCleanup=!1,!0}_startRenderPage(t,s){const o=this._intentStates.get(s);o&&(this._stats&&this._stats.timeEnd("Page Request"),o.displayReadyCapability&&o.displayReadyCapability.resolve(t))}_renderPageChunk(t,s){for(let o=0,v=t.length;o<v;o++)s.operatorList.fnArray.push(t.fnArray[o]),s.operatorList.argsArray.push(t.argsArray[o]);s.operatorList.lastChunk=t.lastChunk,s.operatorList.separateAnnots=t.separateAnnots;for(const o of s.renderTasks)o.operatorListChanged();t.lastChunk&&this._tryCleanup()}_pumpOperatorList({renderingIntent:t,cacheKey:s,annotationStorageMap:o}){const g=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:s,annotationStorage:o}).getReader(),l=this._intentStates.get(s);l.streamReader=g;const n=()=>{g.read().then(({value:r,done:e})=>{if(e){l.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(r,l),n())},r=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const e of l.renderTasks)e.operatorListChanged();this._tryCleanup()}if(l.displayReadyCapability)l.displayReadyCapability.reject(r);else if(l.opListReadCapability)l.opListReadCapability.reject(r);else throw r}})};n()}_abortOperatorList({intentState:t,reason:s,force:o=!1}){if(t.streamReader){if(!o){if(t.renderTasks.size>0)return;if(s instanceof _display_utils.RenderingCancelledException){t.streamReaderCancelTimeout=setTimeout(()=>{this._abortOperatorList({intentState:t,reason:s,force:!0}),t.streamReaderCancelTimeout=null},RENDERING_CANCELLED_TIMEOUT);return}}if(t.streamReader.cancel(new _util.AbortException(s.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[v,g]of this._intentStates)if(g===t){this._intentStates.delete(v);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){this._listeners=[],this._deferred=Promise.resolve()}postMessage(t,s){const o={data:structuredClone(t,s)};this._deferred.then(()=>{for(const v of this._listeners)v.call(this,o)})}addEventListener(t,s){this._listeners.push(s)}removeEventListener(t,s){const o=this._listeners.indexOf(s);this._listeners.splice(o,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_is_node.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const c=(A=document==null?void 0:document.currentScript)==null?void 0:A.src;c&&(PDFWorkerUtil.fallbackWorkerSrc=c.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(c,t){let s;try{if(s=new URL(c),!s.origin||s.origin==="null")return!1}catch{return!1}const o=new URL(t,s);return s.origin===o.origin},PDFWorkerUtil.createCDNWrapper=function(c){const t=`importScripts("${c}");`;return URL.createObjectURL(new Blob([t]))}}const _PDFWorker=class _PDFWorker{constructor({name:c=null,port:t=null,verbosity:s=(0,_util.getVerbosityLevel)()}={}){if(t&&R(_PDFWorker,f).has(t))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=c,this.destroyed=!1,this.verbosity=s,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,t){R(_PDFWorker,f).set(t,this),this._initializeFromPort(t);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(c){this._port=c,this._messageHandler=new _message_handler.MessageHandler("main","worker",c),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve()}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!_PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:c}=_PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,c)||(c=PDFWorkerUtil.createCDNWrapper(new URL(c,window.location).href));const t=new Worker(c),s=new _message_handler.MessageHandler("main","worker",t),o=()=>{t.removeEventListener("error",v),s.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},v=()=>{this._webWorker||o()};t.addEventListener("error",v),s.on("test",l=>{if(t.removeEventListener("error",v),this.destroyed){o();return}l?(this._messageHandler=s,this._port=t,this._webWorker=t,this._readyCapability.resolve(),s.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),s.destroy(),t.terminate())}),s.on("ready",l=>{if(t.removeEventListener("error",v),this.destroyed){o();return}try{g()}catch{this._setupFakeWorker()}});const g=()=>{const l=new Uint8Array;s.send("test",l,[l.buffer])};g();return}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),_PDFWorker._setupFakeWorkerGlobal.then(c=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const t=new LoopbackPort;this._port=t;const s=`fake${PDFWorkerUtil.fakeWorkerId++}`,o=new _message_handler.MessageHandler(s+"_worker",s,t);c.setup(o,t);const v=new _message_handler.MessageHandler(s,s+"_worker",t);this._messageHandler=v,this._readyCapability.resolve(),v.send("configure",{verbosity:this.verbosity})}).catch(c=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${c.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),R(_PDFWorker,f).delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(c){if(!(c!=null&&c.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return R(this,f).has(c.port)?R(this,f).get(c.port):new _PDFWorker(c)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){var c;try{return((c=globalThis.pdfjsWorker)==null?void 0:c.WorkerMessageHandler)||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}};f=new WeakMap,Ot(_PDFWorker,f,new WeakMap);let PDFWorker=_PDFWorker;exports.PDFWorker=PDFWorker,PDFWorker.getWorkerSrc=function(){return(0,_display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead."),this.workerSrc};class WorkerTransport{constructor(t,s,o,v){Ot(this,_,null);Ot(this,V,new Map);Ot(this,q,new Map);Ot(this,Y,null);this.messageHandler=t,this.loadingTask=s,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({docId:s.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:v.ownerDocument,styleElement:v.styleElement}),this._params=v,v.useWorkerFetch||(this.CMapReaderFactory=new v.CMapReaderFactory({baseUrl:v.cMapUrl,isCompressed:v.cMapPacked}),this.StandardFontDataFactory=new v.StandardFontDataFactory({baseUrl:v.standardFontDataUrl})),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=o,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}get stats(){return R(this,_)}getRenderingIntent(t,s=_util.AnnotationMode.ENABLE,o=null,v=!1){let g=_util.RenderingIntentFlag.DISPLAY,l=null;switch(t){case"any":g=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":g=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(s){case _util.AnnotationMode.DISABLE:g+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:g+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:g+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,l=(g&_util.RenderingIntentFlag.PRINT&&o instanceof _annotation_storage.PrintAnnotationStorage?o:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${s}`)}return v&&(g+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:g,cacheKey:`${g}_${_annotation_storage.AnnotationStorage.getHash(l)}`,annotationStorageMap:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const o of R(this,V).values())t.push(o._destroy());R(this,V).clear(),R(this,q).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const s=this.messageHandler.sendWithPromise("Terminate",null);return t.push(s),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),It(this,Y,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null,this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:s}=this;t.on("GetReader",(o,v)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=g=>{this._lastProgress={loaded:g.loaded,total:g.total}},v.onPull=()=>{this._fullReader.read().then(function({value:g,done:l}){if(l){v.close();return}(0,_util.assert)((0,_util.isArrayBuffer)(g),"GetReader - expected an ArrayBuffer."),v.enqueue(new Uint8Array(g),1,[g])}).catch(g=>{v.error(g)})},v.onCancel=g=>{this._fullReader.cancel(g),v.ready.catch(l=>{if(!this.destroyed)throw l})}}),t.on("ReaderHeadersReady",o=>{const v=(0,_util.createPromiseCapability)(),g=this._fullReader;return g.headersReady.then(()=>{var l;(!g.isStreamingSupported||!g.isRangeSupported)&&(this._lastProgress&&((l=s.onProgress)==null||l.call(s,this._lastProgress)),g.onProgress=n=>{var r;(r=s.onProgress)==null||r.call(s,{loaded:n.loaded,total:n.total})}),v.resolve({isStreamingSupported:g.isStreamingSupported,isRangeSupported:g.isRangeSupported,contentLength:g.contentLength})},v.reject),v.promise}),t.on("GetRangeReader",(o,v)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const g=this._networkStream.getRangeReader(o.begin,o.end);if(!g){v.close();return}v.onPull=()=>{g.read().then(function({value:l,done:n}){if(n){v.close();return}(0,_util.assert)((0,_util.isArrayBuffer)(l),"GetRangeReader - expected an ArrayBuffer."),v.enqueue(new Uint8Array(l),1,[l])}).catch(l=>{v.error(l)})},v.onCancel=l=>{g.cancel(l),v.ready.catch(n=>{if(!this.destroyed)throw n})}}),t.on("GetDoc",({pdfInfo:o})=>{this._numPages=o.numPages,this._htmlForXfa=o.htmlForXfa,delete o.htmlForXfa,s._capability.resolve(new PDFDocumentProxy(o,this))}),t.on("DocException",function(o){let v;switch(o.name){case"PasswordException":v=new _util.PasswordException(o.message,o.code);break;case"InvalidPDFException":v=new _util.InvalidPDFException(o.message);break;case"MissingPDFException":v=new _util.MissingPDFException(o.message);break;case"UnexpectedResponseException":v=new _util.UnexpectedResponseException(o.message,o.status);break;case"UnknownErrorException":v=new _util.UnknownErrorException(o.message,o.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}s._capability.reject(v)}),t.on("PasswordRequest",o=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),s.onPassword){const v=g=>{g instanceof Error?this._passwordCapability.reject(g):this._passwordCapability.resolve({password:g})};try{s.onPassword(v,o.code)}catch(g){this._passwordCapability.reject(g)}}else this._passwordCapability.reject(new _util.PasswordException(o.message,o.code));return this._passwordCapability.promise}),t.on("DataLoaded",o=>{var v;(v=s.onProgress)==null||v.call(s,{loaded:o.length,total:o.length}),this.downloadInfoCapability.resolve(o)}),t.on("StartRenderPage",o=>{if(this.destroyed)return;R(this,V).get(o.pageIndex)._startRenderPage(o.transparency,o.cacheKey)}),t.on("commonobj",([o,v,g])=>{var l;if(!this.destroyed&&!this.commonObjs.has(o))switch(v){case"Font":const n=this._params;if("error"in g){const E=g.error;(0,_util.warn)(`Error during font loading: ${E}`),this.commonObjs.resolve(o,E);break}let r=null;n.pdfBug&&((l=globalThis.FontInspector)!=null&&l.enabled)&&(r={registerFont(E,x){globalThis.FontInspector.fontAdded(E,x)}});const e=new _font_loader.FontFaceObject(g,{isEvalSupported:n.isEvalSupported,disableFontFace:n.disableFontFace,ignoreErrors:n.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:r});this.fontLoader.bind(e).catch(E=>t.sendWithPromise("FontFallback",{id:o})).finally(()=>{!n.fontExtraProperties&&e.data&&(e.data=null),this.commonObjs.resolve(o,e)});break;case"FontPath":case"Image":this.commonObjs.resolve(o,g);break;default:throw new Error(`Got unknown common object type ${v}`)}}),t.on("obj",([o,v,g,l])=>{var r;if(this.destroyed)return;const n=R(this,V).get(v);if(!n.objs.has(o))switch(g){case"Image":n.objs.resolve(o,l);const e=8e6;if(l){let E;if(l.bitmap){const{bitmap:x,width:L,height:O}=l;E=L*O*4,n._bitmaps.add(x)}else E=((r=l.data)==null?void 0:r.length)||0;E>e&&(n.cleanupAfterRender=!0)}break;case"Pattern":n.objs.resolve(o,l);break;default:throw new Error(`Got unknown object type ${g}`)}}),t.on("DocProgress",o=>{var v;this.destroyed||(v=s.onProgress)==null||v.call(s,{loaded:o.loaded,total:o.total})}),t.on("DocStats",o=>{this.destroyed||It(this,_,Object.freeze({streamTypes:Object.freeze(o.streamTypes),fontTypes:Object.freeze(o.fontTypes)}))}),t.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),t.on("FetchBuiltInCMap",o=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.CMapReaderFactory?this.CMapReaderFactory.fetch(o):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",o=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.StandardFontDataFactory?this.StandardFontDataFactory.fetch(o):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}_onUnsupportedFeature({featureId:t}){var s,o;this.destroyed||(o=(s=this.loadingTask).onUnsupportedFeature)==null||o.call(s,t)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const s=t-1,o=R(this,q).get(s);if(o)return o;const v=this.messageHandler.sendWithPromise("GetPage",{pageIndex:s}).then(g=>{if(this.destroyed)throw new Error("Transport destroyed");const l=new PDFPageProxy(s,g,this,this._params.ownerDocument,this._params.pdfBug);return R(this,V).set(s,l),l});return R(this,q).set(s,v),v}getPageIndex(t){return typeof t!="object"||t===null||!Number.isInteger(t.num)||t.num<0||!Number.isInteger(t.gen)||t.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen})}getAnnotations(t,s){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:s})}saveDocument(){var t;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:((t=this._fullReader)==null?void 0:t.filename)??null}).finally(()=>{this.annotationStorage.resetModified()})}getFieldObjects(){return this._getFieldObjectsPromise||(this._getFieldObjectsPromise=this.messageHandler.sendWithPromise("GetFieldObjects",null))}hasJSActions(){return this._hasJSActionsPromise||(this._hasJSActionsPromise=this.messageHandler.sendWithPromise("HasJSActions",null))}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(t=>new _optional_content_config.OptionalContentConfig(t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return R(this,Y)||It(this,Y,this.messageHandler.sendWithPromise("GetMetadata",null).then(t=>{var s,o;return{info:t[0],metadata:t[1]?new _metadata.Metadata(t[1]):null,contentDispositionFilename:((s=this._fullReader)==null?void 0:s.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(await this.messageHandler.sendWithPromise("Cleanup",null),!this.destroyed){for(const s of R(this,V).values())if(!s.cleanup())throw new Error(`startCleanup: Page ${s.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),It(this,Y,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null}}get loadingParams(){const t=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:t.disableAutoFetch,enableXfa:t.enableXfa})}}_=new WeakMap,V=new WeakMap,q=new WeakMap,Y=new WeakMap;class PDFObjects{constructor(){Ot(this,b);Ot(this,M,Object.create(null))}get(t,s=null){if(s){const v=Dt(this,b,ln).call(this,t);return v.capability.promise.then(()=>s(v.data)),null}const o=R(this,M)[t];if(!(o!=null&&o.capability.settled))throw new Error(`Requesting object that isn't resolved yet ${t}.`);return o.data}has(t){const s=R(this,M)[t];return(s==null?void 0:s.capability.settled)||!1}resolve(t,s=null){const o=Dt(this,b,ln).call(this,t);o.data=s,o.capability.resolve()}clear(){It(this,M,Object.create(null))}}M=new WeakMap,b=new WeakSet,ln=function(t){const s=R(this,M)[t];return s||(R(this,M)[t]={capability:(0,_util.createPromiseCapability)(),data:null})};class RenderTask{constructor(t){Ot(this,P,null);It(this,P,t),this.onContinue=null}get promise(){return R(this,P).capability.promise}cancel(){R(this,P).cancel()}get separateAnnots(){const{separateAnnots:t}=R(this,P).operatorList;if(!t)return!1;const{annotationCanvasMap:s}=R(this,P);return t.form||t.canvas&&(s==null?void 0:s.size)>0}}P=new WeakMap,exports.RenderTask=RenderTask;const S=class S{constructor({callback:t,params:s,objs:o,commonObjs:v,annotationCanvasMap:g,operatorList:l,pageIndex:n,canvasFactory:r,useRequestAnimationFrame:e=!1,pdfBug:E=!1,pageColors:x=null}){this.callback=t,this.params=s,this.objs=o,this.commonObjs=v,this.annotationCanvasMap=g,this.operatorListIdx=null,this.operatorList=l,this._pageIndex=n,this.canvasFactory=r,this._pdfBug=E,this.pageColors=x,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=e===!0&&typeof window<"u",this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=s.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:s}){var r;if(this.cancelled)return;if(this._canvas){if(R(S,F).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");R(S,F).add(this._canvas)}this._pdfBug&&((r=globalThis.StepperManager)!=null&&r.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:o,viewport:v,transform:g,imageLayer:l,background:n}=this.params;this.gfx=new _canvas.CanvasGraphics(o,this.commonObjs,this.objs,this.canvasFactory,l,s,this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:g,viewport:v,transparency:t,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(t=null){this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&R(S,F).delete(this._canvas),this.callback(t||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas"))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}this.stepper&&this.stepper.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this._canvas&&R(S,F).delete(this._canvas),this.callback())))}};F=new WeakMap,Ot(S,F,new WeakSet);let InternalRenderTask=S;const version="2.16.105";exports.version=version;const build="172ccdbe5";exports.build=build}),((m,a,A)=>{var M,xn,w;Object.defineProperty(a,"__esModule",{value:!0}),a.PrintAnnotationStorage=a.AnnotationStorage=void 0;var f=A(1),_=A(6),V=A(10);class q{constructor(){Ot(this,M);this._storage=new Map,this._modified=!1,this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(F,S){const c=this._storage.get(F);return c===void 0?S:Object.assign(S,c)}getRawValue(F){return this._storage.get(F)}remove(F){if(this._storage.delete(F),this._storage.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const S of this._storage.values())if(S instanceof _.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(F,S){const c=this._storage.get(F);let t=!1;if(c!==void 0)for(const[s,o]of Object.entries(S))c[s]!==o&&(t=!0,c[s]=o);else t=!0,this._storage.set(F,S);t&&Dt(this,M,xn).call(this),S instanceof _.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(S.constructor._type)}has(F){return this._storage.has(F)}getAll(){return this._storage.size>0?(0,f.objectFromMap)(this._storage):null}get size(){return this._storage.size}resetModified(){this._modified&&(this._modified=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Y(this)}get serializable(){if(this._storage.size===0)return null;const F=new Map;for(const[S,c]of this._storage){const t=c instanceof _.AnnotationEditor?c.serialize():c;t&&F.set(S,t)}return F}static getHash(F){if(!F)return"";const S=new V.MurmurHash3_64;for(const[c,t]of F)S.update(`${c}:${JSON.stringify(t)}`);return S.hexdigest()}}M=new WeakSet,xn=function(){this._modified||(this._modified=!0,typeof this.onSetModified=="function"&&this.onSetModified())},a.AnnotationStorage=q;class Y extends q{constructor(S){super();Ot(this,w,null);It(this,w,structuredClone(S.serializable))}get print(){(0,f.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return R(this,w)}}w=new WeakMap,a.PrintAnnotationStorage=Y}),((m,a,A)=>{var q,Y,M,b,w,P;Object.defineProperty(a,"__esModule",{value:!0}),a.AnnotationEditor=void 0;var f=A(7),_=A(1);const F=class F{constructor(c){Ot(this,q,this.focusin.bind(this));Ot(this,Y,this.focusout.bind(this));Ot(this,M,!1);Ot(this,b,!1);Ot(this,w,!1);Ot(this,P,F._zIndex++);this.constructor===F&&(0,_.unreachable)("Cannot initialize AnnotationEditor."),this.parent=c.parent,this.id=c.id,this.width=this.height=null,this.pageIndex=c.parent.pageIndex,this.name=c.name,this.div=null;const[t,s]=this.parent.viewportBaseDimensions;this.x=c.x/t,this.y=c.y/s,this.rotation=this.parent.viewport.rotation,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,_.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=R(this,P)}focusin(c){R(this,M)?It(this,M,!1):this.parent.setSelected(this)}focusout(c){if(!this.isAttachedToDOM)return;const t=c.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(c.preventDefault(),this.parent.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.parent.addToAnnotationStorage(this)}dragstart(c){const t=this.parent.div.getBoundingClientRect();this.startX=c.clientX-t.x,this.startY=c.clientY-t.y,c.dataTransfer.setData("text/plain",this.id),c.dataTransfer.effectAllowed="move"}setAt(c,t,s,o){const[v,g]=this.parent.viewportBaseDimensions;[s,o]=this.screenToPageTranslation(s,o),this.x=(c+s)/v,this.y=(t+o)/g,this.div.style.left=`${100*this.x}%`,this.div.style.top=`${100*this.y}%`}translate(c,t){const[s,o]=this.parent.viewportBaseDimensions;[c,t]=this.screenToPageTranslation(c,t),this.x+=c/s,this.y+=t/o,this.div.style.left=`${100*this.x}%`,this.div.style.top=`${100*this.y}%`}screenToPageTranslation(c,t){const{rotation:s}=this.parent.viewport;switch(s){case 90:return[t,-c];case 180:return[-c,-t];case 270:return[-t,c];default:return[c,t]}}setDims(c,t){const[s,o]=this.parent.viewportBaseDimensions;this.div.style.width=`${100*c/s}%`,this.div.style.height=`${100*t/o}%`}getInitialTranslation(){return[0,0]}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",R(this,q)),this.div.addEventListener("focusout",R(this,Y));const[c,t]=this.getInitialTranslation();return this.translate(c,t),(0,f.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(c){const t=f.KeyboardManager.platform.isMac;if(c.button!==0||c.ctrlKey&&t){c.preventDefault();return}c.ctrlKey&&!t||c.shiftKey||c.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this),It(this,M,!0)}getRect(c,t){const[s,o]=this.parent.viewportBaseDimensions,[v,g]=this.parent.pageDimensions,l=v*c/s,n=g*t/o,r=this.x*v,e=this.y*g,E=this.width*v,x=this.height*g;switch(this.rotation){case 0:return[r+l,g-e-n-x,r+l+E,g-e-n];case 90:return[r+n,g-e+l,r+n+x,g-e+l+E];case 180:return[r-l-E,g-e+n,r-l,g-e+n+x];case 270:return[r-n-x,g-e-l-E,r-n,g-e-l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(c,t){const[s,o,v,g]=c,l=v-s,n=g-o;switch(this.rotation){case 0:return[s,t-g,l,n];case 90:return[s,t-o,n,l];case 180:return[v,t-o,l,n];case 270:return[v,t-g,n,l];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){It(this,w,!0)}disableEditMode(){It(this,w,!1)}isInEditMode(){return R(this,w)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var c;(c=this.div)==null||c.addEventListener("focusin",R(this,q))}serialize(){(0,_.unreachable)("An editor must be serializable")}static deserialize(c,t){const s=new this.prototype.constructor({parent:t,id:t.getNextId()});s.rotation=c.rotation;const[o,v]=t.pageDimensions,[g,l,n,r]=s.getRectInCurrentCoords(c.rect,v);return s.x=g/o,s.y=l/v,s.width=n/o,s.height=r/v,s}remove(){this.div.removeEventListener("focusin",R(this,q)),this.div.removeEventListener("focusout",R(this,Y)),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){var c;(c=this.div)==null||c.classList.add("selectedEditor")}unselect(){var c;(c=this.div)==null||c.classList.remove("selectedEditor")}updateParams(c,t){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return R(this,b)}set isEditing(c){It(this,b,c),c?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}};q=new WeakMap,Y=new WeakMap,M=new WeakMap,b=new WeakMap,w=new WeakMap,P=new WeakMap,ee(F,"_colorManager",new f.ColorManager),ee(F,"_zIndex",1);let V=F;a.AnnotationEditor=V}),((m,a,A)=>{var S,c,t,s,o,v,wn,n,e,E,x,L,O,yt,St,pt,K,N,U,G,bt,wt,Mt,H,h,u,kn,un,re,Ee,Pn,Tn,cn,Ce,ve;Object.defineProperty(a,"__esModule",{value:!0}),a.KeyboardManager=a.CommandManager=a.ColorManager=a.AnnotationEditorUIManager=void 0,a.bindEvents=V,a.opacityToHex=q;var f=A(1),_=A(8);function V(D,p,B){for(const _t of B)p.addEventListener(_t,D[_t].bind(D))}function q(D){return Math.round(Math.min(255,Math.max(1,255*D))).toString(16).padStart(2,"0")}class Y{constructor(){Ot(this,S,0)}getId(){return`${f.AnnotationEditorPrefix}${on(this,S)._++}`}}S=new WeakMap;class M{constructor(p=128){Ot(this,c,[]);Ot(this,t,!1);Ot(this,s);Ot(this,o,-1);It(this,s,p)}add({cmd:p,undo:B,mustExec:_t,type:z=NaN,overwriteIfSameType:Q=!1,keepUndo:At=!1}){if(_t&&p(),R(this,t))return;const kt={cmd:p,undo:B,type:z};if(R(this,o)===-1){R(this,c).length>0&&(R(this,c).length=0),It(this,o,0),R(this,c).push(kt);return}if(Q&&R(this,c)[R(this,o)].type===z){At&&(kt.undo=R(this,c)[R(this,o)].undo),R(this,c)[R(this,o)]=kt;return}const Rt=R(this,o)+1;Rt===R(this,s)?R(this,c).splice(0,1):(It(this,o,Rt),Rt<R(this,c).length&&R(this,c).splice(Rt)),R(this,c).push(kt)}undo(){R(this,o)!==-1&&(It(this,t,!0),R(this,c)[R(this,o)].undo(),It(this,t,!1),It(this,o,R(this,o)-1))}redo(){R(this,o)<R(this,c).length-1&&(It(this,o,R(this,o)+1),It(this,t,!0),R(this,c)[R(this,o)].cmd(),It(this,t,!1))}hasSomethingToUndo(){return R(this,o)!==-1}hasSomethingToRedo(){return R(this,o)<R(this,c).length-1}destroy(){It(this,c,null)}}c=new WeakMap,t=new WeakMap,s=new WeakMap,o=new WeakMap,a.CommandManager=M;const l=class l{constructor(p){Ot(this,v);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const B=l.platform.isMac;for(const[_t,z]of p)for(const Q of _t){const At=Q.startsWith("mac+");B&&At?(this.callbacks.set(Q.slice(4),z),this.allKeys.add(Q.split("+").at(-1))):!B&&!At&&(this.callbacks.set(Q,z),this.allKeys.add(Q.split("+").at(-1)))}}static get platform(){const p=typeof navigator<"u"?navigator.platform:"";return(0,f.shadow)(this,"platform",{isWin:p.includes("Win"),isMac:p.includes("Mac")})}exec(p,B){if(!this.allKeys.has(B.key))return;const _t=this.callbacks.get(Dt(this,v,wn).call(this,B));_t&&(_t.bind(p)(),B.stopPropagation(),B.preventDefault())}};v=new WeakSet,wn=function(p){p.altKey&&this.buffer.push("alt"),p.ctrlKey&&this.buffer.push("ctrl"),p.metaKey&&this.buffer.push("meta"),p.shiftKey&&this.buffer.push("shift"),this.buffer.push(p.key);const B=this.buffer.join("+");return this.buffer.length=0,B};let b=l;a.KeyboardManager=b;class w{constructor(){Ot(this,n,null)}copy(p){p&&(Array.isArray(p)?It(this,n,p.map(B=>B.serialize())):It(this,n,[p.serialize()]),It(this,n,R(this,n).filter(B=>!!B)),R(this,n).length===0&&It(this,n,null))}paste(){return R(this,n)}isEmpty(){return R(this,n)===null}destroy(){It(this,n,null)}}n=new WeakMap;const r=class r{get _colors(){const p=new Map([["CanvasText",null],["Canvas",null]]);return(0,_.getColorValues)(p),(0,f.shadow)(this,"_colors",p)}convert(p){const B=(0,_.getRGB)(p);if(!window.matchMedia("(forced-colors: active)").matches)return B;for(const[_t,z]of this._colors)if(z.every((Q,At)=>Q===B[At]))return r._colorsMapping.get(_t);return B}getHexCode(p){const B=this._colors.get(p);return B?f.Util.makeHexColor(...B):p}};ee(r,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let P=r;a.ColorManager=P;const j=class j{constructor(p,B){Ot(this,u);Ot(this,e,null);Ot(this,E,new Map);Ot(this,x,new Map);Ot(this,L,new w);Ot(this,O,new M);Ot(this,yt,0);Ot(this,St,null);Ot(this,pt,null);Ot(this,K,new Y);Ot(this,N,!1);Ot(this,U,f.AnnotationEditorType.NONE);Ot(this,G,new Set);Ot(this,bt,this.keydown.bind(this));Ot(this,wt,this.onEditingAction.bind(this));Ot(this,Mt,this.onPageChanging.bind(this));Ot(this,H,{isEditing:!1,isEmpty:!0,hasEmptyClipboard:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1});Ot(this,h,null);It(this,h,p),It(this,pt,B),R(this,pt)._on("editingaction",R(this,wt)),R(this,pt)._on("pagechanging",R(this,Mt))}destroy(){Dt(this,u,un).call(this),R(this,pt)._off("editingaction",R(this,wt)),R(this,pt)._off("pagechanging",R(this,Mt));for(const p of R(this,x).values())p.destroy();R(this,x).clear(),R(this,E).clear(),It(this,e,null),R(this,G).clear(),R(this,L).destroy(),R(this,O).destroy()}onPageChanging({pageNumber:p}){It(this,yt,p-1)}focusMainContainer(){R(this,h).focus()}keydown(p){var B;(B=this.getActive())!=null&&B.shouldGetKeyboardEvents()||j._keyboardManager.exec(this,p)}onEditingAction(p){["undo","redo","cut","copy","paste","delete","selectAll"].includes(p.name)&&this[p.name]()}setEditingState(p){p?(Dt(this,u,kn).call(this),Dt(this,u,re).call(this,{isEditing:R(this,U)!==f.AnnotationEditorType.NONE,isEmpty:Dt(this,u,Ce).call(this),hasSomethingToUndo:R(this,O).hasSomethingToUndo(),hasSomethingToRedo:R(this,O).hasSomethingToRedo(),hasSelectedEditor:!1,hasEmptyClipboard:R(this,L).isEmpty()})):(Dt(this,u,un).call(this),Dt(this,u,re).call(this,{isEditing:!1}))}registerEditorTypes(p){It(this,St,p);for(const B of R(this,St))Dt(this,u,Ee).call(this,B.defaultPropertiesToUpdate)}getId(){return R(this,K).getId()}addLayer(p){R(this,x).set(p.pageIndex,p),R(this,N)?p.enable():p.disable()}removeLayer(p){R(this,x).delete(p.pageIndex)}updateMode(p){if(It(this,U,p),p===f.AnnotationEditorType.NONE)this.setEditingState(!1),Dt(this,u,Tn).call(this);else{this.setEditingState(!0),Dt(this,u,Pn).call(this);for(const B of R(this,x).values())B.updateMode(p)}}updateToolbar(p){p!==R(this,U)&&R(this,pt).dispatch("switchannotationeditormode",{source:this,mode:p})}updateParams(p,B){for(const _t of R(this,G))_t.updateParams(p,B);for(const _t of R(this,St))_t.updateDefaultParams(p,B)}getEditors(p){const B=[];for(const _t of R(this,E).values())_t.pageIndex===p&&B.push(_t);return B}getEditor(p){return R(this,E).get(p)}addEditor(p){R(this,E).set(p.id,p)}removeEditor(p){R(this,E).delete(p.id),this.unselect(p)}setActiveEditor(p){R(this,e)!==p&&(It(this,e,p),p&&Dt(this,u,Ee).call(this,p.propertiesToUpdate))}toggleSelected(p){if(R(this,G).has(p)){R(this,G).delete(p),p.unselect(),Dt(this,u,re).call(this,{hasSelectedEditor:this.hasSelection});return}R(this,G).add(p),p.select(),Dt(this,u,Ee).call(this,p.propertiesToUpdate),Dt(this,u,re).call(this,{hasSelectedEditor:!0})}setSelected(p){for(const B of R(this,G))B!==p&&B.unselect();R(this,G).clear(),R(this,G).add(p),p.select(),Dt(this,u,Ee).call(this,p.propertiesToUpdate),Dt(this,u,re).call(this,{hasSelectedEditor:!0})}isSelected(p){return R(this,G).has(p)}unselect(p){p.unselect(),R(this,G).delete(p),Dt(this,u,re).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return R(this,G).size!==0}undo(){R(this,O).undo(),Dt(this,u,re).call(this,{hasSomethingToUndo:R(this,O).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:Dt(this,u,Ce).call(this)})}redo(){R(this,O).redo(),Dt(this,u,re).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:R(this,O).hasSomethingToRedo(),isEmpty:Dt(this,u,Ce).call(this)})}addCommands(p){R(this,O).add(p),Dt(this,u,re).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:Dt(this,u,Ce).call(this)})}delete(){if(R(this,e)&&R(this,e).commitOrRemove(),!this.hasSelection)return;const p=[...R(this,G)],B=()=>{for(const z of p)z.remove()},_t=()=>{for(const z of p)Dt(this,u,cn).call(this,z)};this.addCommands({cmd:B,undo:_t,mustExec:!0})}copy(){if(R(this,e)&&R(this,e).commitOrRemove(),this.hasSelection){const p=[];for(const B of R(this,G))B.isEmpty()||p.push(B);if(p.length===0)return;R(this,L).copy(p),Dt(this,u,re).call(this,{hasEmptyClipboard:!1})}}cut(){this.copy(),this.delete()}paste(){if(R(this,L).isEmpty())return;this.unselectAll();const p=R(this,x).get(R(this,yt)),B=R(this,L).paste().map(Q=>p.deserialize(Q)),_t=()=>{for(const Q of B)Dt(this,u,cn).call(this,Q);Dt(this,u,ve).call(this,B)},z=()=>{for(const Q of B)Q.remove()};this.addCommands({cmd:_t,undo:z,mustExec:!0})}selectAll(){for(const p of R(this,G))p.commit();Dt(this,u,ve).call(this,R(this,E).values())}unselectAll(){if(R(this,e)){R(this,e).commitOrRemove();return}if(Dt(this,u,ve).size!==0){for(const p of R(this,G))p.unselect();R(this,G).clear(),Dt(this,u,re).call(this,{hasSelectedEditor:!1})}}isActive(p){return R(this,e)===p}getActive(){return R(this,e)}getMode(){return R(this,U)}};e=new WeakMap,E=new WeakMap,x=new WeakMap,L=new WeakMap,O=new WeakMap,yt=new WeakMap,St=new WeakMap,pt=new WeakMap,K=new WeakMap,N=new WeakMap,U=new WeakMap,G=new WeakMap,bt=new WeakMap,wt=new WeakMap,Mt=new WeakMap,H=new WeakMap,h=new WeakMap,u=new WeakSet,kn=function(){R(this,h).addEventListener("keydown",R(this,bt))},un=function(){R(this,h).removeEventListener("keydown",R(this,bt))},re=function(p){Object.entries(p).some(([_t,z])=>R(this,H)[_t]!==z)&&R(this,pt).dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(R(this,H),p)})},Ee=function(p){R(this,pt).dispatch("annotationeditorparamschanged",{source:this,details:p})},Pn=function(){if(!R(this,N)){It(this,N,!0);for(const p of R(this,x).values())p.enable()}},Tn=function(){if(this.unselectAll(),R(this,N)){It(this,N,!1);for(const p of R(this,x).values())p.disable()}},cn=function(p){const B=R(this,x).get(p.pageIndex);B?B.addOrRebuild(p):this.addEditor(p)},Ce=function(){if(R(this,E).size===0)return!0;if(R(this,E).size===1)for(const p of R(this,E).values())return p.isEmpty();return!1},ve=function(p){R(this,G).clear();for(const B of p)B.isEmpty()||(R(this,G).add(B),B.select());Dt(this,u,re).call(this,{hasSelectedEditor:!0})},ee(j,"_keyboardManager",new b([[["ctrl+a","mac+meta+a"],j.prototype.selectAll],[["ctrl+c","mac+meta+c"],j.prototype.copy],[["ctrl+v","mac+meta+v"],j.prototype.paste],[["ctrl+x","mac+meta+x"],j.prototype.cut],[["ctrl+z","mac+meta+z"],j.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],j.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],j.prototype.delete],[["Escape","mac+Escape"],j.prototype.unselectAll]]));let F=j;a.AnnotationEditorUIManager=F}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.StatTimer=a.RenderingCancelledException=a.PixelsPerInch=a.PageViewport=a.PDFDateString=a.DOMStandardFontDataFactory=a.DOMSVGFactory=a.DOMCanvasFactory=a.DOMCMapReaderFactory=a.AnnotationPrefix=void 0,a.deprecated=r,a.getColorValues=O,a.getCurrentTransform=yt,a.getCurrentTransformInverse=St,a.getFilenameFromUrl=o,a.getPdfFilenameFromUrl=v,a.getRGB=L,a.getXfaPageViewport=x,a.isDataScheme=t,a.isPdfFile=s,a.isValidFetchUrl=l,a.loadScript=n;var f=A(9),_=A(1);const V="http://www.w3.org/2000/svg",q="pdfjs_internal_id_";a.AnnotationPrefix=q;const pt=class pt{};ee(pt,"CSS",96),ee(pt,"PDF",72),ee(pt,"PDF_TO_CSS_UNITS",pt.CSS/pt.PDF);let Y=pt;a.PixelsPerInch=Y;class M extends f.BaseCanvasFactory{constructor({ownerDocument:N=globalThis.document}={}){super(),this._document=N}_createCanvas(N,U){const G=this._document.createElement("canvas");return G.width=N,G.height=U,G}}a.DOMCanvasFactory=M;async function b(K,N=!1){if(l(K,document.baseURI)){const U=await fetch(K);if(!U.ok)throw new Error(U.statusText);return N?new Uint8Array(await U.arrayBuffer()):(0,_.stringToBytes)(await U.text())}return new Promise((U,G)=>{const bt=new XMLHttpRequest;bt.open("GET",K,!0),N&&(bt.responseType="arraybuffer"),bt.onreadystatechange=()=>{if(bt.readyState===XMLHttpRequest.DONE){if(bt.status===200||bt.status===0){let wt;if(N&&bt.response?wt=new Uint8Array(bt.response):!N&&bt.responseText&&(wt=(0,_.stringToBytes)(bt.responseText)),wt){U(wt);return}}G(new Error(bt.statusText))}},bt.send(null)})}class w extends f.BaseCMapReaderFactory{_fetchData(N,U){return b(N,this.isCompressed).then(G=>({cMapData:G,compressionType:U}))}}a.DOMCMapReaderFactory=w;class P extends f.BaseStandardFontDataFactory{_fetchData(N){return b(N,!0)}}a.DOMStandardFontDataFactory=P;class F extends f.BaseSVGFactory{_createSVG(N){return document.createElementNS(V,N)}}a.DOMSVGFactory=F;class S{constructor({viewBox:N,scale:U,rotation:G,offsetX:bt=0,offsetY:wt=0,dontFlip:Mt=!1}){this.viewBox=N,this.scale=U,this.rotation=G,this.offsetX=bt,this.offsetY=wt;const H=(N[2]+N[0])/2,h=(N[3]+N[1])/2;let u,T,I,$;switch(G%=360,G<0&&(G+=360),G){case 180:u=-1,T=0,I=0,$=1;break;case 90:u=0,T=1,I=1,$=0;break;case 270:u=0,T=-1,I=-1,$=0;break;case 0:u=1,T=0,I=0,$=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}Mt&&(I=-I,$=-$);let W,i,d,C;u===0?(W=Math.abs(h-N[1])*U+bt,i=Math.abs(H-N[0])*U+wt,d=Math.abs(N[3]-N[1])*U,C=Math.abs(N[2]-N[0])*U):(W=Math.abs(H-N[0])*U+bt,i=Math.abs(h-N[1])*U+wt,d=Math.abs(N[2]-N[0])*U,C=Math.abs(N[3]-N[1])*U),this.transform=[u*U,T*U,I*U,$*U,W-u*U*H-I*U*h,i-T*U*H-$*U*h],this.width=d,this.height=C}clone({scale:N=this.scale,rotation:U=this.rotation,offsetX:G=this.offsetX,offsetY:bt=this.offsetY,dontFlip:wt=!1}={}){return new S({viewBox:this.viewBox.slice(),scale:N,rotation:U,offsetX:G,offsetY:bt,dontFlip:wt})}convertToViewportPoint(N,U){return _.Util.applyTransform([N,U],this.transform)}convertToViewportRectangle(N){const U=_.Util.applyTransform([N[0],N[1]],this.transform),G=_.Util.applyTransform([N[2],N[3]],this.transform);return[U[0],U[1],G[0],G[1]]}convertToPdfPoint(N,U){return _.Util.applyInverseTransform([N,U],this.transform)}}a.PageViewport=S;class c extends _.BaseException{constructor(N,U){super(N,"RenderingCancelledException"),this.type=U}}a.RenderingCancelledException=c;function t(K){const N=K.length;let U=0;for(;U<N&&K[U].trim()==="";)U++;return K.substring(U,U+5).toLowerCase()==="data:"}function s(K){return typeof K=="string"&&/\.pdf$/i.test(K)}function o(K){const N=K.indexOf("#"),U=K.indexOf("?"),G=Math.min(N>0?N:K.length,U>0?U:K.length);return K.substring(K.lastIndexOf("/",G)+1,G)}function v(K,N="document.pdf"){if(typeof K!="string")return N;if(t(K))return(0,_.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),N;const U=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,G=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,bt=U.exec(K);let wt=G.exec(bt[1])||G.exec(bt[2])||G.exec(bt[3]);if(wt&&(wt=wt[0],wt.includes("%")))try{wt=G.exec(decodeURIComponent(wt))[0]}catch{}return wt||N}class g{constructor(){this.started=Object.create(null),this.times=[]}time(N){N in this.started&&(0,_.warn)(`Timer is already running for ${N}`),this.started[N]=Date.now()}timeEnd(N){N in this.started||(0,_.warn)(`Timer has not been started for ${N}`),this.times.push({name:N,start:this.started[N],end:Date.now()}),delete this.started[N]}toString(){const N=[];let U=0;for(const G of this.times){const bt=G.name;bt.length>U&&(U=bt.length)}for(const G of this.times){const bt=G.end-G.start;N.push(`${G.name.padEnd(U)} ${bt}ms
|
|
38
|
-
`)}return N.join("")}}a.StatTimer=g;function l(K,N){try{const{protocol:U}=N?new URL(K,N):new URL(K);return U==="http:"||U==="https:"}catch{return!1}}function n(K,N=!1){return new Promise((U,G)=>{const bt=document.createElement("script");bt.src=K,bt.onload=function(wt){N&&bt.remove(),U(wt)},bt.onerror=function(){G(new Error(`Cannot load script at: ${bt.src}`))},(document.head||document.documentElement).append(bt)})}function r(K){console.log("Deprecated API usage: "+K)}let e;class E{static toDateObject(N){if(!N||typeof N!="string")return null;e||(e=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const U=e.exec(N);if(!U)return null;const G=parseInt(U[1],10);let bt=parseInt(U[2],10);bt=bt>=1&&bt<=12?bt-1:0;let wt=parseInt(U[3],10);wt=wt>=1&&wt<=31?wt:1;let Mt=parseInt(U[4],10);Mt=Mt>=0&&Mt<=23?Mt:0;let H=parseInt(U[5],10);H=H>=0&&H<=59?H:0;let h=parseInt(U[6],10);h=h>=0&&h<=59?h:0;const u=U[7]||"Z";let T=parseInt(U[8],10);T=T>=0&&T<=23?T:0;let I=parseInt(U[9],10)||0;return I=I>=0&&I<=59?I:0,u==="-"?(Mt+=T,H+=I):u==="+"&&(Mt-=T,H-=I),new Date(Date.UTC(G,bt,wt,Mt,H,h))}}a.PDFDateString=E;function x(K,{scale:N=1,rotation:U=0}){const{width:G,height:bt}=K.attributes.style,wt=[0,0,parseInt(G),parseInt(bt)];return new S({viewBox:wt,scale:N,rotation:U})}function L(K){if(K.startsWith("#")){const N=parseInt(K.slice(1),16);return[(N&16711680)>>16,(N&65280)>>8,N&255]}return K.startsWith("rgb(")?K.slice(4,-1).split(",").map(N=>parseInt(N)):K.startsWith("rgba(")?K.slice(5,-1).split(",").map(N=>parseInt(N)).slice(0,3):((0,_.warn)(`Not a valid color format: "${K}"`),[0,0,0])}function O(K){const N=document.createElement("span");N.style.visibility="hidden",document.body.append(N);for(const U of K.keys()){N.style.color=U;const G=window.getComputedStyle(N).color;K.set(U,L(G))}N.remove()}function yt(K){const{a:N,b:U,c:G,d:bt,e:wt,f:Mt}=K.getTransform();return[N,U,G,bt,wt,Mt]}function St(K){const{a:N,b:U,c:G,d:bt,e:wt,f:Mt}=K.getTransform().invertSelf();return[N,U,G,bt,wt,Mt]}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BaseStandardFontDataFactory=a.BaseSVGFactory=a.BaseCanvasFactory=a.BaseCMapReaderFactory=void 0;var f=A(1);class _{constructor(){this.constructor===_&&(0,f.unreachable)("Cannot initialize BaseCanvasFactory.")}create(b,w){if(b<=0||w<=0)throw new Error("Invalid canvas size");const P=this._createCanvas(b,w);return{canvas:P,context:P.getContext("2d")}}reset(b,w,P){if(!b.canvas)throw new Error("Canvas is not specified");if(w<=0||P<=0)throw new Error("Invalid canvas size");b.canvas.width=w,b.canvas.height=P}destroy(b){if(!b.canvas)throw new Error("Canvas is not specified");b.canvas.width=0,b.canvas.height=0,b.canvas=null,b.context=null}_createCanvas(b,w){(0,f.unreachable)("Abstract method `_createCanvas` called.")}}a.BaseCanvasFactory=_;class V{constructor({baseUrl:b=null,isCompressed:w=!1}){this.constructor===V&&(0,f.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=b,this.isCompressed=w}async fetch({name:b}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!b)throw new Error("CMap name must be specified.");const w=this.baseUrl+b+(this.isCompressed?".bcmap":""),P=this.isCompressed?f.CMapCompressionType.BINARY:f.CMapCompressionType.NONE;return this._fetchData(w,P).catch(F=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${w}`)})}_fetchData(b,w){(0,f.unreachable)("Abstract method `_fetchData` called.")}}a.BaseCMapReaderFactory=V;class q{constructor({baseUrl:b=null}){this.constructor===q&&(0,f.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=b}async fetch({filename:b}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!b)throw new Error("Font filename must be specified.");const w=`${this.baseUrl}${b}`;return this._fetchData(w).catch(P=>{throw new Error(`Unable to load font data at: ${w}`)})}_fetchData(b){(0,f.unreachable)("Abstract method `_fetchData` called.")}}a.BaseStandardFontDataFactory=q;class Y{constructor(){this.constructor===Y&&(0,f.unreachable)("Cannot initialize BaseSVGFactory.")}create(b,w,P=!1){if(b<=0||w<=0)throw new Error("Invalid SVG dimensions");const F=this._createSVG("svg:svg");return F.setAttribute("version","1.1"),P||(F.setAttribute("width",`${b}px`),F.setAttribute("height",`${w}px`)),F.setAttribute("preserveAspectRatio","none"),F.setAttribute("viewBox",`0 0 ${b} ${w}`),F}createElement(b){if(typeof b!="string")throw new Error("Invalid SVG element type");return this._createSVG(b)}_createSVG(b){(0,f.unreachable)("Abstract method `_createSVG` called.")}}a.BaseSVGFactory=Y}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.MurmurHash3_64=void 0;var f=A(1);const _=3285377520,V=4294901760,q=65535;class Y{constructor(b){this.h1=b?b&4294967295:_,this.h2=b?b&4294967295:_}update(b){let w,P;if(typeof b=="string"){w=new Uint8Array(b.length*2),P=0;for(let e=0,E=b.length;e<E;e++){const x=b.charCodeAt(e);x<=255?w[P++]=x:(w[P++]=x>>>8,w[P++]=x&255)}}else if((0,f.isArrayBuffer)(b))w=b.slice(),P=w.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const F=P>>2,S=P-F*4,c=new Uint32Array(w.buffer,0,F);let t=0,s=0,o=this.h1,v=this.h2;const g=3432918353,l=461845907,n=g&q,r=l&q;for(let e=0;e<F;e++)e&1?(t=c[e],t=t*g&V|t*n&q,t=t<<15|t>>>17,t=t*l&V|t*r&q,o^=t,o=o<<13|o>>>19,o=o*5+3864292196):(s=c[e],s=s*g&V|s*n&q,s=s<<15|s>>>17,s=s*l&V|s*r&q,v^=s,v=v<<13|v>>>19,v=v*5+3864292196);switch(t=0,S){case 3:t^=w[F*4+2]<<16;case 2:t^=w[F*4+1]<<8;case 1:t^=w[F*4],t=t*g&V|t*n&q,t=t<<15|t>>>17,t=t*l&V|t*r&q,F&1?o^=t:v^=t}this.h1=o,this.h2=v}hexdigest(){let b=this.h1,w=this.h2;b^=w>>>1,b=b*3981806797&V|b*36045&q,w=w*4283543511&V|((w<<16|b>>>16)*2950163797&V)>>>16,b^=w>>>1,b=b*444984403&V|b*60499&q,w=w*3301882366&V|((w<<16|b>>>16)*3120437893&V)>>>16,b^=w>>>1;const P=(b>>>0).toString(16),F=(w>>>0).toString(16);return P.padStart(8,"0")+F.padStart(8,"0")}}a.MurmurHash3_64=Y}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FontLoader=a.FontFaceObject=void 0;var f=A(1);class _{constructor({docId:M,onUnsupportedFeature:b,ownerDocument:w=globalThis.document,styleElement:P=null}){this.constructor===_&&(0,f.unreachable)("Cannot initialize BaseFontLoader."),this.docId=M,this._onUnsupportedFeature=b,this._document=w,this.nativeFontFaces=[],this.styleElement=null}addNativeFontFace(M){this.nativeFontFaces.push(M),this._document.fonts.add(M)}insertRule(M){let b=this.styleElement;b||(b=this.styleElement=this._document.createElement("style"),b.id=`PDFJS_FONT_STYLE_TAG_${this.docId}`,this._document.documentElement.getElementsByTagName("head")[0].append(b));const w=b.sheet;w.insertRule(M,w.cssRules.length)}clear(){for(const M of this.nativeFontFaces)this._document.fonts.delete(M);this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(M){if(M.attached||M.missingFile)return;if(M.attached=!0,this.isFontLoadingAPISupported){const w=M.createNativeFontFace();if(w){this.addNativeFontFace(w);try{await w.loaded}catch(P){throw this._onUnsupportedFeature({featureId:f.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,f.warn)(`Failed to load font '${w.family}': '${P}'.`),M.disableFontFace=!0,P}}return}const b=M.createFontFaceRule();if(b){if(this.insertRule(b),this.isSyncFontLoadingSupported)return;await new Promise(w=>{const P=this._queueLoadingCallback(w);this._prepareFontLoadEvent([b],[M],P)})}}_queueLoadingCallback(M){(0,f.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){var b;const M=!!((b=this._document)!=null&&b.fonts);return(0,f.shadow)(this,"isFontLoadingAPISupported",M)}get isSyncFontLoadingSupported(){(0,f.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,f.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(M,b,w){(0,f.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let V;a.FontLoader=V,a.FontLoader=V=class extends _{constructor(M){super(M),this.loadingContext={requests:[],nextRequestId:0},this.loadTestFontId=0}get isSyncFontLoadingSupported(){let M=!1;if(typeof navigator>"u")M=!0;else{const b=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);(b==null?void 0:b[1])>=14&&(M=!0)}return(0,f.shadow)(this,"isSyncFontLoadingSupported",M)}_queueLoadingCallback(M){function b(){for((0,f.assert)(!P.done,"completeRequest() cannot be called twice."),P.done=!0;w.requests.length>0&&w.requests[0].done;){const F=w.requests.shift();setTimeout(F.callback,0)}}const w=this.loadingContext,P={id:`pdfjs-font-loading-${w.nextRequestId++}`,done:!1,complete:b,callback:M};return w.requests.push(P),P}get _loadTestFont(){const M=function(){return atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==")};return(0,f.shadow)(this,"_loadTestFont",M())}_prepareFontLoadEvent(M,b,w){function P(St,pt){return St.charCodeAt(pt)<<24|St.charCodeAt(pt+1)<<16|St.charCodeAt(pt+2)<<8|St.charCodeAt(pt+3)&255}function F(St,pt,K,N){const U=St.substring(0,pt),G=St.substring(pt+K);return U+N+G}let S,c;const t=this._document.createElement("canvas");t.width=1,t.height=1;const s=t.getContext("2d");let o=0;function v(St,pt){if(o++,o>30){(0,f.warn)("Load test font never loaded."),pt();return}if(s.font="30px "+St,s.fillText(".",0,20),s.getImageData(0,0,1,1).data[3]>0){pt();return}setTimeout(v.bind(null,St,pt))}const g=`lt${Date.now()}${this.loadTestFontId++}`;let l=this._loadTestFont;l=F(l,976,g.length,g);const r=16,e=1482184792;let E=P(l,r);for(S=0,c=g.length-3;S<c;S+=4)E=E-e+P(g,S)|0;S<g.length&&(E=E-e+P(g+"XXX",S)|0),l=F(l,r,4,(0,f.string32)(E));const x=`url(data:font/opentype;base64,${btoa(l)});`,L=`@font-face {font-family:"${g}";src:${x}}`;this.insertRule(L);const O=[];for(const St of b)O.push(St.loadedName);O.push(g);const yt=this._document.createElement("div");yt.style.visibility="hidden",yt.style.width=yt.style.height="10px",yt.style.position="absolute",yt.style.top=yt.style.left="0px";for(const St of O){const pt=this._document.createElement("span");pt.textContent="Hi",pt.style.fontFamily=St,yt.append(pt)}this._document.body.append(yt),v(g,()=>{yt.remove(),w.complete()})}};class q{constructor(M,{isEvalSupported:b=!0,disableFontFace:w=!1,ignoreErrors:P=!1,onUnsupportedFeature:F,fontRegistry:S=null}){this.compiledGlyphs=Object.create(null);for(const c in M)this[c]=M[c];this.isEvalSupported=b!==!1,this.disableFontFace=w===!0,this.ignoreErrors=P===!0,this._onUnsupportedFeature=F,this.fontRegistry=S}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let M;if(!this.cssFontInfo)M=new FontFace(this.loadedName,this.data,{});else{const b={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(b.style=`oblique ${this.cssFontInfo.italicAngle}deg`),M=new FontFace(this.cssFontInfo.fontFamily,this.data,b)}return this.fontRegistry&&this.fontRegistry.registerFont(this),M}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const M=(0,f.bytesToString)(this.data),b=`url(data:${this.mimetype};base64,${btoa(M)});`;let w;if(!this.cssFontInfo)w=`@font-face {font-family:"${this.loadedName}";src:${b}}`;else{let P=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(P+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),w=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${P}src:${b}}`}return this.fontRegistry&&this.fontRegistry.registerFont(this,b),w}getPathGenerator(M,b){if(this.compiledGlyphs[b]!==void 0)return this.compiledGlyphs[b];let w;try{w=M.get(this.loadedName+"_path_"+b)}catch(P){if(!this.ignoreErrors)throw P;return this._onUnsupportedFeature({featureId:f.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,f.warn)(`getPathGenerator - ignoring character: "${P}".`),this.compiledGlyphs[b]=function(F,S){}}if(this.isEvalSupported&&f.FeatureTest.isEvalSupported){const P=[];for(const F of w){const S=F.args!==void 0?F.args.join(","):"";P.push("c.",F.cmd,"(",S,`);
|
|
39
|
-
`)}return this.compiledGlyphs[b]=new Function("c","size",P.join(""))}return this.compiledGlyphs[b]=function(P,F){for(const S of w)S.cmd==="scale"&&(S.args=[F,-F]),P[S.cmd].apply(P,S.args)}}}a.FontFaceObject=q}),((m,a,A)=>{var bt,dn;Object.defineProperty(a,"__esModule",{value:!0}),a.CanvasGraphics=void 0;var f=A(8),_=A(1),V=A(13),q=A(14),Y=A(3);const M=16,b=100,w=4096,P=15,F=10,S=Y.isNodeJS&&typeof Path2D>"u"?-1:1e3,c=16;function t(H,h){if(H._removeMirroring)throw new Error("Context is already forwarding operations.");H.__originalSave=H.save,H.__originalRestore=H.restore,H.__originalRotate=H.rotate,H.__originalScale=H.scale,H.__originalTranslate=H.translate,H.__originalTransform=H.transform,H.__originalSetTransform=H.setTransform,H.__originalResetTransform=H.resetTransform,H.__originalClip=H.clip,H.__originalMoveTo=H.moveTo,H.__originalLineTo=H.lineTo,H.__originalBezierCurveTo=H.bezierCurveTo,H.__originalRect=H.rect,H.__originalClosePath=H.closePath,H.__originalBeginPath=H.beginPath,H._removeMirroring=()=>{H.save=H.__originalSave,H.restore=H.__originalRestore,H.rotate=H.__originalRotate,H.scale=H.__originalScale,H.translate=H.__originalTranslate,H.transform=H.__originalTransform,H.setTransform=H.__originalSetTransform,H.resetTransform=H.__originalResetTransform,H.clip=H.__originalClip,H.moveTo=H.__originalMoveTo,H.lineTo=H.__originalLineTo,H.bezierCurveTo=H.__originalBezierCurveTo,H.rect=H.__originalRect,H.closePath=H.__originalClosePath,H.beginPath=H.__originalBeginPath,delete H._removeMirroring},H.save=function(){h.save(),this.__originalSave()},H.restore=function(){h.restore(),this.__originalRestore()},H.translate=function(T,I){h.translate(T,I),this.__originalTranslate(T,I)},H.scale=function(T,I){h.scale(T,I),this.__originalScale(T,I)},H.transform=function(T,I,$,W,i,d){h.transform(T,I,$,W,i,d),this.__originalTransform(T,I,$,W,i,d)},H.setTransform=function(T,I,$,W,i,d){h.setTransform(T,I,$,W,i,d),this.__originalSetTransform(T,I,$,W,i,d)},H.resetTransform=function(){h.resetTransform(),this.__originalResetTransform()},H.rotate=function(T){h.rotate(T),this.__originalRotate(T)},H.clip=function(T){h.clip(T),this.__originalClip(T)},H.moveTo=function(u,T){h.moveTo(u,T),this.__originalMoveTo(u,T)},H.lineTo=function(u,T){h.lineTo(u,T),this.__originalLineTo(u,T)},H.bezierCurveTo=function(u,T,I,$,W,i){h.bezierCurveTo(u,T,I,$,W,i),this.__originalBezierCurveTo(u,T,I,$,W,i)},H.rect=function(u,T,I,$){h.rect(u,T,I,$),this.__originalRect(u,T,I,$)},H.closePath=function(){h.closePath(),this.__originalClosePath()},H.beginPath=function(){h.beginPath(),this.__originalBeginPath()}}class s{constructor(h){this.canvasFactory=h,this.cache=Object.create(null)}getCanvas(h,u,T){let I;return this.cache[h]!==void 0?(I=this.cache[h],this.canvasFactory.reset(I,u,T)):(I=this.canvasFactory.create(u,T),this.cache[h]=I),I}delete(h){delete this.cache[h]}clear(){for(const h in this.cache){const u=this.cache[h];this.canvasFactory.destroy(u),delete this.cache[h]}}}function o(H,h,u,T,I,$,W,i,d,C){const[y,k,j,D,p,B]=(0,f.getCurrentTransform)(H);if(k===0&&j===0){const Q=W*y+p,At=Math.round(Q),kt=i*D+B,Rt=Math.round(kt),xt=(W+d)*y+p,Ht=Math.abs(Math.round(xt)-At)||1,Ut=(i+C)*D+B,Nt=Math.abs(Math.round(Ut)-Rt)||1;return H.setTransform(Math.sign(y),0,0,Math.sign(D),At,Rt),H.drawImage(h,u,T,I,$,0,0,Ht,Nt),H.setTransform(y,k,j,D,p,B),[Ht,Nt]}if(y===0&&D===0){const Q=i*j+p,At=Math.round(Q),kt=W*k+B,Rt=Math.round(kt),xt=(i+C)*j+p,Ht=Math.abs(Math.round(xt)-At)||1,Ut=(W+d)*k+B,Nt=Math.abs(Math.round(Ut)-Rt)||1;return H.setTransform(0,Math.sign(k),Math.sign(j),0,At,Rt),H.drawImage(h,u,T,I,$,0,0,Nt,Ht),H.setTransform(y,k,j,D,p,B),[Nt,Ht]}H.drawImage(h,u,T,I,$,W,i,d,C);const _t=Math.hypot(y,k),z=Math.hypot(j,D);return[_t*d,z*C]}function v(H){const{width:h,height:u}=H;if(h>S||u>S)return null;const T=1e3,I=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),$=h+1;let W=new Uint8Array($*(u+1)),i,d,C;const y=h+7&-8;let k=new Uint8Array(y*u),j=0;for(const z of H.data){let Q=128;for(;Q>0;)k[j++]=z&Q?0:255,Q>>=1}let D=0;for(j=0,k[j]!==0&&(W[0]=1,++D),d=1;d<h;d++)k[j]!==k[j+1]&&(W[d]=k[j]?2:1,++D),j++;for(k[j]!==0&&(W[d]=2,++D),i=1;i<u;i++){j=i*y,C=i*$,k[j-y]!==k[j]&&(W[C]=k[j]?1:8,++D);let z=(k[j]?4:0)+(k[j-y]?8:0);for(d=1;d<h;d++)z=(z>>2)+(k[j+1]?4:0)+(k[j-y+1]?8:0),I[z]&&(W[C+d]=I[z],++D),j++;if(k[j-y]!==k[j]&&(W[C+d]=k[j]?2:4,++D),D>T)return null}for(j=y*(u-1),C=i*$,k[j]!==0&&(W[C]=8,++D),d=1;d<h;d++)k[j]!==k[j+1]&&(W[C+d]=k[j]?4:8,++D),j++;if(k[j]!==0&&(W[C+d]=4,++D),D>T)return null;const p=new Int32Array([0,$,-1,0,-$,0,0,0,1]),B=new Path2D;for(i=0;D&&i<=u;i++){let z=i*$;const Q=z+h;for(;z<Q&&!W[z];)z++;if(z===Q)continue;B.moveTo(z%$,i);const At=z;let kt=W[z];do{const Rt=p[kt];do z+=Rt;while(!W[z]);const xt=W[z];xt!==5&&xt!==10?(kt=xt,W[z]=0):(kt=xt&51*kt>>4,W[z]&=kt>>2|kt<<2),B.lineTo(z%$,z/$|0),W[z]||--D}while(At!==z);--i}return k=null,W=null,function(z){z.save(),z.scale(1/h,-1/u),z.translate(0,-u),z.fill(B),z.beginPath(),z.restore()}}class g{constructor(h,u){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=_.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=_.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=_.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps=null,this.startNewPathAndClipBox([0,0,h,u])}clone(){const h=Object.create(this);return h.clipBox=this.clipBox.slice(),h}setCurrentPoint(h,u){this.x=h,this.y=u}updatePathMinMax(h,u,T){[u,T]=_.Util.applyTransform([u,T],h),this.minX=Math.min(this.minX,u),this.minY=Math.min(this.minY,T),this.maxX=Math.max(this.maxX,u),this.maxY=Math.max(this.maxY,T)}updateRectMinMax(h,u){const T=_.Util.applyTransform(u,h),I=_.Util.applyTransform(u.slice(2),h);this.minX=Math.min(this.minX,T[0],I[0]),this.minY=Math.min(this.minY,T[1],I[1]),this.maxX=Math.max(this.maxX,T[0],I[0]),this.maxY=Math.max(this.maxY,T[1],I[1])}updateScalingPathMinMax(h,u){_.Util.scaleMinMax(h,u),this.minX=Math.min(this.minX,u[0]),this.maxX=Math.max(this.maxX,u[1]),this.minY=Math.min(this.minY,u[2]),this.maxY=Math.max(this.maxY,u[3])}updateCurvePathMinMax(h,u,T,I,$,W,i,d,C,y){const k=_.Util.bezierBoundingBox(u,T,I,$,W,i,d,C);if(y){y[0]=Math.min(y[0],k[0],k[2]),y[1]=Math.max(y[1],k[0],k[2]),y[2]=Math.min(y[2],k[1],k[3]),y[3]=Math.max(y[3],k[1],k[3]);return}this.updateRectMinMax(h,k)}getPathBoundingBox(h=V.PathType.FILL,u=null){const T=[this.minX,this.minY,this.maxX,this.maxY];if(h===V.PathType.STROKE){u||(0,_.unreachable)("Stroke bounding box must include transform.");const I=_.Util.singularValueDecompose2dScale(u),$=I[0]*this.lineWidth/2,W=I[1]*this.lineWidth/2;T[0]-=$,T[1]-=W,T[2]+=$,T[3]+=W}return T}updateClipFromPath(){const h=_.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(h||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(h){this.clipBox=h,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(h=V.PathType.FILL,u=null){return _.Util.intersect(this.clipBox,this.getPathBoundingBox(h,u))}}function l(H,h,u=null){if(typeof ImageData<"u"&&h instanceof ImageData){H.putImageData(h,0,0);return}const T=h.height,I=h.width,$=T%c,W=(T-$)/c,i=$===0?W:W+1,d=H.createImageData(I,c);let C=0,y;const k=h.data,j=d.data;let D,p,B,_t,z,Q,At,kt;if(u)switch(u.length){case 1:z=u[0],Q=u[0],At=u[0],kt=u[0];break;case 4:z=u[0],Q=u[1],At=u[2],kt=u[3];break}if(h.kind===_.ImageKind.GRAYSCALE_1BPP){const Rt=k.byteLength,xt=new Uint32Array(j.buffer,0,j.byteLength>>2),Ht=xt.length,Ut=I+7>>3;let Nt=4294967295,Xt=_.FeatureTest.isLittleEndian?4278190080:255;for(kt&&kt[0]===255&&kt[255]===0&&([Nt,Xt]=[Xt,Nt]),D=0;D<i;D++){for(B=D<W?c:$,y=0,p=0;p<B;p++){const Gt=Rt-C;let Zt=0;const zt=Gt>Ut?I:Gt*8-7,Vt=zt&-8;let Yt=0,Jt=0;for(;Zt<Vt;Zt+=8)Jt=k[C++],xt[y++]=Jt&128?Nt:Xt,xt[y++]=Jt&64?Nt:Xt,xt[y++]=Jt&32?Nt:Xt,xt[y++]=Jt&16?Nt:Xt,xt[y++]=Jt&8?Nt:Xt,xt[y++]=Jt&4?Nt:Xt,xt[y++]=Jt&2?Nt:Xt,xt[y++]=Jt&1?Nt:Xt;for(;Zt<zt;Zt++)Yt===0&&(Jt=k[C++],Yt=128),xt[y++]=Jt&Yt?Nt:Xt,Yt>>=1}for(;y<Ht;)xt[y++]=0;H.putImageData(d,0,D*c)}}else if(h.kind===_.ImageKind.RGBA_32BPP){const Rt=!!(z||Q||At);for(p=0,_t=I*c*4,D=0;D<W;D++){if(j.set(k.subarray(C,C+_t)),C+=_t,Rt)for(let xt=0;xt<_t;xt+=4)z&&(j[xt+0]=z[j[xt+0]]),Q&&(j[xt+1]=Q[j[xt+1]]),At&&(j[xt+2]=At[j[xt+2]]);H.putImageData(d,0,p),p+=c}if(D<i){if(_t=I*$*4,j.set(k.subarray(C,C+_t)),Rt)for(let xt=0;xt<_t;xt+=4)z&&(j[xt+0]=z[j[xt+0]]),Q&&(j[xt+1]=Q[j[xt+1]]),At&&(j[xt+2]=At[j[xt+2]]);H.putImageData(d,0,p)}}else if(h.kind===_.ImageKind.RGB_24BPP){const Rt=!!(z||Q||At);for(B=c,_t=I*B,D=0;D<i;D++){for(D>=W&&(B=$,_t=I*B),y=0,p=_t;p--;)j[y++]=k[C++],j[y++]=k[C++],j[y++]=k[C++],j[y++]=255;if(Rt)for(let xt=0;xt<y;xt+=4)z&&(j[xt+0]=z[j[xt+0]]),Q&&(j[xt+1]=Q[j[xt+1]]),At&&(j[xt+2]=At[j[xt+2]]);H.putImageData(d,0,D*c)}}else throw new Error(`bad image kind: ${h.kind}`)}function n(H,h){if(h.bitmap){H.drawImage(h.bitmap,0,0);return}const u=h.height,T=h.width,I=u%c,$=(u-I)/c,W=I===0?$:$+1,i=H.createImageData(T,c);let d=0;const C=h.data,y=i.data;for(let k=0;k<W;k++){const j=k<$?c:I;({srcPos:d}=(0,q.applyMaskImageData)({src:C,srcPos:d,dest:y,width:T,height:j})),H.putImageData(i,0,k*c)}}function r(H,h){const u=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let T=0,I=u.length;T<I;T++){const $=u[T];H[$]!==void 0&&(h[$]=H[$])}H.setLineDash!==void 0&&(h.setLineDash(H.getLineDash()),h.lineDashOffset=H.lineDashOffset)}function e(H,h){H.strokeStyle=H.fillStyle=h||"#000000",H.fillRule="nonzero",H.globalAlpha=1,H.lineWidth=1,H.lineCap="butt",H.lineJoin="miter",H.miterLimit=10,H.globalCompositeOperation="source-over",H.font="10px sans-serif",H.setLineDash!==void 0&&(H.setLineDash([]),H.lineDashOffset=0)}function E(H,h,u,T){const I=H.length;for(let $=3;$<I;$+=4){const W=H[$];if(W===0)H[$-3]=h,H[$-2]=u,H[$-1]=T;else if(W<255){const i=255-W;H[$-3]=H[$-3]*W+h*i>>8,H[$-2]=H[$-2]*W+u*i>>8,H[$-1]=H[$-1]*W+T*i>>8}}}function x(H,h,u){const T=H.length,I=1/255;for(let $=3;$<T;$+=4){const W=u?u[H[$]]:H[$];h[$]=h[$]*W*I|0}}function L(H,h,u){const T=H.length;for(let I=3;I<T;I+=4){const $=H[I-3]*77+H[I-2]*152+H[I-1]*28;h[I]=u?h[I]*u[$>>8]>>8:h[I]*$>>16}}function O(H,h,u,T,I,$,W,i,d,C,y){const k=!!$,j=k?$[0]:0,D=k?$[1]:0,p=k?$[2]:0;let B;I==="Luminosity"?B=L:B=x;const z=Math.min(T,Math.ceil(1048576/u));for(let Q=0;Q<T;Q+=z){const At=Math.min(z,T-Q),kt=H.getImageData(i-C,Q+(d-y),u,At),Rt=h.getImageData(i,Q+d,u,At);k&&E(kt.data,j,D,p),B(kt.data,Rt.data,W),h.putImageData(Rt,i,Q+d)}}function yt(H,h,u,T){const I=T[0],$=T[1],W=T[2]-I,i=T[3]-$;W===0||i===0||(O(h.context,u,W,i,h.subtype,h.backdrop,h.transferMap,I,$,h.offsetX,h.offsetY),H.save(),H.globalAlpha=1,H.globalCompositeOperation="source-over",H.setTransform(1,0,0,1,0,0),H.drawImage(u.canvas,0,0),H.restore())}function St(H,h){const u=_.Util.singularValueDecompose2dScale(H);u[0]=Math.fround(u[0]),u[1]=Math.fround(u[1]);const T=Math.fround((globalThis.devicePixelRatio||1)*f.PixelsPerInch.PDF_TO_CSS_UNITS);return h!==void 0?h:u[0]<=T||u[1]<=T}const pt=["butt","round","square"],K=["miter","round","bevel"],N={},U={},Mt=class Mt{constructor(h,u,T,I,$,W,i,d){Ot(this,bt);this.ctx=h,this.current=new g(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=u,this.objs=T,this.canvasFactory=I,this.imageLayer=$,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=[],this.optionalContentConfig=W,this.cachedCanvases=new s(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=i,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.backgroundColor=(d==null?void 0:d.background)||null,this.foregroundColor=(d==null?void 0:d.foreground)||null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(h,u=null){return typeof h=="string"?h.startsWith("g_")?this.commonObjs.get(h):this.objs.get(h):u}beginDrawing({transform:h,viewport:u,transparency:T=!1,background:I=null}){const $=this.ctx.canvas.width,W=this.ctx.canvas.height,i=I||"#ffffff";if(this.ctx.save(),this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;const d=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;const C=this.backgroundColor=this.ctx.fillStyle;let y=!0,k=i;if(this.ctx.fillStyle=i,k=this.ctx.fillStyle,y=typeof k=="string"&&/^#[0-9A-Fa-f]{6}$/.test(k),d==="#000000"&&C==="#ffffff"||d===C||!y)this.foregroundColor=this.backgroundColor=null;else{const[j,D,p]=(0,f.getRGB)(k),B=z=>(z/=255,z<=.03928?z/12.92:((z+.055)/1.055)**2.4),_t=Math.round(.2126*B(j)+.7152*B(D)+.0722*B(p));this.selectColor=(z,Q,At)=>{const kt=.2126*B(z)+.7152*B(Q)+.0722*B(At);return Math.round(kt)===_t?C:d}}}if(this.ctx.fillStyle=this.backgroundColor||i,this.ctx.fillRect(0,0,$,W),this.ctx.restore(),T){const d=this.cachedCanvases.getCanvas("transparent",$,W);this.compositeCtx=this.ctx,this.transparentCanvas=d.canvas,this.ctx=d.context,this.ctx.save(),this.ctx.transform(...(0,f.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),e(this.ctx,this.foregroundColor),h&&(this.ctx.transform(...h),this.outputScaleX=h[0],this.outputScaleY=h[0]),this.ctx.transform(...u.transform),this.viewportScale=u.scale,this.baseTransform=(0,f.getCurrentTransform)(this.ctx),this.imageLayer&&((0,f.deprecated)("The `imageLayer` functionality will be removed in the future."),this.imageLayer.beginLayout())}executeOperatorList(h,u,T,I){const $=h.argsArray,W=h.fnArray;let i=u||0;const d=$.length;if(d===i)return i;const C=d-i>F&&typeof T=="function",y=C?Date.now()+P:0;let k=0;const j=this.commonObjs,D=this.objs;let p;for(;;){if(I!==void 0&&i===I.nextBreakPoint)return I.breakIt(i,T),i;if(p=W[i],p!==_.OPS.dependency)this[p].apply(this,$[i]);else for(const B of $[i]){const _t=B.startsWith("g_")?j:D;if(!_t.has(B))return _t.get(B,T),i}if(i++,i===d)return i;if(C&&++k>F){if(Date.now()>y)return T(),i;k=0}}}endDrawing(){Dt(this,bt,dn).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const h of this._cachedBitmapsMap.values()){for(const u of h.values())typeof HTMLCanvasElement<"u"&&u instanceof HTMLCanvasElement&&(u.width=u.height=0);h.clear()}this._cachedBitmapsMap.clear(),this.imageLayer&&this.imageLayer.endLayout()}_scaleImage(h,u){const T=h.width,I=h.height;let $=Math.max(Math.hypot(u[0],u[1]),1),W=Math.max(Math.hypot(u[2],u[3]),1),i=T,d=I,C="prescale1",y,k;for(;$>2&&i>1||W>2&&d>1;){let j=i,D=d;$>2&&i>1&&(j=Math.ceil(i/2),$/=i/j),W>2&&d>1&&(D=Math.ceil(d/2),W/=d/D),y=this.cachedCanvases.getCanvas(C,j,D),k=y.context,k.clearRect(0,0,j,D),k.drawImage(h,0,0,i,d,0,0,j,D),h=y.canvas,i=j,d=D,C=C==="prescale1"?"prescale2":"prescale1"}return{img:h,paintWidth:i,paintHeight:d}}_createMaskCanvas(h){const u=this.ctx,{width:T,height:I}=h,$=this.current.fillColor,W=this.current.patternFill,i=(0,f.getCurrentTransform)(u);let d,C,y,k;if((h.bitmap||h.data)&&h.count>1){const Ht=h.bitmap||h.data.buffer,Ut=i.slice(0,4);C=JSON.stringify(W?Ut:[Ut,$]),d=this._cachedBitmapsMap.get(Ht),d||(d=new Map,this._cachedBitmapsMap.set(Ht,d));const Nt=d.get(C);if(Nt&&!W){const Xt=Math.round(Math.min(i[0],i[2])+i[4]),Gt=Math.round(Math.min(i[1],i[3])+i[5]);return{canvas:Nt,offsetX:Xt,offsetY:Gt}}y=Nt}y||(k=this.cachedCanvases.getCanvas("maskCanvas",T,I),n(k.context,h));let j=_.Util.transform(i,[1/T,0,0,-1/I,0,0]);j=_.Util.transform(j,[1,0,0,1,0,-I]);const D=_.Util.applyTransform([0,0],j),p=_.Util.applyTransform([T,I],j),B=_.Util.normalizeRect([D[0],D[1],p[0],p[1]]),_t=Math.round(B[2]-B[0])||1,z=Math.round(B[3]-B[1])||1,Q=this.cachedCanvases.getCanvas("fillCanvas",_t,z),At=Q.context,kt=Math.min(D[0],p[0]),Rt=Math.min(D[1],p[1]);At.translate(-kt,-Rt),At.transform(...j),y||(y=this._scaleImage(k.canvas,(0,f.getCurrentTransformInverse)(At)),y=y.img,d&&W&&d.set(C,y)),At.imageSmoothingEnabled=St((0,f.getCurrentTransform)(At),h.interpolate),o(At,y,0,0,y.width,y.height,0,0,T,I),At.globalCompositeOperation="source-in";const xt=_.Util.transform((0,f.getCurrentTransformInverse)(At),[1,0,0,1,-kt,-Rt]);return At.fillStyle=W?$.getPattern(u,this,xt,V.PathType.FILL):$,At.fillRect(0,0,T,I),d&&!W&&(this.cachedCanvases.delete("fillCanvas"),d.set(C,Q.canvas)),{canvas:Q.canvas,offsetX:Math.round(kt),offsetY:Math.round(Rt)}}setLineWidth(h){h!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=h,this.ctx.lineWidth=h}setLineCap(h){this.ctx.lineCap=pt[h]}setLineJoin(h){this.ctx.lineJoin=K[h]}setMiterLimit(h){this.ctx.miterLimit=h}setDash(h,u){const T=this.ctx;T.setLineDash!==void 0&&(T.setLineDash(h),T.lineDashOffset=u)}setRenderingIntent(h){}setFlatness(h){}setGState(h){for(let u=0,T=h.length;u<T;u++){const I=h[u],$=I[0],W=I[1];switch($){case"LW":this.setLineWidth(W);break;case"LC":this.setLineCap(W);break;case"LJ":this.setLineJoin(W);break;case"ML":this.setMiterLimit(W);break;case"D":this.setDash(W[0],W[1]);break;case"RI":this.setRenderingIntent(W);break;case"FL":this.setFlatness(W);break;case"Font":this.setFont(W[0],W[1]);break;case"CA":this.current.strokeAlpha=I[1];break;case"ca":this.current.fillAlpha=I[1],this.ctx.globalAlpha=I[1];break;case"BM":this.ctx.globalCompositeOperation=W;break;case"SMask":this.current.activeSMask=W?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=W}}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const h=this.inSMaskMode;this.current.activeSMask&&!h?this.beginSMaskMode():!this.current.activeSMask&&h&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const h=this.ctx.canvas.width,u=this.ctx.canvas.height,T="smaskGroupAt"+this.groupLevel,I=this.cachedCanvases.getCanvas(T,h,u);this.suspendedCtx=this.ctx,this.ctx=I.context;const $=this.ctx;$.setTransform(...(0,f.getCurrentTransform)(this.suspendedCtx)),r(this.suspendedCtx,$),t($,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),r(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(h){if(!this.current.activeSMask)return;h?(h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]),h[2]=Math.ceil(h[2]),h[3]=Math.ceil(h[3])):h=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const u=this.current.activeSMask,T=this.suspendedCtx;yt(T,u,this.ctx,h),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}save(){this.inSMaskMode?(r(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const h=this.current;this.stateStack.push(h),this.current=h.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),r(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(h,u,T,I,$,W){this.ctx.transform(h,u,T,I,$,W),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(h,u,T){const I=this.ctx,$=this.current;let W=$.x,i=$.y,d,C;const y=(0,f.getCurrentTransform)(I),k=y[0]===0&&y[3]===0||y[1]===0&&y[2]===0,j=k?T.slice(0):null;for(let D=0,p=0,B=h.length;D<B;D++)switch(h[D]|0){case _.OPS.rectangle:W=u[p++],i=u[p++];const _t=u[p++],z=u[p++],Q=W+_t,At=i+z;I.moveTo(W,i),_t===0||z===0?I.lineTo(Q,At):(I.lineTo(Q,i),I.lineTo(Q,At),I.lineTo(W,At)),k||$.updateRectMinMax(y,[W,i,Q,At]),I.closePath();break;case _.OPS.moveTo:W=u[p++],i=u[p++],I.moveTo(W,i),k||$.updatePathMinMax(y,W,i);break;case _.OPS.lineTo:W=u[p++],i=u[p++],I.lineTo(W,i),k||$.updatePathMinMax(y,W,i);break;case _.OPS.curveTo:d=W,C=i,W=u[p+4],i=u[p+5],I.bezierCurveTo(u[p],u[p+1],u[p+2],u[p+3],W,i),$.updateCurvePathMinMax(y,d,C,u[p],u[p+1],u[p+2],u[p+3],W,i,j),p+=6;break;case _.OPS.curveTo2:d=W,C=i,I.bezierCurveTo(W,i,u[p],u[p+1],u[p+2],u[p+3]),$.updateCurvePathMinMax(y,d,C,W,i,u[p],u[p+1],u[p+2],u[p+3],j),W=u[p+2],i=u[p+3],p+=4;break;case _.OPS.curveTo3:d=W,C=i,W=u[p+2],i=u[p+3],I.bezierCurveTo(u[p],u[p+1],W,i,W,i),$.updateCurvePathMinMax(y,d,C,u[p],u[p+1],W,i,W,i,j),p+=4;break;case _.OPS.closePath:I.closePath();break}k&&$.updateScalingPathMinMax(y,j),$.setCurrentPoint(W,i)}closePath(){this.ctx.closePath()}stroke(h){h=typeof h<"u"?h:!0;const u=this.ctx,T=this.current.strokeColor;u.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof T=="object"&&(T!=null&&T.getPattern)?(u.save(),u.strokeStyle=T.getPattern(u,this,(0,f.getCurrentTransformInverse)(u),V.PathType.STROKE),this.rescaleAndStroke(!1),u.restore()):this.rescaleAndStroke(!0)),h&&this.consumePath(this.current.getClippedPathBoundingBox()),u.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(h){h=typeof h<"u"?h:!0;const u=this.ctx,T=this.current.fillColor,I=this.current.patternFill;let $=!1;I&&(u.save(),u.fillStyle=T.getPattern(u,this,(0,f.getCurrentTransformInverse)(u),V.PathType.FILL),$=!0);const W=this.current.getClippedPathBoundingBox();this.contentVisible&&W!==null&&(this.pendingEOFill?(u.fill("evenodd"),this.pendingEOFill=!1):u.fill()),$&&u.restore(),h&&this.consumePath(W)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=N}eoClip(){this.pendingClip=U}beginText(){this.current.textMatrix=_.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const h=this.pendingTextPaths,u=this.ctx;if(h===void 0){u.beginPath();return}u.save(),u.beginPath();for(const T of h)u.setTransform(...T.transform),u.translate(T.x,T.y),T.addToPath(u,T.fontSize);u.restore(),u.clip(),u.beginPath(),delete this.pendingTextPaths}setCharSpacing(h){this.current.charSpacing=h}setWordSpacing(h){this.current.wordSpacing=h}setHScale(h){this.current.textHScale=h/100}setLeading(h){this.current.leading=-h}setFont(h,u){const T=this.commonObjs.get(h),I=this.current;if(!T)throw new Error(`Can't find font for ${h}`);if(I.fontMatrix=T.fontMatrix||_.FONT_IDENTITY_MATRIX,(I.fontMatrix[0]===0||I.fontMatrix[3]===0)&&(0,_.warn)("Invalid font matrix for font "+h),u<0?(u=-u,I.fontDirection=-1):I.fontDirection=1,this.current.font=T,this.current.fontSize=u,T.isType3Font)return;const $=T.loadedName||"sans-serif";let W="normal";T.black?W="900":T.bold&&(W="bold");const i=T.italic?"italic":"normal",d=`"${$}", ${T.fallbackName}`;let C=u;u<M?C=M:u>b&&(C=b),this.current.fontSizeScale=u/C,this.ctx.font=`${i} ${W} ${C}px ${d}`}setTextRenderingMode(h){this.current.textRenderingMode=h}setTextRise(h){this.current.textRise=h}moveText(h,u){this.current.x=this.current.lineX+=h,this.current.y=this.current.lineY+=u}setLeadingMoveText(h,u){this.setLeading(-u),this.moveText(h,u)}setTextMatrix(h,u,T,I,$,W){this.current.textMatrix=[h,u,T,I,$,W],this.current.textMatrixScale=Math.hypot(h,u),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(h,u,T,I){const $=this.ctx,W=this.current,i=W.font,d=W.textRenderingMode,C=W.fontSize/W.fontSizeScale,y=d&_.TextRenderingMode.FILL_STROKE_MASK,k=!!(d&_.TextRenderingMode.ADD_TO_PATH_FLAG),j=W.patternFill&&!i.missingFile;let D;(i.disableFontFace||k||j)&&(D=i.getPathGenerator(this.commonObjs,h)),i.disableFontFace||j?($.save(),$.translate(u,T),$.beginPath(),D($,C),I&&$.setTransform(...I),(y===_.TextRenderingMode.FILL||y===_.TextRenderingMode.FILL_STROKE)&&$.fill(),(y===_.TextRenderingMode.STROKE||y===_.TextRenderingMode.FILL_STROKE)&&$.stroke(),$.restore()):((y===_.TextRenderingMode.FILL||y===_.TextRenderingMode.FILL_STROKE)&&$.fillText(h,u,T),(y===_.TextRenderingMode.STROKE||y===_.TextRenderingMode.FILL_STROKE)&&$.strokeText(h,u,T)),k&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,f.getCurrentTransform)($),x:u,y:T,fontSize:C,addToPath:D})}get isFontSubpixelAAEnabled(){const{context:h}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);h.scale(1.5,1),h.fillText("I",0,10);const u=h.getImageData(0,0,10,10).data;let T=!1;for(let I=3;I<u.length;I+=4)if(u[I]>0&&u[I]<255){T=!0;break}return(0,_.shadow)(this,"isFontSubpixelAAEnabled",T)}showText(h){const u=this.current,T=u.font;if(T.isType3Font)return this.showType3Text(h);const I=u.fontSize;if(I===0)return;const $=this.ctx,W=u.fontSizeScale,i=u.charSpacing,d=u.wordSpacing,C=u.fontDirection,y=u.textHScale*C,k=h.length,j=T.vertical,D=j?1:-1,p=T.defaultVMetrics,B=I*u.fontMatrix[0],_t=u.textRenderingMode===_.TextRenderingMode.FILL&&!T.disableFontFace&&!u.patternFill;$.save(),$.transform(...u.textMatrix),$.translate(u.x,u.y+u.textRise),C>0?$.scale(y,-1):$.scale(y,1);let z;if(u.patternFill){$.save();const xt=u.fillColor.getPattern($,this,(0,f.getCurrentTransformInverse)($),V.PathType.FILL);z=(0,f.getCurrentTransform)($),$.restore(),$.fillStyle=xt}let Q=u.lineWidth;const At=u.textMatrixScale;if(At===0||Q===0){const xt=u.textRenderingMode&_.TextRenderingMode.FILL_STROKE_MASK;(xt===_.TextRenderingMode.STROKE||xt===_.TextRenderingMode.FILL_STROKE)&&(Q=this.getSinglePixelWidth())}else Q/=At;W!==1&&($.scale(W,W),Q/=W),$.lineWidth=Q;let kt=0,Rt;for(Rt=0;Rt<k;++Rt){const xt=h[Rt];if(typeof xt=="number"){kt+=D*xt*I/1e3;continue}let Ht=!1;const Ut=(xt.isSpace?d:0)+i,Nt=xt.fontChar,Xt=xt.accent;let Gt,Zt,zt=xt.width;if(j){const Yt=xt.vmetric||p,Jt=-(xt.vmetric?Yt[1]:zt*.5)*B,oe=Yt[2]*B;zt=Yt?-Yt[0]:zt,Gt=Jt/W,Zt=(kt+oe)/W}else Gt=kt/W,Zt=0;if(T.remeasure&&zt>0){const Yt=$.measureText(Nt).width*1e3/I*W;if(zt<Yt&&this.isFontSubpixelAAEnabled){const Jt=zt/Yt;Ht=!0,$.save(),$.scale(Jt,1),Gt/=Jt}else zt!==Yt&&(Gt+=(zt-Yt)/2e3*I/W)}if(this.contentVisible&&(xt.isInFont||T.missingFile)){if(_t&&!Xt)$.fillText(Nt,Gt,Zt);else if(this.paintChar(Nt,Gt,Zt,z),Xt){const Yt=Gt+I*Xt.offset.x/W,Jt=Zt-I*Xt.offset.y/W;this.paintChar(Xt.fontChar,Yt,Jt,z)}}let Vt;j?Vt=zt*B-Ut*C:Vt=zt*B+Ut*C,kt+=Vt,Ht&&$.restore()}j?u.y-=kt:u.x+=kt*y,$.restore(),this.compose()}showType3Text(h){const u=this.ctx,T=this.current,I=T.font,$=T.fontSize,W=T.fontDirection,i=I.vertical?1:-1,d=T.charSpacing,C=T.wordSpacing,y=T.textHScale*W,k=T.fontMatrix||_.FONT_IDENTITY_MATRIX,j=h.length,D=T.textRenderingMode===_.TextRenderingMode.INVISIBLE;let p,B,_t,z;if(!(D||$===0)){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,u.save(),u.transform(...T.textMatrix),u.translate(T.x,T.y),u.scale(y,W),p=0;p<j;++p){if(B=h[p],typeof B=="number"){z=i*B*$/1e3,this.ctx.translate(z,0),T.x+=z*y;continue}const Q=(B.isSpace?C:0)+d,At=I.charProcOperatorList[B.operatorListId];if(!At){(0,_.warn)(`Type3 character "${B.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=B,this.save(),u.scale($,$),u.transform(...k),this.executeOperatorList(At),this.restore()),_t=_.Util.applyTransform([B.width,0],k)[0]*$+Q,u.translate(_t,0),T.x+=_t*y}u.restore(),this.processingType3=null}}setCharWidth(h,u){}setCharWidthAndBounds(h,u,T,I,$,W){this.ctx.rect(T,I,$-T,W-I),this.ctx.clip(),this.endPath()}getColorN_Pattern(h){let u;if(h[0]==="TilingPattern"){const T=h[1],I=this.baseTransform||(0,f.getCurrentTransform)(this.ctx),$={createCanvasGraphics:W=>new Mt(W,this.commonObjs,this.objs,this.canvasFactory)};u=new V.TilingPattern(h,T,this.ctx,$,I)}else u=this._getPattern(h[1],h[2]);return u}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(h,u,T){var $;const I=(($=this.selectColor)==null?void 0:$.call(this,h,u,T))||_.Util.makeHexColor(h,u,T);this.ctx.strokeStyle=I,this.current.strokeColor=I}setFillRGBColor(h,u,T){var $;const I=(($=this.selectColor)==null?void 0:$.call(this,h,u,T))||_.Util.makeHexColor(h,u,T);this.ctx.fillStyle=I,this.current.fillColor=I,this.current.patternFill=!1}_getPattern(h,u=null){let T;return this.cachedPatterns.has(h)?T=this.cachedPatterns.get(h):(T=(0,V.getShadingPattern)(this.objs.get(h)),this.cachedPatterns.set(h,T)),u&&(T.matrix=u),T}shadingFill(h){if(!this.contentVisible)return;const u=this.ctx;this.save();const T=this._getPattern(h);u.fillStyle=T.getPattern(u,this,(0,f.getCurrentTransformInverse)(u),V.PathType.SHADING);const I=(0,f.getCurrentTransformInverse)(u);if(I){const $=u.canvas,W=$.width,i=$.height,d=_.Util.applyTransform([0,0],I),C=_.Util.applyTransform([0,i],I),y=_.Util.applyTransform([W,0],I),k=_.Util.applyTransform([W,i],I),j=Math.min(d[0],C[0],y[0],k[0]),D=Math.min(d[1],C[1],y[1],k[1]),p=Math.max(d[0],C[0],y[0],k[0]),B=Math.max(d[1],C[1],y[1],k[1]);this.ctx.fillRect(j,D,p-j,B-D)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,_.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,_.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(h,u){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(h)&&h.length===6&&this.transform(...h),this.baseTransform=(0,f.getCurrentTransform)(this.ctx),u)){const T=u[2]-u[0],I=u[3]-u[1];this.ctx.rect(u[0],u[1],T,I),this.current.updateRectMinMax((0,f.getCurrentTransform)(this.ctx),u),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(h){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const u=this.ctx;h.isolated||(0,_.info)("TODO: Support non-isolated groups."),h.knockout&&(0,_.warn)("Knockout groups not supported.");const T=(0,f.getCurrentTransform)(u);if(h.matrix&&u.transform(...h.matrix),!h.bbox)throw new Error("Bounding box is required.");let I=_.Util.getAxialAlignedBoundingBox(h.bbox,(0,f.getCurrentTransform)(u));const $=[0,0,u.canvas.width,u.canvas.height];I=_.Util.intersect(I,$)||[0,0,0,0];const W=Math.floor(I[0]),i=Math.floor(I[1]);let d=Math.max(Math.ceil(I[2])-W,1),C=Math.max(Math.ceil(I[3])-i,1),y=1,k=1;d>w&&(y=d/w,d=w),C>w&&(k=C/w,C=w),this.current.startNewPathAndClipBox([0,0,d,C]);let j="groupAt"+this.groupLevel;h.smask&&(j+="_smask_"+this.smaskCounter++%2);const D=this.cachedCanvases.getCanvas(j,d,C),p=D.context;p.scale(1/y,1/k),p.translate(-W,-i),p.transform(...T),h.smask?this.smaskStack.push({canvas:D.canvas,context:p,offsetX:W,offsetY:i,scaleX:y,scaleY:k,subtype:h.smask.subtype,backdrop:h.smask.backdrop,transferMap:h.smask.transferMap||null,startTransformInverse:null}):(u.setTransform(1,0,0,1,0,0),u.translate(W,i),u.scale(y,k),u.save()),r(u,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(u),this.groupLevel++}endGroup(h){if(!this.contentVisible)return;this.groupLevel--;const u=this.ctx,T=this.groupStack.pop();if(this.ctx=T,this.ctx.imageSmoothingEnabled=!1,h.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const I=(0,f.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...I);const $=_.Util.getAxialAlignedBoundingBox([0,0,u.canvas.width,u.canvas.height],I);this.ctx.drawImage(u.canvas,0,0),this.ctx.restore(),this.compose($)}}beginAnnotation(h,u,T,I,$){if(Dt(this,bt,dn).call(this),e(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(u)&&u.length===4){const W=u[2]-u[0],i=u[3]-u[1];if($&&this.annotationCanvasMap){T=T.slice(),T[4]-=u[0],T[5]-=u[1],u=u.slice(),u[0]=u[1]=0,u[2]=W,u[3]=i;const[d,C]=_.Util.singularValueDecompose2dScale((0,f.getCurrentTransform)(this.ctx)),{viewportScale:y}=this,k=Math.ceil(W*this.outputScaleX*y),j=Math.ceil(i*this.outputScaleY*y);this.annotationCanvas=this.canvasFactory.create(k,j);const{canvas:D,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(h,D),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.setTransform(d,0,0,-C,0,i*C),e(this.ctx,this.foregroundColor)}else e(this.ctx,this.foregroundColor),this.ctx.rect(u[0],u[1],W,i),this.ctx.clip(),this.endPath()}this.current=new g(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...T),this.transform(...I)}endAnnotation(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(h){if(!this.contentVisible)return;const u=h.count;h=this.getObject(h.data,h),h.count=u;const T=this.ctx,I=this.processingType3;if(I&&(I.compiled===void 0&&(I.compiled=v(h)),I.compiled)){I.compiled(T);return}const $=this._createMaskCanvas(h),W=$.canvas;T.save(),T.setTransform(1,0,0,1,0,0),T.drawImage(W,$.offsetX,$.offsetY),T.restore(),this.compose()}paintImageMaskXObjectRepeat(h,u,T=0,I=0,$,W){if(!this.contentVisible)return;h=this.getObject(h.data,h);const i=this.ctx;i.save();const d=(0,f.getCurrentTransform)(i);i.transform(u,T,I,$,0,0);const C=this._createMaskCanvas(h);i.setTransform(1,0,0,1,0,0);for(let y=0,k=W.length;y<k;y+=2){const j=_.Util.transform(d,[u,T,I,$,W[y],W[y+1]]),[D,p]=_.Util.applyTransform([0,0],j);i.drawImage(C.canvas,D,p)}i.restore(),this.compose()}paintImageMaskXObjectGroup(h){if(!this.contentVisible)return;const u=this.ctx,T=this.current.fillColor,I=this.current.patternFill;for(const $ of h){const{data:W,width:i,height:d,transform:C}=$,y=this.cachedCanvases.getCanvas("maskCanvas",i,d),k=y.context;k.save();const j=this.getObject(W,$);n(k,j),k.globalCompositeOperation="source-in",k.fillStyle=I?T.getPattern(k,this,(0,f.getCurrentTransformInverse)(u),V.PathType.FILL):T,k.fillRect(0,0,i,d),k.restore(),u.save(),u.transform(...C),u.scale(1,-1),o(u,y.canvas,0,0,i,d,0,-1,1,1),u.restore()}this.compose()}paintImageXObject(h){if(!this.contentVisible)return;const u=this.getObject(h);if(!u){(0,_.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(u)}paintImageXObjectRepeat(h,u,T,I){if(!this.contentVisible)return;const $=this.getObject(h);if(!$){(0,_.warn)("Dependent image isn't ready yet");return}const W=$.width,i=$.height,d=[];for(let C=0,y=I.length;C<y;C+=2)d.push({transform:[u,0,0,T,I[C],I[C+1]],x:0,y:0,w:W,h:i});this.paintInlineImageXObjectGroup($,d)}paintInlineImageXObject(h){if(!this.contentVisible)return;const u=h.width,T=h.height,I=this.ctx;this.save(),I.scale(1/u,-1/T);let $;if(typeof HTMLElement=="function"&&h instanceof HTMLElement||!h.data)$=h;else{const C=this.cachedCanvases.getCanvas("inlineImage",u,T),y=C.context;l(y,h,this.current.transferMaps),$=C.canvas}const W=this._scaleImage($,(0,f.getCurrentTransformInverse)(I));I.imageSmoothingEnabled=St((0,f.getCurrentTransform)(I),h.interpolate);const[i,d]=o(I,W.img,0,0,W.paintWidth,W.paintHeight,0,-T,u,T);if(this.imageLayer){const[C,y]=_.Util.applyTransform([0,-T],(0,f.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:h,left:C,top:y,width:i,height:d})}this.compose(),this.restore()}paintInlineImageXObjectGroup(h,u){if(!this.contentVisible)return;const T=this.ctx,I=h.width,$=h.height,W=this.cachedCanvases.getCanvas("inlineImage",I,$),i=W.context;l(i,h,this.current.transferMaps);for(const d of u){if(T.save(),T.transform(...d.transform),T.scale(1,-1),o(T,W.canvas,d.x,d.y,d.w,d.h,0,-1,1,1),this.imageLayer){const[C,y]=_.Util.applyTransform([d.x,d.y],(0,f.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:h,left:C,top:y,width:I,height:$})}T.restore()}this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(h){}markPointProps(h,u){}beginMarkedContent(h){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(h,u){h==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(u)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(h){const u=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(h);const T=this.ctx;this.pendingClip&&(u||(this.pendingClip===U?T.clip("evenodd"):T.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),T.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const h=(0,f.getCurrentTransform)(this.ctx);if(h[1]===0&&h[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(h[0]),Math.abs(h[3]));else{const u=Math.abs(h[0]*h[3]-h[2]*h[1]),T=Math.hypot(h[0],h[2]),I=Math.hypot(h[1],h[3]);this._cachedGetSinglePixelWidth=Math.max(T,I)/u}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:h}=this.current,u=(0,f.getCurrentTransform)(this.ctx);let T,I;if(u[1]===0&&u[2]===0){const $=Math.abs(u[0]),W=Math.abs(u[3]);if(h===0)T=1/$,I=1/W;else{const i=$*h,d=W*h;T=i<1?1/i:1,I=d<1?1/d:1}}else{const $=Math.abs(u[0]*u[3]-u[2]*u[1]),W=Math.hypot(u[0],u[1]),i=Math.hypot(u[2],u[3]);if(h===0)T=i/$,I=W/$;else{const d=h*$;T=i>d?i/d:1,I=W>d?W/d:1}}this._cachedScaleForStroking=[T,I]}return this._cachedScaleForStroking}rescaleAndStroke(h){const{ctx:u}=this,{lineWidth:T}=this.current,[I,$]=this.getScaleForStroking();if(u.lineWidth=T||1,I===1&&$===1){u.stroke();return}let W,i,d;h&&(W=(0,f.getCurrentTransform)(u),i=u.getLineDash().slice(),d=u.lineDashOffset),u.scale(I,$);const C=Math.max(I,$);u.setLineDash(u.getLineDash().map(y=>y/C)),u.lineDashOffset/=C,u.stroke(),h&&(u.setTransform(...W),u.setLineDash(i),u.lineDashOffset=d)}isContentVisible(){for(let h=this.markedContentStack.length-1;h>=0;h--)if(!this.markedContentStack[h].visible)return!1;return!0}};bt=new WeakSet,dn=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)};let G=Mt;a.CanvasGraphics=G;for(const H in _.OPS)G.prototype[H]!==void 0&&(G.prototype[_.OPS[H]]=G.prototype[H])}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TilingPattern=a.PathType=void 0,a.getShadingPattern=c;var f=A(1),_=A(8),V=A(3);const q={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};a.PathType=q;function Y(o,v){if(!v||V.isNodeJS)return;const g=v[2]-v[0],l=v[3]-v[1],n=new Path2D;n.rect(v[0],v[1],g,l),o.clip(n)}class M{constructor(){this.constructor===M&&(0,f.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,f.unreachable)("Abstract method `getPattern` called.")}}class b extends M{constructor(v){super(),this._type=v[1],this._bbox=v[2],this._colorStops=v[3],this._p0=v[4],this._p1=v[5],this._r0=v[6],this._r1=v[7],this.matrix=null}_createGradient(v){let g;this._type==="axial"?g=v.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(g=v.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const l of this._colorStops)g.addColorStop(l[0],l[1]);return g}getPattern(v,g,l,n){let r;if(n===q.STROKE||n===q.FILL){const e=g.current.getClippedPathBoundingBox(n,(0,_.getCurrentTransform)(v))||[0,0,0,0],E=Math.ceil(e[2]-e[0])||1,x=Math.ceil(e[3]-e[1])||1,L=g.cachedCanvases.getCanvas("pattern",E,x,!0),O=L.context;O.clearRect(0,0,O.canvas.width,O.canvas.height),O.beginPath(),O.rect(0,0,O.canvas.width,O.canvas.height),O.translate(-e[0],-e[1]),l=f.Util.transform(l,[1,0,0,1,e[0],e[1]]),O.transform(...g.baseTransform),this.matrix&&O.transform(...this.matrix),Y(O,this._bbox),O.fillStyle=this._createGradient(O),O.fill(),r=v.createPattern(L.canvas,"no-repeat");const yt=new DOMMatrix(l);try{r.setTransform(yt)}catch(St){(0,f.warn)(`RadialAxialShadingPattern.getPattern: "${St==null?void 0:St.message}".`)}}else Y(v,this._bbox),r=this._createGradient(v);return r}}function w(o,v,g,l,n,r,e,E){const x=v.coords,L=v.colors,O=o.data,yt=o.width*4;let St;x[g+1]>x[l+1]&&(St=g,g=l,l=St,St=r,r=e,e=St),x[l+1]>x[n+1]&&(St=l,l=n,n=St,St=e,e=E,E=St),x[g+1]>x[l+1]&&(St=g,g=l,l=St,St=r,r=e,e=St);const pt=(x[g]+v.offsetX)*v.scaleX,K=(x[g+1]+v.offsetY)*v.scaleY,N=(x[l]+v.offsetX)*v.scaleX,U=(x[l+1]+v.offsetY)*v.scaleY,G=(x[n]+v.offsetX)*v.scaleX,bt=(x[n+1]+v.offsetY)*v.scaleY;if(K>=bt)return;const wt=L[r],Mt=L[r+1],H=L[r+2],h=L[e],u=L[e+1],T=L[e+2],I=L[E],$=L[E+1],W=L[E+2],i=Math.round(K),d=Math.round(bt);let C,y,k,j,D,p,B,_t;for(let z=i;z<=d;z++){if(z<U){let xt;z<K?xt=0:xt=(K-z)/(K-U),C=pt-(pt-N)*xt,y=wt-(wt-h)*xt,k=Mt-(Mt-u)*xt,j=H-(H-T)*xt}else{let xt;z>bt?xt=1:U===bt?xt=0:xt=(U-z)/(U-bt),C=N-(N-G)*xt,y=h-(h-I)*xt,k=u-(u-$)*xt,j=T-(T-W)*xt}let Q;z<K?Q=0:z>bt?Q=1:Q=(K-z)/(K-bt),D=pt-(pt-G)*Q,p=wt-(wt-I)*Q,B=Mt-(Mt-$)*Q,_t=H-(H-W)*Q;const At=Math.round(Math.min(C,D)),kt=Math.round(Math.max(C,D));let Rt=yt*z+At*4;for(let xt=At;xt<=kt;xt++)Q=(C-xt)/(C-D),Q<0?Q=0:Q>1&&(Q=1),O[Rt++]=y-(y-p)*Q|0,O[Rt++]=k-(k-B)*Q|0,O[Rt++]=j-(j-_t)*Q|0,O[Rt++]=255}}function P(o,v,g){const l=v.coords,n=v.colors;let r,e;switch(v.type){case"lattice":const E=v.verticesPerRow,x=Math.floor(l.length/E)-1,L=E-1;for(r=0;r<x;r++){let O=r*E;for(let yt=0;yt<L;yt++,O++)w(o,g,l[O],l[O+1],l[O+E],n[O],n[O+1],n[O+E]),w(o,g,l[O+E+1],l[O+1],l[O+E],n[O+E+1],n[O+1],n[O+E])}break;case"triangles":for(r=0,e=l.length;r<e;r+=3)w(o,g,l[r],l[r+1],l[r+2],n[r],n[r+1],n[r+2]);break;default:throw new Error("illegal figure")}}class F extends M{constructor(v){super(),this._coords=v[2],this._colors=v[3],this._figures=v[4],this._bounds=v[5],this._bbox=v[7],this._background=v[8],this.matrix=null}_createMeshCanvas(v,g,l){const E=Math.floor(this._bounds[0]),x=Math.floor(this._bounds[1]),L=Math.ceil(this._bounds[2])-E,O=Math.ceil(this._bounds[3])-x,yt=Math.min(Math.ceil(Math.abs(L*v[0]*1.1)),3e3),St=Math.min(Math.ceil(Math.abs(O*v[1]*1.1)),3e3),pt=L/yt,K=O/St,N={coords:this._coords,colors:this._colors,offsetX:-E,offsetY:-x,scaleX:1/pt,scaleY:1/K},U=yt+4,G=St+4,bt=l.getCanvas("mesh",U,G,!1),wt=bt.context,Mt=wt.createImageData(yt,St);if(g){const h=Mt.data;for(let u=0,T=h.length;u<T;u+=4)h[u]=g[0],h[u+1]=g[1],h[u+2]=g[2],h[u+3]=255}for(const h of this._figures)P(Mt,h,N);return wt.putImageData(Mt,2,2),{canvas:bt.canvas,offsetX:E-2*pt,offsetY:x-2*K,scaleX:pt,scaleY:K}}getPattern(v,g,l,n){Y(v,this._bbox);let r;if(n===q.SHADING)r=f.Util.singularValueDecompose2dScale((0,_.getCurrentTransform)(v));else if(r=f.Util.singularValueDecompose2dScale(g.baseTransform),this.matrix){const E=f.Util.singularValueDecompose2dScale(this.matrix);r=[r[0]*E[0],r[1]*E[1]]}const e=this._createMeshCanvas(r,n===q.SHADING?null:this._background,g.cachedCanvases);return n!==q.SHADING&&(v.setTransform(...g.baseTransform),this.matrix&&v.transform(...this.matrix)),v.translate(e.offsetX,e.offsetY),v.scale(e.scaleX,e.scaleY),v.createPattern(e.canvas,"no-repeat")}}class S extends M{getPattern(){return"hotpink"}}function c(o){switch(o[0]){case"RadialAxial":return new b(o);case"Mesh":return new F(o);case"Dummy":return new S}throw new Error(`Unknown IR type: ${o[0]}`)}const t={COLORED:1,UNCOLORED:2};class s{static get MAX_PATTERN_SIZE(){return(0,f.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(v,g,l,n,r){this.operatorList=v[2],this.matrix=v[3]||[1,0,0,1,0,0],this.bbox=v[4],this.xstep=v[5],this.ystep=v[6],this.paintType=v[7],this.tilingType=v[8],this.color=g,this.ctx=l,this.canvasGraphicsFactory=n,this.baseTransform=r}createPatternCanvas(v){const g=this.operatorList,l=this.bbox,n=this.xstep,r=this.ystep,e=this.paintType,E=this.tilingType,x=this.color,L=this.canvasGraphicsFactory;(0,f.info)("TilingType: "+E);const O=l[0],yt=l[1],St=l[2],pt=l[3],K=f.Util.singularValueDecompose2dScale(this.matrix),N=f.Util.singularValueDecompose2dScale(this.baseTransform),U=[K[0]*N[0],K[1]*N[1]],G=this.getSizeAndScale(n,this.ctx.canvas.width,U[0]),bt=this.getSizeAndScale(r,this.ctx.canvas.height,U[1]),wt=v.cachedCanvases.getCanvas("pattern",G.size,bt.size,!0),Mt=wt.context,H=L.createCanvasGraphics(Mt);H.groupLevel=v.groupLevel,this.setFillAndStrokeStyleToContext(H,e,x);let h=O,u=yt,T=St,I=pt;return O<0&&(h=0,T+=Math.abs(O)),yt<0&&(u=0,I+=Math.abs(yt)),Mt.translate(-(G.scale*h),-(bt.scale*u)),H.transform(G.scale,0,0,bt.scale,0,0),Mt.save(),this.clipBbox(H,h,u,T,I),H.baseTransform=(0,_.getCurrentTransform)(H.ctx),H.executeOperatorList(g),H.endDrawing(),{canvas:wt.canvas,scaleX:G.scale,scaleY:bt.scale,offsetX:h,offsetY:u}}getSizeAndScale(v,g,l){v=Math.abs(v);const n=Math.max(s.MAX_PATTERN_SIZE,g);let r=Math.ceil(v*l);return r>=n?r=n:l=r/v,{scale:l,size:r}}clipBbox(v,g,l,n,r){const e=n-g,E=r-l;v.ctx.rect(g,l,e,E),v.current.updateRectMinMax((0,_.getCurrentTransform)(v.ctx),[g,l,n,r]),v.clip(),v.endPath()}setFillAndStrokeStyleToContext(v,g,l){const n=v.ctx,r=v.current;switch(g){case t.COLORED:const e=this.ctx;n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle,r.fillColor=e.fillStyle,r.strokeColor=e.strokeStyle;break;case t.UNCOLORED:const E=f.Util.makeHexColor(l[0],l[1],l[2]);n.fillStyle=E,n.strokeStyle=E,r.fillColor=E,r.strokeColor=E;break;default:throw new f.FormatError(`Unsupported paint type: ${g}`)}}getPattern(v,g,l,n){let r=l;n!==q.SHADING&&(r=f.Util.transform(r,g.baseTransform),this.matrix&&(r=f.Util.transform(r,this.matrix)));const e=this.createPatternCanvas(g);let E=new DOMMatrix(r);E=E.translate(e.offsetX,e.offsetY),E=E.scale(1/e.scaleX,1/e.scaleY);const x=v.createPattern(e.canvas,"repeat");try{x.setTransform(E)}catch(L){(0,f.warn)(`TilingPattern.getPattern: "${L==null?void 0:L.message}".`)}return x}}a.TilingPattern=s}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.applyMaskImageData=_;var f=A(1);function _({src:V,srcPos:q=0,dest:Y,destPos:M=0,width:b,height:w,inverseDecode:P=!1}){const F=f.FeatureTest.isLittleEndian?4278190080:255,[S,c]=P?[0,F]:[F,0],t=b>>3,s=b&7,o=V.length;Y=new Uint32Array(Y.buffer);for(let v=0;v<w;v++){for(const l=q+t;q<l;q++){const n=q<o?V[q]:255;Y[M++]=n&128?c:S,Y[M++]=n&64?c:S,Y[M++]=n&32?c:S,Y[M++]=n&16?c:S,Y[M++]=n&8?c:S,Y[M++]=n&4?c:S,Y[M++]=n&2?c:S,Y[M++]=n&1?c:S}if(s===0)continue;const g=q<o?V[q++]:255;for(let l=0;l<s;l++)Y[M++]=g&1<<7-l?c:S}return{srcPos:q,destPos:M}}}),((m,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.GlobalWorkerOptions=void 0;const A=Object.create(null);a.GlobalWorkerOptions=A,A.workerPort=A.workerPort===void 0?null:A.workerPort,A.workerSrc=A.workerSrc===void 0?"":A.workerSrc}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.MessageHandler=void 0;var f=A(1);const _={DATA:1,ERROR:2},V={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function q(M){switch(M instanceof Error||typeof M=="object"&&M!==null||(0,f.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),M.name){case"AbortException":return new f.AbortException(M.message);case"MissingPDFException":return new f.MissingPDFException(M.message);case"PasswordException":return new f.PasswordException(M.message,M.code);case"UnexpectedResponseException":return new f.UnexpectedResponseException(M.message,M.status);case"UnknownErrorException":return new f.UnknownErrorException(M.message,M.details);default:return new f.UnknownErrorException(M.message,M.toString())}}class Y{constructor(b,w,P){this.sourceName=b,this.targetName=w,this.comObj=P,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=F=>{const S=F.data;if(S.targetName!==this.sourceName)return;if(S.stream){this._processStreamMessage(S);return}if(S.callback){const t=S.callbackId,s=this.callbackCapabilities[t];if(!s)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],S.callback===_.DATA)s.resolve(S.data);else if(S.callback===_.ERROR)s.reject(q(S.reason));else throw new Error("Unexpected callback case");return}const c=this.actionHandler[S.action];if(!c)throw new Error(`Unknown action from worker: ${S.action}`);if(S.callbackId){const t=this.sourceName,s=S.sourceName;new Promise(function(o){o(c(S.data))}).then(function(o){P.postMessage({sourceName:t,targetName:s,callback:_.DATA,callbackId:S.callbackId,data:o})},function(o){P.postMessage({sourceName:t,targetName:s,callback:_.ERROR,callbackId:S.callbackId,reason:q(o)})});return}if(S.streamId){this._createStreamSink(S);return}c(S.data)},P.addEventListener("message",this._onComObjOnMessage)}on(b,w){const P=this.actionHandler;if(P[b])throw new Error(`There is already an actionName called "${b}"`);P[b]=w}send(b,w,P){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:b,data:w},P)}sendWithPromise(b,w,P){const F=this.callbackId++,S=(0,f.createPromiseCapability)();this.callbackCapabilities[F]=S;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:b,callbackId:F,data:w},P)}catch(c){S.reject(c)}return S.promise}sendWithStream(b,w,P,F){const S=this.streamId++,c=this.sourceName,t=this.targetName,s=this.comObj;return new ReadableStream({start:o=>{const v=(0,f.createPromiseCapability)();return this.streamControllers[S]={controller:o,startCall:v,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:c,targetName:t,action:b,streamId:S,data:w,desiredSize:o.desiredSize},F),v.promise},pull:o=>{const v=(0,f.createPromiseCapability)();return this.streamControllers[S].pullCall=v,s.postMessage({sourceName:c,targetName:t,stream:V.PULL,streamId:S,desiredSize:o.desiredSize}),v.promise},cancel:o=>{(0,f.assert)(o instanceof Error,"cancel must have a valid reason");const v=(0,f.createPromiseCapability)();return this.streamControllers[S].cancelCall=v,this.streamControllers[S].isClosed=!0,s.postMessage({sourceName:c,targetName:t,stream:V.CANCEL,streamId:S,reason:q(o)}),v.promise}},P)}_createStreamSink(b){const w=b.streamId,P=this.sourceName,F=b.sourceName,S=this.comObj,c=this,t=this.actionHandler[b.action],s={enqueue(o,v=1,g){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=v,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,f.createPromiseCapability)(),this.ready=this.sinkCapability.promise),S.postMessage({sourceName:P,targetName:F,stream:V.ENQUEUE,streamId:w,chunk:o},g)},close(){this.isCancelled||(this.isCancelled=!0,S.postMessage({sourceName:P,targetName:F,stream:V.CLOSE,streamId:w}),delete c.streamSinks[w])},error(o){(0,f.assert)(o instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,S.postMessage({sourceName:P,targetName:F,stream:V.ERROR,streamId:w,reason:q(o)}))},sinkCapability:(0,f.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:b.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[w]=s,new Promise(function(o){o(t(b.data,s))}).then(function(){S.postMessage({sourceName:P,targetName:F,stream:V.START_COMPLETE,streamId:w,success:!0})},function(o){S.postMessage({sourceName:P,targetName:F,stream:V.START_COMPLETE,streamId:w,reason:q(o)})})}_processStreamMessage(b){const w=b.streamId,P=this.sourceName,F=b.sourceName,S=this.comObj,c=this.streamControllers[w],t=this.streamSinks[w];switch(b.stream){case V.START_COMPLETE:b.success?c.startCall.resolve():c.startCall.reject(q(b.reason));break;case V.PULL_COMPLETE:b.success?c.pullCall.resolve():c.pullCall.reject(q(b.reason));break;case V.PULL:if(!t){S.postMessage({sourceName:P,targetName:F,stream:V.PULL_COMPLETE,streamId:w,success:!0});break}t.desiredSize<=0&&b.desiredSize>0&&t.sinkCapability.resolve(),t.desiredSize=b.desiredSize,new Promise(function(s){s(t.onPull&&t.onPull())}).then(function(){S.postMessage({sourceName:P,targetName:F,stream:V.PULL_COMPLETE,streamId:w,success:!0})},function(s){S.postMessage({sourceName:P,targetName:F,stream:V.PULL_COMPLETE,streamId:w,reason:q(s)})});break;case V.ENQUEUE:if((0,f.assert)(c,"enqueue should have stream controller"),c.isClosed)break;c.controller.enqueue(b.chunk);break;case V.CLOSE:if((0,f.assert)(c,"close should have stream controller"),c.isClosed)break;c.isClosed=!0,c.controller.close(),this._deleteStreamController(c,w);break;case V.ERROR:(0,f.assert)(c,"error should have stream controller"),c.controller.error(q(b.reason)),this._deleteStreamController(c,w);break;case V.CANCEL_COMPLETE:b.success?c.cancelCall.resolve():c.cancelCall.reject(q(b.reason)),this._deleteStreamController(c,w);break;case V.CANCEL:if(!t)break;new Promise(function(s){s(t.onCancel&&t.onCancel(q(b.reason)))}).then(function(){S.postMessage({sourceName:P,targetName:F,stream:V.CANCEL_COMPLETE,streamId:w,success:!0})},function(s){S.postMessage({sourceName:P,targetName:F,stream:V.CANCEL_COMPLETE,streamId:w,reason:q(s)})}),t.sinkCapability.reject(q(b.reason)),t.isCancelled=!0,delete this.streamSinks[w];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(b,w){await Promise.allSettled([b.startCall&&b.startCall.promise,b.pullCall&&b.pullCall.promise,b.cancelCall&&b.cancelCall.promise]),delete this.streamControllers[w]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}a.MessageHandler=Y}),((m,a,A)=>{var V,q;Object.defineProperty(a,"__esModule",{value:!0}),a.Metadata=void 0;var f=A(1);class _{constructor({parsedData:M,rawData:b}){Ot(this,V);Ot(this,q);It(this,V,M),It(this,q,b)}getRaw(){return R(this,q)}get(M){return R(this,V).get(M)??null}getAll(){return(0,f.objectFromMap)(R(this,V))}has(M){return R(this,V).has(M)}}V=new WeakMap,q=new WeakMap,a.Metadata=_}),((m,a,A)=>{var Y,M,b,w,P,F,hn;Object.defineProperty(a,"__esModule",{value:!0}),a.OptionalContentConfig=void 0;var f=A(1);const _=Symbol("INTERNAL");class V{constructor(t,s){Ot(this,Y,!0);this.name=t,this.intent=s}get visible(){return R(this,Y)}_setVisible(t,s){t!==_&&(0,f.unreachable)("Internal method `_setVisible` called."),It(this,Y,s)}}Y=new WeakMap;class q{constructor(t){Ot(this,F);Ot(this,M,!0);Ot(this,b,new Map);Ot(this,w,null);Ot(this,P,null);if(this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,It(this,P,t.order);for(const s of t.groups)R(this,b).set(s.id,new V(s.name,s.intent));if(t.baseState==="OFF")for(const s of R(this,b).values())s._setVisible(_,!1);for(const s of t.on)R(this,b).get(s)._setVisible(_,!0);for(const s of t.off)R(this,b).get(s)._setVisible(_,!1);It(this,w,new Map);for(const[s,o]of R(this,b))R(this,w).set(s,o.visible)}}isVisible(t){if(R(this,b).size===0)return!0;if(!t)return(0,f.warn)("Optional content group not defined."),!0;if(t.type==="OCG")return R(this,b).has(t.id)?R(this,b).get(t.id).visible:((0,f.warn)(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return Dt(this,F,hn).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const s of t.ids){if(!R(this,b).has(s))return(0,f.warn)(`Optional content group not found: ${s}`),!0;if(R(this,b).get(s).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const s of t.ids){if(!R(this,b).has(s))return(0,f.warn)(`Optional content group not found: ${s}`),!0;if(!R(this,b).get(s).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const s of t.ids){if(!R(this,b).has(s))return(0,f.warn)(`Optional content group not found: ${s}`),!0;if(!R(this,b).get(s).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const s of t.ids){if(!R(this,b).has(s))return(0,f.warn)(`Optional content group not found: ${s}`),!0;if(R(this,b).get(s).visible)return!1}return!0}return(0,f.warn)(`Unknown optional content policy ${t.policy}.`),!0}return(0,f.warn)(`Unknown group type ${t.type}.`),!0}setVisibility(t,s=!0){if(!R(this,b).has(t)){(0,f.warn)(`Optional content group not found: ${t}`);return}R(this,b).get(t)._setVisible(_,!!s),It(this,M,null)}get hasInitialVisibility(){if(R(this,M)!==null)return R(this,M);for(const[t,s]of R(this,b)){const o=R(this,w).get(t);if(s.visible!==o)return It(this,M,!1)}return It(this,M,!0)}getOrder(){return R(this,b).size?R(this,P)?R(this,P).slice():[...R(this,b).keys()]:null}getGroups(){return R(this,b).size>0?(0,f.objectFromMap)(R(this,b)):null}getGroup(t){return R(this,b).get(t)||null}}M=new WeakMap,b=new WeakMap,w=new WeakMap,P=new WeakMap,F=new WeakSet,hn=function(t){const s=t.length;if(s<2)return!0;const o=t[0];for(let v=1;v<s;v++){const g=t[v];let l;if(Array.isArray(g))l=Dt(this,F,hn).call(this,g);else if(R(this,b).has(g))l=R(this,b).get(g).visible;else return(0,f.warn)(`Optional content group not found: ${g}`),!0;switch(o){case"And":if(!l)return!1;break;case"Or":if(l)return!0;break;case"Not":return!l;default:return!0}}return o==="And"},a.OptionalContentConfig=q}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PDFDataTransportStream=void 0;var f=A(1),_=A(8);class V{constructor(b,w){(0,f.assert)(w,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=b.progressiveDone||!1,this._contentDispositionFilename=b.contentDispositionFilename||null;const P=b.initialData;if((P==null?void 0:P.length)>0){const F=new Uint8Array(P).buffer;this._queuedChunks.push(F)}this._pdfDataRangeTransport=w,this._isStreamingSupported=!b.disableStream,this._isRangeSupported=!b.disableRange,this._contentLength=b.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((F,S)=>{this._onReceiveData({begin:F,chunk:S})}),this._pdfDataRangeTransport.addProgressListener((F,S)=>{this._onProgress({loaded:F,total:S})}),this._pdfDataRangeTransport.addProgressiveReadListener(F=>{this._onReceiveData({chunk:F})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData(b){const w=new Uint8Array(b.chunk).buffer;if(b.begin===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(w):this._queuedChunks.push(w);else{const P=this._rangeReaders.some(function(F){return F._begin!==b.begin?!1:(F._enqueue(w),!0)});(0,f.assert)(P,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var b;return((b=this._fullRequestReader)==null?void 0:b._loaded)??0}_onProgress(b){if(b.total===void 0){const w=this._rangeReaders[0];w!=null&&w.onProgress&&w.onProgress({loaded:b.loaded})}else{const w=this._fullRequestReader;w!=null&&w.onProgress&&w.onProgress({loaded:b.loaded,total:b.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(b){const w=this._rangeReaders.indexOf(b);w>=0&&this._rangeReaders.splice(w,1)}getFullReader(){(0,f.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const b=this._queuedChunks;return this._queuedChunks=null,new q(this,b,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(b,w){if(w<=this._progressiveDataLength)return null;const P=new Y(this,b,w);return this._pdfDataRangeTransport.requestDataRange(b,w),this._rangeReaders.push(P),P}cancelAllRequests(b){this._fullRequestReader&&this._fullRequestReader.cancel(b);for(const w of this._rangeReaders.slice(0))w.cancel(b);this._pdfDataRangeTransport.abort()}}a.PDFDataTransportStream=V;class q{constructor(b,w,P=!1,F=null){this._stream=b,this._done=P||!1,this._filename=(0,_.isPdfFile)(F)?F:null,this._queuedChunks=w||[],this._loaded=0;for(const S of this._queuedChunks)this._loaded+=S.byteLength;this._requests=[],this._headersReady=Promise.resolve(),b._fullRequestReader=this,this.onProgress=null}_enqueue(b){this._done||(this._requests.length>0?this._requests.shift().resolve({value:b,done:!1}):this._queuedChunks.push(b),this._loaded+=b.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const b=(0,f.createPromiseCapability)();return this._requests.push(b),b.promise}cancel(b){this._done=!0;for(const w of this._requests)w.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Y{constructor(b,w,P){this._stream=b,this._begin=w,this._end=P,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(b){if(!this._done){if(this._requests.length===0)this._queuedChunk=b;else{this._requests.shift().resolve({value:b,done:!1});for(const P of this._requests)P.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const w=this._queuedChunk;return this._queuedChunk=null,{value:w,done:!1}}if(this._done)return{value:void 0,done:!0};const b=(0,f.createPromiseCapability)();return this._requests.push(b),b.promise}cancel(b){this._done=!0;for(const w of this._requests)w.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((m,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.XfaText=void 0;class A{static textContent(_){const V=[],q={items:V,styles:Object.create(null)};function Y(M){var P;if(!M)return;let b=null;const w=M.name;if(w==="#text")b=M.value;else if(A.shouldBuildText(w))(P=M==null?void 0:M.attributes)!=null&&P.textContent?b=M.attributes.textContent:M.value&&(b=M.value);else return;if(b!==null&&V.push({str:b}),!!M.children)for(const F of M.children)Y(F)}return Y(_),q}static shouldBuildText(_){return!(_==="textarea"||_==="input"||_==="option"||_==="select")}}a.XfaText=A}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.NodeStandardFontDataFactory=a.NodeCanvasFactory=a.NodeCMapReaderFactory=void 0;var f=A(9);const _=function(M){return new Promise((b,w)=>{require$$0.readFile(M,(F,S)=>{if(F||!S){w(new Error(F));return}b(new Uint8Array(S))})})};class V extends f.BaseCanvasFactory{_createCanvas(b,w){return require$$0.createCanvas(b,w)}}a.NodeCanvasFactory=V;class q extends f.BaseCMapReaderFactory{_fetchData(b,w){return _(b).then(P=>({cMapData:P,compressionType:w}))}}a.NodeCMapReaderFactory=q;class Y extends f.BaseStandardFontDataFactory{_fetchData(b){return _(b)}}a.NodeStandardFontDataFactory=Y}),((m,a,A)=>{var M,b,w,P,F,S,c,t,s,fn,Dn,pn,Rn;Object.defineProperty(a,"__esModule",{value:!0}),a.AnnotationEditorLayer=void 0;var f=A(7),_=A(1),V=A(23),q=A(24);const n=class n{constructor(e){Ot(this,s);Ot(this,M);Ot(this,b,!1);Ot(this,w,this.pointerup.bind(this));Ot(this,P,this.pointerdown.bind(this));Ot(this,F,new Map);Ot(this,S,!1);Ot(this,c,!1);Ot(this,t);n._initialized||(n._initialized=!0,V.FreeTextEditor.initialize(e.l10n),q.InkEditor.initialize(e.l10n),e.uiManager.registerEditorTypes([V.FreeTextEditor,q.InkEditor])),It(this,t,e.uiManager),this.annotationStorage=e.annotationStorage,this.pageIndex=e.pageIndex,this.div=e.div,It(this,M,e.accessibilityManager),R(this,t).addLayer(this)}updateToolbar(e){R(this,t).updateToolbar(e)}updateMode(e=R(this,t).getMode()){Dt(this,s,Rn).call(this),e===_.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),R(this,t).unselectAll()}addInkEditorIfNeeded(e){if(!e&&R(this,t).getMode()!==_.AnnotationEditorType.INK)return;if(!e){for(const x of R(this,F).values())if(x.isEmpty()){x.setInBackground();return}}Dt(this,s,pn).call(this,{offsetX:0,offsetY:0}).setInBackground()}setEditingState(e){R(this,t).setEditingState(e)}addCommands(e){R(this,t).addCommands(e)}enable(){this.div.style.pointerEvents="auto";for(const e of R(this,F).values())e.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const e of R(this,F).values())e.disableEditing()}setActiveEditor(e){R(this,t).getActive()!==e&&R(this,t).setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",R(this,P)),this.div.addEventListener("pointerup",R(this,w))}disableClick(){this.div.removeEventListener("pointerdown",R(this,P)),this.div.removeEventListener("pointerup",R(this,w))}attach(e){R(this,F).set(e.id,e)}detach(e){var E;R(this,F).delete(e.id),(E=R(this,M))==null||E.removePointerInTextLayer(e.contentDiv)}remove(e){R(this,t).removeEditor(e),this.detach(e),this.annotationStorage.remove(e.id),e.div.style.display="none",setTimeout(()=>{e.div.style.display="",e.div.remove(),e.isAttachedToDOM=!1,document.activeElement===document.body&&R(this,t).focusMainContainer()},0),R(this,c)||this.addInkEditorIfNeeded(!1)}add(e){if(Dt(this,s,fn).call(this,e),R(this,t).addEditor(e),this.attach(e),!e.isAttachedToDOM){const E=e.render();this.div.append(E),e.isAttachedToDOM=!0}this.moveEditorInDOM(e),e.onceAdded(),this.addToAnnotationStorage(e)}moveEditorInDOM(e){var E;(E=R(this,M))==null||E.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addToAnnotationStorage(e){!e.isEmpty()&&!this.annotationStorage.has(e.id)&&this.annotationStorage.setValue(e.id,e)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addANewEditor(e){const E=()=>{this.addOrRebuild(e)},x=()=>{e.remove()};this.addCommands({cmd:E,undo:x,mustExec:!0})}addUndoableEditor(e){const E=()=>{this.addOrRebuild(e)},x=()=>{e.remove()};this.addCommands({cmd:E,undo:x,mustExec:!1})}getNextId(){return R(this,t).getId()}deserialize(e){switch(e.annotationType){case _.AnnotationEditorType.FREETEXT:return V.FreeTextEditor.deserialize(e,this);case _.AnnotationEditorType.INK:return q.InkEditor.deserialize(e,this)}return null}setSelected(e){R(this,t).setSelected(e)}toggleSelected(e){R(this,t).toggleSelected(e)}isSelected(e){return R(this,t).isSelected(e)}unselect(e){R(this,t).unselect(e)}pointerup(e){const E=f.KeyboardManager.platform.isMac;if(!(e.button!==0||e.ctrlKey&&E)&&e.target===this.div&&R(this,S)){if(It(this,S,!1),!R(this,b)){It(this,b,!0);return}Dt(this,s,pn).call(this,e)}}pointerdown(e){const E=f.KeyboardManager.platform.isMac;if(e.button!==0||e.ctrlKey&&E||e.target!==this.div)return;It(this,S,!0);const x=R(this,t).getActive();It(this,b,!x||x.isEmpty())}drop(e){const E=e.dataTransfer.getData("text/plain"),x=R(this,t).getEditor(E);if(!x)return;e.preventDefault(),e.dataTransfer.dropEffect="move",Dt(this,s,fn).call(this,x);const L=this.div.getBoundingClientRect(),O=e.clientX-L.x,yt=e.clientY-L.y;x.translate(O-x.startX,yt-x.startY),this.moveEditorInDOM(x),x.div.focus()}dragover(e){e.preventDefault()}destroy(){var e,E;((e=R(this,t).getActive())==null?void 0:e.parent)===this&&R(this,t).setActiveEditor(null);for(const x of R(this,F).values())(E=R(this,M))==null||E.removePointerInTextLayer(x.contentDiv),x.isAttachedToDOM=!1,x.div.remove(),x.parent=null;this.div=null,R(this,F).clear(),R(this,t).removeLayer(this)}render(e){this.viewport=e.viewport,(0,f.bindEvents)(this,this.div,["dragover","drop"]),this.setDimensions();for(const E of R(this,t).getEditors(this.pageIndex))this.add(E);this.updateMode()}update(e){this.viewport=e.viewport,this.setDimensions(),this.updateMode()}get scaleFactor(){return this.viewport.scale}get pageDimensions(){const[e,E,x,L]=this.viewport.viewBox,O=x-e,yt=L-E;return[O,yt]}get viewportBaseDimensions(){const{width:e,height:E,rotation:x}=this.viewport;return x%180===0?[e,E]:[E,e]}setDimensions(){const{width:e,height:E,rotation:x}=this.viewport,L=x%180!==0,O=Math.floor(e)+"px",yt=Math.floor(E)+"px";this.div.style.width=L?yt:O,this.div.style.height=L?O:yt,this.div.setAttribute("data-main-rotation",x)}};M=new WeakMap,b=new WeakMap,w=new WeakMap,P=new WeakMap,F=new WeakMap,S=new WeakMap,c=new WeakMap,t=new WeakMap,s=new WeakSet,fn=function(e){var E;e.parent!==this&&(this.attach(e),e.pageIndex=this.pageIndex,(E=e.parent)==null||E.detach(e),e.parent=this,e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))},Dn=function(e){switch(R(this,t).getMode()){case _.AnnotationEditorType.FREETEXT:return new V.FreeTextEditor(e);case _.AnnotationEditorType.INK:return new q.InkEditor(e)}return null},pn=function(e){const E=this.getNextId(),x=Dt(this,s,Dn).call(this,{parent:this,id:E,x:e.offsetX,y:e.offsetY});return x&&this.add(x),x},Rn=function(){It(this,c,!0);for(const e of R(this,F).values())e.isEmpty()&&e.remove();It(this,c,!1)},ee(n,"_initialized",!1);let Y=n;a.AnnotationEditorLayer=Y}),((m,a,A)=>{var Y,M,b,w,P,F,S,c,Mn,On,In,gn;Object.defineProperty(a,"__esModule",{value:!0}),a.FreeTextEditor=void 0;var f=A(1),_=A(7),V=A(6);const g=class g extends V.AnnotationEditor{constructor(r){super({...r,name:"freeTextEditor"});Ot(this,c);Ot(this,Y,this.editorDivBlur.bind(this));Ot(this,M,this.editorDivFocus.bind(this));Ot(this,b,this.editorDivKeydown.bind(this));Ot(this,w);Ot(this,P,"");Ot(this,F,!1);Ot(this,S);It(this,w,r.color||g._defaultColor||V.AnnotationEditor._defaultLineColor),It(this,S,r.fontSize||g._defaultFontSize)}static initialize(r){this._l10nPromise=new Map(["free_text_default_content","editor_free_text_aria_label"].map(E=>[E,r.get(E)]));const e=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(e.getPropertyValue("--freetext-padding"))}static updateDefaultParams(r,e){switch(r){case f.AnnotationEditorParamsType.FREETEXT_SIZE:g._defaultFontSize=e;break;case f.AnnotationEditorParamsType.FREETEXT_COLOR:g._defaultColor=e;break}}updateParams(r,e){switch(r){case f.AnnotationEditorParamsType.FREETEXT_SIZE:Dt(this,c,Mn).call(this,e);break;case f.AnnotationEditorParamsType.FREETEXT_COLOR:Dt(this,c,On).call(this,e);break}}static get defaultPropertiesToUpdate(){return[[f.AnnotationEditorParamsType.FREETEXT_SIZE,g._defaultFontSize],[f.AnnotationEditorParamsType.FREETEXT_COLOR,g._defaultColor||V.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[f.AnnotationEditorParamsType.FREETEXT_SIZE,R(this,S)],[f.AnnotationEditorParamsType.FREETEXT_COLOR,R(this,w)]]}getInitialTranslation(){return[-g._internalPadding*this.parent.scaleFactor,-(g._internalPadding+R(this,S))*this.parent.scaleFactor]}rebuild(){super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(f.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.enableEditing(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.editorDiv.addEventListener("keydown",R(this,b)),this.editorDiv.addEventListener("focus",R(this,M)),this.editorDiv.addEventListener("blur",R(this,Y)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.disableEditing(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",R(this,b)),this.editorDiv.removeEventListener("focus",R(this,M)),this.editorDiv.removeEventListener("blur",R(this,Y)),this.div.focus(),this.isEditing=!1)}focusin(r){super.focusin(r),r.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus())}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent.setEditingState(!0),super.remove()}commit(){super.commit(),R(this,F)||(It(this,F,!0),this.parent.addUndoableEditor(this)),this.disableEditMode(),It(this,P,Dt(this,c,In).call(this).trimEnd()),Dt(this,c,gn).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(r){this.enableEditMode(),this.editorDiv.focus()}keydown(r){r.target===this.div&&r.key==="Enter"&&(this.enableEditMode(),this.editorDiv.focus())}editorDivKeydown(r){g._keyboardManager.exec(this,r)}editorDivFocus(r){this.isEditing=!0}editorDivBlur(r){this.isEditing=!1}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let r,e;this.width&&(r=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",`${this.id}-editor`),this.enableEditing(),g._l10nPromise.get("editor_free_text_aria_label").then(x=>{var L;return(L=this.editorDiv)==null?void 0:L.setAttribute("aria-label",x)}),g._l10nPromise.get("free_text_default_content").then(x=>{var L;return(L=this.editorDiv)==null?void 0:L.setAttribute("default-content",x)}),this.editorDiv.contentEditable=!0;const{style:E}=this.editorDiv;if(E.fontSize=`calc(${R(this,S)}px * var(--scale-factor))`,E.color=R(this,w),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,_.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[x,L]=this.parent.viewportBaseDimensions;this.setAt(r*x,e*L,this.width*x,this.height*L);for(const O of R(this,P).split(`
|
|
40
|
-
`)){const yt=document.createElement("div");yt.append(O?document.createTextNode(O):document.createElement("br")),this.editorDiv.append(yt)}this.div.draggable=!0,this.editorDiv.contentEditable=!1}else this.div.draggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(r,e){const E=super.deserialize(r,e);return It(E,S,r.fontSize),It(E,w,f.Util.makeHexColor(...r.color)),It(E,P,r.value),E}serialize(){if(this.isEmpty())return null;const r=g._internalPadding*this.parent.scaleFactor,e=this.getRect(r,r),E=V.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:f.AnnotationEditorType.FREETEXT,color:E,fontSize:R(this,S),value:R(this,P),pageIndex:this.parent.pageIndex,rect:e,rotation:this.rotation}}};Y=new WeakMap,M=new WeakMap,b=new WeakMap,w=new WeakMap,P=new WeakMap,F=new WeakMap,S=new WeakMap,c=new WeakSet,Mn=function(r){const e=x=>{this.editorDiv.style.fontSize=`calc(${x}px * var(--scale-factor))`,this.translate(0,-(x-R(this,S))*this.parent.scaleFactor),It(this,S,x),Dt(this,c,gn).call(this)},E=R(this,S);this.parent.addCommands({cmd:()=>{e(r)},undo:()=>{e(E)},mustExec:!0,type:f.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},On=function(r){const e=R(this,w);this.parent.addCommands({cmd:()=>{It(this,w,r),this.editorDiv.style.color=r},undo:()=>{It(this,w,e),this.editorDiv.style.color=e},mustExec:!0,type:f.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},In=function(){const r=this.editorDiv.getElementsByTagName("div");if(r.length===0)return this.editorDiv.innerText;const e=[];for(let E=0,x=r.length;E<x;E++){const O=r[E].firstChild;(O==null?void 0:O.nodeName)==="#text"?e.push(O.data):e.push("")}return e.join(`
|
|
41
|
-
`)},gn=function(){const[r,e]=this.parent.viewportBaseDimensions,E=this.div.getBoundingClientRect();this.width=E.width/r,this.height=E.height/e},ee(g,"_freeTextDefaultContent",""),ee(g,"_l10nPromise"),ee(g,"_internalPadding",0),ee(g,"_defaultColor",null),ee(g,"_defaultFontSize",10),ee(g,"_keyboardManager",new _.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],g.prototype.commitOrRemove]])),ee(g,"_type","freetext");let q=g;a.FreeTextEditor=q}),((m,a,A)=>{var b,w,P,F,S,c,t,s,o,v,g,l,n,r,e,Ln,Bn,Nn,jn,mn,$n,Un,Wn,le,bn,Fe,we,fe,_n,tn,h,An,Hn,qn,Xn,yn,en,pe,En;Object.defineProperty(a,"__esModule",{value:!0}),a.InkEditor=void 0,Object.defineProperty(a,"fitCurve",{enumerable:!0,get:function(){return V.fitCurve}});var f=A(1),_=A(6),V=A(25),q=A(7);const Y=16,y=class y extends _.AnnotationEditor{constructor(D){super({...D,name:"inkEditor"});Ot(this,e);Ot(this,b,0);Ot(this,w,0);Ot(this,P,0);Ot(this,F,this.canvasPointermove.bind(this));Ot(this,S,this.canvasPointerleave.bind(this));Ot(this,c,this.canvasPointerup.bind(this));Ot(this,t,this.canvasPointerdown.bind(this));Ot(this,s,!1);Ot(this,o,!1);Ot(this,v,null);Ot(this,g,null);Ot(this,l,0);Ot(this,n,0);Ot(this,r,null);this.color=D.color||null,this.thickness=D.thickness||null,this.opacity=D.opacity||null,this.paths=[],this.bezierPath2D=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(D){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink_aria_label"].map(p=>[p,D.get(p)]))}static updateDefaultParams(D,p){switch(D){case f.AnnotationEditorParamsType.INK_THICKNESS:y._defaultThickness=p;break;case f.AnnotationEditorParamsType.INK_COLOR:y._defaultColor=p;break;case f.AnnotationEditorParamsType.INK_OPACITY:y._defaultOpacity=p/100;break}}updateParams(D,p){switch(D){case f.AnnotationEditorParamsType.INK_THICKNESS:Dt(this,e,Ln).call(this,p);break;case f.AnnotationEditorParamsType.INK_COLOR:Dt(this,e,Bn).call(this,p);break;case f.AnnotationEditorParamsType.INK_OPACITY:Dt(this,e,Nn).call(this,p);break}}static get defaultPropertiesToUpdate(){return[[f.AnnotationEditorParamsType.INK_THICKNESS,y._defaultThickness],[f.AnnotationEditorParamsType.INK_COLOR,y._defaultColor||_.AnnotationEditor._defaultLineColor],[f.AnnotationEditorParamsType.INK_OPACITY,Math.round(y._defaultOpacity*100)]]}get propertiesToUpdate(){return[[f.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||y._defaultThickness],[f.AnnotationEditorParamsType.INK_COLOR,this.color||y._defaultColor||_.AnnotationEditor._defaultLineColor],[f.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??y._defaultOpacity))]]}rebuild(){super.rebuild(),this.div!==null&&(this.canvas||(Dt(this,e,Fe).call(this),Dt(this,e,we).call(this)),this.isAttachedToDOM||(this.parent.add(this),Dt(this,e,fe).call(this)),Dt(this,e,pe).call(this))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,R(this,g).disconnect(),It(this,g,null),super.remove())}enableEditMode(){R(this,s)||this.canvas===null||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",R(this,t)),this.canvas.addEventListener("pointerup",R(this,c)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",R(this,t)),this.canvas.removeEventListener("pointerup",R(this,c)))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){R(this,s)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),It(this,s,!0),this.div.classList.add("disabled"),Dt(this,e,pe).call(this,!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus())}focusin(D){super.focusin(D),this.enableEditMode()}canvasPointerdown(D){D.button!==0||!this.isInEditMode()||R(this,s)||(this.setInForeground(),D.type!=="mouse"&&this.div.focus(),D.stopPropagation(),this.canvas.addEventListener("pointerleave",R(this,S)),this.canvas.addEventListener("pointermove",R(this,F)),Dt(this,e,$n).call(this,D.offsetX,D.offsetY))}canvasPointermove(D){D.stopPropagation(),Dt(this,e,Un).call(this,D.offsetX,D.offsetY)}canvasPointerup(D){D.button===0&&this.isInEditMode()&&this.currentPath.length!==0&&(D.stopPropagation(),Dt(this,e,bn).call(this,D),this.setInBackground())}canvasPointerleave(D){Dt(this,e,bn).call(this,D),this.setInBackground()}render(){if(this.div)return this.div;let D,p;this.width&&(D=this.x,p=this.y),super.render(),y._l10nPromise.get("editor_ink_aria_label").then(At=>{var kt;return(kt=this.div)==null?void 0:kt.setAttribute("aria-label",At)});const[B,_t,z,Q]=Dt(this,e,jn).call(this);if(this.setAt(B,_t,0,0),this.setDims(z,Q),Dt(this,e,Fe).call(this),this.width){const[At,kt]=this.parent.viewportBaseDimensions;this.setAt(D*At,p*kt,this.width*At,this.height*kt),It(this,o,!0),Dt(this,e,fe).call(this),this.setDims(this.width*At,this.height*kt),Dt(this,e,le).call(this),Dt(this,e,En).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return Dt(this,e,we).call(this),this.div}setDimensions(D,p){const B=Math.round(D),_t=Math.round(p);if(R(this,l)===B&&R(this,n)===_t)return;It(this,l,B),It(this,n,_t),this.canvas.style.visibility="hidden",R(this,b)&&Math.abs(R(this,b)-D/p)>.01&&(p=Math.ceil(D/R(this,b)),this.setDims(D,p));const[z,Q]=this.parent.viewportBaseDimensions;this.width=D/z,this.height=p/Q,R(this,s)&&Dt(this,e,_n).call(this,D,p),Dt(this,e,fe).call(this),Dt(this,e,le).call(this),this.canvas.style.visibility="visible"}static deserialize(D,p){var Ht,Ut;const B=super.deserialize(D,p);B.thickness=D.thickness,B.color=f.Util.makeHexColor(...D.color),B.opacity=D.opacity;const[_t,z]=p.pageDimensions,Q=B.width*_t,At=B.height*z,kt=p.scaleFactor,Rt=D.thickness/2;It(B,b,Q/At),It(B,s,!0),It(B,l,Math.round(Q)),It(B,n,Math.round(At));for(const{bezier:Nt}of D.paths){const Xt=[];B.paths.push(Xt);let Gt=kt*(Nt[0]-Rt),Zt=kt*(At-Nt[1]-Rt);for(let Vt=2,Yt=Nt.length;Vt<Yt;Vt+=6){const Jt=kt*(Nt[Vt]-Rt),oe=kt*(At-Nt[Vt+1]-Rt),ce=kt*(Nt[Vt+2]-Rt),de=kt*(At-Nt[Vt+3]-Rt),Pt=kt*(Nt[Vt+4]-Rt),J=kt*(At-Nt[Vt+5]-Rt);Xt.push([[Gt,Zt],[Jt,oe],[ce,de],[Pt,J]]),Gt=Pt,Zt=J}const zt=Dt(this,h,An).call(this,Xt);B.bezierPath2D.push(zt)}const xt=Dt(Ht=B,e,yn).call(Ht);return It(B,P,Math.max(Y,xt[2]-xt[0])),It(B,w,Math.max(Y,xt[3]-xt[1])),Dt(Ut=B,e,_n).call(Ut,Q,At),B}serialize(){if(this.isEmpty())return null;const D=this.getRect(0,0),p=this.rotation%180===0?D[3]-D[1]:D[2]-D[0],B=_.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:f.AnnotationEditorType.INK,color:B,thickness:this.thickness,opacity:this.opacity,paths:Dt(this,e,Hn).call(this,this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,p),pageIndex:this.parent.pageIndex,rect:D,rotation:this.rotation}}};b=new WeakMap,w=new WeakMap,P=new WeakMap,F=new WeakMap,S=new WeakMap,c=new WeakMap,t=new WeakMap,s=new WeakMap,o=new WeakMap,v=new WeakMap,g=new WeakMap,l=new WeakMap,n=new WeakMap,r=new WeakMap,e=new WeakSet,Ln=function(D){const p=this.thickness;this.parent.addCommands({cmd:()=>{this.thickness=D,Dt(this,e,pe).call(this)},undo:()=>{this.thickness=p,Dt(this,e,pe).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Bn=function(D){const p=this.color;this.parent.addCommands({cmd:()=>{this.color=D,Dt(this,e,le).call(this)},undo:()=>{this.color=p,Dt(this,e,le).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Nn=function(D){D/=100;const p=this.opacity;this.parent.addCommands({cmd:()=>{this.opacity=D,Dt(this,e,le).call(this)},undo:()=>{this.opacity=p,Dt(this,e,le).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},jn=function(){const{width:D,height:p,rotation:B}=this.parent.viewport;switch(B){case 90:return[0,D,D,p];case 180:return[D,p,D,p];case 270:return[p,0,D,p];default:return[0,0,D,p]}},mn=function(){this.ctx.lineWidth=this.thickness*this.parent.scaleFactor/this.scaleFactor,this.ctx.lineCap="round",this.ctx.lineJoin="round",this.ctx.miterLimit=10,this.ctx.strokeStyle=`${this.color}${(0,q.opacityToHex)(this.opacity)}`},$n=function(D,p){this.isEditing=!0,R(this,o)||(It(this,o,!0),Dt(this,e,fe).call(this),this.thickness||(this.thickness=y._defaultThickness),this.color||(this.color=y._defaultColor||_.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=y._defaultOpacity)),this.currentPath.push([D,p]),It(this,v,null),Dt(this,e,mn).call(this),this.ctx.beginPath(),this.ctx.moveTo(D,p),It(this,r,()=>{R(this,r)&&(R(this,v)&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):Dt(this,e,le).call(this),this.ctx.lineTo(...R(this,v)),It(this,v,null),this.ctx.stroke()),window.requestAnimationFrame(R(this,r)))}),window.requestAnimationFrame(R(this,r))},Un=function(D,p){const[B,_t]=this.currentPath.at(-1);D===B&&p===_t||(this.currentPath.push([D,p]),It(this,v,[D,p]))},Wn=function(D,p){var Rt;this.ctx.closePath(),It(this,r,null),D=Math.min(Math.max(D,0),this.canvas.width),p=Math.min(Math.max(p,0),this.canvas.height);const[B,_t]=this.currentPath.at(-1);(D!==B||p!==_t)&&this.currentPath.push([D,p]);let z;if(this.currentPath.length!==1)z=(0,V.fitCurve)(this.currentPath,30,null);else{const xt=[D,p];z=[[xt,xt.slice(),xt.slice(),xt]]}const Q=Dt(Rt=y,h,An).call(Rt,z);this.currentPath.length=0;const At=()=>{this.paths.push(z),this.bezierPath2D.push(Q),this.rebuild()},kt=()=>{this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(Dt(this,e,Fe).call(this),Dt(this,e,we).call(this)),Dt(this,e,pe).call(this))};this.parent.addCommands({cmd:At,undo:kt,mustExec:!0})},le=function(){if(this.isEmpty()){Dt(this,e,tn).call(this);return}Dt(this,e,mn).call(this);const{canvas:D,ctx:p}=this;p.setTransform(1,0,0,1,0,0),p.clearRect(0,0,D.width,D.height),Dt(this,e,tn).call(this);for(const B of this.bezierPath2D)p.stroke(B)},bn=function(D){Dt(this,e,Wn).call(this,D.offsetX,D.offsetY),this.canvas.removeEventListener("pointerleave",R(this,S)),this.canvas.removeEventListener("pointermove",R(this,F)),this.parent.addToAnnotationStorage(this)},Fe=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",y._l10nPromise.get("editor_ink_canvas_aria_label").then(D=>{var p;return(p=this.canvas)==null?void 0:p.setAttribute("aria-label",D)}),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},we=function(){It(this,g,new ResizeObserver(D=>{const p=D[0].contentRect;p.width&&p.height&&this.setDimensions(p.width,p.height)})),R(this,g).observe(this.div)},fe=function(){if(!R(this,o))return;const[D,p]=this.parent.viewportBaseDimensions;this.canvas.width=Math.ceil(this.width*D),this.canvas.height=Math.ceil(this.height*p),Dt(this,e,tn).call(this)},_n=function(D,p){const B=Dt(this,e,en).call(this),_t=(D-B)/R(this,P),z=(p-B)/R(this,w);this.scaleFactor=Math.min(_t,z)},tn=function(){const D=Dt(this,e,en).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+D,this.translationY*this.scaleFactor+D)},h=new WeakSet,An=function(D){const p=new Path2D;for(let B=0,_t=D.length;B<_t;B++){const[z,Q,At,kt]=D[B];B===0&&p.moveTo(...z),p.bezierCurveTo(Q[0],Q[1],At[0],At[1],kt[0],kt[1])}return p},Hn=function(D,p,B,_t){const Q=[],At=this.thickness/2;let kt,Rt;for(const xt of this.paths){kt=[],Rt=[];for(let Ht=0,Ut=xt.length;Ht<Ut;Ht++){const[Nt,Xt,Gt,Zt]=xt[Ht],zt=D*(Nt[0]+p)+At,Vt=_t-D*(Nt[1]+B)-At,Yt=D*(Xt[0]+p)+At,Jt=_t-D*(Xt[1]+B)-At,oe=D*(Gt[0]+p)+At,ce=_t-D*(Gt[1]+B)-At,de=D*(Zt[0]+p)+At,Pt=_t-D*(Zt[1]+B)-At;Ht===0&&(kt.push(zt,Vt),Rt.push(zt,Vt)),kt.push(Yt,Jt,oe,ce,de,Pt),Dt(this,e,qn).call(this,zt,Vt,Yt,Jt,oe,ce,de,Pt,4,Rt)}Q.push({bezier:kt,points:Rt})}return Q},qn=function(D,p,B,_t,z,Q,At,kt,Rt,xt){if(Dt(this,e,Xn).call(this,D,p,B,_t,z,Q,At,kt)){xt.push(At,kt);return}for(let Ht=1;Ht<Rt-1;Ht++){const Ut=Ht/Rt,Nt=1-Ut;let Xt=Ut*D+Nt*B,Gt=Ut*p+Nt*_t,Zt=Ut*B+Nt*z,zt=Ut*_t+Nt*Q;const Vt=Ut*z+Nt*At,Yt=Ut*Q+Nt*kt;Xt=Ut*Xt+Nt*Zt,Gt=Ut*Gt+Nt*zt,Zt=Ut*Zt+Nt*Vt,zt=Ut*zt+Nt*Yt,Xt=Ut*Xt+Nt*Zt,Gt=Ut*Gt+Nt*zt,xt.push(Xt,Gt)}xt.push(At,kt)},Xn=function(D,p,B,_t,z,Q,At,kt){const xt=(3*B-2*D-At)**2,Ht=(3*_t-2*p-kt)**2,Ut=(3*z-D-2*At)**2,Nt=(3*Q-p-2*kt)**2;return Math.max(xt,Ut)+Math.max(Ht,Nt)<=10},yn=function(){let D=1/0,p=-1/0,B=1/0,_t=-1/0;for(const z of this.paths)for(const[Q,At,kt,Rt]of z){const xt=f.Util.bezierBoundingBox(...Q,...At,...kt,...Rt);D=Math.min(D,xt[0]),B=Math.min(B,xt[1]),p=Math.max(p,xt[2]),_t=Math.max(_t,xt[3])}return[D,B,p,_t]},en=function(){return R(this,s)?Math.ceil(this.thickness*this.parent.scaleFactor):0},pe=function(D=!1){if(this.isEmpty())return;if(!R(this,s)){Dt(this,e,le).call(this);return}const p=Dt(this,e,yn).call(this),B=Dt(this,e,en).call(this);It(this,P,Math.max(Y,p[2]-p[0])),It(this,w,Math.max(Y,p[3]-p[1]));const _t=Math.ceil(B+R(this,P)*this.scaleFactor),z=Math.ceil(B+R(this,w)*this.scaleFactor),[Q,At]=this.parent.viewportBaseDimensions;this.width=_t/Q,this.height=z/At,It(this,b,_t/z),Dt(this,e,En).call(this);const kt=this.translationX,Rt=this.translationY;this.translationX=-p[0],this.translationY=-p[1],Dt(this,e,fe).call(this),Dt(this,e,le).call(this),It(this,l,_t),It(this,n,z),this.setDims(_t,z);const xt=D?B/this.scaleFactor/2:0;this.translate(kt-this.translationX-xt,Rt-this.translationY-xt)},En=function(){const{style:D}=this.div;R(this,b)>=1?(D.minHeight=`${Y}px`,D.minWidth=`${Math.round(R(this,b)*Y)}px`):(D.minWidth=`${Y}px`,D.minHeight=`${Math.round(Y/R(this,b))}px`)},Ot(y,h),ee(y,"_defaultColor",null),ee(y,"_defaultOpacity",1),ee(y,"_defaultThickness",1),ee(y,"_l10nPromise"),ee(y,"_type","ink");let M=y;a.InkEditor=M}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.fitCurve=void 0;const f=A(26);a.fitCurve=f}),(m=>{function a(c,t,s){if(!Array.isArray(c))throw new TypeError("First argument should be an array");if(c.forEach(l=>{if(!Array.isArray(l)||l.some(n=>typeof n!="number")||l.length!==c[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")}),c=c.filter((l,n)=>n===0||!l.every((r,e)=>r===c[n-1][e])),c.length<2)return[];const o=c.length,v=P(c[1],c[0]),g=P(c[o-2],c[o-1]);return A(c,v,g,t,s)}function A(c,t,s,o,v){var l,n,r,e,E,x,L,O,yt,St,pt,K,N;if(c.length===2)return K=F.vectorLen(F.subtract(c[0],c[1]))/3,l=[c[0],F.addArrays(c[0],F.mulItems(t,K)),F.addArrays(c[1],F.mulItems(s,K)),c[1]],[l];if(n=Y(c),[l,e,x]=f(c,n,n,t,s,v),e===0||e<o)return[l];if(e<o*o)for(r=n,E=e,L=x,N=0;N<20;N++){if(r=V(l,c,r),[l,e,x]=f(c,n,r,t,s,v),e<o)return[l];if(x===L){let U=e/E;if(U>.9999&&U<1.0001)break}E=e,L=x}return pt=[],O=F.subtract(c[x-1],c[x+1]),O.every(U=>U===0)&&(O=F.subtract(c[x-1],c[x]),[O[0],O[1]]=[-O[1],O[0]]),yt=F.normalize(O),St=F.mulItems(yt,-1),pt=pt.concat(A(c.slice(0,x+1),t,yt,o,v)),pt=pt.concat(A(c.slice(x),St,s,o,v)),pt}function f(c,t,s,o,v,g){var l,n,r;return l=_(c,s,o,v),[n,r]=M(c,l,t),g&&g({bez:l,points:c,params:t,maxErr:n,maxPoint:r}),[l,n,r]}function _(c,t,s,o){var v,g,l,n,r,e,E,x,L,O,yt,St,pt,K,N,U,G,bt=c[0],wt=c[c.length-1];for(v=[bt,null,null,wt],g=F.zeros_Xx2x2(t.length),pt=0,K=t.length;pt<K;pt++)U=t[pt],G=1-U,l=g[pt],l[0]=F.mulItems(s,3*U*(G*G)),l[1]=F.mulItems(o,3*G*(U*U));for(n=[[0,0],[0,0]],r=[0,0],pt=0,K=c.length;pt<K;pt++)U=t[pt],l=g[pt],n[0][0]+=F.dot(l[0],l[0]),n[0][1]+=F.dot(l[0],l[1]),n[1][0]+=F.dot(l[0],l[1]),n[1][1]+=F.dot(l[1],l[1]),N=F.subtract(c[pt],S.q([bt,bt,wt,wt],U)),r[0]+=F.dot(l[0],N),r[1]+=F.dot(l[1],N);return e=n[0][0]*n[1][1]-n[1][0]*n[0][1],E=n[0][0]*r[1]-n[1][0]*r[0],x=r[0]*n[1][1]-r[1]*n[0][1],L=e===0?0:x/e,O=e===0?0:E/e,St=F.vectorLen(F.subtract(bt,wt)),yt=1e-6*St,L<yt||O<yt?(v[1]=F.addArrays(bt,F.mulItems(s,St/3)),v[2]=F.addArrays(wt,F.mulItems(o,St/3))):(v[1]=F.addArrays(bt,F.mulItems(s,L)),v[2]=F.addArrays(wt,F.mulItems(o,O))),v}function V(c,t,s){return s.map((o,v)=>q(c,t[v],o))}function q(c,t,s){var o=F.subtract(S.q(c,s),t),v=S.qprime(c,s),g=F.mulMatrix(o,v),l=F.sum(F.squareItems(v))+2*F.mulMatrix(o,S.qprimeprime(c,s));return l===0?s:s-g/l}function Y(c){var t=[],s,o,v;return c.forEach((g,l)=>{s=l?o+F.vectorLen(F.subtract(g,v)):0,t.push(s),o=s,v=g}),t=t.map(g=>g/o),t}function M(c,t,s){var o,v,g,l,n,r,e,E;v=0,g=Math.floor(c.length/2);const x=b(t,10);for(n=0,r=c.length;n<r;n++)e=c[n],E=w(t,s[n],x,10),l=F.subtract(S.q(t,E),e),o=l[0]*l[0]+l[1]*l[1],o>v&&(v=o,g=n);return[v,g]}var b=function(c,t){for(var s,o=[0],v=c[0],g=0,l=1;l<=t;l++)s=S.q(c,l/t),g+=F.vectorLen(F.subtract(s,v)),o.push(g),v=s;return o=o.map(n=>n/g),o};function w(c,t,s,o){if(t<0)return 0;if(t>1)return 1;for(var v,g,l,n,r,e=1;e<=o;e++)if(t<=s[e]){n=(e-1)/o,l=e/o,g=s[e-1],v=s[e],r=(t-g)/(v-g)*(l-n)+n;break}return r}function P(c,t){return F.normalize(F.subtract(c,t))}class F{static zeros_Xx2x2(t){for(var s=[];t--;)s.push([0,0]);return s}static mulItems(t,s){return t.map(o=>o*s)}static mulMatrix(t,s){return t.reduce((o,v,g)=>o+v*s[g],0)}static subtract(t,s){return t.map((o,v)=>o-s[v])}static addArrays(t,s){return t.map((o,v)=>o+s[v])}static addItems(t,s){return t.map(o=>o+s)}static sum(t){return t.reduce((s,o)=>s+o)}static dot(t,s){return F.mulMatrix(t,s)}static vectorLen(t){return Math.hypot(...t)}static divItems(t,s){return t.map(o=>o/s)}static squareItems(t){return t.map(s=>s*s)}static normalize(t){return this.divItems(t,this.vectorLen(t))}}class S{static q(t,s){var o=1-s,v=F.mulItems(t[0],o*o*o),g=F.mulItems(t[1],3*o*o*s),l=F.mulItems(t[2],3*o*s*s),n=F.mulItems(t[3],s*s*s);return F.addArrays(F.addArrays(v,g),F.addArrays(l,n))}static qprime(t,s){var o=1-s,v=F.mulItems(F.subtract(t[1],t[0]),3*o*o),g=F.mulItems(F.subtract(t[2],t[1]),6*o*s),l=F.mulItems(F.subtract(t[3],t[2]),3*s*s);return F.addArrays(F.addArrays(v,g),l)}static qprimeprime(t,s){return F.addArrays(F.mulItems(F.addArrays(F.subtract(t[2],F.mulItems(t[1],2)),t[0]),6*(1-s)),F.mulItems(F.addArrays(F.subtract(t[3],F.mulItems(t[2],2)),t[1]),6*s))}}m.exports=a,m.exports.fitCubic=A,m.exports.createTangent=P}),((m,a,A)=>{var h,Cn,vn,Fn;Object.defineProperty(a,"__esModule",{value:!0}),a.AnnotationLayer=void 0;var f=A(1),_=A(8),V=A(5),q=A(28),Y=A(29);const M=1e3,b=9,w=new WeakSet;function P(W){return{width:W[2]-W[0],height:W[3]-W[1]}}class F{static create(i){switch(i.data.annotationType){case f.AnnotationType.LINK:return new c(i);case f.AnnotationType.TEXT:return new t(i);case f.AnnotationType.WIDGET:switch(i.data.fieldType){case"Tx":return new o(i);case"Btn":return i.data.radioButton?new g(i):i.data.checkBox?new v(i):new l(i);case"Ch":return new n(i)}return new s(i);case f.AnnotationType.POPUP:return new r(i);case f.AnnotationType.FREETEXT:return new E(i);case f.AnnotationType.LINE:return new x(i);case f.AnnotationType.SQUARE:return new L(i);case f.AnnotationType.CIRCLE:return new O(i);case f.AnnotationType.POLYLINE:return new yt(i);case f.AnnotationType.CARET:return new pt(i);case f.AnnotationType.INK:return new K(i);case f.AnnotationType.POLYGON:return new St(i);case f.AnnotationType.HIGHLIGHT:return new N(i);case f.AnnotationType.UNDERLINE:return new U(i);case f.AnnotationType.SQUIGGLY:return new G(i);case f.AnnotationType.STRIKEOUT:return new bt(i);case f.AnnotationType.STAMP:return new wt(i);case f.AnnotationType.FILEATTACHMENT:return new Mt(i);default:return new S(i)}}}class S{constructor(i,{isRenderable:d=!1,ignoreBorder:C=!1,createQuadrilaterals:y=!1}={}){this.isRenderable=d,this.data=i.data,this.layer=i.layer,this.page=i.page,this.viewport=i.viewport,this.linkService=i.linkService,this.downloadManager=i.downloadManager,this.imageResourcesPath=i.imageResourcesPath,this.renderForms=i.renderForms,this.svgFactory=i.svgFactory,this.annotationStorage=i.annotationStorage,this.enableScripting=i.enableScripting,this.hasJSActions=i.hasJSActions,this._fieldObjects=i.fieldObjects,this._mouseState=i.mouseState,d&&(this.container=this._createContainer(C)),y&&(this.quadrilaterals=this._createQuadrilaterals(C))}_createContainer(i=!1){const d=this.data,C=this.page,y=this.viewport,k=document.createElement("section"),{width:j,height:D}=P(d.rect),[p,B,_t,z]=y.viewBox,Q=_t-p,At=z-B;k.setAttribute("data-annotation-id",d.id);const kt=f.Util.normalizeRect([d.rect[0],C.view[3]-d.rect[1]+C.view[1],d.rect[2],C.view[3]-d.rect[3]+C.view[1]]);if(!i&&d.borderStyle.width>0){k.style.borderWidth=`${d.borderStyle.width}px`;const xt=d.borderStyle.horizontalCornerRadius,Ht=d.borderStyle.verticalCornerRadius;if(xt>0||Ht>0){const Nt=`calc(${xt}px * var(--scale-factor)) / calc(${Ht}px * var(--scale-factor))`;k.style.borderRadius=Nt}else if(this instanceof g){const Nt=`calc(${j}px * var(--scale-factor)) / calc(${D}px * var(--scale-factor))`;k.style.borderRadius=Nt}switch(d.borderStyle.style){case f.AnnotationBorderStyleType.SOLID:k.style.borderStyle="solid";break;case f.AnnotationBorderStyleType.DASHED:k.style.borderStyle="dashed";break;case f.AnnotationBorderStyleType.BEVELED:(0,f.warn)("Unimplemented border style: beveled");break;case f.AnnotationBorderStyleType.INSET:(0,f.warn)("Unimplemented border style: inset");break;case f.AnnotationBorderStyleType.UNDERLINE:k.style.borderBottomStyle="solid";break}const Ut=d.borderColor||null;Ut?k.style.borderColor=f.Util.makeHexColor(Ut[0]|0,Ut[1]|0,Ut[2]|0):k.style.borderWidth=0}k.style.left=`${100*(kt[0]-p)/Q}%`,k.style.top=`${100*(kt[1]-B)/At}%`;const{rotation:Rt}=d;return d.hasOwnCanvas||Rt===0?(k.style.width=`${100*j/Q}%`,k.style.height=`${100*D/At}%`):this.setRotation(Rt,k),k}setRotation(i,d=this.container){const[C,y,k,j]=this.viewport.viewBox,D=k-C,p=j-y,{width:B,height:_t}=P(this.data.rect);let z,Q;i%180===0?(z=100*B/D,Q=100*_t/p):(z=100*_t/D,Q=100*B/p),d.style.width=`${z}%`,d.style.height=`${Q}%`,d.setAttribute("data-main-rotation",(360-i)%360)}get _commonActions(){const i=(d,C,y)=>{const k=y.detail[d];y.target.style[C]=q.ColorConverters[`${k[0]}_HTML`](k.slice(1))};return(0,f.shadow)(this,"_commonActions",{display:d=>{const C=d.detail.display%2===1;this.container.style.visibility=C?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:C,print:d.detail.display===0||d.detail.display===3})},print:d=>{this.annotationStorage.setValue(this.data.id,{print:d.detail.print})},hidden:d=>{this.container.style.visibility=d.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:d.detail.hidden})},focus:d=>{setTimeout(()=>d.target.focus({preventScroll:!1}),0)},userName:d=>{d.target.title=d.detail.userName},readonly:d=>{d.detail.readonly?d.target.setAttribute("readonly",""):d.target.removeAttribute("readonly")},required:d=>{this._setRequired(d.target,d.detail.required)},bgColor:d=>{i("bgColor","backgroundColor",d)},fillColor:d=>{i("fillColor","backgroundColor",d)},fgColor:d=>{i("fgColor","color",d)},textColor:d=>{i("textColor","color",d)},borderColor:d=>{i("borderColor","borderColor",d)},strokeColor:d=>{i("strokeColor","borderColor",d)},rotation:d=>{const C=d.detail.rotation;this.setRotation(C),this.annotationStorage.setValue(this.data.id,{rotation:C})}})}_dispatchEventFromSandbox(i,d){const C=this._commonActions;for(const y of Object.keys(d.detail)){const k=i[y]||C[y];k&&k(d)}}_setDefaultPropertiesFromJS(i){if(!this.enableScripting)return;const d=this.annotationStorage.getRawValue(this.data.id);if(!d)return;const C=this._commonActions;for(const[y,k]of Object.entries(d)){const j=C[y];if(j){const D={detail:{[y]:k},target:i};j(D),delete d[y]}}}_createQuadrilaterals(i=!1){if(!this.data.quadPoints)return null;const d=[],C=this.data.rect;for(const y of this.data.quadPoints)this.data.rect=[y[2].x,y[2].y,y[1].x,y[1].y],d.push(this._createContainer(i));return this.data.rect=C,d}_createPopup(i,d){let C=this.container;this.quadrilaterals&&(i=i||this.quadrilaterals,C=this.quadrilaterals[0]),i||(i=document.createElement("div"),i.className="popupTriggerArea",C.append(i));const k=new e({container:C,trigger:i,color:d.color,titleObj:d.titleObj,modificationDate:d.modificationDate,contentsObj:d.contentsObj,richText:d.richText,hideWrapper:!0}).render();k.style.left="100%",C.append(k)}_renderQuadrilaterals(i){for(const d of this.quadrilaterals)d.className=i;return this.quadrilaterals}render(){(0,f.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(i,d=null){const C=[];if(this._fieldObjects){const y=this._fieldObjects[i];if(y)for(const{page:k,id:j,exportValues:D}of y){if(k===-1||j===d)continue;const p=typeof D=="string"?D:null,B=document.querySelector(`[data-element-id="${j}"]`);if(B&&!w.has(B)){(0,f.warn)(`_getElementsByName - element not allowed: ${j}`);continue}C.push({id:j,exportValue:p,domElement:B})}return C}for(const y of document.getElementsByName(i)){const{id:k,exportValue:j}=y;k!==d&&w.has(y)&&C.push({id:k,exportValue:j,domElement:y})}return C}static get platform(){const i=typeof navigator<"u"?navigator.platform:"";return(0,f.shadow)(this,"platform",{isWin:i.includes("Win"),isMac:i.includes("Mac")})}}class c extends S{constructor(i,d=null){super(i,{isRenderable:!0,ignoreBorder:!!(d!=null&&d.ignoreBorder),createQuadrilaterals:!0}),this.isTooltipOnly=i.data.isTooltipOnly}render(){const{data:i,linkService:d}=this,C=document.createElement("a");C.setAttribute("data-element-id",i.id);let y=!1;return i.url?(d.addLinkAttributes(C,i.url,i.newWindow),y=!0):i.action?(this._bindNamedAction(C,i.action),y=!0):i.dest?(this._bindLink(C,i.dest),y=!0):(i.actions&&(i.actions.Action||i.actions["Mouse Up"]||i.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(C,i),y=!0),i.resetForm?(this._bindResetFormAction(C,i.resetForm),y=!0):this.isTooltipOnly&&!y&&(this._bindLink(C,""),y=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map((k,j)=>{const D=j===0?C:C.cloneNode();return k.append(D),k}):(this.container.className="linkAnnotation",y&&this.container.append(C),this.container)}_bindLink(i,d){i.href=this.linkService.getDestinationHash(d),i.onclick=()=>(d&&this.linkService.goToDestination(d),!1),(d||d==="")&&(i.className="internalLink")}_bindNamedAction(i,d){i.href=this.linkService.getAnchorUrl(""),i.onclick=()=>(this.linkService.executeNamedAction(d),!1),i.className="internalLink"}_bindJSAction(i,d){i.href=this.linkService.getAnchorUrl("");const C=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const y of Object.keys(d.actions)){const k=C.get(y);k&&(i[k]=()=>{var j;return(j=this.linkService.eventBus)==null||j.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d.id,name:y}}),!1})}i.onclick||(i.onclick=()=>!1),i.className="internalLink"}_bindResetFormAction(i,d){const C=i.onclick;if(C||(i.href=this.linkService.getAnchorUrl("")),i.className="internalLink",!this._fieldObjects){(0,f.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),C||(i.onclick=()=>!1);return}i.onclick=()=>{var _t;C&&C();const{fields:y,refs:k,include:j}=d,D=[];if(y.length!==0||k.length!==0){const z=new Set(k);for(const Q of y){const At=this._fieldObjects[Q]||[];for(const{id:kt}of At)z.add(kt)}for(const Q of Object.values(this._fieldObjects))for(const At of Q)z.has(At.id)===j&&D.push(At)}else for(const z of Object.values(this._fieldObjects))D.push(...z);const p=this.annotationStorage,B=[];for(const z of D){const{id:Q}=z;switch(B.push(Q),z.type){case"text":{const kt=z.defaultValue||"";p.setValue(Q,{value:kt});break}case"checkbox":case"radiobutton":{const kt=z.defaultValue===z.exportValues;p.setValue(Q,{value:kt});break}case"combobox":case"listbox":{const kt=z.defaultValue||"";p.setValue(Q,{value:kt});break}default:continue}const At=document.querySelector(`[data-element-id="${Q}"]`);if(At){if(!w.has(At)){(0,f.warn)(`_bindResetFormAction - element not allowed: ${Q}`);continue}}else continue;At.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((_t=this.linkService.eventBus)==null||_t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:B,name:"ResetForm"}})),!1}}}class t extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d})}render(){this.container.className="textAnnotation";const i=document.createElement("img");return i.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",i.alt="[{{type}} Annotation]",i.dataset.l10nId="text_annotation_type",i.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(i,this.data),this.container.append(i),this.container}}class s extends S{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(i){const{isWin:d,isMac:C}=S.platform;return d&&i.ctrlKey||C&&i.metaKey}_setEventListener(i,d,C,y){d.includes("mouse")?i.addEventListener(d,k=>{var j;(j=this.linkService.eventBus)==null||j.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:C,value:y(k),shift:k.shiftKey,modifier:this._getKeyModifier(k)}})}):i.addEventListener(d,k=>{var j;(j=this.linkService.eventBus)==null||j.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:C,value:y(k)}})})}_setEventListeners(i,d,C){var y;for(const[k,j]of d)(j==="Action"||(y=this.data.actions)!=null&&y[j])&&this._setEventListener(i,k,j,C)}_setBackgroundColor(i){const d=this.data.backgroundColor||null;i.style.backgroundColor=d===null?"transparent":f.Util.makeHexColor(d[0],d[1],d[2])}_setTextStyle(i){const d=["left","center","right"],{fontColor:C}=this.data.defaultAppearanceData,y=this.data.defaultAppearanceData.fontSize||b,k=i.style;let j;if(this.data.multiLine){const D=Math.abs(this.data.rect[3]-this.data.rect[1]),p=Math.round(D/(f.LINE_FACTOR*y))||1,B=D/p;j=Math.min(y,Math.round(B/f.LINE_FACTOR))}else{const D=Math.abs(this.data.rect[3]-this.data.rect[1]);j=Math.min(y,Math.round(D/f.LINE_FACTOR))}k.fontSize=`calc(${j}px * var(--scale-factor))`,k.color=f.Util.makeHexColor(C[0],C[1],C[2]),this.data.textAlignment!==null&&(k.textAlign=d[this.data.textAlignment])}_setRequired(i,d){d?i.setAttribute("required",!0):i.removeAttribute("required"),i.setAttribute("aria-required",d)}}class o extends s{constructor(i){const d=i.renderForms||!i.data.hasAppearance&&!!i.data.fieldValue;super(i,{isRenderable:d})}setPropertyOnSiblings(i,d,C,y){const k=this.annotationStorage;for(const j of this._getElementsByName(i.name,i.id))j.domElement&&(j.domElement[d]=C),k.setValue(j.id,{[y]:C})}render(){var y;const i=this.annotationStorage,d=this.data.id;this.container.className="textWidgetAnnotation";let C=null;if(this.renderForms){const k=i.getValue(d,{value:this.data.fieldValue});let j=k.formattedValue||k.value||"";const D=i.getValue(d,{charLimit:this.data.maxLen}).charLimit;D&&j.length>D&&(j=j.slice(0,D));const p={userValue:j,formattedValue:null,valueOnFocus:""};this.data.multiLine?(C=document.createElement("textarea"),C.textContent=j,this.data.doNotScroll&&(C.style.overflowY="hidden")):(C=document.createElement("input"),C.type="text",C.setAttribute("value",j),this.data.doNotScroll&&(C.style.overflowX="hidden")),w.add(C),C.setAttribute("data-element-id",d),C.disabled=this.data.readOnly,C.name=this.data.fieldName,C.tabIndex=M,this._setRequired(C,this.data.required),D&&(C.maxLength=D),C.addEventListener("input",_t=>{i.setValue(d,{value:_t.target.value}),this.setPropertyOnSiblings(C,"value",_t.target.value,"value")}),C.addEventListener("resetform",_t=>{const z=this.data.defaultFieldValue??"";C.value=p.userValue=z,p.formattedValue=null});let B=_t=>{const{formattedValue:z}=p;z!=null&&(_t.target.value=z),_t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){C.addEventListener("focus",z=>{p.userValue&&(z.target.value=p.userValue),p.valueOnFocus=z.target.value}),C.addEventListener("updatefromsandbox",z=>{const Q={value(At){p.userValue=At.detail.value??"",i.setValue(d,{value:p.userValue.toString()}),At.target.value=p.userValue},formattedValue(At){const{formattedValue:kt}=At.detail;p.formattedValue=kt,kt!=null&&At.target!==document.activeElement&&(At.target.value=kt),i.setValue(d,{formattedValue:kt})},selRange(At){At.target.setSelectionRange(...At.detail.selRange)},charLimit:At=>{var Ht;const{charLimit:kt}=At.detail,{target:Rt}=At;if(kt===0){Rt.removeAttribute("maxLength");return}Rt.setAttribute("maxLength",kt);let xt=p.userValue;!xt||xt.length<=kt||(xt=xt.slice(0,kt),Rt.value=p.userValue=xt,i.setValue(d,{value:xt}),(Ht=this.linkService.eventBus)==null||Ht.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:xt,willCommit:!0,commitKey:1,selStart:Rt.selectionStart,selEnd:Rt.selectionEnd}}))}};this._dispatchEventFromSandbox(Q,z)}),C.addEventListener("keydown",z=>{var kt;let Q=-1;if(z.key==="Escape"?Q=0:z.key==="Enter"?Q=2:z.key==="Tab"&&(Q=3),Q===-1)return;const{value:At}=z.target;p.valueOnFocus!==At&&(p.userValue=At,(kt=this.linkService.eventBus)==null||kt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:At,willCommit:!0,commitKey:Q,selStart:z.target.selectionStart,selEnd:z.target.selectionEnd}}))});const _t=B;B=null,C.addEventListener("blur",z=>{var At;const{value:Q}=z.target;p.userValue=Q,this._mouseState.isDown&&p.valueOnFocus!==Q&&((At=this.linkService.eventBus)==null||At.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:Q,willCommit:!0,commitKey:1,selStart:z.target.selectionStart,selEnd:z.target.selectionEnd}})),_t(z)}),(y=this.data.actions)!=null&&y.Keystroke&&C.addEventListener("beforeinput",z=>{var Nt;const{data:Q,target:At}=z,{value:kt,selectionStart:Rt,selectionEnd:xt}=At;let Ht=Rt,Ut=xt;switch(z.inputType){case"deleteWordBackward":{const Xt=kt.substring(0,Rt).match(/\w*[^\w]*$/);Xt&&(Ht-=Xt[0].length);break}case"deleteWordForward":{const Xt=kt.substring(Rt).match(/^[^\w]*\w*/);Xt&&(Ut+=Xt[0].length);break}case"deleteContentBackward":Rt===xt&&(Ht-=1);break;case"deleteContentForward":Rt===xt&&(Ut+=1);break}z.preventDefault(),(Nt=this.linkService.eventBus)==null||Nt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:kt,change:Q||"",willCommit:!1,selStart:Ht,selEnd:Ut}})}),this._setEventListeners(C,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],z=>z.target.value)}if(B&&C.addEventListener("blur",B),this.data.comb){const z=(this.data.rect[2]-this.data.rect[0])/D;C.classList.add("comb"),C.style.letterSpacing=`calc(${z}px * var(--scale-factor) - 1ch)`}}else C=document.createElement("div"),C.textContent=this.data.fieldValue,C.style.verticalAlign="middle",C.style.display="table-cell";return this._setTextStyle(C),this._setBackgroundColor(C),this._setDefaultPropertiesFromJS(C),this.container.append(C),this.container}}class v extends s{constructor(i){super(i,{isRenderable:i.renderForms})}render(){const i=this.annotationStorage,d=this.data,C=d.id;let y=i.getValue(C,{value:d.exportValue===d.fieldValue}).value;typeof y=="string"&&(y=y!=="Off",i.setValue(C,{value:y})),this.container.className="buttonWidgetAnnotation checkBox";const k=document.createElement("input");return w.add(k),k.setAttribute("data-element-id",C),k.disabled=d.readOnly,this._setRequired(k,this.data.required),k.type="checkbox",k.name=d.fieldName,y&&k.setAttribute("checked",!0),k.setAttribute("exportValue",d.exportValue),k.tabIndex=M,k.addEventListener("change",j=>{const{name:D,checked:p}=j.target;for(const B of this._getElementsByName(D,C)){const _t=p&&B.exportValue===d.exportValue;B.domElement&&(B.domElement.checked=_t),i.setValue(B.id,{value:_t})}i.setValue(C,{value:p})}),k.addEventListener("resetform",j=>{const D=d.defaultFieldValue||"Off";j.target.checked=D===d.exportValue}),this.enableScripting&&this.hasJSActions&&(k.addEventListener("updatefromsandbox",j=>{const D={value(p){p.target.checked=p.detail.value!=="Off",i.setValue(C,{value:p.target.checked})}};this._dispatchEventFromSandbox(D,j)}),this._setEventListeners(k,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],j=>j.target.checked)),this._setBackgroundColor(k),this._setDefaultPropertiesFromJS(k),this.container.append(k),this.container}}class g extends s{constructor(i){super(i,{isRenderable:i.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const i=this.annotationStorage,d=this.data,C=d.id;let y=i.getValue(C,{value:d.fieldValue===d.buttonValue}).value;typeof y=="string"&&(y=y!==d.buttonValue,i.setValue(C,{value:y}));const k=document.createElement("input");if(w.add(k),k.setAttribute("data-element-id",C),k.disabled=d.readOnly,this._setRequired(k,this.data.required),k.type="radio",k.name=d.fieldName,y&&k.setAttribute("checked",!0),k.tabIndex=M,k.addEventListener("change",j=>{const{name:D,checked:p}=j.target;for(const B of this._getElementsByName(D,C))i.setValue(B.id,{value:!1});i.setValue(C,{value:p})}),k.addEventListener("resetform",j=>{const D=d.defaultFieldValue;j.target.checked=D!=null&&D===d.buttonValue}),this.enableScripting&&this.hasJSActions){const j=d.buttonValue;k.addEventListener("updatefromsandbox",D=>{const p={value:B=>{const _t=j===B.detail.value;for(const z of this._getElementsByName(B.target.name)){const Q=_t&&z.id===C;z.domElement&&(z.domElement.checked=Q),i.setValue(z.id,{value:Q})}}};this._dispatchEventFromSandbox(p,D)}),this._setEventListeners(k,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],D=>D.target.checked)}return this._setBackgroundColor(k),this._setDefaultPropertiesFromJS(k),this.container.append(k),this.container}}class l extends c{constructor(i){super(i,{ignoreBorder:i.data.hasAppearance})}render(){const i=super.render();i.className="buttonWidgetAnnotation pushButton",this.data.alternativeText&&(i.title=this.data.alternativeText);const d=i.lastChild;return this.enableScripting&&this.hasJSActions&&d&&(this._setDefaultPropertiesFromJS(d),d.addEventListener("updatefromsandbox",C=>{this._dispatchEventFromSandbox({},C)})),i}}class n extends s{constructor(i){super(i,{isRenderable:i.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const i=this.annotationStorage,d=this.data.id,C=i.getValue(d,{value:this.data.fieldValue}),y=document.createElement("select");w.add(y),y.setAttribute("data-element-id",d),y.disabled=this.data.readOnly,this._setRequired(y,this.data.required),y.name=this.data.fieldName,y.tabIndex=M;let k=this.data.combo&&this.data.options.length>0;this.data.combo||(y.size=this.data.options.length,this.data.multiSelect&&(y.multiple=!0)),y.addEventListener("resetform",B=>{const _t=this.data.defaultFieldValue;for(const z of y.options)z.selected=z.value===_t});for(const B of this.data.options){const _t=document.createElement("option");_t.textContent=B.displayValue,_t.value=B.exportValue,C.value.includes(B.exportValue)&&(_t.setAttribute("selected",!0),k=!1),y.append(_t)}let j=null;if(k){const B=document.createElement("option");B.value=" ",B.setAttribute("hidden",!0),B.setAttribute("selected",!0),y.prepend(B),j=()=>{B.remove(),y.removeEventListener("input",j),j=null},y.addEventListener("input",j)}const D=(B,_t)=>{const z=_t?"value":"textContent",Q=B.target.options;return B.target.multiple?Array.prototype.filter.call(Q,At=>At.selected).map(At=>At[z]):Q.selectedIndex===-1?null:Q[Q.selectedIndex][z]},p=B=>{const _t=B.target.options;return Array.prototype.map.call(_t,z=>({displayValue:z.textContent,exportValue:z.value}))};return this.enableScripting&&this.hasJSActions?(y.addEventListener("updatefromsandbox",B=>{const _t={value(z){j==null||j();const Q=z.detail.value,At=new Set(Array.isArray(Q)?Q:[Q]);for(const kt of y.options)kt.selected=At.has(kt.value);i.setValue(d,{value:D(z,!0)})},multipleSelection(z){y.multiple=!0},remove(z){const Q=y.options,At=z.detail.remove;Q[At].selected=!1,y.remove(At),Q.length>0&&Array.prototype.findIndex.call(Q,Rt=>Rt.selected)===-1&&(Q[0].selected=!0),i.setValue(d,{value:D(z,!0),items:p(z)})},clear(z){for(;y.length!==0;)y.remove(0);i.setValue(d,{value:null,items:[]})},insert(z){const{index:Q,displayValue:At,exportValue:kt}=z.detail.insert,Rt=y.children[Q],xt=document.createElement("option");xt.textContent=At,xt.value=kt,Rt?Rt.before(xt):y.append(xt),i.setValue(d,{value:D(z,!0),items:p(z)})},items(z){const{items:Q}=z.detail;for(;y.length!==0;)y.remove(0);for(const At of Q){const{displayValue:kt,exportValue:Rt}=At,xt=document.createElement("option");xt.textContent=kt,xt.value=Rt,y.append(xt)}y.options.length>0&&(y.options[0].selected=!0),i.setValue(d,{value:D(z,!0),items:p(z)})},indices(z){const Q=new Set(z.detail.indices);for(const At of z.target.options)At.selected=Q.has(At.index);i.setValue(d,{value:D(z,!0)})},editable(z){z.target.disabled=!z.detail.editable}};this._dispatchEventFromSandbox(_t,B)}),y.addEventListener("input",B=>{var Q;const _t=D(B,!0),z=D(B,!1);i.setValue(d,{value:_t}),(Q=this.linkService.eventBus)==null||Q.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:z,changeEx:_t,willCommit:!0,commitKey:1,keyDown:!1}})}),this._setEventListeners(y,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],B=>B.target.checked)):y.addEventListener("input",function(B){i.setValue(d,{value:D(B,!0)})}),this.data.combo&&this._setTextStyle(y),this._setBackgroundColor(y),this._setDefaultPropertiesFromJS(y),this.container.append(y),this.container}}class r extends S{constructor(i){var C,y,k;const d=!!((C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d})}render(){const i=["Line","Square","Circle","PolyLine","Polygon","Ink"];if(this.container.className="popupAnnotation",i.includes(this.data.parentType))return this.container;const d=`[data-annotation-id="${this.data.parentId}"]`,C=this.layer.querySelectorAll(d);if(C.length===0)return this.container;const y=new e({container:this.container,trigger:Array.from(C),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),k=this.page,j=f.Util.normalizeRect([this.data.parentRect[0],k.view[3]-this.data.parentRect[1]+k.view[1],this.data.parentRect[2],k.view[3]-this.data.parentRect[3]+k.view[1]]),D=j[0]+this.data.parentRect[2]-this.data.parentRect[0],p=j[1],[B,_t,z,Q]=this.viewport.viewBox,At=z-B,kt=Q-_t;return this.container.style.left=`${100*(D-B)/At}%`,this.container.style.top=`${100*(p-_t)/kt}%`,this.container.append(y.render()),this.container}}class e{constructor(i){this.container=i.container,this.trigger=i.trigger,this.color=i.color,this.titleObj=i.titleObj,this.modificationDate=i.modificationDate,this.contentsObj=i.contentsObj,this.richText=i.richText,this.hideWrapper=i.hideWrapper||!1,this.pinned=!1}render(){var D,p;const d=document.createElement("div");d.className="popupWrapper",this.hideElement=this.hideWrapper?d:this.container,this.hideElement.hidden=!0;const C=document.createElement("div");C.className="popup";const y=this.color;if(y){const B=.7*(255-y[0])+y[0],_t=.7*(255-y[1])+y[1],z=.7*(255-y[2])+y[2];C.style.backgroundColor=f.Util.makeHexColor(B|0,_t|0,z|0)}const k=document.createElement("h1");k.dir=this.titleObj.dir,k.textContent=this.titleObj.str,C.append(k);const j=_.PDFDateString.toDateObject(this.modificationDate);if(j){const B=document.createElement("span");B.className="popupDate",B.textContent="{{date}}, {{time}}",B.dataset.l10nId="annotation_date_string",B.dataset.l10nArgs=JSON.stringify({date:j.toLocaleDateString(),time:j.toLocaleTimeString()}),C.append(B)}if((D=this.richText)!=null&&D.str&&(!((p=this.contentsObj)!=null&&p.str)||this.contentsObj.str===this.richText.str))Y.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:C}),C.lastChild.className="richText popupContent";else{const B=this._formatContents(this.contentsObj);C.append(B)}Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const B of this.trigger)B.addEventListener("click",this._toggle.bind(this)),B.addEventListener("mouseover",this._show.bind(this,!1)),B.addEventListener("mouseout",this._hide.bind(this,!1));return C.addEventListener("click",this._hide.bind(this,!0)),d.append(C),d}_formatContents({str:i,dir:d}){const C=document.createElement("p");C.className="popupContent",C.dir=d;const y=i.split(/(?:\r\n?|\n)/);for(let k=0,j=y.length;k<j;++k){const D=y[k];C.append(document.createTextNode(D)),k<j-1&&C.append(document.createElement("br"))}return C}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(i=!1){i&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(i=!0){i&&(this.pinned=!1),!this.hideElement.hidden&&!this.pinned&&(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class E extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0}),this.textContent=i.data.textContent}render(){if(this.container.className="freeTextAnnotation",this.textContent){const i=document.createElement("div");i.className="annotationTextContent",i.setAttribute("role","comment");for(const d of this.textContent){const C=document.createElement("span");C.textContent=d,i.append(C)}this.container.append(i)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class x extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const i=this.data,{width:d,height:C}=P(i.rect),y=this.svgFactory.create(d,C,!0),k=this.svgFactory.createElement("svg:line");return k.setAttribute("x1",i.rect[2]-i.lineCoordinates[0]),k.setAttribute("y1",i.rect[3]-i.lineCoordinates[1]),k.setAttribute("x2",i.rect[2]-i.lineCoordinates[2]),k.setAttribute("y2",i.rect[3]-i.lineCoordinates[3]),k.setAttribute("stroke-width",i.borderStyle.width||1),k.setAttribute("stroke","transparent"),k.setAttribute("fill","transparent"),y.append(k),this.container.append(y),this._createPopup(k,i),this.container}}class L extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const i=this.data,{width:d,height:C}=P(i.rect),y=this.svgFactory.create(d,C,!0),k=i.borderStyle.width,j=this.svgFactory.createElement("svg:rect");return j.setAttribute("x",k/2),j.setAttribute("y",k/2),j.setAttribute("width",d-k),j.setAttribute("height",C-k),j.setAttribute("stroke-width",k||1),j.setAttribute("stroke","transparent"),j.setAttribute("fill","transparent"),y.append(j),this.container.append(y),this._createPopup(j,i),this.container}}class O extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const i=this.data,{width:d,height:C}=P(i.rect),y=this.svgFactory.create(d,C,!0),k=i.borderStyle.width,j=this.svgFactory.createElement("svg:ellipse");return j.setAttribute("cx",d/2),j.setAttribute("cy",C/2),j.setAttribute("rx",d/2-k/2),j.setAttribute("ry",C/2-k/2),j.setAttribute("stroke-width",k||1),j.setAttribute("stroke","transparent"),j.setAttribute("fill","transparent"),y.append(j),this.container.append(y),this._createPopup(j,i),this.container}}class yt extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const i=this.data,{width:d,height:C}=P(i.rect),y=this.svgFactory.create(d,C,!0);let k=[];for(const D of i.vertices){const p=D.x-i.rect[0],B=i.rect[3]-D.y;k.push(p+","+B)}k=k.join(" ");const j=this.svgFactory.createElement(this.svgElementName);return j.setAttribute("points",k),j.setAttribute("stroke-width",i.borderStyle.width||1),j.setAttribute("stroke","transparent"),j.setAttribute("fill","transparent"),y.append(j),this.container.append(y),this._createPopup(j,i),this.container}}class St extends yt{constructor(i){super(i),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class pt extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0})}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class K extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const i=this.data,{width:d,height:C}=P(i.rect),y=this.svgFactory.create(d,C,!0);for(const k of i.inkLists){let j=[];for(const p of k){const B=p.x-i.rect[0],_t=i.rect[3]-p.y;j.push(`${B},${_t}`)}j=j.join(" ");const D=this.svgFactory.createElement(this.svgElementName);D.setAttribute("points",j),D.setAttribute("stroke-width",i.borderStyle.width||1),D.setAttribute("stroke","transparent"),D.setAttribute("fill","transparent"),this._createPopup(D,i),y.append(D)}return this.container.append(y),this.container}}class N extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.className="highlightAnnotation",this.container)}}class U extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.className="underlineAnnotation",this.container)}}class G extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.className="squigglyAnnotation",this.container)}}class bt extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.className="strikeoutAnnotation",this.container)}}class wt extends S{constructor(i){var C,y,k;const d=!!(i.data.hasPopup||(C=i.data.titleObj)!=null&&C.str||(y=i.data.contentsObj)!=null&&y.str||(k=i.data.richText)!=null&&k.str);super(i,{isRenderable:d,ignoreBorder:!0})}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class Mt extends S{constructor(i){var y;super(i,{isRenderable:!0});const{filename:d,content:C}=this.data.file;this.filename=(0,_.getFilenameFromUrl)(d),this.content=C,(y=this.linkService.eventBus)==null||y.dispatch("fileattachmentannotation",{source:this,filename:d,content:C})}render(){var d,C;this.container.className="fileAttachmentAnnotation";const i=document.createElement("div");return i.className="popupTriggerArea",i.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&((d=this.data.titleObj)!=null&&d.str||(C=this.data.contentsObj)!=null&&C.str||this.data.richText)&&this._createPopup(i,this.data),this.container.append(i),this.container}_download(){var i;(i=this.downloadManager)==null||i.openOrDownloadData(this.container,this.content,this.filename)}}const $=class ${static render(i){var D,p;const{annotations:d,div:C,viewport:y,accessibilityManager:k}=i;Dt(this,h,vn).call(this,C,y);let j=0;for(const B of d){if(B.annotationType!==f.AnnotationType.POPUP){const{width:z,height:Q}=P(B.rect);if(z<=0||Q<=0)continue}const _t=F.create({data:B,layer:C,page:i.page,viewport:y,linkService:i.linkService,downloadManager:i.downloadManager,imageResourcesPath:i.imageResourcesPath||"",renderForms:i.renderForms!==!1,svgFactory:new _.DOMSVGFactory,annotationStorage:i.annotationStorage||new V.AnnotationStorage,enableScripting:i.enableScripting,hasJSActions:i.hasJSActions,fieldObjects:i.fieldObjects,mouseState:i.mouseState||{isDown:!1}});if(_t.isRenderable){const z=_t.render();if(B.hidden&&(z.style.visibility="hidden"),Array.isArray(z))for(const Q of z)Q.style.zIndex=j++,Dt(D=$,h,Cn).call(D,Q,B.id,C,k);else z.style.zIndex=j++,_t instanceof r?C.prepend(z):Dt(p=$,h,Cn).call(p,z,B.id,C,k)}}Dt(this,h,Fn).call(this,C,i.annotationCanvasMap)}static update(i){const{annotationCanvasMap:d,div:C,viewport:y}=i;Dt(this,h,vn).call(this,C,y),Dt(this,h,Fn).call(this,C,d),C.hidden=!1}};h=new WeakSet,Cn=function(i,d,C,y){const k=i.firstChild||i;k.id=`${_.AnnotationPrefix}${d}`,C.append(i),y==null||y.moveElementInDOM(C,i,k,!1)},vn=function(i,{width:d,height:C,rotation:y}){const{style:k}=i,j=y%180!==0,D=Math.floor(d)+"px",p=Math.floor(C)+"px";k.width=j?p:D,k.height=j?D:p,i.setAttribute("data-main-rotation",y)},Fn=function(i,d){if(d){for(const[C,y]of d){const k=i.querySelector(`[data-annotation-id="${C}"]`);if(!k)continue;const{firstChild:j}=k;j?j.nodeName==="CANVAS"?j.replaceWith(y):j.before(y):k.append(y)}d.clear()}},Ot($,h);let H=$;a.AnnotationLayer=H}),((m,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorConverters=void 0;function A(_){return Math.floor(Math.max(0,Math.min(1,_))*255).toString(16).padStart(2,"0")}class f{static CMYK_G([V,q,Y,M]){return["G",1-Math.min(1,.3*V+.59*Y+.11*q+M)]}static G_CMYK([V]){return["CMYK",0,0,0,1-V]}static G_RGB([V]){return["RGB",V,V,V]}static G_HTML([V]){const q=A(V);return`#${q}${q}${q}`}static RGB_G([V,q,Y]){return["G",.3*V+.59*q+.11*Y]}static RGB_HTML([V,q,Y]){const M=A(V),b=A(q),w=A(Y);return`#${M}${b}${w}`}static T_HTML(){return"#00000000"}static CMYK_RGB([V,q,Y,M]){return["RGB",1-Math.min(1,V+M),1-Math.min(1,Y+M),1-Math.min(1,q+M)]}static CMYK_HTML(V){const q=this.CMYK_RGB(V).slice(1);return this.RGB_HTML(q)}static RGB_CMYK([V,q,Y]){const M=1-V,b=1-q,w=1-Y,P=Math.min(M,b,w);return["CMYK",M,b,w,P]}}a.ColorConverters=f}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.XfaLayer=void 0;var f=A(20);class _{static setupStorage(q,Y,M,b,w){const P=b.getValue(Y,{value:null});switch(M.name){case"textarea":if(P.value!==null&&(q.textContent=P.value),w==="print")break;q.addEventListener("input",F=>{b.setValue(Y,{value:F.target.value})});break;case"input":if(M.attributes.type==="radio"||M.attributes.type==="checkbox"){if(P.value===M.attributes.xfaOn?q.setAttribute("checked",!0):P.value===M.attributes.xfaOff&&q.removeAttribute("checked"),w==="print")break;q.addEventListener("change",F=>{b.setValue(Y,{value:F.target.checked?F.target.getAttribute("xfaOn"):F.target.getAttribute("xfaOff")})})}else{if(P.value!==null&&q.setAttribute("value",P.value),w==="print")break;q.addEventListener("input",F=>{b.setValue(Y,{value:F.target.value})})}break;case"select":if(P.value!==null)for(const F of M.children)F.attributes.value===P.value&&(F.attributes.selected=!0);q.addEventListener("input",F=>{const S=F.target.options,c=S.selectedIndex===-1?"":S[S.selectedIndex].value;b.setValue(Y,{value:c})});break}}static setAttributes({html:q,element:Y,storage:M=null,intent:b,linkService:w}){const{attributes:P}=Y,F=q instanceof HTMLAnchorElement;P.type==="radio"&&(P.name=`${P.name}-${b}`);for(const[S,c]of Object.entries(P))if(c!=null)switch(S){case"class":c.length&&q.setAttribute(S,c.join(" "));break;case"dataId":break;case"id":q.setAttribute("data-element-id",c);break;case"style":Object.assign(q.style,c);break;case"textContent":q.textContent=c;break;default:(!F||S!=="href"&&S!=="newWindow")&&q.setAttribute(S,c)}F&&w.addLinkAttributes(q,P.href,P.newWindow),M&&P.dataId&&this.setupStorage(q,P.dataId,Y,M)}static render(q){var t;const Y=q.annotationStorage,M=q.linkService,b=q.xfaHtml,w=q.intent||"display",P=document.createElement(b.name);b.attributes&&this.setAttributes({html:P,element:b,intent:w,linkService:M});const F=[[b,-1,P]],S=q.div;if(S.append(P),q.viewport){const s=`matrix(${q.viewport.transform.join(",")})`;S.style.transform=s}w!=="richText"&&S.setAttribute("class","xfaLayer xfaFont");const c=[];for(;F.length>0;){const[s,o,v]=F.at(-1);if(o+1===s.children.length){F.pop();continue}const g=s.children[++F.at(-1)[1]];if(g===null)continue;const{name:l}=g;if(l==="#text"){const r=document.createTextNode(g.value);c.push(r),v.append(r);continue}let n;if((t=g==null?void 0:g.attributes)!=null&&t.xmlns?n=document.createElementNS(g.attributes.xmlns,l):n=document.createElement(l),v.append(n),g.attributes&&this.setAttributes({html:n,element:g,storage:Y,intent:w,linkService:M}),g.children&&g.children.length>0)F.push([g,-1,n]);else if(g.value){const r=document.createTextNode(g.value);f.XfaText.shouldBuildText(l)&&c.push(r),n.append(r)}}for(const s of S.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))s.setAttribute("readOnly",!0);return{textDivs:c}}static update(q){const Y=`matrix(${q.viewport.transform.join(",")})`;q.div.style.transform=Y,q.div.hidden=!1}}a.XfaLayer=_}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TextLayerRenderTask=void 0,a.renderTextLayer=v;var f=A(1),_=A(8);const V=1e5,q=30,Y=.8,M=new Map,b=/^\s+$/g;function w(g,l){const n=M.get(g);if(n)return n;l.save(),l.font=`${q}px ${g}`;const r=l.measureText("");let e=r.fontBoundingBoxAscent,E=Math.abs(r.fontBoundingBoxDescent);if(e){l.restore();const L=e/(e+E);return M.set(g,L),L}l.strokeStyle="red",l.clearRect(0,0,q,q),l.strokeText("g",0,0);let x=l.getImageData(0,0,q,q).data;E=0;for(let L=x.length-1-3;L>=0;L-=4)if(x[L]>0){E=Math.ceil(L/4/q);break}l.clearRect(0,0,q,q),l.strokeText("A",0,q),x=l.getImageData(0,0,q,q).data,e=0;for(let L=0,O=x.length;L<O;L+=4)if(x[L]>0){e=q-Math.floor(L/4/q);break}if(l.restore(),e){const L=e/(e+E);return M.set(g,L),L}return M.set(g,Y),Y}function P(g,l,n,r){const e=document.createElement("span"),E=g._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:l.str!=="",hasEOL:l.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1,fontSize:0}:{angle:0,canvasWidth:0,hasText:l.str!=="",hasEOL:l.hasEOL,fontSize:0};g._textDivs.push(e);const x=f.Util.transform(g._viewport.transform,l.transform);let L=Math.atan2(x[1],x[0]);const O=n[l.fontName];O.vertical&&(L+=Math.PI/2);const yt=Math.hypot(x[2],x[3]),St=yt*w(O.fontFamily,r);let pt,K;L===0?(pt=x[4],K=x[5]-St):(pt=x[4]+St*Math.sin(L),K=x[5]-St*Math.cos(L)),e.style.left=`${pt}px`,e.style.top=`${K}px`,e.style.fontSize=`${yt}px`,e.style.fontFamily=O.fontFamily,E.fontSize=yt,e.setAttribute("role","presentation"),e.textContent=l.str,e.dir=l.dir,g._fontInspectorEnabled&&(e.dataset.fontName=l.fontName),L!==0&&(E.angle=L*(180/Math.PI));let N=!1;if(l.str.length>1||g._enhanceTextSelection&&b.test(l.str))N=!0;else if(l.str!==" "&&l.transform[0]!==l.transform[3]){const U=Math.abs(l.transform[0]),G=Math.abs(l.transform[3]);U!==G&&Math.max(U,G)/Math.min(U,G)>1.5&&(N=!0)}if(N&&(O.vertical?E.canvasWidth=l.height*g._viewport.scale:E.canvasWidth=l.width*g._viewport.scale),g._textDivProperties.set(e,E),g._textContentStream&&g._layoutText(e),g._enhanceTextSelection&&E.hasText){let U=1,G=0;L!==0&&(U=Math.cos(L),G=Math.sin(L));const bt=(O.vertical?l.height:l.width)*g._viewport.scale,wt=yt;let Mt,H;L!==0?(Mt=[U,G,-G,U,pt,K],H=f.Util.getAxialAlignedBoundingBox([0,0,bt,wt],Mt)):H=[pt,K,pt+bt,K+wt],g._bounds.push({left:H[0],top:H[1],right:H[2],bottom:H[3],div:e,size:[bt,wt],m:Mt})}}function F(g){if(g._canceled)return;const l=g._textDivs,n=g._capability,r=l.length;if(r>V){g._renderingDone=!0,n.resolve();return}if(!g._textContentStream)for(let e=0;e<r;e++)g._layoutText(l[e]);g._renderingDone=!0,n.resolve()}function S(g,l,n){let r=0;for(let e=0;e<n;e++){const E=g[l++];E>0&&(r=r?Math.min(E,r):E)}return r}function c(g){const l=g._bounds,n=g._viewport,r=t(n.width,n.height,l);for(let e=0;e<r.length;e++){const E=l[e].div,x=g._textDivProperties.get(E);if(x.angle===0){x.paddingLeft=l[e].left-r[e].left,x.paddingTop=l[e].top-r[e].top,x.paddingRight=r[e].right-l[e].right,x.paddingBottom=r[e].bottom-l[e].bottom,g._textDivProperties.set(E,x);continue}const L=r[e],O=l[e],yt=O.m,St=yt[0],pt=yt[1],K=[[0,0],[0,O.size[1]],[O.size[0],0],O.size],N=new Float64Array(64);for(let G=0,bt=K.length;G<bt;G++){const wt=f.Util.applyTransform(K[G],yt);N[G+0]=St&&(L.left-wt[0])/St,N[G+4]=pt&&(L.top-wt[1])/pt,N[G+8]=St&&(L.right-wt[0])/St,N[G+12]=pt&&(L.bottom-wt[1])/pt,N[G+16]=pt&&(L.left-wt[0])/-pt,N[G+20]=St&&(L.top-wt[1])/St,N[G+24]=pt&&(L.right-wt[0])/-pt,N[G+28]=St&&(L.bottom-wt[1])/St,N[G+32]=St&&(L.left-wt[0])/-St,N[G+36]=pt&&(L.top-wt[1])/-pt,N[G+40]=St&&(L.right-wt[0])/-St,N[G+44]=pt&&(L.bottom-wt[1])/-pt,N[G+48]=pt&&(L.left-wt[0])/pt,N[G+52]=St&&(L.top-wt[1])/-St,N[G+56]=pt&&(L.right-wt[0])/pt,N[G+60]=St&&(L.bottom-wt[1])/-St}const U=1+Math.min(Math.abs(St),Math.abs(pt));x.paddingLeft=S(N,32,16)/U,x.paddingTop=S(N,48,16)/U,x.paddingRight=S(N,0,16)/U,x.paddingBottom=S(N,16,16)/U,g._textDivProperties.set(E,x)}}function t(g,l,n){const r=n.map(function(E,x){return{x1:E.left,y1:E.top,x2:E.right,y2:E.bottom,index:x,x1New:void 0,x2New:void 0}});s(g,r);const e=new Array(n.length);for(const E of r){const x=E.index;e[x]={left:E.x1New,top:0,right:E.x2New,bottom:0}}n.map(function(E,x){const L=e[x],O=r[x];O.x1=E.top,O.y1=g-L.right,O.x2=E.bottom,O.y2=g-L.left,O.index=x,O.x1New=void 0,O.x2New=void 0}),s(l,r);for(const E of r){const x=E.index;e[x].top=E.x1New,e[x].bottom=E.x2New}return e}function s(g,l){l.sort(function(e,E){return e.x1-E.x1||e.index-E.index});const r=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const e of l){let E=0;for(;E<r.length&&r[E].end<=e.y1;)E++;let x=r.length-1;for(;x>=0&&r[x].start>=e.y2;)x--;let L,O,yt,St,pt=-1/0;for(yt=E;yt<=x;yt++){L=r[yt],O=L.boundary;let U;O.x2>e.x1?U=O.index>e.index?O.x1New:e.x1:O.x2New===void 0?U=(O.x2+e.x1)/2:U=O.x2New,U>pt&&(pt=U)}for(e.x1New=pt,yt=E;yt<=x;yt++)L=r[yt],O=L.boundary,O.x2New===void 0?O.x2>e.x1?O.index>e.index&&(O.x2New=O.x2):O.x2New=pt:O.x2New>pt&&(O.x2New=Math.max(pt,O.x2));const K=[];let N=null;for(yt=E;yt<=x;yt++){L=r[yt],O=L.boundary;const U=O.x2>e.x2?O:e;N===U?K.at(-1).end=L.end:(K.push({start:L.start,end:L.end,boundary:U}),N=U)}for(r[E].start<e.y1&&(K[0].start=e.y1,K.unshift({start:r[E].start,end:e.y1,boundary:r[E].boundary})),e.y2<r[x].end&&(K.at(-1).end=e.y2,K.push({start:e.y2,end:r[x].end,boundary:r[x].boundary})),yt=E;yt<=x;yt++){if(L=r[yt],O=L.boundary,O.x2New!==void 0)continue;let U=!1;for(St=E-1;!U&&St>=0&&r[St].start>=O.y1;St--)U=r[St].boundary===O;for(St=x+1;!U&&St<r.length&&r[St].end<=O.y2;St++)U=r[St].boundary===O;for(St=0;!U&&St<K.length;St++)U=K[St].boundary===O;U||(O.x2New=pt)}Array.prototype.splice.apply(r,[E,x-E+1,...K])}for(const e of r){const E=e.boundary;E.x2New===void 0&&(E.x2New=Math.max(g,E.x2))}}class o{constructor({textContent:l,textContentStream:n,container:r,viewport:e,textDivs:E,textContentItemsStr:x,enhanceTextSelection:L}){var O;L&&(0,_.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."),this._textContent=l,this._textContentStream=n,this._container=r,this._document=r.ownerDocument,this._viewport=e,this._textDivs=E||[],this._textContentItemsStr=x||[],this._enhanceTextSelection=!!L,this._fontInspectorEnabled=!!((O=globalThis.FontInspector)!=null&&O.enabled),this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,f.createPromiseCapability)(),this._renderTimer=null,this._bounds=[],this._devicePixelRatio=globalThis.devicePixelRatio||1,this._capability.promise.finally(()=>{this._enhanceTextSelection||(this._textDivProperties=null),this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new f.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._renderTimer!==null&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))}_processItems(l,n){for(let r=0,e=l.length;r<e;r++){if(l[r].str===void 0){if(l[r].type==="beginMarkedContentProps"||l[r].type==="beginMarkedContent"){const E=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),l[r].id!==null&&this._container.setAttribute("id",`${l[r].id}`),E.append(this._container)}else l[r].type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(l[r].str),P(this,l[r],n,this._layoutTextCtx)}}_layoutText(l){const n=this._textDivProperties.get(l);let r="";if(n.canvasWidth!==0&&n.hasText){const{fontFamily:e}=l.style,{fontSize:E}=n;(E!==this._layoutTextLastFontSize||e!==this._layoutTextLastFontFamily)&&(this._layoutTextCtx.font=`${E*this._devicePixelRatio}px ${e}`,this._layoutTextLastFontSize=E,this._layoutTextLastFontFamily=e);const{width:x}=this._layoutTextCtx.measureText(l.textContent);if(x>0){const L=this._devicePixelRatio*n.canvasWidth/x;this._enhanceTextSelection&&(n.scale=L),r=`scaleX(${L})`}}if(n.angle!==0&&(r=`rotate(${n.angle}deg) ${r}`),r.length>0&&(this._enhanceTextSelection&&(n.originalTransform=r),l.style.transform=r),n.hasText&&this._container.append(l),n.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this._container.append(e)}}_render(l=0){const n=(0,f.createPromiseCapability)();let r=Object.create(null);const e=this._document.createElement("canvas");if(e.height=e.width=q,this._layoutTextCtx=e.getContext("2d",{alpha:!1}),this._textContent){const E=this._textContent.items,x=this._textContent.styles;this._processItems(E,x),n.resolve()}else if(this._textContentStream){const E=()=>{this._reader.read().then(({value:x,done:L})=>{if(L){n.resolve();return}Object.assign(r,x.styles),this._processItems(x.items,r),E()},n.reject)};this._reader=this._textContentStream.getReader(),E()}else throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');n.promise.then(()=>{r=null,l?this._renderTimer=setTimeout(()=>{F(this),this._renderTimer=null},l):F(this)},this._capability.reject)}expandTextDivs(l=!1){if(!this._enhanceTextSelection||!this._renderingDone)return;this._bounds!==null&&(c(this),this._bounds=null);const n=[],r=[];for(let e=0,E=this._textDivs.length;e<E;e++){const x=this._textDivs[e],L=this._textDivProperties.get(x);L.hasText&&(l?(n.length=0,r.length=0,L.originalTransform&&n.push(L.originalTransform),L.paddingTop>0?(r.push(`${L.paddingTop}px`),n.push(`translateY(${-L.paddingTop}px)`)):r.push(0),L.paddingRight>0?r.push(`${L.paddingRight/L.scale}px`):r.push(0),L.paddingBottom>0?r.push(`${L.paddingBottom}px`):r.push(0),L.paddingLeft>0?(r.push(`${L.paddingLeft/L.scale}px`),n.push(`translateX(${-L.paddingLeft/L.scale}px)`)):r.push(0),x.style.padding=r.join(" "),n.length&&(x.style.transform=n.join(" "))):(x.style.padding=null,x.style.transform=L.originalTransform))}}}a.TextLayerRenderTask=o;function v(g){const l=new o({textContent:g.textContent,textContentStream:g.textContentStream,container:g.container,viewport:g.viewport,textDivs:g.textDivs,textContentItemsStr:g.textContentItemsStr,enhanceTextSelection:g.enhanceTextSelection});return l._render(g.timeout),l}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SVGGraphics=void 0;var f=A(8),_=A(1),V=A(3);let q=class{constructor(){(0,_.unreachable)("Not implemented: SVGGraphics")}};a.SVGGraphics=q;{let t=function(n){let r=[];const e=[];for(const E of n){if(E.fn==="save"){r.push({fnId:92,fn:"group",items:[]}),e.push(r),r=r.at(-1).items;continue}E.fn==="restore"?r=e.pop():r.push(E)}return r},s=function(n){if(Number.isInteger(n))return n.toString();const r=n.toFixed(10);let e=r.length-1;if(r[e]!=="0")return r;do e--;while(r[e]==="0");return r.substring(0,r[e]==="."?e:e+1)},o=function(n){if(n[4]===0&&n[5]===0){if(n[1]===0&&n[2]===0)return n[0]===1&&n[3]===1?"":`scale(${s(n[0])} ${s(n[3])})`;if(n[0]===n[3]&&n[1]===-n[2]){const r=Math.acos(n[0])*180/Math.PI;return`rotate(${s(r)})`}}else if(n[0]===1&&n[1]===0&&n[2]===0&&n[3]===1)return`translate(${s(n[4])} ${s(n[5])})`;return`matrix(${s(n[0])} ${s(n[1])} ${s(n[2])} ${s(n[3])} ${s(n[4])} ${s(n[5])})`};const Y={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},M="http://www.w3.org/XML/1998/namespace",b="http://www.w3.org/1999/xlink",w=["butt","round","square"],P=["miter","round","bevel"],F=function(n,r="",e=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!e)return URL.createObjectURL(new Blob([n],{type:r}));const E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let x=`data:${r};base64,`;for(let L=0,O=n.length;L<O;L+=3){const yt=n[L]&255,St=n[L+1]&255,pt=n[L+2]&255,K=yt>>2,N=(yt&3)<<4|St>>4,U=L+1<O?(St&15)<<2|pt>>6:64,G=L+2<O?pt&63:64;x+=E[K]+E[N]+E[U]+E[G]}return x},S=(function(){const n=new Uint8Array([137,80,78,71,13,10,26,10]),r=12,e=new Int32Array(256);for(let pt=0;pt<256;pt++){let K=pt;for(let N=0;N<8;N++)K&1?K=3988292384^K>>1&2147483647:K=K>>1&2147483647;e[pt]=K}function E(pt,K,N){let U=-1;for(let G=K;G<N;G++){const bt=(U^pt[G])&255,wt=e[bt];U=U>>>8^wt}return U^-1}function x(pt,K,N,U){let G=U;const bt=K.length;N[G]=bt>>24&255,N[G+1]=bt>>16&255,N[G+2]=bt>>8&255,N[G+3]=bt&255,G+=4,N[G]=pt.charCodeAt(0)&255,N[G+1]=pt.charCodeAt(1)&255,N[G+2]=pt.charCodeAt(2)&255,N[G+3]=pt.charCodeAt(3)&255,G+=4,N.set(K,G),G+=K.length;const wt=E(N,U+4,G);N[G]=wt>>24&255,N[G+1]=wt>>16&255,N[G+2]=wt>>8&255,N[G+3]=wt&255}function L(pt,K,N){let U=1,G=0;for(let bt=K;bt<N;++bt)U=(U+(pt[bt]&255))%65521,G=(G+U)%65521;return G<<16|U}function O(pt){if(!V.isNodeJS)return yt(pt);try{let K;parseInt(process.versions.node)>=8?K=pt:K=Buffer.from(pt);const N=require$$0.deflateSync(K,{level:9});return N instanceof Uint8Array?N:new Uint8Array(N)}catch(K){(0,_.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+K)}return yt(pt)}function yt(pt){let K=pt.length;const N=65535,U=Math.ceil(K/N),G=new Uint8Array(2+K+U*5+4);let bt=0;G[bt++]=120,G[bt++]=156;let wt=0;for(;K>N;)G[bt++]=0,G[bt++]=255,G[bt++]=255,G[bt++]=0,G[bt++]=0,G.set(pt.subarray(wt,wt+N),bt),bt+=N,wt+=N,K-=N;G[bt++]=1,G[bt++]=K&255,G[bt++]=K>>8&255,G[bt++]=~K&65535&255,G[bt++]=(~K&65535)>>8&255,G.set(pt.subarray(wt),bt),bt+=pt.length-wt;const Mt=L(pt,0,pt.length);return G[bt++]=Mt>>24&255,G[bt++]=Mt>>16&255,G[bt++]=Mt>>8&255,G[bt++]=Mt&255,G}function St(pt,K,N,U){const G=pt.width,bt=pt.height;let wt,Mt,H;const h=pt.data;switch(K){case _.ImageKind.GRAYSCALE_1BPP:Mt=0,wt=1,H=G+7>>3;break;case _.ImageKind.RGB_24BPP:Mt=2,wt=8,H=G*3;break;case _.ImageKind.RGBA_32BPP:Mt=6,wt=8,H=G*4;break;default:throw new Error("invalid format")}const u=new Uint8Array((1+H)*bt);let T=0,I=0;for(let y=0;y<bt;++y)u[T++]=0,u.set(h.subarray(I,I+H),T),I+=H,T+=H;if(K===_.ImageKind.GRAYSCALE_1BPP&&U){T=0;for(let y=0;y<bt;y++){T++;for(let k=0;k<H;k++)u[T++]^=255}}const $=new Uint8Array([G>>24&255,G>>16&255,G>>8&255,G&255,bt>>24&255,bt>>16&255,bt>>8&255,bt&255,wt,Mt,0,0,0]),W=O(u),i=n.length+r*3+$.length+W.length,d=new Uint8Array(i);let C=0;return d.set(n,C),C+=n.length,x("IHDR",$,d,C),C+=r+$.length,x("IDATA",W,d,C),C+=r+W.length,x("IEND",new Uint8Array(0),d,C),F(d,"image/png",N)}return function(K,N,U){const G=K.kind===void 0?_.ImageKind.GRAYSCALE_1BPP:K.kind;return St(K,G,N,U)}})();class c{constructor(){this.fontSizeScale=1,this.fontWeight=Y.fontWeight,this.fontSize=0,this.textMatrix=_.IDENTITY_MATRIX,this.fontMatrix=_.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=_.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=Y.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(r,e){this.x=r,this.y=e}}let v=0,g=0,l=0;a.SVGGraphics=q=class{constructor(n,r,e=!1){(0,f.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new f.DOMSVGFactory,this.current=new c,this.transformMatrix=_.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=n,this.objs=r,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!e,this._operatorIdMapping=[];for(const E in _.OPS)this._operatorIdMapping[_.OPS[E]]=E}save(){this.transformStack.push(this.transformMatrix);const n=this.current;this.extraStack.push(n),this.current=n.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(n){this.save(),this.executeOpTree(n),this.restore()}loadDependencies(n){const r=n.fnArray,e=n.argsArray;for(let E=0,x=r.length;E<x;E++)if(r[E]===_.OPS.dependency)for(const L of e[E]){const O=L.startsWith("g_")?this.commonObjs:this.objs,yt=new Promise(St=>{O.get(L,St)});this.current.dependencies.push(yt)}return Promise.all(this.current.dependencies)}transform(n,r,e,E,x,L){const O=[n,r,e,E,x,L];this.transformMatrix=_.Util.transform(this.transformMatrix,O),this.tgrp=null}getSVG(n,r){this.viewport=r;const e=this._initialize(r);return this.loadDependencies(n).then(()=>(this.transformMatrix=_.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(n)),e))}convertOpList(n){const r=this._operatorIdMapping,e=n.argsArray,E=n.fnArray,x=[];for(let L=0,O=E.length;L<O;L++){const yt=E[L];x.push({fnId:yt,fn:r[yt],args:e[L]})}return t(x)}executeOpTree(n){for(const r of n){const e=r.fn,E=r.fnId,x=r.args;switch(E|0){case _.OPS.beginText:this.beginText();break;case _.OPS.dependency:break;case _.OPS.setLeading:this.setLeading(x);break;case _.OPS.setLeadingMoveText:this.setLeadingMoveText(x[0],x[1]);break;case _.OPS.setFont:this.setFont(x);break;case _.OPS.showText:this.showText(x[0]);break;case _.OPS.showSpacedText:this.showText(x[0]);break;case _.OPS.endText:this.endText();break;case _.OPS.moveText:this.moveText(x[0],x[1]);break;case _.OPS.setCharSpacing:this.setCharSpacing(x[0]);break;case _.OPS.setWordSpacing:this.setWordSpacing(x[0]);break;case _.OPS.setHScale:this.setHScale(x[0]);break;case _.OPS.setTextMatrix:this.setTextMatrix(x[0],x[1],x[2],x[3],x[4],x[5]);break;case _.OPS.setTextRise:this.setTextRise(x[0]);break;case _.OPS.setTextRenderingMode:this.setTextRenderingMode(x[0]);break;case _.OPS.setLineWidth:this.setLineWidth(x[0]);break;case _.OPS.setLineJoin:this.setLineJoin(x[0]);break;case _.OPS.setLineCap:this.setLineCap(x[0]);break;case _.OPS.setMiterLimit:this.setMiterLimit(x[0]);break;case _.OPS.setFillRGBColor:this.setFillRGBColor(x[0],x[1],x[2]);break;case _.OPS.setStrokeRGBColor:this.setStrokeRGBColor(x[0],x[1],x[2]);break;case _.OPS.setStrokeColorN:this.setStrokeColorN(x);break;case _.OPS.setFillColorN:this.setFillColorN(x);break;case _.OPS.shadingFill:this.shadingFill(x[0]);break;case _.OPS.setDash:this.setDash(x[0],x[1]);break;case _.OPS.setRenderingIntent:this.setRenderingIntent(x[0]);break;case _.OPS.setFlatness:this.setFlatness(x[0]);break;case _.OPS.setGState:this.setGState(x[0]);break;case _.OPS.fill:this.fill();break;case _.OPS.eoFill:this.eoFill();break;case _.OPS.stroke:this.stroke();break;case _.OPS.fillStroke:this.fillStroke();break;case _.OPS.eoFillStroke:this.eoFillStroke();break;case _.OPS.clip:this.clip("nonzero");break;case _.OPS.eoClip:this.clip("evenodd");break;case _.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case _.OPS.paintImageXObject:this.paintImageXObject(x[0]);break;case _.OPS.paintInlineImageXObject:this.paintInlineImageXObject(x[0]);break;case _.OPS.paintImageMaskXObject:this.paintImageMaskXObject(x[0]);break;case _.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(x[0],x[1]);break;case _.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case _.OPS.closePath:this.closePath();break;case _.OPS.closeStroke:this.closeStroke();break;case _.OPS.closeFillStroke:this.closeFillStroke();break;case _.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case _.OPS.nextLine:this.nextLine();break;case _.OPS.transform:this.transform(x[0],x[1],x[2],x[3],x[4],x[5]);break;case _.OPS.constructPath:this.constructPath(x[0],x[1]);break;case _.OPS.endPath:this.endPath();break;case 92:this.group(r.items);break;default:(0,_.warn)(`Unimplemented operator ${e}`);break}}}setWordSpacing(n){this.current.wordSpacing=n}setCharSpacing(n){this.current.charSpacing=n}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(n,r,e,E,x,L){const O=this.current;O.textMatrix=O.lineMatrix=[n,r,e,E,x,L],O.textMatrixScale=Math.hypot(n,r),O.x=O.lineX=0,O.y=O.lineY=0,O.xcoords=[],O.ycoords=[],O.tspan=this.svgFactory.createElement("svg:tspan"),O.tspan.setAttributeNS(null,"font-family",O.fontFamily),O.tspan.setAttributeNS(null,"font-size",`${s(O.fontSize)}px`),O.tspan.setAttributeNS(null,"y",s(-O.y)),O.txtElement=this.svgFactory.createElement("svg:text"),O.txtElement.append(O.tspan)}beginText(){const n=this.current;n.x=n.lineX=0,n.y=n.lineY=0,n.textMatrix=_.IDENTITY_MATRIX,n.lineMatrix=_.IDENTITY_MATRIX,n.textMatrixScale=1,n.tspan=this.svgFactory.createElement("svg:tspan"),n.txtElement=this.svgFactory.createElement("svg:text"),n.txtgrp=this.svgFactory.createElement("svg:g"),n.xcoords=[],n.ycoords=[]}moveText(n,r){const e=this.current;e.x=e.lineX+=n,e.y=e.lineY+=r,e.xcoords=[],e.ycoords=[],e.tspan=this.svgFactory.createElement("svg:tspan"),e.tspan.setAttributeNS(null,"font-family",e.fontFamily),e.tspan.setAttributeNS(null,"font-size",`${s(e.fontSize)}px`),e.tspan.setAttributeNS(null,"y",s(-e.y))}showText(n){const r=this.current,e=r.font,E=r.fontSize;if(E===0)return;const x=r.fontSizeScale,L=r.charSpacing,O=r.wordSpacing,yt=r.fontDirection,St=r.textHScale*yt,pt=e.vertical,K=pt?1:-1,N=e.defaultVMetrics,U=E*r.fontMatrix[0];let G=0;for(const Mt of n){if(Mt===null){G+=yt*O;continue}else if(typeof Mt=="number"){G+=K*Mt*E/1e3;continue}const H=(Mt.isSpace?O:0)+L,h=Mt.fontChar;let u,T,I=Mt.width;if(pt){let W;const i=Mt.vmetric||N;W=Mt.vmetric?i[1]:I*.5,W=-W*U;const d=i[2]*U;I=i?-i[0]:I,u=W/x,T=(G+d)/x}else u=G/x,T=0;(Mt.isInFont||e.missingFile)&&(r.xcoords.push(r.x+u),pt&&r.ycoords.push(-r.y+T),r.tspan.textContent+=h);let $;pt?$=I*U-H*yt:$=I*U+H*yt,G+=$}r.tspan.setAttributeNS(null,"x",r.xcoords.map(s).join(" ")),pt?r.tspan.setAttributeNS(null,"y",r.ycoords.map(s).join(" ")):r.tspan.setAttributeNS(null,"y",s(-r.y)),pt?r.y-=G:r.x+=G*St,r.tspan.setAttributeNS(null,"font-family",r.fontFamily),r.tspan.setAttributeNS(null,"font-size",`${s(r.fontSize)}px`),r.fontStyle!==Y.fontStyle&&r.tspan.setAttributeNS(null,"font-style",r.fontStyle),r.fontWeight!==Y.fontWeight&&r.tspan.setAttributeNS(null,"font-weight",r.fontWeight);const bt=r.textRenderingMode&_.TextRenderingMode.FILL_STROKE_MASK;if(bt===_.TextRenderingMode.FILL||bt===_.TextRenderingMode.FILL_STROKE?(r.fillColor!==Y.fillColor&&r.tspan.setAttributeNS(null,"fill",r.fillColor),r.fillAlpha<1&&r.tspan.setAttributeNS(null,"fill-opacity",r.fillAlpha)):r.textRenderingMode===_.TextRenderingMode.ADD_TO_PATH?r.tspan.setAttributeNS(null,"fill","transparent"):r.tspan.setAttributeNS(null,"fill","none"),bt===_.TextRenderingMode.STROKE||bt===_.TextRenderingMode.FILL_STROKE){const Mt=1/(r.textMatrixScale||1);this._setStrokeAttributes(r.tspan,Mt)}let wt=r.textMatrix;r.textRise!==0&&(wt=wt.slice(),wt[5]+=r.textRise),r.txtElement.setAttributeNS(null,"transform",`${o(wt)} scale(${s(St)}, -1)`),r.txtElement.setAttributeNS(M,"xml:space","preserve"),r.txtElement.append(r.tspan),r.txtgrp.append(r.txtElement),this._ensureTransformGroup().append(r.txtElement)}setLeadingMoveText(n,r){this.setLeading(-r),this.moveText(n,r)}addFontStyle(n){if(!n.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const r=F(n.data,n.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${n.loadedName}"; src: url(${r}); }
|
|
42
|
-
`}setFont(n){const r=this.current,e=this.commonObjs.get(n[0]);let E=n[1];r.font=e,this.embedFonts&&!e.missingFile&&!this.embeddedFonts[e.loadedName]&&(this.addFontStyle(e),this.embeddedFonts[e.loadedName]=e),r.fontMatrix=e.fontMatrix||_.FONT_IDENTITY_MATRIX;let x="normal";e.black?x="900":e.bold&&(x="bold");const L=e.italic?"italic":"normal";E<0?(E=-E,r.fontDirection=-1):r.fontDirection=1,r.fontSize=E,r.fontFamily=e.loadedName,r.fontWeight=x,r.fontStyle=L,r.tspan=this.svgFactory.createElement("svg:tspan"),r.tspan.setAttributeNS(null,"y",s(-r.y)),r.xcoords=[],r.ycoords=[]}endText(){var r;const n=this.current;n.textRenderingMode&_.TextRenderingMode.ADD_TO_PATH_FLAG&&((r=n.txtElement)!=null&&r.hasChildNodes())&&(n.element=n.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(n){n>0&&(this.current.lineWidth=n)}setLineCap(n){this.current.lineCap=w[n]}setLineJoin(n){this.current.lineJoin=P[n]}setMiterLimit(n){this.current.miterLimit=n}setStrokeAlpha(n){this.current.strokeAlpha=n}setStrokeRGBColor(n,r,e){this.current.strokeColor=_.Util.makeHexColor(n,r,e)}setFillAlpha(n){this.current.fillAlpha=n}setFillRGBColor(n,r,e){this.current.fillColor=_.Util.makeHexColor(n,r,e),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(n){this.current.strokeColor=this._makeColorN_Pattern(n)}setFillColorN(n){this.current.fillColor=this._makeColorN_Pattern(n)}shadingFill(n){const r=this.viewport.width,e=this.viewport.height,E=_.Util.inverseTransform(this.transformMatrix),x=_.Util.applyTransform([0,0],E),L=_.Util.applyTransform([0,e],E),O=_.Util.applyTransform([r,0],E),yt=_.Util.applyTransform([r,e],E),St=Math.min(x[0],L[0],O[0],yt[0]),pt=Math.min(x[1],L[1],O[1],yt[1]),K=Math.max(x[0],L[0],O[0],yt[0]),N=Math.max(x[1],L[1],O[1],yt[1]),U=this.svgFactory.createElement("svg:rect");U.setAttributeNS(null,"x",St),U.setAttributeNS(null,"y",pt),U.setAttributeNS(null,"width",K-St),U.setAttributeNS(null,"height",N-pt),U.setAttributeNS(null,"fill",this._makeShadingPattern(n)),this.current.fillAlpha<1&&U.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(U)}_makeColorN_Pattern(n){return n[0]==="TilingPattern"?this._makeTilingPattern(n):this._makeShadingPattern(n)}_makeTilingPattern(n){const r=n[1],e=n[2],E=n[3]||_.IDENTITY_MATRIX,[x,L,O,yt]=n[4],St=n[5],pt=n[6],K=n[7],N=`shading${l++}`,[U,G,bt,wt]=_.Util.normalizeRect([..._.Util.applyTransform([x,L],E),..._.Util.applyTransform([O,yt],E)]),[Mt,H]=_.Util.singularValueDecompose2dScale(E),h=St*Mt,u=pt*H,T=this.svgFactory.createElement("svg:pattern");T.setAttributeNS(null,"id",N),T.setAttributeNS(null,"patternUnits","userSpaceOnUse"),T.setAttributeNS(null,"width",h),T.setAttributeNS(null,"height",u),T.setAttributeNS(null,"x",`${U}`),T.setAttributeNS(null,"y",`${G}`);const I=this.svg,$=this.transformMatrix,W=this.current.fillColor,i=this.current.strokeColor,d=this.svgFactory.create(bt-U,wt-G);if(this.svg=d,this.transformMatrix=E,K===2){const C=_.Util.makeHexColor(...r);this.current.fillColor=C,this.current.strokeColor=C}return this.executeOpTree(this.convertOpList(e)),this.svg=I,this.transformMatrix=$,this.current.fillColor=W,this.current.strokeColor=i,T.append(d.childNodes[0]),this.defs.append(T),`url(#${N})`}_makeShadingPattern(n){switch(typeof n=="string"&&(n=this.objs.get(n)),n[0]){case"RadialAxial":const r=`shading${l++}`,e=n[3];let E;switch(n[1]){case"axial":const x=n[4],L=n[5];E=this.svgFactory.createElement("svg:linearGradient"),E.setAttributeNS(null,"id",r),E.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),E.setAttributeNS(null,"x1",x[0]),E.setAttributeNS(null,"y1",x[1]),E.setAttributeNS(null,"x2",L[0]),E.setAttributeNS(null,"y2",L[1]);break;case"radial":const O=n[4],yt=n[5],St=n[6],pt=n[7];E=this.svgFactory.createElement("svg:radialGradient"),E.setAttributeNS(null,"id",r),E.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),E.setAttributeNS(null,"cx",yt[0]),E.setAttributeNS(null,"cy",yt[1]),E.setAttributeNS(null,"r",pt),E.setAttributeNS(null,"fx",O[0]),E.setAttributeNS(null,"fy",O[1]),E.setAttributeNS(null,"fr",St);break;default:throw new Error(`Unknown RadialAxial type: ${n[1]}`)}for(const x of e){const L=this.svgFactory.createElement("svg:stop");L.setAttributeNS(null,"offset",x[0]),L.setAttributeNS(null,"stop-color",x[1]),E.append(L)}return this.defs.append(E),`url(#${r})`;case"Mesh":return(0,_.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${n[0]}`)}}setDash(n,r){this.current.dashArray=n,this.current.dashPhase=r}constructPath(n,r){const e=this.current;let E=e.x,x=e.y,L=[],O=0;for(const yt of n)switch(yt|0){case _.OPS.rectangle:E=r[O++],x=r[O++];const St=r[O++],pt=r[O++],K=E+St,N=x+pt;L.push("M",s(E),s(x),"L",s(K),s(x),"L",s(K),s(N),"L",s(E),s(N),"Z");break;case _.OPS.moveTo:E=r[O++],x=r[O++],L.push("M",s(E),s(x));break;case _.OPS.lineTo:E=r[O++],x=r[O++],L.push("L",s(E),s(x));break;case _.OPS.curveTo:E=r[O+4],x=r[O+5],L.push("C",s(r[O]),s(r[O+1]),s(r[O+2]),s(r[O+3]),s(E),s(x)),O+=6;break;case _.OPS.curveTo2:L.push("C",s(E),s(x),s(r[O]),s(r[O+1]),s(r[O+2]),s(r[O+3])),E=r[O+2],x=r[O+3],O+=4;break;case _.OPS.curveTo3:E=r[O+2],x=r[O+3],L.push("C",s(r[O]),s(r[O+1]),s(E),s(x),s(E),s(x)),O+=4;break;case _.OPS.closePath:L.push("Z");break}L=L.join(" "),e.path&&n.length>0&&n[0]!==_.OPS.rectangle&&n[0]!==_.OPS.moveTo?L=e.path.getAttributeNS(null,"d")+L:(e.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(e.path)),e.path.setAttributeNS(null,"d",L),e.path.setAttributeNS(null,"fill","none"),e.element=e.path,e.setCurrentPoint(E,x)}endPath(){const n=this.current;if(n.path=null,!this.pendingClip)return;if(!n.element){this.pendingClip=null;return}const r=`clippath${v++}`,e=this.svgFactory.createElement("svg:clipPath");e.setAttributeNS(null,"id",r),e.setAttributeNS(null,"transform",o(this.transformMatrix));const E=n.element.cloneNode(!0);if(this.pendingClip==="evenodd"?E.setAttributeNS(null,"clip-rule","evenodd"):E.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,e.append(E),this.defs.append(e),n.activeClipUrl){n.clipGroup=null;for(const x of this.extraStack)x.clipGroup=null;e.setAttributeNS(null,"clip-path",n.activeClipUrl)}n.activeClipUrl=`url(#${r})`,this.tgrp=null}clip(n){this.pendingClip=n}closePath(){const n=this.current;if(n.path){const r=`${n.path.getAttributeNS(null,"d")}Z`;n.path.setAttributeNS(null,"d",r)}}setLeading(n){this.current.leading=-n}setTextRise(n){this.current.textRise=n}setTextRenderingMode(n){this.current.textRenderingMode=n}setHScale(n){this.current.textHScale=n/100}setRenderingIntent(n){}setFlatness(n){}setGState(n){for(const[r,e]of n)switch(r){case"LW":this.setLineWidth(e);break;case"LC":this.setLineCap(e);break;case"LJ":this.setLineJoin(e);break;case"ML":this.setMiterLimit(e);break;case"D":this.setDash(e[0],e[1]);break;case"RI":this.setRenderingIntent(e);break;case"FL":this.setFlatness(e);break;case"Font":this.setFont(e);break;case"CA":this.setStrokeAlpha(e);break;case"ca":this.setFillAlpha(e);break;default:(0,_.warn)(`Unimplemented graphic state operator ${r}`);break}}fill(){const n=this.current;n.element&&(n.element.setAttributeNS(null,"fill",n.fillColor),n.element.setAttributeNS(null,"fill-opacity",n.fillAlpha),this.endPath())}stroke(){const n=this.current;n.element&&(this._setStrokeAttributes(n.element),n.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(n,r=1){const e=this.current;let E=e.dashArray;r!==1&&E.length>0&&(E=E.map(function(x){return r*x})),n.setAttributeNS(null,"stroke",e.strokeColor),n.setAttributeNS(null,"stroke-opacity",e.strokeAlpha),n.setAttributeNS(null,"stroke-miterlimit",s(e.miterLimit)),n.setAttributeNS(null,"stroke-linecap",e.lineCap),n.setAttributeNS(null,"stroke-linejoin",e.lineJoin),n.setAttributeNS(null,"stroke-width",s(r*e.lineWidth)+"px"),n.setAttributeNS(null,"stroke-dasharray",E.map(s).join(" ")),n.setAttributeNS(null,"stroke-dashoffset",s(r*e.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x","0"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","1px"),n.setAttributeNS(null,"height","1px"),n.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(n)}paintImageXObject(n){const r=n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n);if(!r){(0,_.warn)(`Dependent image with object ID ${n} is not ready yet`);return}this.paintInlineImageXObject(r)}paintInlineImageXObject(n,r){const e=n.width,E=n.height,x=S(n,this.forceDataSchema,!!r),L=this.svgFactory.createElement("svg:rect");L.setAttributeNS(null,"x","0"),L.setAttributeNS(null,"y","0"),L.setAttributeNS(null,"width",s(e)),L.setAttributeNS(null,"height",s(E)),this.current.element=L,this.clip("nonzero");const O=this.svgFactory.createElement("svg:image");O.setAttributeNS(b,"xlink:href",x),O.setAttributeNS(null,"x","0"),O.setAttributeNS(null,"y",s(-E)),O.setAttributeNS(null,"width",s(e)+"px"),O.setAttributeNS(null,"height",s(E)+"px"),O.setAttributeNS(null,"transform",`scale(${s(1/e)} ${s(-1/E)})`),r?r.append(O):this._ensureTransformGroup().append(O)}paintImageMaskXObject(n){const r=this.current,e=n.width,E=n.height,x=r.fillColor;r.maskId=`mask${g++}`;const L=this.svgFactory.createElement("svg:mask");L.setAttributeNS(null,"id",r.maskId);const O=this.svgFactory.createElement("svg:rect");O.setAttributeNS(null,"x","0"),O.setAttributeNS(null,"y","0"),O.setAttributeNS(null,"width",s(e)),O.setAttributeNS(null,"height",s(E)),O.setAttributeNS(null,"fill",x),O.setAttributeNS(null,"mask",`url(#${r.maskId})`),this.defs.append(L),this._ensureTransformGroup().append(O),this.paintInlineImageXObject(n,L)}paintFormXObjectBegin(n,r){if(Array.isArray(n)&&n.length===6&&this.transform(n[0],n[1],n[2],n[3],n[4],n[5]),r){const e=r[2]-r[0],E=r[3]-r[1],x=this.svgFactory.createElement("svg:rect");x.setAttributeNS(null,"x",r[0]),x.setAttributeNS(null,"y",r[1]),x.setAttributeNS(null,"width",s(e)),x.setAttributeNS(null,"height",s(E)),this.current.element=x,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(n){const r=this.svgFactory.create(n.width,n.height),e=this.svgFactory.createElement("svg:defs");r.append(e),this.defs=e;const E=this.svgFactory.createElement("svg:g");return E.setAttributeNS(null,"transform",o(n.transform)),r.append(E),this.svg=E,r}_ensureClipGroup(){if(!this.current.clipGroup){const n=this.svgFactory.createElement("svg:g");n.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(n),this.current.clipGroup=n}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",o(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PDFNodeStream=void 0;var f=A(1),_=A(33);const V=require$$0,q=require$$0,Y=require$$0,M=require$$0,b=/^file:\/\/\/[a-zA-Z]:\//;function w(g){const l=M.parse(g);return l.protocol==="file:"||l.host?l:/^[a-z]:[/\\]/i.test(g)?M.parse(`file:///${g}`):(l.host||(l.protocol="file:"),l)}class P{constructor(l){this.source=l,this.url=w(l.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&l.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new o(this):new t(this),this._fullRequestReader}getRangeReader(l,n){if(n<=this._progressiveDataLength)return null;const r=this.isFsUrl?new v(this,l,n):new s(this,l,n);return this._rangeRequestReaders.push(r),r}cancelAllRequests(l){this._fullRequestReader&&this._fullRequestReader.cancel(l);for(const n of this._rangeRequestReaders.slice(0))n.cancel(l)}}a.PDFNodeStream=P;class F{constructor(l){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null;const n=l.source;this._contentLength=n.length,this._loaded=0,this._filename=null,this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange,this._readableStream=null,this._readCapability=(0,f.createPromiseCapability)(),this._headersCapability=(0,f.createPromiseCapability)()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const l=this._readableStream.read();return l===null?(this._readCapability=(0,f.createPromiseCapability)(),this.read()):(this._loaded+=l.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(l).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",n=>{this._error(n)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new f.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class S{constructor(l){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,f.createPromiseCapability)();const n=l.source;this._isStreamingSupported=!n.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const l=this._readableStream.read();return l===null?(this._readCapability=(0,f.createPromiseCapability)(),this.read()):(this._loaded+=l.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(l).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",n=>{this._error(n)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function c(g,l){return{protocol:g.protocol,auth:g.auth,host:g.hostname,port:g.port,path:g.path,method:"GET",headers:l}}class t extends F{constructor(l){super(l);const n=r=>{if(r.statusCode===404){const L=new f.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=L,this._headersCapability.reject(L);return}this._headersCapability.resolve(),this._setReadableStream(r);const e=L=>this._readableStream.headers[L.toLowerCase()],{allowRangeRequests:E,suggestedLength:x}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:l.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=E,this._contentLength=x||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(e)};this._request=null,this._url.protocol==="http:"?this._request=q.request(c(this._url,l.httpHeaders),n):this._request=Y.request(c(this._url,l.httpHeaders),n),this._request.on("error",r=>{this._storedError=r,this._headersCapability.reject(r)}),this._request.end()}}class s extends S{constructor(l,n,r){super(l),this._httpHeaders={};for(const E in l.httpHeaders){const x=l.httpHeaders[E];typeof x>"u"||(this._httpHeaders[E]=x)}this._httpHeaders.Range=`bytes=${n}-${r-1}`;const e=E=>{if(E.statusCode===404){const x=new f.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=x;return}this._setReadableStream(E)};this._request=null,this._url.protocol==="http:"?this._request=q.request(c(this._url,this._httpHeaders),e):this._request=Y.request(c(this._url,this._httpHeaders),e),this._request.on("error",E=>{this._storedError=E}),this._request.end()}}class o extends F{constructor(l){super(l);let n=decodeURIComponent(this._url.path);b.test(this._url.href)&&(n=n.replace(/^\//,"")),V.lstat(n,(r,e)=>{if(r){r.code==="ENOENT"&&(r=new f.MissingPDFException(`Missing PDF "${n}".`)),this._storedError=r,this._headersCapability.reject(r);return}this._contentLength=e.size,this._setReadableStream(V.createReadStream(n)),this._headersCapability.resolve()})}}class v extends S{constructor(l,n,r){super(l);let e=decodeURIComponent(this._url.path);b.test(this._url.href)&&(e=e.replace(/^\//,"")),this._setReadableStream(V.createReadStream(e,{start:n,end:r-1}))}}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createResponseStatusError=M,a.extractFilenameFromHeader=Y,a.validateRangeRequestCapabilities=q,a.validateResponseStatus=b;var f=A(1),_=A(34),V=A(8);function q({getResponseHeader:w,isHttp:P,rangeChunkSize:F,disableRange:S}){const c={allowRangeRequests:!1,suggestedLength:void 0},t=parseInt(w("Content-Length"),10);return!Number.isInteger(t)||(c.suggestedLength=t,t<=2*F)||S||!P||w("Accept-Ranges")!=="bytes"||(w("Content-Encoding")||"identity")!=="identity"||(c.allowRangeRequests=!0),c}function Y(w){const P=w("Content-Disposition");if(P){let F=(0,_.getFilenameFromContentDispositionHeader)(P);if(F.includes("%"))try{F=decodeURIComponent(F)}catch{}if((0,V.isPdfFile)(F))return F}return null}function M(w,P){return w===404||w===0&&P.startsWith("file:")?new f.MissingPDFException('Missing PDF "'+P+'".'):new f.UnexpectedResponseException(`Unexpected server response (${w}) while retrieving PDF "${P}".`,w)}function b(w){return w===200||w===206}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getFilenameFromContentDispositionHeader=_;var f=A(1);function _(V){let q=!0,Y=M("filename\\*","i").exec(V);if(Y){Y=Y[1];let t=F(Y);return t=unescape(t),t=S(t),t=c(t),w(t)}if(Y=P(V),Y){const t=c(Y);return w(t)}if(Y=M("filename","i").exec(V),Y){Y=Y[1];let t=F(Y);return t=c(t),w(t)}function M(t,s){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',s)}function b(t,s){if(t){if(!/^[\x00-\xFF]+$/.test(s))return s;try{const o=new TextDecoder(t,{fatal:!0}),v=(0,f.stringToBytes)(s);s=o.decode(v),q=!1}catch{}}return s}function w(t){return q&&/[\x80-\xff]/.test(t)&&(t=b("utf-8",t),q&&(t=b("iso-8859-1",t))),t}function P(t){const s=[];let o;const v=M("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(o=v.exec(t))!==null;){let[,l,n,r]=o;if(l=parseInt(l,10),l in s){if(l===0)break;continue}s[l]=[n,r]}const g=[];for(let l=0;l<s.length&&l in s;++l){let[n,r]=s[l];r=F(r),n&&(r=unescape(r),l===0&&(r=S(r))),g.push(r)}return g.join("")}function F(t){if(t.startsWith('"')){const s=t.slice(1).split('\\"');for(let o=0;o<s.length;++o){const v=s[o].indexOf('"');v!==-1&&(s[o]=s[o].slice(0,v),s.length=o+1),s[o]=s[o].replace(/\\(.)/g,"$1")}t=s.join('"')}return t}function S(t){const s=t.indexOf("'");if(s===-1)return t;const o=t.slice(0,s),g=t.slice(s+1).replace(/^[^']*'/,"");return b(o,g)}function c(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(s,o,v,g){if(v==="q"||v==="Q")return g=g.replace(/_/g," "),g=g.replace(/=([0-9a-fA-F]{2})/g,function(l,n){return String.fromCharCode(parseInt(n,16))}),b(o,g);try{g=atob(g)}catch{}return b(o,g)})}return""}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PDFNetworkStream=void 0;var f=A(1),_=A(33);const V=200,q=206;function Y(F){const S=F.response;return typeof S!="string"?S:(0,f.stringToBytes)(S).buffer}class M{constructor(S,c={}){this.url=S,this.isHttp=/^https?:/i.test(S),this.httpHeaders=this.isHttp&&c.httpHeaders||Object.create(null),this.withCredentials=c.withCredentials||!1,this.getXhr=c.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(S,c,t){const s={begin:S,end:c};for(const o in t)s[o]=t[o];return this.request(s)}requestFull(S){return this.request(S)}request(S){const c=this.getXhr(),t=this.currXhrId++,s=this.pendingRequests[t]={xhr:c};c.open("GET",this.url),c.withCredentials=this.withCredentials;for(const o in this.httpHeaders){const v=this.httpHeaders[o];typeof v>"u"||c.setRequestHeader(o,v)}return this.isHttp&&"begin"in S&&"end"in S?(c.setRequestHeader("Range",`bytes=${S.begin}-${S.end-1}`),s.expectedStatus=q):s.expectedStatus=V,c.responseType="arraybuffer",S.onError&&(c.onerror=function(o){S.onError(c.status)}),c.onreadystatechange=this.onStateChange.bind(this,t),c.onprogress=this.onProgress.bind(this,t),s.onHeadersReceived=S.onHeadersReceived,s.onDone=S.onDone,s.onError=S.onError,s.onProgress=S.onProgress,c.send(null),t}onProgress(S,c){var s;const t=this.pendingRequests[S];t&&((s=t.onProgress)==null||s.call(t,c))}onStateChange(S,c){var l,n,r;const t=this.pendingRequests[S];if(!t)return;const s=t.xhr;if(s.readyState>=2&&t.onHeadersReceived&&(t.onHeadersReceived(),delete t.onHeadersReceived),s.readyState!==4||!(S in this.pendingRequests))return;if(delete this.pendingRequests[S],s.status===0&&this.isHttp){(l=t.onError)==null||l.call(t,s.status);return}const o=s.status||V;if(!(o===V&&t.expectedStatus===q)&&o!==t.expectedStatus){(n=t.onError)==null||n.call(t,s.status);return}const g=Y(s);if(o===q){const e=s.getResponseHeader("Content-Range"),E=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);t.onDone({begin:parseInt(E[1],10),chunk:g})}else g?t.onDone({begin:0,chunk:g}):(r=t.onError)==null||r.call(t,s.status)}getRequestXhr(S){return this.pendingRequests[S].xhr}isPendingRequest(S){return S in this.pendingRequests}abortRequest(S){const c=this.pendingRequests[S].xhr;delete this.pendingRequests[S],c.abort()}}class b{constructor(S){this._source=S,this._manager=new M(S.url,{httpHeaders:S.httpHeaders,withCredentials:S.withCredentials}),this._rangeChunkSize=S.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(S){const c=this._rangeRequestReaders.indexOf(S);c>=0&&this._rangeRequestReaders.splice(c,1)}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new w(this._manager,this._source),this._fullRequestReader}getRangeReader(S,c){const t=new P(this._manager,S,c);return t.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(t),t}cancelAllRequests(S){var c;(c=this._fullRequestReader)==null||c.cancel(S);for(const t of this._rangeRequestReaders.slice(0))t.cancel(S)}}a.PDFNetworkStream=b;class w{constructor(S,c){this._manager=S;const t={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=c.url,this._fullRequestId=S.requestFull(t),this._headersReceivedCapability=(0,f.createPromiseCapability)(),this._disableRange=c.disableRange||!1,this._contentLength=c.length,this._rangeChunkSize=c.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const S=this._fullRequestId,c=this._manager.getRequestXhr(S),t=v=>c.getResponseHeader(v),{allowRangeRequests:s,suggestedLength:o}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(t),this._isRangeSupported&&this._manager.abortRequest(S),this._headersReceivedCapability.resolve()}_onDone(S){if(S&&(this._requests.length>0?this._requests.shift().resolve({value:S.chunk,done:!1}):this._cachedChunks.push(S.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(S){this._storedError=(0,_.createResponseStatusError)(S,this._url),this._headersReceivedCapability.reject(this._storedError);for(const c of this._requests)c.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(S){var c;(c=this.onProgress)==null||c.call(this,{loaded:S.loaded,total:S.lengthComputable?S.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const S=(0,f.createPromiseCapability)();return this._requests.push(S),S.promise}cancel(S){this._done=!0,this._headersReceivedCapability.reject(S);for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class P{constructor(S,c,t){this._manager=S;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=S.url,this._requestId=S.requestRange(c,t,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var S;(S=this.onClosed)==null||S.call(this,this)}_onDone(S){const c=S.chunk;this._requests.length>0?this._requests.shift().resolve({value:c,done:!1}):this._queuedChunk=c,this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(S){this._storedError=(0,_.createResponseStatusError)(S,this._url);for(const c of this._requests)c.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(S){var c;this.isStreamingSupported||(c=this.onProgress)==null||c.call(this,{loaded:S.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const c=this._queuedChunk;return this._queuedChunk=null,{value:c,done:!1}}if(this._done)return{value:void 0,done:!0};const S=(0,f.createPromiseCapability)();return this._requests.push(S),S.promise}cancel(S){this._done=!0;for(const c of this._requests)c.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PDFFetchStream=void 0;var f=A(1),_=A(33);function V(w,P,F){return{method:"GET",headers:w,signal:F.signal,mode:"cors",credentials:P?"include":"same-origin",redirect:"follow"}}function q(w){const P=new Headers;for(const F in w){const S=w[F];typeof S>"u"||P.append(F,S)}return P}class Y{constructor(P){this.source=P,this.isHttp=/^https?:/i.test(P.url),this.httpHeaders=this.isHttp&&P.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var P;return((P=this._fullRequestReader)==null?void 0:P._loaded)??0}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new M(this),this._fullRequestReader}getRangeReader(P,F){if(F<=this._progressiveDataLength)return null;const S=new b(this,P,F);return this._rangeRequestReaders.push(S),S}cancelAllRequests(P){this._fullRequestReader&&this._fullRequestReader.cancel(P);for(const F of this._rangeRequestReaders.slice(0))F.cancel(P)}}a.PDFFetchStream=Y;class M{constructor(P){this._stream=P,this._reader=null,this._loaded=0,this._filename=null;const F=P.source;this._withCredentials=F.withCredentials||!1,this._contentLength=F.length,this._headersCapability=(0,f.createPromiseCapability)(),this._disableRange=F.disableRange||!1,this._rangeChunkSize=F.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!F.disableStream,this._isRangeSupported=!F.disableRange,this._headers=q(this._stream.httpHeaders);const S=F.url;fetch(S,V(this._headers,this._withCredentials,this._abortController)).then(c=>{if(!(0,_.validateResponseStatus)(c.status))throw(0,_.createResponseStatusError)(c.status,S);this._reader=c.body.getReader(),this._headersCapability.resolve();const t=v=>c.headers.get(v),{allowRangeRequests:s,suggestedLength:o}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=o||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new f.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:P,done:F}=await this._reader.read();return F?{value:P,done:F}:(this._loaded+=P.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(P).buffer,done:!1})}cancel(P){this._reader&&this._reader.cancel(P),this._abortController.abort()}}class b{constructor(P,F,S){this._stream=P,this._reader=null,this._loaded=0;const c=P.source;this._withCredentials=c.withCredentials||!1,this._readCapability=(0,f.createPromiseCapability)(),this._isStreamingSupported=!c.disableStream,this._abortController=new AbortController,this._headers=q(this._stream.httpHeaders),this._headers.append("Range",`bytes=${F}-${S-1}`);const t=c.url;fetch(t,V(this._headers,this._withCredentials,this._abortController)).then(s=>{if(!(0,_.validateResponseStatus)(s.status))throw(0,_.createResponseStatusError)(s.status,t);this._readCapability.resolve(),this._reader=s.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:P,done:F}=await this._reader.read();return F?{value:P,done:F}:(this._loaded+=P.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(P).buffer,done:!1})}cancel(P){this._reader&&this._reader.cancel(P),this._abortController.abort()}}})],__webpack_module_cache__={};function __w_pdfjs_require__(m){var a=__webpack_module_cache__[m];if(a!==void 0)return a.exports;var A=__webpack_module_cache__[m]={exports:{}};return __webpack_modules__[m](A,A.exports,__w_pdfjs_require__),A.exports}var __webpack_exports__={};return(()=>{var m=__webpack_exports__;Object.defineProperty(m,"__esModule",{value:!0}),Object.defineProperty(m,"AnnotationEditorLayer",{enumerable:!0,get:function(){return _.AnnotationEditorLayer}}),Object.defineProperty(m,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return a.AnnotationEditorParamsType}}),Object.defineProperty(m,"AnnotationEditorType",{enumerable:!0,get:function(){return a.AnnotationEditorType}}),Object.defineProperty(m,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return V.AnnotationEditorUIManager}}),Object.defineProperty(m,"AnnotationLayer",{enumerable:!0,get:function(){return q.AnnotationLayer}}),Object.defineProperty(m,"AnnotationMode",{enumerable:!0,get:function(){return a.AnnotationMode}}),Object.defineProperty(m,"CMapCompressionType",{enumerable:!0,get:function(){return a.CMapCompressionType}}),Object.defineProperty(m,"GlobalWorkerOptions",{enumerable:!0,get:function(){return Y.GlobalWorkerOptions}}),Object.defineProperty(m,"InvalidPDFException",{enumerable:!0,get:function(){return a.InvalidPDFException}}),Object.defineProperty(m,"LoopbackPort",{enumerable:!0,get:function(){return A.LoopbackPort}}),Object.defineProperty(m,"MissingPDFException",{enumerable:!0,get:function(){return a.MissingPDFException}}),Object.defineProperty(m,"OPS",{enumerable:!0,get:function(){return a.OPS}}),Object.defineProperty(m,"PDFDataRangeTransport",{enumerable:!0,get:function(){return A.PDFDataRangeTransport}}),Object.defineProperty(m,"PDFDateString",{enumerable:!0,get:function(){return f.PDFDateString}}),Object.defineProperty(m,"PDFWorker",{enumerable:!0,get:function(){return A.PDFWorker}}),Object.defineProperty(m,"PasswordResponses",{enumerable:!0,get:function(){return a.PasswordResponses}}),Object.defineProperty(m,"PermissionFlag",{enumerable:!0,get:function(){return a.PermissionFlag}}),Object.defineProperty(m,"PixelsPerInch",{enumerable:!0,get:function(){return f.PixelsPerInch}}),Object.defineProperty(m,"RenderingCancelledException",{enumerable:!0,get:function(){return f.RenderingCancelledException}}),Object.defineProperty(m,"SVGGraphics",{enumerable:!0,get:function(){return w.SVGGraphics}}),Object.defineProperty(m,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return a.UNSUPPORTED_FEATURES}}),Object.defineProperty(m,"UnexpectedResponseException",{enumerable:!0,get:function(){return a.UnexpectedResponseException}}),Object.defineProperty(m,"Util",{enumerable:!0,get:function(){return a.Util}}),Object.defineProperty(m,"VerbosityLevel",{enumerable:!0,get:function(){return a.VerbosityLevel}}),Object.defineProperty(m,"XfaLayer",{enumerable:!0,get:function(){return P.XfaLayer}}),Object.defineProperty(m,"build",{enumerable:!0,get:function(){return A.build}}),Object.defineProperty(m,"createPromiseCapability",{enumerable:!0,get:function(){return a.createPromiseCapability}}),Object.defineProperty(m,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return a.createValidAbsoluteUrl}}),Object.defineProperty(m,"getDocument",{enumerable:!0,get:function(){return A.getDocument}}),Object.defineProperty(m,"getFilenameFromUrl",{enumerable:!0,get:function(){return f.getFilenameFromUrl}}),Object.defineProperty(m,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return f.getPdfFilenameFromUrl}}),Object.defineProperty(m,"getXfaPageViewport",{enumerable:!0,get:function(){return f.getXfaPageViewport}}),Object.defineProperty(m,"isPdfFile",{enumerable:!0,get:function(){return f.isPdfFile}}),Object.defineProperty(m,"loadScript",{enumerable:!0,get:function(){return f.loadScript}}),Object.defineProperty(m,"renderTextLayer",{enumerable:!0,get:function(){return b.renderTextLayer}}),Object.defineProperty(m,"shadow",{enumerable:!0,get:function(){return a.shadow}}),Object.defineProperty(m,"version",{enumerable:!0,get:function(){return A.version}});var a=__w_pdfjs_require__(1),A=__w_pdfjs_require__(4),f=__w_pdfjs_require__(8),_=__w_pdfjs_require__(22),V=__w_pdfjs_require__(7),q=__w_pdfjs_require__(27),Y=__w_pdfjs_require__(15),M=__w_pdfjs_require__(3),b=__w_pdfjs_require__(30),w=__w_pdfjs_require__(31),P=__w_pdfjs_require__(29);if(M.isNodeJS){const{PDFNodeStream:F}=__w_pdfjs_require__(32);(0,A.setPDFNetworkStreamFactory)(S=>new F(S))}else{const{PDFNetworkStream:F}=__w_pdfjs_require__(35),{PDFFetchStream:S}=__w_pdfjs_require__(36);(0,A.setPDFNetworkStreamFactory)(c=>(0,f.isValidFetchUrl)(c.url)?new S(c):new F(c))}})(),__webpack_exports__})())})(pdf)),pdf.exports}var pdfExports=requirePdf();const De="#FFEB3B",Be=()=>`annotation_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,ke=({pageNumber:m,scale:a,isAnnotating:A,annotations:f=[],onAnnotationAdd:_,onAnnotationDelete:V,readOnly:q=!1})=>{const Y=useRef(null),[M,b]=useState(!1),[w,P]=useState({x:0,y:0}),[F,S]=useState(null),[c,t]=useState(null),s=useCallback(l=>{if(!A||!Y.current)return;const n=Y.current.getBoundingClientRect(),r=(l.clientX-n.left)/n.width,e=(l.clientY-n.top)/n.height;console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:",{clientX:l.clientX,clientY:l.clientY,rect:n,x:r,y:e,scale:a}),b(!0),P({x:r,y:e})},[A,a]),o=useCallback(l=>{if(!M||!Y.current)return;const n=Y.current.getBoundingClientRect(),r=(l.clientX-n.left)/n.width,e=(l.clientY-n.top)/n.height;S({x:Math.min(w.x,r),y:Math.min(w.y,e),width:Math.abs(r-w.x),height:Math.abs(e-w.y)})},[M,w,a]),v=useCallback(()=>{if(!M||!F)return;if(b(!1),F.width<5||F.height<5){S(null);return}const l={id:Be(),pageNumber:m,...F,content:"",color:De};_==null||_(l),S(null)},[M,F,m,_]),g=useCallback(l=>{t(c===l?null:l)},[c]);return useCallback((l,n)=>{const r={...l,content:n};_==null||_(r)},[_]),useCallback(l=>{V==null||V(l),t(null)},[V]),console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:",{pageNumber:m,annotations:f.length,currentPageAnnotationsCount:f.filter(l=>l.pageNumber===m).length,currentPageAnnotations:f.filter(l=>l.pageNumber===m)}),React__default.createElement("div",{ref:Y,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10,pointerEvents:"auto"},onMouseDown:s,onMouseMove:o,onMouseUp:v,onMouseLeave:v},F&&React__default.createElement("div",{className:"absolute border-2 border-yellow-400 bg-yellow-100/30",style:{left:`${F.x*100}%`,top:`${F.y*100}%`,width:`${F.width*100}%`,height:`${F.height*100}%`}}),f.filter(l=>l.pageNumber===m).map(l=>(console.log("\u6E32\u67D3\u6807\u6CE8:",l.id,`\u4F4D\u7F6E: ${l.x*100}%, ${l.y*100}%`),React__default.createElement("div",{key:l.id,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0}},React__default.createElement("div",{className:"border border-solid",style:{position:"absolute",left:`${l.x*100}%`,top:`${l.y*100}%`,width:`${l.width*100}%`,height:`${l.height*100}%`,borderWidth:"2px",borderColor:`${l.color}`,backgroundColor:`${l.color}4D`,zIndex:1e3},onClick:()=>g(l.id)})))))},Ae={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},$e=dt$1.div`
|
|
43
|
-
display: flex;
|
|
44
|
-
align-items: center;
|
|
45
|
-
justify-content: center;
|
|
46
|
-
height: 200px;
|
|
47
|
-
color: ${m=>m.$theme.colors.disabledText};
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
`,Pe=dt$1.div`
|
|
50
|
-
display: flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
justify-content: center;
|
|
53
|
-
height: 200px;
|
|
54
|
-
color: ${m=>m.$theme.colors.error};
|
|
55
|
-
font-size: 14px;
|
|
56
|
-
text-align: center;
|
|
57
|
-
`,Te=({pdfDocument:m,currentPage:a,pdfStartPage:A=1,scale:f,annotations:_,isAnnotating:V,isSlidesMode:q=!1,setScale:Y,onScaleChange:M,onAnnotationChange:b,onAnnotationDelete:w,styles:P})=>{const[F,S]=useState(!1),[c,t]=useState(null),[s,o]=useState(null),[v,g]=useState(!0),l=(P==null?void 0:P.theme)||Ae,n=useRef(null),r=useRef(null),e=useRef(!1),E=useRef(null),x=useCallback(St=>{if(!r.current||!v||!M)return null;const pt=r.current,K=pt.offsetWidth-40,N=pt.offsetHeight-40,U=K/St.width,G=N/St.height,bt=Math.min(U,G,1),wt=Math.max(.3,Math.min(1,bt));return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:",{containerWidth:K,containerHeight:N,viewportWidth:St.width,viewportHeight:St.height,scaleX:U,scaleY:G,autoScale:bt,finalScale:wt}),wt},[v,M]),L=useCallback(async()=>{if(!(!m||!n.current)){if(e.current||E.current===a){console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");return}try{E.current=a,e.current=!0;const St=a-A+1;if(console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${A}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${a}, \u76F8\u5BF9\u9875\u7801=${St}`),St<1||St>m.numPages)throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${St}, PDF\u603B\u9875\u6570=${m.numPages}`),new Error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${a}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${m.numPages}\u9875`);const pt=await m.getPage(St),K=n.current,N=K.getContext("2d");console.log("\u5F53\u524Dscale\u503C:",f);const U=pt.getViewport({scale:1});if(console.log("viewport\u5C3A\u5BF8:",U.width,"x",U.height),v&&g(!1),K.width=U.width,K.height=U.height,K.width&&K.height&&o({width:K.width,height:K.height}),await pt.render({canvasContext:N,viewport:U}).promise,console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:",K.width,"x",K.height),r.current){const G=r.current;console.log("\u5BB9\u5668\u5C3A\u5BF8:",G.offsetWidth,"x",G.offsetHeight),console.log("Canvas\u663E\u793A\u5C3A\u5BF8:",K.offsetWidth,"x",K.offsetHeight)}}catch(St){console.error("PDF\u6E32\u67D3\u5931\u8D25:",St)}finally{e.current=!1}}},[m,f,A,x,M,a]);if(useEffect(()=>{m&&a&&A&&(console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:","pdfStartPage:"+A,"currentPage:"+a,"pdfDocument:",m),L())},[a,m,A]),useEffect(()=>{m&&a&&L()},[f,m,a]),F)return React__default.createElement("div",{className:"flex justify-center items-center min-h-full"},React__default.createElement($e,{$theme:l},"\u52A0\u8F7D\u4E2D..."));if(c)return React__default.createElement("div",{className:"flex justify-center items-center min-h-full"},React__default.createElement(Pe,{$theme:l},React__default.createElement("div",null,React__default.createElement("div",null,"\u52A0\u8F7D\u5931\u8D25"),React__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},c))));const O=useRef(null),yt=()=>{const St=r.current?r.current.offsetWidth-40:null;if(!St||!(s!=null&&s.width))return;const pt=s.width,K=+(St/pt).toFixed(2);typeof K=="number"?Y&&Y(K):(clearInterval(O.current),O.current=null)};return useEffect(()=>{if(!r.current||!(s!=null&&s.width)||!(s!=null&&s.height)){clearInterval(O.current),O.current=null,O.current=setInterval(()=>{yt()},34);return}else yt();return()=>{clearInterval(O.current),O.current=null}},[s]),React__default.createElement("div",{ref:r,className:"bg-gray-100",style:{display:q?"block":"flex",justifyContent:q?"initial":"center",alignItems:q?"initial":"flex-start",padding:"20px",minHeight:"100%",width:"100%",overflow:"visible"}},F?React__default.createElement("div",{className:"flex flex-col items-center gap-2 mt-20"},React__default.createElement("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900"}),React__default.createElement("div",{className:"text-xs text-gray-600"},"PDF\u52A0\u8F7D\u4E2D...")):c?React__default.createElement("div",{className:"flex flex-col items-center gap-2 mt-20 text-red-500"},React__default.createElement("div",null,"\u6E32\u67D3\u9519\u8BEF"),React__default.createElement("div",{className:"text-xs"},c)):React__default.createElement("div",{className:"flex justify-center items-start"},React__default.createElement("div",{className:"relative",style:{transform:`scale(${f})`,transformOrigin:"center",display:"inline-block"}},React__default.createElement("canvas",{ref:n,className:"shadow-lg bg-white border border-gray-300",style:{display:"block"}}),React__default.createElement(ke,{pageNumber:a,scale:f||1,isAnnotating:V,annotations:_,onAnnotationAdd:b,onAnnotationDelete:w,readOnly:!V}))))},_e=dt$1.div`
|
|
58
|
-
flex: 1;
|
|
59
|
-
background: ${m=>m.$theme.colors.background};
|
|
60
|
-
position: relative;
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
scroll-behavior: smooth;
|
|
64
|
-
|
|
65
|
-
min-height: 0; /* 确保flex子元素可以收缩 */
|
|
66
|
-
height: calc(100% - 1px); /* 明确的高度设置,减去header高度 */
|
|
67
|
-
/* 支持大尺寸内容的滚动 */
|
|
68
|
-
overflow-x: auto;
|
|
69
|
-
overflow-y: auto; /* 改为auto,允许垂直滚动 */
|
|
70
|
-
`,Re=dt$1.div`
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: center;
|
|
74
|
-
height: 100%;
|
|
75
|
-
color: ${m=>m.$theme.colors.disabledText};
|
|
76
|
-
`,Ne=dt$1.div`
|
|
77
|
-
display: flex;
|
|
78
|
-
flex-direction: column;
|
|
79
|
-
align-items: center;
|
|
80
|
-
justify-content: center;
|
|
81
|
-
height: 100%;
|
|
82
|
-
color: ${m=>m.$theme.colors.error};
|
|
83
|
-
text-align: center;
|
|
84
|
-
padding: 20px;
|
|
85
|
-
`,Le=`
|
|
86
|
-
.md-annotation {
|
|
87
|
-
position: relative;
|
|
88
|
-
display: inline;
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
transition: opacity 0.2s;
|
|
91
|
-
background-color: var(--highlight-color, #FFE599);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.md-annotation:hover {
|
|
95
|
-
opacity: 0.8;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/* \u8868\u683C\u6807\u6CE8\u6837\u5F0F */
|
|
99
|
-
.table-annotation {
|
|
100
|
-
background-color: var(--table-highlight-color, rgba(255, 229, 153, 0.5));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/* markdown_table\u6A21\u5F0F\u4E0B\u7684\u8868\u683C\u6837\u5F0F */
|
|
104
|
-
.markdown-table-mode table {
|
|
105
|
-
overflow: visible !important;
|
|
106
|
-
max-width: none !important;
|
|
107
|
-
width: auto !important;
|
|
108
|
-
table-layout: auto !important;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.markdown-table-mode table,
|
|
112
|
-
.markdown-table-mode table * {
|
|
113
|
-
overflow: visible !important;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.markdown-table-mode .table-container{
|
|
117
|
-
margin: 0 !important;
|
|
118
|
-
overflow: auto !important;
|
|
119
|
-
width: 100% !important;
|
|
120
|
-
min-width: 100% !important;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/* \u786E\u4FDD\u8868\u683C\u5355\u5143\u683C\u4E0D\u4F1A\u88AB\u538B\u7F29 */
|
|
124
|
-
.markdown-table-mode table td,
|
|
125
|
-
.markdown-table-mode table th {
|
|
126
|
-
white-space: nowrap !important;
|
|
127
|
-
min-width: 50px !important;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/* \u79FB\u9664fit-content\uFF0C\u4F7F\u7528100%\u5BBD\u5EA6\u786E\u4FDD\u5185\u5BB9\u80FD\u6B63\u5E38\u663E\u793A */
|
|
131
|
-
.markdown-table-mode div{
|
|
132
|
-
width: fit-content !important;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/* \u4E3A\u8868\u683C\u6DFB\u52A0\u6700\u5C0F\u5BBD\u5EA6\uFF0C\u786E\u4FDD\u5185\u5BB9\u4E0D\u88AB\u538B\u7F29 */
|
|
136
|
-
.markdown-table-mode table {
|
|
137
|
-
min-width: fit-content !important;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.markdown-table-mode.markdown-scrollbar::-webkit-scrollbar {
|
|
141
|
-
width: 12px;
|
|
142
|
-
height: 12px;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/* \u81EA\u5B9A\u4E49\u6EDA\u52A8\u6761\u6837\u5F0F */
|
|
147
|
-
.markdown-scrollbar::-webkit-scrollbar {
|
|
148
|
-
width: 8px;
|
|
149
|
-
height: 8px;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.markdown-scrollbar::-webkit-scrollbar-track {
|
|
153
|
-
background: #f1f1f1;
|
|
154
|
-
border-radius: 4px;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.markdown-scrollbar::-webkit-scrollbar-thumb {
|
|
158
|
-
background: #c1c1c1;
|
|
159
|
-
border-radius: 4px;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.markdown-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
163
|
-
background: #a9a9a;
|
|
164
|
-
}
|
|
165
|
-
`,ze={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},Se=m=>{if(console.log("=== detectFileType \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",m),!m)return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"),"unknown";const a=m.fileName||"",A=m.fileType||"",f=m.content;return console.log("\u68C0\u6D4B\u53C2\u6570:",{fileName:a,fileType:A,content:f}),A==="pdf"||A==="pdf_slides"?(console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"),A):A==="image"?(console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"),"image"):A==="markdown_table"?(console.log("\u68C0\u6D4B\u5230Markdown\u8868\u683C\u6587\u4EF6"),"markdown_table"):A==="markdown"?(console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"),"markdown"):A==="html"?(console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"),"html"):A==="text"?(console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"),"text"):a.toLowerCase().endsWith(".pdf")||(f==null?void 0:f.type)==="pdf"?(console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"),"pdf"):a.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)||(f==null?void 0:f.type)==="image"?(console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"),"image"):a.toLowerCase().endsWith(".md")||(f==null?void 0:f.type)==="markdown"?(console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"),"markdown"):a.toLowerCase().match(/\.(html|htm)$/)||(f==null?void 0:f.type)==="html"?(console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"),"html"):a.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/)||(f==null?void 0:f.type)==="text"?(console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"),"text"):(console.log("\u672A\u8BC6\u522B\u7684\u6587\u4EF6\u7C7B\u578B\uFF0C\u8FD4\u56DE unknown"),"unknown")},Me=(m,a,A=!1,f=void 0)=>{var _,V,q,Y,M,b,w;console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPdfContent:","pdfStartPage:"+m.pdfStartPage,"currentPage:"+a.currentPage),console.log("=== renderPdfContent \u5F00\u59CB ==="),console.log("PDF\u6570\u636E:",m),console.log("PDF\u6587\u6863:",(_=m.content)==null?void 0:_.document),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof((V=m.content)==null?void 0:V.document)),console.log("PDF\u6587\u6863\u662F\u5426\u4E3Anull:",((q=m.content)==null?void 0:q.document)===null),console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:",((Y=m.content)==null?void 0:Y.document)===void 0),console.log("PDF\u6587\u6863\u65B9\u6CD5:",(M=m.content)!=null&&M.document?Object.getOwnPropertyNames(Object.getPrototypeOf(m.content.document)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u5C5E\u6027:",(b=m.content)!=null&&b.document?Object.keys(m.content.document):"\u65E0\u6587\u6863");const P=m.pdfStartPage||1;console.log("PDF\u8D77\u59CB\u9875:",P);const F=(a.annotationData||[]).filter(t=>"pageNumber"in t&&"x"in t&&"y"in t);console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="),console.log("\u539F\u59CBannotationData:",a.annotationData),console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:",F);const S=A?.82:1,c=a.initialZoom||a.scale||S;return React__default.createElement(Te,{pdfDocument:((w=m.content)==null?void 0:w.document)||null,currentPage:a.currentPage||1,pdfStartPage:P,scale:c,setScale:f,annotations:F,isAnnotating:!1,isSlidesMode:A,onPageChange:a.eventsEmit?t=>{var s;return(s=a.eventsEmit)==null?void 0:s.call(a,"pageChange",{pageNumber:t})}:void 0,onScaleChange:a.eventsEmit?t=>{var s;return(s=a.eventsEmit)==null?void 0:s.call(a,"scaleChange",{scale:t})}:void 0,onAnnotationChange:a.eventsEmit?t=>{var s;return(s=a.eventsEmit)==null?void 0:s.call(a,"annotationChange",{annotation:t})}:void 0,onAnnotationDelete:a.eventsEmit?t=>{var s;return(s=a.eventsEmit)==null?void 0:s.call(a,"annotationDelete",{annotationId:t})}:void 0,styles:a.styles})},Ie=(m,a)=>{var A,f,_,V,q,Y,M,b,w,P,F,S,c,t;console.log("=== Fviewer renderImageContent ==="),console.log("data:",m),console.log("data.content:",m.content),console.log("data.content?.url:",(A=m.content)==null?void 0:A.url),console.log("rotation:",a.rotation);const s=((f=m.content)==null?void 0:f.url)||m.content,[o,v]=useState(!0),[g,l]=useState(!1),n=()=>{console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:",s),v(!1),l(!1)},r=()=>{console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",s),v(!1),l(!0)};return React__default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",padding:"20px",overflow:"auto",position:"relative",backgroundColor:"#272727"}},o&&React__default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",zIndex:1}},React__default.createElement("div",{style:{width:"32px",height:"32px",border:`3px solid ${((q=(V=(_=a.styles)==null?void 0:_.theme)==null?void 0:V.colors)==null?void 0:q.border)||"#dee2e6"}`,borderTop:`3px solid ${((b=(M=(Y=a.styles)==null?void 0:Y.theme)==null?void 0:M.colors)==null?void 0:b.primary)||"#007bff"}`,borderRadius:"50%",animation:"spin 1s linear infinite"}}),React__default.createElement("div",{style:{fontSize:"12px",color:((F=(P=(w=a.styles)==null?void 0:w.theme)==null?void 0:P.colors)==null?void 0:F.text)||"#343a40"}},"\u56FE\u7247\u52A0\u8F7D\u4E2D...")),g&&React__default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",zIndex:1}},React__default.createElement("div",{style:{fontSize:"14px",color:((t=(c=(S=a.styles)==null?void 0:S.theme)==null?void 0:c.colors)==null?void 0:t.error)||"#dc3545"}},"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")),React__default.createElement("img",{src:s,alt:m.fileName||"\u56FE\u7247",onLoad:n,onError:r,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",transform:`scale(${a.scale||1}) rotate(${a.rotation||0}deg)`,opacity:o?0:1,transition:"opacity 0.3s ease-in-out, transform 0.2s ease-in-out"}}),React__default.createElement("style",null,`
|
|
166
|
-
@keyframes spin {
|
|
167
|
-
0% { transform: rotate(0deg); }
|
|
168
|
-
100% { transform: rotate(360deg); }
|
|
169
|
-
}
|
|
170
|
-
`))},We=(m,a)=>{var A,f,_,V,q;console.log("=== Fviewer renderTextContent ==="),console.log("data:",m),console.log("data.content:",m.content);let Y="";typeof m.content=="string"?Y=m.content:(A=m.content)!=null&&A.text?Y=m.content.text:(f=m.content)!=null&&f.content&&(Y=m.content.content),console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:",Y);const M=useRef(null),b=useRef(null);return useEffect(()=>{if(M.current&&b.current&&Y){const w=setTimeout(()=>{var P;const F=((P=M.current)==null?void 0:P.scrollHeight)||0,S=Math.max(F+80,200);b.current&&(b.current.style.minHeight=`${S}px`,console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:",S))},100);return()=>clearTimeout(w)}},[Y]),React__default.createElement("div",{style:{height:"100%",overflow:"auto",backgroundColor:"#f5f5f5",padding:"20px",display:"flex",justifyContent:"center",position:"relative"}},React__default.createElement("div",{ref:b,style:{width:"100%",maxWidth:"800px",backgroundColor:"white",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",borderRadius:"8px",padding:"40px",margin:"20px 0",position:"relative",transform:`scale(${a.scale||1})`,transition:"transform 0.2s ease-in-out",transformOrigin:"top center"}},React__default.createElement("div",{ref:M,style:{width:"100%",overflow:"visible"}},React__default.createElement(Hv,{dataSource:{type:la.TEXT,content:Y},size:"md",theme:{primaryColor:((q=(V=(_=a.styles)==null?void 0:_.theme)==null?void 0:V.colors)==null?void 0:q.primary)||"#007bff",backgroundColor:"transparent",textColor:"#333",borderColor:"transparent",borderRadius:"0",padding:"0"},style:{border:"none",background:"transparent",width:"100%",height:"auto",overflow:"visible"}})),React__default.createElement("div",{style:{position:"absolute",top:"0",left:"0",right:"0",height:"2px",background:"linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}})))},je=({data:m,parentProps:a,isTableMode:A=!1})=>{var f,_,V,q,Y,M,b,w,P,F,S,c;const t=useRef(null),s=useRef(null),o=useRef(null),v=useRef(!1);useRef(0),useRef(null);const[g]=useState(!1),l=(N,U)=>{console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="),console.log("\u6EDA\u52A8\u4F4D\u7F6E:",{scrollTop:N,scrollHeight:U}),a.eventsEmit&&a.eventsEmit("markdown_scroll",{scrollTop:N,scrollHeight:U})},n=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_top")},r=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_bottom")},e=useRef();e.current=N=>{var U,G;try{if(!A)return;const bt=typeof m.content=="string"?m.content:((U=m.content)==null?void 0:U.content)||"";if(!bt||O.length===0)return;const wt=JSON.stringify(O.map(H=>({o:H.offsets,c:H.color}))),Mt=`${bt.length}:${bt.substring(0,64)}:${bt.substring(bt.length-64)}|${wt}`;if(((G=N.dataset)==null?void 0:G.tableAnnoRuntimeSig)===Mt)return;setTimeout(()=>{pt(),N.dataset&&(N.dataset.tableAnnoRuntimeSig=Mt)},50)}catch(bt){console.warn("[MarkdownRendered] apply failed",bt)}};const E=React__default.useCallback(N=>{var U;return(U=e.current)==null?void 0:U.call(e,N)},[]),x=useCallback(()=>{var N;if(!g||!t.current)return;const U=window.getSelection();if(!U||U.isCollapsed)return;const G=U.getRangeAt(0),bt=G.toString().trim();if(!bt)return;const wt=t.current;let Mt=0,H=0;const h=document.createTreeWalker(wt,NodeFilter.SHOW_TEXT,{acceptNode:I=>{var $;return($=I.parentElement)!=null&&$.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let u=h.nextNode();for(;u;){if(u===G.startContainer){H=Mt+G.startOffset;break}Mt+=((N=u.textContent)==null?void 0:N.length)||0,u=h.nextNode()}console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:",{text:bt,startOffset:H,charCount:Mt,container:G.startContainer.textContent});const T={id:`md-anno-${Date.now()}`,start:H,end:H+bt.length,color:"#FFE599"};console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",T),a.eventsEmit&&a.eventsEmit("md_annotation_add",T),U.removeAllRanges()},[g,a.eventsEmit]),L=A?[]:(a.annotationData||[]).filter(N=>"start"in N&&"end"in N&&!("pageNumber"in N)),O=A?(a.annotationData||[]).filter(N=>"offsets"in N&&Array.isArray(N.offsets)):[],yt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");return}const N=t.current.querySelectorAll(".md-annotation");console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",N.length),N.length>0&&N.forEach(U=>{const G=U.parentNode;G&&G.replaceChild(document.createTextNode(U.textContent||""),U)}),console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A")},[]),St=useCallback(()=>{t.current&&(t.current.querySelectorAll("table").forEach(N=>{Array.from(N.rows).forEach(U=>{Array.from(U.cells).forEach(G=>{G.getAttribute("data-table-annotated")==="1"&&(G.style.removeProperty("background"),G.style.removeProperty("background-color"),G.removeAttribute("data-table-annotated"),G.removeAttribute("title"))})})}),console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8"))},[]),pt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="),console.log("tableAnnotations:",O),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");return}if(St(),!O.length){console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");return}const N=t.current.querySelectorAll("table");if(console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",N.length),N.length===0){console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");return}v.current=!0,O.forEach((U,G)=>{const bt=U.offsets;if(console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",U),!Array.isArray(bt)||!bt.length||!Array.isArray(bt[0])||bt[0].length!==2){console.warn("[TableAnnotation] annotation.offsets is not valid",U);return}bt.forEach((wt,Mt)=>{const[H,h]=wt;if(typeof H!="number"||typeof h!="number"){console.warn("[TableAnnotation] offset is not [number, number]",wt);return}N.forEach((u,T)=>{var I;const $=Array.from(u.rows),W=$[H];if(!W){console.warn("[TableAnnotation] row out of range",{row:H,tableIndex:T,totalRows:$.length});return}const i=(I=W.cells)==null?void 0:I[h];if(!i){console.warn("[TableAnnotation] cell is undefined",{row:H,col:h,tableIndex:T});return}const d=U.color||"rgba(255, 229, 153, 0.5)",C=getComputedStyle(i).backgroundColor;i.getAttribute("data-table-annotated")==="1"&&(C===d||i.style.backgroundColor===d)||(i.style.setProperty("background",d,"important"),i.style.setProperty("background-color",d,"important"),i.setAttribute("data-table-annotated","1")),U.content&&(i.title=U.content),Mt===0&&G===0&&setTimeout(()=>{i.scrollIntoView({behavior:"smooth",block:"start"})},300)})})}),requestAnimationFrame(()=>{v.current=!1})},[O,St]),K=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="),!t.current||!L.length){console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}s.current&&clearTimeout(s.current);const N=()=>{var U;console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");const G=(U=t.current)==null?void 0:U.querySelectorAll(".md-annotation");console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:",(G==null?void 0:G.length)||0),G==null||G.forEach(T=>{const I=T.parentNode;I&&I.replaceChild(document.createTextNode(T.textContent||""),T)});const bt=document.createTreeWalker(t.current,NodeFilter.SHOW_TEXT,{acceptNode:T=>{var I;return(I=T.parentElement)!=null&&I.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),wt=[];let Mt;for(;Mt=bt.nextNode();)wt.push(Mt);if(console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",wt.length),wt.length===0){console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),s.current=setTimeout(()=>{N()},200);return}let H=0;const h=wt.map(T=>{var I;const $=H;return H+=((I=T.textContent)==null?void 0:I.length)||0,{node:T,start:$,end:H,text:T.textContent}});console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",h),console.log("\u603B\u6587\u672C\u957F\u5EA6:",H);const u=[...L].sort((T,I)=>I.start-T.start);console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",u),u.forEach(T=>{const{start:I,end:$,color:W}=T;console.log("\u5904\u7406\u6807\u6CE8:",{annotation:T,nodePositions:h});const i=h.filter(d=>I<d.end&&$>d.start);console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",i.length),i.forEach(({node:d,start:C})=>{var y,k,j,D,p,B;const _t=Math.max(0,I-C),z=Math.min(((y=d.textContent)==null?void 0:y.length)||0,$-C);if(console.log("\u672C\u5730\u4F4D\u7F6E:",{localStart:_t,localEnd:z,nodeTextLength:(k=d.textContent)==null?void 0:k.length}),_t>=z){console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");return}const Q=((j=d.textContent)==null?void 0:j.slice(0,_t))||"",At=((D=d.textContent)==null?void 0:D.slice(_t,z))||"",kt=((p=d.textContent)==null?void 0:p.slice(z))||"";console.log("\u5206\u5272\u6587\u672C:",{before:Q,annotatedText:At,after:kt});const Rt=document.createElement("span");Rt.className="md-annotation",Rt.style.backgroundColor=W||"#FFE599",Rt.textContent=At;const xt=document.createDocumentFragment();Q&&xt.appendChild(document.createTextNode(Q)),xt.appendChild(Rt),kt&&xt.appendChild(document.createTextNode(kt)),(B=d.parentNode)==null||B.replaceChild(xt,d),console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:",At)})})};s.current=setTimeout(()=>{N()},100)},[L]);return useEffect(()=>{var N;if(A){console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");return}const U=typeof m.content=="string"?m.content:((N=m.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="),console.log("markdownRef.current:",t.current),console.log("isTableMode:",A),console.log("mdAnnotations:",L),console.log("tableAnnotations:",O),console.log("data.content:",m.content),console.log("\u5B9E\u9645\u5185\u5BB9:",U),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");return}if(A||yt(),!A&&L.length>0){K();return}console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8")},[A,O,L]),useEffect(()=>{if(!A)return document.addEventListener("mouseup",x),()=>{document.removeEventListener("mouseup",x)}},[x,A]),useEffect(()=>{var N;const U=typeof m.content=="string"?m.content:((N=m.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");return}console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="),console.log("isTableMode:",A),console.log("\u5185\u5BB9\u957F\u5EA6:",U.length||0),typeof U=="string"?(console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:",U.substring(0,100)),console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:",U.substring(U.length-100))):(console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:",typeof U),console.log("\u5185\u5BB9\u503C:",U)),console.log("\u6807\u6CE8\u6570\u636E:",L),console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:",O)},[L,O,A]),useEffect(()=>{if(A&&t.current){const N=setTimeout(()=>{var U;const G=(U=t.current)==null?void 0:U.querySelectorAll("table");G&&G.length>0&&(console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:",G.length),G.forEach((bt,wt)=>{if(bt instanceof HTMLTableElement){bt.style.width="100%",bt.style.minWidth="100%",bt.style.tableLayout="auto";const Mt=bt.closest(".markdown-table-mode");Mt&&Mt instanceof HTMLElement&&(Mt.style.width="100%",Mt.style.overflowX="auto"),console.log(`\u8868\u683C ${wt+1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`)}}))},500);return()=>clearTimeout(N)}},[A,m.content]),useEffect(()=>()=>{s.current&&clearTimeout(s.current),o.current&&(o.current.disconnect(),o.current=null)},[]),React__default.createElement("div",{style:{height:"100%",width:"100%",overflow:"auto"},className:`markdown-container markdown-scrollbar ${A?"markdown-table-mode":""}`},React__default.createElement("style",null,Le),React__default.createElement("div",{ref:t},React__default.createElement(Hv,{dataSource:{type:la.MARKDOWN,content:(()=>{var N,U;return typeof m.content=="string"?m.content:(N=m.content)!=null&&N.text?m.content.text:(U=m.content)!=null&&U.content?m.content.content:""})()},size:"md",onScroll:A?void 0:l,onScrollToTop:A?void 0:n,onScrollToBottom:A?void 0:r,onRendered:E,theme:{primaryColor:((V=(_=(f=a.styles)==null?void 0:f.theme)==null?void 0:_.colors)==null?void 0:V.primary)||"#007bff",backgroundColor:((M=(Y=(q=a.styles)==null?void 0:q.theme)==null?void 0:Y.colors)==null?void 0:M.background)||"#f8f9fa",textColor:((P=(w=(b=a.styles)==null?void 0:b.theme)==null?void 0:w.colors)==null?void 0:P.text)||"#343a40",borderColor:((c=(S=(F=a.styles)==null?void 0:F.theme)==null?void 0:S.colors)==null?void 0:c.border)||"#dee2e6",borderRadius:A?"0px":"8px",padding:A?"0px":"20px"},style:{height:"100%",border:"none",background:"transparent",overflowY:A?"visible":"scroll"}})))},Oe=({markdown:m,onRendered:a,tableAnnotations:A=[]})=>{const f=useRef(null),_=q=>{const Y=q.split(/\r?\n/).filter(F=>F.trim().length>0);let M=-1;for(let F=0;F<Y.length-1;F++){const S=Y[F].trim(),c=Y[F+1].trim();if(S.startsWith("|")&&S.endsWith("|")&&c.replace(/\s|:|\|/g,"").match(/^[-]+$/)){M=F;break}}if(M===-1)return null;const b=Y[M].split("|").slice(1,-1).map(F=>F.trim()),w=[];for(let F=M+2;F<Y.length;F++){const S=Y[F].trim();if(!S.startsWith("|")||!S.endsWith("|"))break;w.push(S)}const P=w.map(F=>F.split("|").slice(1,-1).map(S=>S.trim()));return{headers:b,rows:P}},V=React__default.useMemo(()=>_(m),[m]);return useEffect(()=>{const q=()=>{try{if(!f.current)return;const M=f.current.querySelectorAll("table");if(M.forEach(b=>{Array.from(b.rows).forEach(w=>{Array.from(w.cells).forEach(P=>{P.getAttribute("data-table-annotated")==="1"&&(P.style.removeProperty("background"),P.style.removeProperty("background-color"),P.removeAttribute("data-table-annotated"),P.removeAttribute("title"))})})}),!A.length||!M||M.length===0)return;A.forEach((b,w)=>{(b.offsets||[]).forEach((P,F)=>{const[S,c]=P;M.forEach(t=>{var s;const o=Array.from(t.rows)[S];if(!o)return;const v=(s=o.cells)==null?void 0:s[c];if(!v)return;const g=b.color||"rgba(255, 229, 153, 0.5)";v.getAttribute("data-table-annotated")==="1"||(v.style.setProperty("background",g,"important"),v.style.setProperty("background-color",g,"important"),v.setAttribute("data-table-annotated","1"),b.content&&(v.title=b.content)),w===0&&F===0&&setTimeout(()=>v.scrollIntoView({behavior:"smooth",block:"start"}),50)})})})}catch(M){console.warn("[MinimalMarkdownTable] apply annotations failed",M)}},Y=requestAnimationFrame(()=>{q(),a&&a()});return()=>cancelAnimationFrame(Y)},[m,A,a]),V?React__default.createElement("div",{ref:f,className:"markdown-table-mode z-mdtbl-wrapper"},React__default.createElement("style",null,`
|
|
171
|
-
.z-mdtbl-wrapper { overflow: auto; position: relative; }
|
|
172
|
-
.z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
|
|
173
|
-
.z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
|
|
174
|
-
.z-mdtbl th { background: transparent; font-weight: 600; color: inherit; }
|
|
175
|
-
.z-mdtbl tbody tr:nth-child(odd) { background: transparent; }
|
|
176
|
-
.z-mdtbl tbody tr:hover { background: transparent; }
|
|
177
|
-
.z-mdtbl td, .z-mdtbl th { white-space: nowrap; }
|
|
178
|
-
.z-mdtbl thead tr:first-child th:first-child { border-top-left-radius: 8px; }
|
|
179
|
-
.z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
|
|
180
|
-
.z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
|
|
181
|
-
.z-mdtbl tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
|
|
182
|
-
`),React__default.createElement("table",{className:"z-mdtbl"},React__default.createElement("thead",null,React__default.createElement("tr",null,V.headers.map((q,Y)=>React__default.createElement("th",{key:Y},q)))),React__default.createElement("tbody",null,V.rows.map((q,Y)=>React__default.createElement("tr",{key:Y},q.map((M,b)=>React__default.createElement("td",{key:b},M))))))):React__default.createElement("div",{ref:f,style:{padding:"8px"}},"\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C")},He=(m,a)=>{var A,f;console.log("=== Fviewer renderHtmlContent ==="),console.log("data:",m),console.log("data.content:",m.content);let _="";return typeof m.content=="string"?_=m.content:(A=m.content)!=null&&A.text?_=m.content.text:(f=m.content)!=null&&f.content&&(_=m.content.content),console.log("\u6700\u7EC8\u4F20\u9012\u7ED9 iframe \u7684 content:",_),React__default.createElement("div",{style:{height:"100%",overflow:"auto",position:"relative"}},React__default.createElement("iframe",{srcDoc:_,style:{width:"100%",height:"100%",border:"none",background:"white"},title:"HTML Preview",sandbox:"allow-same-origin allow-scripts"}))},Ze=(m,a)=>React__default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",color:"#666"}},React__default.createElement("div",null,React__default.createElement("div",null,"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"),React__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},m.fileName||"\u672A\u77E5\u6587\u4EF6"))),Xe=({data:m,annotationData:a=[],totalPage:A=0,currentPage:f=1,setScale:_,scale:V,rotation:q=0,eventsEmit:Y,styles:M,tools:b={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0},customComponents:w,className:P,contentClass:F})=>{var S,c,t,s;const o=(M==null?void 0:M.theme)||ze,[v,g]=useState(!1),[l]=useState("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."),[n,r]=useState(null);console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="),console.log("Fviewer data:",m),console.log("Fviewer data.content:",m==null?void 0:m.content),console.log("Fviewer data.content.document:",(S=m==null?void 0:m.content)==null?void 0:S.document),console.log("Fviewer data.content.document\u7C7B\u578B:",typeof((c=m==null?void 0:m.content)==null?void 0:c.document)),console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:",((t=m==null?void 0:m.content)==null?void 0:t.document)===null),console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:",((s=m==null?void 0:m.content)==null?void 0:s.document)===void 0),console.log("Fviewer currentPage:",f),console.log("Fviewer scale:",V);const e=useRef(null),E=useRef(null),x=useRef(0);x.current+=1,console.log("[Fviewer] render count:",x.current);const L=Se(m);console.log("=== Fviewer \u7EC4\u4EF6 ==="),console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:",L),console.log("\u5B8C\u6574\u6570\u636E:",m);const O=()=>{var yt;switch(console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:",L),L){case"pdf":case"pdf_slides":return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:",L,"pdfStartPage:"+m.pdfStartPage,"currentPage:"+f),Me(m,{data:m,annotationData:a,totalPage:A,currentPage:f,scale:V,eventsEmit:Y,styles:M,tools:b,className:P,contentClass:F},L==="pdf_slides",_);case"image":return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"),Ie(m,{scale:V,rotation:q,styles:M});case"text":return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"),We(m,{scale:V,styles:M});case"markdown":case"markdown_table":if(console.log("\u6E32\u67D3Markdown\u5185\u5BB9:",L),L==="markdown_table"){const St=typeof m.content=="string"?m.content:((yt=m.content)==null?void 0:yt.content)||"",pt=(a||[]).filter(K=>"offsets"in K&&Array.isArray(K.offsets));return React__default.createElement(Oe,{markdown:St,tableAnnotations:pt})}return React__default.createElement(je,{data:m,parentProps:{data:m,annotationData:a,eventsEmit:Y,styles:M,tools:b,className:P,contentClass:F},isTableMode:!1});case"html":return console.log("\u6E32\u67D3HTML\u5185\u5BB9"),He(m);default:return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"),Ze(m)}};return React__default.useEffect(()=>{const yt=e.current,St=E.current,pt=yt!==m,K=St!==(m?m.content:void 0);console.log("[Fviewer useEffect:data] triggered",{dataChanged:pt,contentChanged:K,hasData:!!m,hasContent:!!(m!=null&&m.content),isLoadingBefore:v}),e.current=m,E.current=m?m.content:void 0},[m==null?void 0:m.content]),React__default.useEffect(()=>{n&&g(!1)},[n]),React__default.useEffect(()=>{console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="),console.log("annotationData:",a),console.log("annotationData \u957F\u5EA6:",(a==null?void 0:a.length)||0),console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:",L)},[a,L]),React__default.createElement(_e,{$theme:o,className:F},v?w!=null&&w.LoadingComponent?React__default.createElement(w.LoadingComponent,{status:l,theme:o}):React__default.createElement(Re,{$theme:o},l):n?w!=null&&w.ErrorComponent?React__default.createElement(w.ErrorComponent,{error:n,theme:o}):React__default.createElement(Ne,{$theme:o},React__default.createElement("div",null,"\u52A0\u8F7D\u5931\u8D25"),React__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},n)):O())};/**
|
|
183
|
-
* @license lucide-react v0.456.0 - ISC
|
|
184
|
-
*
|
|
185
|
-
* This source code is licensed under the ISC license.
|
|
186
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
-
*/const qe=m=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),be=(...m)=>m.filter((a,A,f)=>!!a&&a.trim()!==""&&f.indexOf(a)===A).join(" ").trim();/**
|
|
188
|
-
* @license lucide-react v0.456.0 - ISC
|
|
189
|
-
*
|
|
190
|
-
* This source code is licensed under the ISC license.
|
|
191
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
-
*/var Ue={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
193
|
-
* @license lucide-react v0.456.0 - ISC
|
|
194
|
-
*
|
|
195
|
-
* This source code is licensed under the ISC license.
|
|
196
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
-
*/const Ye=forwardRef(({color:m="currentColor",size:a=24,strokeWidth:A=2,absoluteStrokeWidth:f,className:_="",children:V,iconNode:q,...Y},M)=>createElement("svg",{ref:M,...Ue,width:a,height:a,stroke:m,strokeWidth:f?Number(A)*24/Number(a):A,className:be("lucide",_),...Y},[...q.map(([b,w])=>createElement(b,w)),...Array.isArray(V)?V:[V]]));/**
|
|
198
|
-
* @license lucide-react v0.456.0 - ISC
|
|
199
|
-
*
|
|
200
|
-
* This source code is licensed under the ISC license.
|
|
201
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
-
*/const ue=(m,a)=>{const A=forwardRef(({className:f,..._},V)=>createElement(Ye,{ref:V,iconNode:a,className:be(`lucide-${qe(m)}`,f),..._}));return A.displayName=`${m}`,A};/**
|
|
203
|
-
* @license lucide-react v0.456.0 - ISC
|
|
204
|
-
*
|
|
205
|
-
* This source code is licensed under the ISC license.
|
|
206
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
-
*/const Ge=ue("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
208
|
-
* @license lucide-react v0.456.0 - ISC
|
|
209
|
-
*
|
|
210
|
-
* This source code is licensed under the ISC license.
|
|
211
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
-
*/const Ve=ue("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
213
|
-
* @license lucide-react v0.456.0 - ISC
|
|
214
|
-
*
|
|
215
|
-
* This source code is licensed under the ISC license.
|
|
216
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
217
|
-
*/const Je=ue("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
218
|
-
* @license lucide-react v0.456.0 - ISC
|
|
219
|
-
*
|
|
220
|
-
* This source code is licensed under the ISC license.
|
|
221
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
222
|
-
*/const Ke=ue("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
223
|
-
* @license lucide-react v0.456.0 - ISC
|
|
224
|
-
*
|
|
225
|
-
* This source code is licensed under the ISC license.
|
|
226
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
227
|
-
*/const Qe=ue("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
228
|
-
* @license lucide-react v0.456.0 - ISC
|
|
229
|
-
*
|
|
230
|
-
* This source code is licensed under the ISC license.
|
|
231
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
232
|
-
*/const et=ue("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
233
|
-
* @license lucide-react v0.456.0 - ISC
|
|
234
|
-
*
|
|
235
|
-
* This source code is licensed under the ISC license.
|
|
236
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
-
*/const tt=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
238
|
-
* @license lucide-react v0.456.0 - ISC
|
|
239
|
-
*
|
|
240
|
-
* This source code is licensed under the ISC license.
|
|
241
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
242
|
-
*/const ot=ue("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
|
|
243
|
-
* @license lucide-react v0.456.0 - ISC
|
|
244
|
-
*
|
|
245
|
-
* This source code is licensed under the ISC license.
|
|
246
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
247
|
-
*/const nt=ue("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),ut=dt$1.div`
|
|
248
|
-
display: flex;
|
|
249
|
-
align-items: center;
|
|
250
|
-
padding: 0px 12px;
|
|
251
|
-
justify-content: space-between;
|
|
252
|
-
padding: ${m=>m.$theme.space.padding};
|
|
253
|
-
border-bottom: 1px solid ${m=>m.$theme.colors.border};
|
|
254
|
-
background: ${m=>m.$theme.colors.background};
|
|
255
|
-
min-height: 52px;
|
|
256
|
-
`,rt=dt$1.div`
|
|
257
|
-
display: flex;
|
|
258
|
-
align-items: center;
|
|
259
|
-
gap: 8px;
|
|
260
|
-
flex: 1;
|
|
261
|
-
min-width: 0;
|
|
262
|
-
`,lt=dt$1.div`
|
|
263
|
-
font-size: 14px;
|
|
264
|
-
font-weight: 500;
|
|
265
|
-
color: ${m=>m.$theme.colors.text};
|
|
266
|
-
white-space: nowrap;
|
|
267
|
-
overflow: hidden;
|
|
268
|
-
text-overflow: ellipsis;
|
|
269
|
-
`,at=dt$1.div`
|
|
270
|
-
font-size: 12px;
|
|
271
|
-
color: ${m=>m.$theme.colors.disabledText};
|
|
272
|
-
white-space: nowrap;
|
|
273
|
-
`,it=dt$1.div`
|
|
274
|
-
display: flex;
|
|
275
|
-
align-items: center;
|
|
276
|
-
gap: 4px;
|
|
277
|
-
`,ne=dt$1.button`
|
|
278
|
-
display: flex;
|
|
279
|
-
align-items: center;
|
|
280
|
-
justify-content: center;
|
|
281
|
-
width: 32px;
|
|
282
|
-
height: 32px;
|
|
283
|
-
border: none;
|
|
284
|
-
border-radius: ${m=>m.$theme.space.radius};
|
|
285
|
-
background: ${m=>m.$active?m.$theme.colors.primary+"20":"transparent"};
|
|
286
|
-
color: ${m=>m.$active?m.$theme.colors.primary:m.$theme.colors.text};
|
|
287
|
-
cursor: pointer;
|
|
288
|
-
transition: all 0.2s ease;
|
|
289
|
-
|
|
290
|
-
/* 确保图标有默认颜色 */
|
|
291
|
-
& > svg {
|
|
292
|
-
color: currentColor;
|
|
293
|
-
stroke: currentColor;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
&:hover {
|
|
297
|
-
background: ${m=>m.$theme.colors.primary+"10"};
|
|
298
|
-
color: ${m=>m.$theme.colors.primary};
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
&:disabled {
|
|
302
|
-
opacity: 0.5;
|
|
303
|
-
cursor: not-allowed;
|
|
304
|
-
}
|
|
305
|
-
`,st=dt$1.div`
|
|
306
|
-
font-size: 12px;
|
|
307
|
-
color: ${m=>m.$theme.colors.disabledText};
|
|
308
|
-
min-width: 40px;
|
|
309
|
-
text-align: center;
|
|
310
|
-
`,ct={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}};React__default.memo(({fileName:m="\u672A\u77E5\u6587\u4EF6",currentPage:a=1,totalPage:A=0,tools:f={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:_,onPrevPage:V,onNextPage:q,onZoomIn:Y,onZoomOut:M,onAnnotationToggle:b,onDownload:w,onRotateLeft:P,onRotateRight:F,onClose:S,scale:c=1,isAnnotating:t=!1,className:s})=>{const o=(_==null?void 0:_.theme)||ct;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",a,"totalPage:",A),React__default.createElement(ut,{$theme:o,className:s},React__default.createElement(rt,{$theme:o},React__default.createElement(lt,{$theme:o},m)),React__default.createElement(it,{$theme:o},f.navigation&&React__default.createElement(React__default.Fragment,null,React__default.createElement(ne,{$theme:o,onClick:V,disabled:a<=1,title:"\u4E0A\u4E00\u9875"},React__default.createElement(Ge,{size:16})),A>0&&React__default.createElement(at,{$theme:o},a," / ",A),React__default.createElement(ne,{$theme:o,onClick:q,disabled:!A||a>=A,title:"\u4E0B\u4E00\u9875"},React__default.createElement(Ve,{size:16}))),f.zoom&&React__default.createElement(React__default.Fragment,null,React__default.createElement(ne,{$theme:o,onClick:M,disabled:c<=.3,title:"\u7F29\u5C0F"},React__default.createElement(nt,{size:16})),React__default.createElement(st,{$theme:o},Math.round(c*100),"%"),React__default.createElement(ne,{$theme:o,onClick:Y,disabled:c>=3,title:"\u653E\u5927"},React__default.createElement(ot,{size:16}))),f.annotation&&React__default.createElement(ne,{$theme:o,$active:t,onClick:b,title:t?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8"},React__default.createElement(Ke,{size:16})),f.download&&React__default.createElement(ne,{$theme:o,onClick:w,title:"\u4E0B\u8F7D"},React__default.createElement(Je,{size:16})),f.rotate&&React__default.createElement(React__default.Fragment,null,React__default.createElement(ne,{$theme:o,onClick:P,title:"\u5411\u5DE6\u65CB\u8F6C"},React__default.createElement(Qe,{size:16})),React__default.createElement(ne,{$theme:o,onClick:F,title:"\u5411\u53F3\u65CB\u8F6C"},React__default.createElement(et,{size:16}))),f.close&&React__default.createElement(ne,{$theme:o,onClick:S,title:"\u5173\u95ED"},React__default.createElement(tt,{size:16}))))});const dt=()=>{if(vt()){console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");return}const m=`PDF Worker \u672A\u6CE8\u518C\u3002\u8BF7\u5728\u5E94\u7528\u5165\u53E3\u5904\u8C03\u7528 registerPDFWorker() \u6CE8\u518C Worker\u3002
|
|
311
|
-
\u793A\u4F8B\uFF1Aimport { registerPDFWorker } from "@mxmweb/fviewer";
|
|
312
|
-
registerPDFWorker("/worker/pdf.worker.min.js");
|
|
313
|
-
\u6CE8\u610F\uFF1AWorker \u6587\u4EF6\u8DEF\u5F84\u9700\u8981\u6839\u636E\u5B9E\u9645\u90E8\u7F72\u60C5\u51B5\u8C03\u6574\u3002`;throw console.error(m),new Error(m)},xe=(m,a,A)=>{if(!m&&!a)return"unknown";const f=m||"",_=a||"";return f.toLowerCase().endsWith(".pdf")||_==="pdf"?"pdf":f.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)||_==="image"?"image":f.toLowerCase().endsWith(".md")||_==="markdown"?_==="markdown_table"?"markdown_table":"markdown":f.toLowerCase().match(/\.(html|htm)$/)||_==="html"?"html":f.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/)||_==="text"?"text":"unknown"},mt=async(m,a={})=>{console.log("=== parsePdfFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof m,options:a});try{dt();let A;if(typeof m=="string"){console.log("\u4ECEURL\u52A0\u8F7DPDF:",m);const V=pdfExports.getDocument({url:m,httpHeaders:a.token?{Authorization:a.token}:void 0});console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",V),console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:",typeof V),console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:",Object.getOwnPropertyNames(Object.getPrototypeOf(V))),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:",Object.keys(V)),A=await V.promise,console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="),console.log("PDF\u6587\u6863\u5BF9\u8C61:",A),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof A),console.log("PDF\u6587\u6863\u65B9\u6CD5:",Object.getOwnPropertyNames(Object.getPrototypeOf(A))),console.log("PDF\u6587\u6863\u5C5E\u6027:",Object.keys(A))}else{console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");const V=pdfExports.getDocument({data:m});console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",V),console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:",typeof V),A=await V.promise,console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="),console.log("PDF\u6587\u6863\u5BF9\u8C61:",A),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof A)}const f=A.numPages;console.log("PDF\u52A0\u8F7D\u6210\u529F\uFF0C\u603B\u9875\u6570:",f),console.log("PDF\u6307\u7EB9:",A.fingerprints),console.log("PDF\u4F20\u8F93\u5BF9\u8C61:",A._transport);const _={type:"pdf",content:{type:"pdf",document:A,totalPages:f},fileName:a.fileName,fileType:"pdf",totalPages:f};return console.log("=== \u89E3\u6790\u7ED3\u679C\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u89E3\u6790\u7ED3\u679C:",_),console.log("\u89E3\u6790\u7ED3\u679C\u7C7B\u578B:",typeof _),console.log("\u89E3\u6790\u7ED3\u679C\u5C5E\u6027:",Object.keys(_)),console.log("\u5185\u5BB9\u5BF9\u8C61:",_.content),console.log("\u6587\u6863\u5BF9\u8C61:",_.content.document),_}catch(A){console.error("PDF\u89E3\u6790\u5931\u8D25:",A),console.error("\u9519\u8BEF\u8BE6\u60C5:",{message:A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF",stack:A instanceof Error?A.stack:void 0,name:A instanceof Error?A.name:void 0,url:typeof m=="string"?m:"ArrayBuffer",options:a});let f="PDF\u89E3\u6790\u5931\u8D25";return A instanceof Error&&(A.message.includes("PDF Worker \u672A\u6CE8\u518C")||A.message.includes("Worker \u672A\u6CE8\u518C")?f=A.message:A.message.includes("Invalid PDF structure")?f="PDF\u6587\u4EF6\u7ED3\u6784\u65E0\u6548\uFF0C\u53EF\u80FD\u6587\u4EF6\u635F\u574F\u6216\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u4EF6":A.message.includes("Failed to fetch")?f="PDF\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u548C\u6587\u4EF6URL":A.message.includes("Worker")||A.message.includes("worker")?f="PDF\u89E3\u6790\u5668\u521D\u59CB\u5316\u5931\u8D25\u3002\u8BF7\u786E\u4FDD\u5728\u5E94\u7528\u5165\u53E3\u5904\u8C03\u7528 registerPDFWorker() \u6CE8\u518C Worker \u6587\u4EF6\u3002":f=`PDF\u89E3\u6790\u5931\u8D25: ${A.message}`),{type:"pdf",content:null,fileName:a.fileName,fileType:"pdf",error:f}}},gt=async(m,a={})=>{console.log("=== parseImageFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof m,options:a});try{let A;if(typeof m=="string")console.log("\u4ECEURL\u52A0\u8F7D\u56FE\u7247:",m),A=m;else{console.log("\u4ECEArrayBuffer\u52A0\u8F7D\u56FE\u7247");const _=new Blob([m]);A=URL.createObjectURL(_)}console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:",A),await new Promise((_,V)=>{const q=new Image;q.onload=()=>{console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:",A),console.log("\u56FE\u7247\u5C3A\u5BF8:",q.width,"x",q.height),_()},q.onerror=()=>{console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:",A),V(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))};const Y=setTimeout(()=>{V(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"))},1e4);q.onload=()=>{clearTimeout(Y),console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:",A),console.log("\u56FE\u7247\u5C3A\u5BF8:",q.width,"x",q.height),_()},q.onerror=()=>{clearTimeout(Y),console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:",A),V(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))},q.src=A});const f={type:"image",content:{type:"image",url:A},fileName:a.fileName,fileType:"image"};return console.log("=== parseImageFile \u7ED3\u679C ==="),console.log("result:",f),f}catch(A){return console.error("\u56FE\u7247\u89E3\u6790\u5931\u8D25:",A),{type:"image",content:null,fileName:a.fileName,fileType:"image",error:`\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF"}`}}},ft=async(m,a={})=>{try{let A;if(typeof m=="string"){const f=await fetch(m,{headers:a.token?{Authorization:a.token}:void 0});if(!f.ok)throw new Error(`HTTP ${f.status}: ${f.statusText}`);A=await f.text()}else A=new TextDecoder("utf-8").decode(m);return{type:"text",content:{type:"text",text:A},fileName:a.fileName,fileType:"text"}}catch(A){return{type:"text",content:null,fileName:a.fileName,fileType:"text",error:`\u6587\u672C\u89E3\u6790\u5931\u8D25: ${A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF"}`}}},Et=async(m,a={})=>{try{let A;if(typeof m=="string"){const f=await fetch(m,{headers:a.token?{Authorization:a.token}:void 0});if(!f.ok)throw new Error(`HTTP ${f.status}: ${f.statusText}`);A=await f.text()}else A=new TextDecoder("utf-8").decode(m);return{type:"markdown",content:{type:"markdown",text:A},fileName:a.fileName,fileType:"markdown"}}catch(A){return{type:"markdown",content:null,fileName:a.fileName,fileType:"markdown",error:`Markdown\u89E3\u6790\u5931\u8D25: ${A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF"}`}}},ht=async(m,a={})=>{console.log("=== parseHtmlFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof m,options:a});try{let A;if(typeof m=="string"){console.log("\u4ECEURL\u52A0\u8F7DHTML:",m);const _=await fetch(m,{headers:a.token?{Authorization:a.token}:void 0});if(console.log("HTTP\u54CD\u5E94\u72B6\u6001:",_.status,_.statusText),!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);A=await _.text(),console.log("HTML\u5185\u5BB9\u957F\u5EA6:",A.length),console.log("HTML\u5185\u5BB9\u524D500\u5B57\u7B26:",A.substring(0,500))}else console.log("\u4ECEArrayBuffer\u52A0\u8F7DHTML"),A=new TextDecoder("utf-8").decode(m);const f={type:"html",content:{type:"html",text:A},fileName:a.fileName,fileType:"html"};return console.log("=== parseHtmlFile \u7ED3\u679C ==="),console.log("result:",f),console.log("result.content.text \u957F\u5EA6:",f.content.text.length),console.log("result.content.text \u524D200\u5B57\u7B26:",f.content.text.substring(0,200)),f}catch(A){return console.error("HTML\u89E3\u6790\u5931\u8D25:",A),{type:"html",content:null,fileName:a.fileName,fileType:"html",error:`HTML\u89E3\u6790\u5931\u8D25: ${A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF"}`}}},Ft=async(m,a={})=>{switch(xe(a.fileName,a.fileType)){case"pdf":return await mt(m,a);case"image":return await gt(m,a);case"text":return await ft(m,a);case"markdown":case"markdown_table":return await Et(m,a);case"html":return await ht(m,a);default:return{type:"unknown",content:null,fileName:a.fileName,fileType:a.fileType,error:"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"}}};dt$1.div`
|
|
314
|
-
display: flex;
|
|
315
|
-
flex-direction: column;
|
|
316
|
-
height: 100%;
|
|
317
|
-
width: 100%;
|
|
318
|
-
background: ${m=>m.$theme.colors.background};
|
|
319
|
-
border: 1px solid ${m=>m.$theme.colors.border};
|
|
320
|
-
border-radius: ${m=>m.$theme.space.radius};
|
|
321
|
-
overflow: hidden;
|
|
322
|
-
min-height: 0; /* 确保flex子元素可以收缩 */
|
|
323
|
-
`;dt$1.div`
|
|
324
|
-
display: flex;
|
|
325
|
-
align-items: center;
|
|
326
|
-
justify-content: center;
|
|
327
|
-
height: 100%;
|
|
328
|
-
color: ${m=>m.$theme.colors.disabledText};
|
|
329
|
-
font-size: 14px;
|
|
330
|
-
`;dt$1.div`
|
|
331
|
-
display: flex;
|
|
332
|
-
flex-direction: column;
|
|
333
|
-
align-items: center;
|
|
334
|
-
justify-content: center;
|
|
335
|
-
height: 100%;
|
|
336
|
-
color: ${m=>m.$theme.colors.error};
|
|
337
|
-
text-align: center;
|
|
338
|
-
padding: 20px;
|
|
339
|
-
`;const vt=()=>!!pdfExports.GlobalWorkerOptions.workerSrc,Bt=(m="/worker/pdf.worker.min.js")=>{try{if(pdfExports.GlobalWorkerOptions.workerSrc){console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:",pdfExports.GlobalWorkerOptions.workerSrc);return}pdfExports.GlobalWorkerOptions.workerSrc=m,console.log("PDF Worker \u6CE8\u518C\u6210\u529F:",m)}catch(a){console.error("PDF Worker \u6CE8\u518C\u5931\u8D25:",a)}},HeaderContainer=dt$1.div`
|
|
340
|
-
display: flex;
|
|
341
|
-
align-items: center;
|
|
342
|
-
padding: 0px 12px;
|
|
343
|
-
justify-content: space-between;
|
|
344
|
-
padding: ${m=>m.$theme.space.padding};
|
|
345
|
-
border-bottom: 1px solid ${m=>m.$theme.colors.border};
|
|
346
|
-
background: ${m=>m.$theme.colors.background};
|
|
347
|
-
min-height: 52px;
|
|
348
|
-
`,FileInfo=dt$1.div`
|
|
349
|
-
display: flex;
|
|
350
|
-
align-items: center;
|
|
351
|
-
gap: 8px;
|
|
352
|
-
flex: 1;
|
|
353
|
-
min-width: 0;
|
|
354
|
-
`,FileName=dt$1.div`
|
|
355
|
-
font-size: 14px;
|
|
356
|
-
font-weight: 500;
|
|
357
|
-
color: ${m=>m.$theme.colors.text};
|
|
358
|
-
white-space: nowrap;
|
|
359
|
-
overflow: hidden;
|
|
360
|
-
text-overflow: ellipsis;
|
|
361
|
-
`,PageInfo=dt$1.div`
|
|
362
|
-
font-size: 12px;
|
|
363
|
-
color: ${m=>m.$theme.colors.disabledText};
|
|
364
|
-
white-space: nowrap;
|
|
365
|
-
`,ToolBar=dt$1.div`
|
|
366
|
-
display: flex;
|
|
367
|
-
align-items: center;
|
|
368
|
-
gap: 4px;
|
|
369
|
-
`,ToolButton=dt$1.button`
|
|
370
|
-
display: flex;
|
|
371
|
-
align-items: center;
|
|
372
|
-
justify-content: center;
|
|
373
|
-
width: 32px;
|
|
374
|
-
height: 32px;
|
|
375
|
-
border: none;
|
|
376
|
-
border-radius: ${m=>m.$theme.space.radius};
|
|
377
|
-
background: ${m=>m.$active?m.$theme.colors.primary+"20":"transparent"};
|
|
378
|
-
color: ${m=>m.$active?m.$theme.colors.primary:m.$theme.colors.text};
|
|
379
|
-
cursor: pointer;
|
|
380
|
-
transition: all 0.2s ease;
|
|
381
|
-
|
|
382
|
-
&:hover {
|
|
383
|
-
background: ${m=>m.$theme.colors.primary+"10"};
|
|
384
|
-
color: ${m=>m.$theme.colors.primary};
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
&:disabled {
|
|
388
|
-
opacity: 0.5;
|
|
389
|
-
cursor: not-allowed;
|
|
390
|
-
}
|
|
391
|
-
`,ZoomInfo=dt$1.div`
|
|
392
|
-
font-size: 12px;
|
|
393
|
-
color: ${m=>m.$theme.colors.disabledText};
|
|
394
|
-
min-width: 40px;
|
|
395
|
-
text-align: center;
|
|
396
|
-
`,defaultTheme$1={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},Header=React__default.memo(({fileName:m="\u672A\u77E5\u6587\u4EF6",currentPage:a=1,totalPage:A=0,tools:f={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:_,onPrevPage:V,onNextPage:q,onZoomIn:Y,onZoomOut:M,onAnnotationToggle:b,onDownload:w,onRotateLeft:P,onRotateRight:F,onClose:S,scale:c=1,isAnnotating:t=!1,className:s})=>{const o=(_==null?void 0:_.theme)||defaultTheme$1;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",a,"totalPage:",A),jsxs(HeaderContainer,{$theme:o,className:s,children:[jsx(FileInfo,{$theme:o,children:jsx(FileName,{$theme:o,children:m})}),jsxs(ToolBar,{$theme:o,children:[f.navigation&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:o,onClick:V,disabled:a<=1,title:"\u4E0A\u4E00\u9875",children:jsx(ChevronLeft,{size:16})}),A>0&&jsxs(PageInfo,{$theme:o,children:[a," / ",A]}),jsx(ToolButton,{$theme:o,onClick:q,disabled:!A||a>=A,title:"\u4E0B\u4E00\u9875",children:jsx(ChevronRight,{size:16})})]}),f.zoom&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:o,onClick:M,disabled:c<=.3,title:"\u7F29\u5C0F",children:jsx(ZoomOut,{size:16})}),jsxs(ZoomInfo,{$theme:o,children:[Math.round(c*100),"%"]}),jsx(ToolButton,{$theme:o,onClick:Y,disabled:c>=3,title:"\u653E\u5927",children:jsx(ZoomIn,{size:16})})]}),f.annotation&&jsx(ToolButton,{$theme:o,$active:t,onClick:b,title:t?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8",children:jsx(Pencil,{size:16})}),f.download&&jsx(ToolButton,{$theme:o,onClick:w,title:"\u4E0B\u8F7D",children:jsx(Download,{size:16})}),f.rotate&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:o,onClick:P,title:"\u5411\u5DE6\u65CB\u8F6C",children:jsx(RotateCcw,{size:16})}),jsx(ToolButton,{$theme:o,onClick:F,title:"\u5411\u53F3\u65CB\u8F6C",children:jsx(RotateCw,{size:16})})]}),f.close&&jsx(ToolButton,{$theme:o,onClick:S,title:"\u5173\u95ED",children:jsx(X,{size:16})})]})]})}),ReaderContainer=dt$1.div`
|
|
397
|
-
display: flex;
|
|
398
|
-
flex-direction: column;
|
|
399
|
-
height: 100%;
|
|
400
|
-
width: 100%;
|
|
401
|
-
background: ${m=>m.$theme.colors.background};
|
|
402
|
-
border: 1px solid ${m=>m.$theme.colors.border};
|
|
403
|
-
border-radius: ${m=>m.$theme.space.radius};
|
|
404
|
-
overflow: hidden;
|
|
405
|
-
min-height: 0;
|
|
406
|
-
position: relative; // 添加相对定位,用于loading遮罩的绝对定位
|
|
407
|
-
|
|
408
|
-
/* 添加动画样式 */
|
|
409
|
-
@keyframes spin {
|
|
410
|
-
0% {
|
|
411
|
-
transform: rotate(0deg);
|
|
412
|
-
}
|
|
413
|
-
100% {
|
|
414
|
-
transform: rotate(360deg);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
`,DefaultLoadingComponent=({status:m,theme:a})=>jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"40px",background:a.colors.background},children:[jsxs("div",{style:{position:"relative",width:"80px",height:"80px",marginBottom:"24px"},children:[jsx("div",{style:{width:"60px",height:"80px",background:a.colors.primary,borderRadius:"8px 8px 0 0",position:"relative",margin:"0 auto"},children:jsx("div",{style:{position:"absolute",top:"0",right:"0",width:"0",height:"0",borderStyle:"solid",borderWidth:"0 20px 20px 0",borderColor:`transparent ${a.colors.background} transparent transparent`}})}),jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"20px",height:"20px",borderRadius:"50%",background:a.colors.background,animation:"pulse 1.5s ease-in-out infinite"}})]}),jsx("div",{style:{fontSize:"16px",fontWeight:"500",color:a.colors.text,marginBottom:"8px",textAlign:"center"},children:m}),jsx("div",{style:{width:"200px",height:"4px",background:a.colors.border,borderRadius:"2px",overflow:"hidden",position:"relative"},children:jsx("div",{style:{width:"30%",height:"100%",background:a.colors.primary,borderRadius:"2px",animation:"loading-progress 2s ease-in-out infinite"}})}),jsx("style",{children:`
|
|
418
|
-
@keyframes pulse {
|
|
419
|
-
0%, 100% {
|
|
420
|
-
opacity: 1;
|
|
421
|
-
transform: translate(-50%, -50%) scale(1);
|
|
422
|
-
}
|
|
423
|
-
50% {
|
|
424
|
-
opacity: 0.5;
|
|
425
|
-
transform: translate(-50%, -50%) scale(1.1);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
@keyframes loading-progress {
|
|
430
|
-
0% {
|
|
431
|
-
transform: translateX(-100%);
|
|
432
|
-
}
|
|
433
|
-
50% {
|
|
434
|
-
transform: translateX(0%);
|
|
435
|
-
}
|
|
436
|
-
100% {
|
|
437
|
-
transform: translateX(100%);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
`})]}),ErrorContainer=dt$1.div`
|
|
441
|
-
display: flex;
|
|
442
|
-
flex-direction: column;
|
|
443
|
-
align-items: center;
|
|
444
|
-
justify-content: center;
|
|
445
|
-
height: 100%;
|
|
446
|
-
color: ${m=>m.$theme.colors.error};
|
|
447
|
-
text-align: center;
|
|
448
|
-
padding: 20px;
|
|
449
|
-
`,DEFAULT_STREAM_API_URL="http://10.15.12.13:9005/proxy/index/knowledgeBase/file/stream",CACHE_EXPIRY_TIME=300*1e3,defaultTheme={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}},GientechStreamReader=({convertedFilePath:m,fileName:a,fileType:A,csrfToken:f,initialPage:_=1,initialZoom:V=1,totalPages:q,annotations:Y=[],pageSize:M=5,streamApiUrl:b=DEFAULT_STREAM_API_URL,authorization:w,eventsEmit:P=()=>{},tools:F,styles:S,customComponents:c,className:t,headerClass:s,contentClass:o})=>{const[v,g]=useState(!0),[l,n]=useState("\u6B63\u5728\u52A0\u8F7D\u6587\u6863..."),[r,e]=useState(null),[E,x]=useState(_),[L,O]=useState(q||0),[yt,St]=useState(V),[pt,K]=useState(0),[N,U]=useState(null),[G,bt]=useState(null),[wt,Mt]=useState(""),[H,h]=useState(null),[u,T]=useState(null),[I,$]=useState({}),W=useRef(!1),i=useRef(!1),d=useRef({}),C=useRef({}),y=useRef(null),k=useRef(null),j=useRef(_),D=useRef(0);D.current+=1,console.log("[GientechStreamReader] render count:",D.current),console.log("[GientechStreamReader] props snapshot (early):",{fileType:A,currentPage:E,totalPages:L,hasMarkdown:!!wt,hasImage:!!G,hasText:!!H,hasHtml:!!u,isLoading:v,error:r});const p=(S==null?void 0:S.theme)||defaultTheme;useEffect(()=>{W.current=!1,i.current=!1},[A,m]);const _t=useCallback(()=>{const Ct={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!1};let Tt;switch(A){case"pdf":case"pdf_slides":Tt={...Ct,annotation:!1,download:!1,navigation:!0,rotate:!1};break;case"image":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!0,zoom:!0};break;case"markdown":case"markdown_table":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;case"text":case"html":case"unknown":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;default:Tt=Ct}return F?{...Tt,...F}:Tt},[A,F])(),z=useCallback((Ct,Tt)=>{const $t=Math.floor((Ct-1)/Tt)*Tt+1;return`${$t}-${$t+Tt-1}`},[]),Q=useCallback(async Ct=>{var Qt;if(!(A==="pdf"||A==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7\u7F13\u5B58\u68C0\u67E5`),null;console.log(`\u68C0\u67E5\u9875\u9762 ${Ct} \u662F\u5426\u5728\u7F13\u5B58\u4E2D`);const $t=d.current[Ct];if($t&&Date.now()-$t.timestamp<CACHE_EXPIRY_TIME)return console.log(`\u4F7F\u7528\u5355\u4E2A\u9875\u9762\u7F13\u5B58: ${Ct}`),$t.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),$t.pdfDocument):null;const jt=z(Ct,M),Wt=C.current[jt];if(console.log(`\u68C0\u67E5chunk\u7F13\u5B58: ${jt}, \u5B58\u5728: ${!!Wt}, \u5305\u542B\u9875\u9762: ${((Qt=Wt==null?void 0:Wt.pages)==null?void 0:Qt.join(", "))||"\u65E0"}`),Wt&&Date.now()-Wt.timestamp<CACHE_EXPIRY_TIME){if(Wt.pages.includes(Ct))return console.log(`\u4F7F\u7528chunk\u7F13\u5B58: ${Ct} (chunk: ${jt})`),Wt.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),Wt.pdfDocument):null;console.log(`\u9875\u9762 ${Ct} \u4E0D\u5728chunk ${jt} \u4E2D\uFF0Cchunk\u5305\u542B: ${Wt.pages.join(", ")}`)}return console.log(`\u9875\u9762 ${Ct} \u4E0D\u5728\u4EFB\u4F55\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42`),null},[M,z,A]),At=useCallback(async Ct=>{var Tt;try{if(!(A==="pdf"||A==="pdf_slides"))throw console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u9700\u8981\u5206\u9875\u53C2\u6570\uFF0C\u83B7\u53D6\u5B8C\u6574\u5185\u5BB9`),new Error(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u5206\u9875\u52A0\u8F7D`);const jt=Math.floor((Ct-1)/M)*M+1,Wt=z(Ct,M);console.log(`\u8BF7\u6C42PDF chunk\u6570\u636E: ${jt} (\u5305\u542B\u9875\u9762 ${jt}-${jt+M-1})`);const Qt={"Content-Type":"application/json"};w&&(Qt.Authorization=w),f&&(Qt["X-CSRF-TOKEN-IN"]=f);const se={convertedFilePath:m,pageNo:jt,pageSize:M},Kt=await axios.post(b,se,{headers:Qt,responseType:"arraybuffer"}),ae=Kt.headers["x-csrf-token-out"]||Kt.headers["X-CSRF-TOKEN-OUT"];ae&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",ae),P("request_finish",ae));const te=Array.from({length:M},(ge,he)=>jt+he);return C.current[Wt]={data:Kt.data,pages:te,timestamp:Date.now(),totalPages:q},console.log(`\u7F13\u5B58PDF chunk\u6570\u636E: ${Wt}, \u5305\u542B\u9875\u9762: ${te.join(", ")}, \u8BF7\u6C42\u7684\u9875\u9762: ${Ct}`),console.log("\u5F53\u524D\u6240\u6709\u7F13\u5B58:",Object.keys(C.current)),Kt.data}catch($t){throw console.error("\u83B7\u53D6PDF stream\u6570\u636E\u5931\u8D25:",$t),new Error(`PDF\u8BF7\u6C42\u5931\u8D25: ${((Tt=$t.response)==null?void 0:Tt.status)||"\u7F51\u7EDC\u9519\u8BEF"}`)}},[b,m,M,w,z,q,L,A,P]),kt=useCallback(async(Ct,Tt=!1)=>{var jt;if(!Ct)return;if(!(A==="pdf"||A==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7PDF\u52A0\u8F7D\u903B\u8F91`),null;try{Tt?(g(!0),n("\u6B63\u5728\u52A0\u8F7DPDF\u6587\u6863...")):(g(!0),n(`\u6B63\u5728\u52A0\u8F7D\u7B2C ${Ct} \u9875...`)),e(null),console.log(`\u5F00\u59CB\u52A0\u8F7DPDF\u9875\u9762: ${Ct}, \u521D\u59CB\u52A0\u8F7D: ${Tt}`);const Wt=await Q(Ct);if(Wt)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),U(Wt),g(!1),n(""),console.log(`\u9875\u9762 ${Ct} \u52A0\u8F7D\u5B8C\u6210\uFF08\u4F7F\u7528\u7F13\u5B58\uFF09`),Wt;const Qt=await At(Ct),se=await Ft(Qt,{fileName:a||"Stream\u6587\u6863",fileType:"pdf",token:w});if(se.error)throw new Error(se.error);if(se.type!=="pdf"||!((jt=se.content)!=null&&jt.document))throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u6863");const Kt=se.content.document;console.log("\u8BBE\u7F6EPDF\u6587\u6863:",Kt),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof Kt),console.log("PDF\u6587\u6863\u65B9\u6CD5:",Kt?Object.getOwnPropertyNames(Object.getPrototypeOf(Kt)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u9875\u6570:",Kt?Kt.numPages:"\u65E0\u9875\u6570"),console.log("\u5F53\u524D\u8BF7\u6C42\u7684\u9875\u9762:",Ct),console.log("PDF\u6587\u6863\u5305\u542B\u7684\u9875\u9762\u8303\u56F4:",Kt?`1-${Kt.numPages}`:"\u65E0\u9875\u6570"),U(Kt);const ae=z(Ct,M);if(C.current[ae]&&(C.current[ae].pdfDocument=Kt,console.log(`\u7F13\u5B58PDF\u6587\u6863\u5230chunk: ${ae}`)),q)console.log(`\u4F7F\u7528\u7528\u6237\u4F20\u5165\u7684\u603B\u9875\u6570: ${q}`),O(q);else if(Kt&&Kt.numPages){const te=Kt.numPages;console.log(`\u7528\u6237\u672A\u4F20\u5165\u603B\u9875\u6570\uFF0C\u4ECEPDF\u6587\u6863\u83B7\u53D6\u5B9E\u9645\u603B\u9875\u6570: ${te}`),O(te)}return g(!1),n(""),console.log(`\u9875\u9762 ${Ct} \u52A0\u8F7D\u5B8C\u6210`),Kt}catch(Wt){throw console.error("PDF\u52A0\u8F7D\u5931\u8D25:",Wt),e(Wt.message||"PDF\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Wt}},[At,a,w,L,Q,z,M,A]),Rt=useCallback(Ct=>{if(!(A==="pdf"||A==="pdf_slides"))return!1;const $t=d.current[Ct];if($t&&Date.now()-$t.timestamp<CACHE_EXPIRY_TIME)return!!$t.pdfDocument;const jt=z(Ct,M),Wt=C.current[jt];return Wt&&Date.now()-Wt.timestamp<CACHE_EXPIRY_TIME?Wt.pages.includes(Ct)&&!!Wt.pdfDocument:!1},[M,z,A]),xt=useCallback(()=>{console.log("\u68C0\u67E5markdown\u5185\u5BB9\u662F\u5426\u5728\u7F13\u5B58\u4E2D");const Ct=y.current;return Ct&&Date.now()-Ct.timestamp<CACHE_EXPIRY_TIME?(console.log("\u4F7F\u7528markdown\u5185\u5BB9\u7F13\u5B58"),Ct.data):(console.log("markdown\u5185\u5BB9\u4E0D\u5728\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42"),null)},[]),Ht=useCallback(async()=>{var Ct;try{console.log("\u8BF7\u6C42\u5B8C\u6574markdown\u6570\u636E");const Tt={"Content-Type":"application/json"};w&&(Tt.Authorization=w),f&&(Tt["X-CSRF-TOKEN-IN"]=f);const $t={convertedFilePath:m};console.log("\u53D1\u9001markdown\u8BF7\u6C42:",$t);const jt=await axios.post(b,$t,{headers:Tt,responseType:"text"}),Wt=jt.headers["x-csrf-token-out"]||jt.headers["X-CSRF-TOKEN-OUT"];return Wt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",Wt),P("request_finish",Wt)),console.log("markdown\u54CD\u5E94\u72B6\u6001:",jt.status),console.log("markdown\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((Ct=jt.data)==null?void 0:Ct.length)||0),jt.data}catch(Tt){throw console.error("\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25:",Tt),new Error(`\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25: ${Tt.message}`)}},[m,w,b,P]),Ut=useCallback(async()=>{try{g(!0),n("\u6B63\u5728\u52A0\u8F7Dmarkdown\u6587\u6863..."),e(null),console.log("\u5F00\u59CB\u52A0\u8F7D\u5B8C\u6574markdown\u6587\u6863");const Ct=xt();if(Ct)return console.log("\u4F7F\u7528\u7F13\u5B58\u7684markdown\u5185\u5BB9"),Mt(Ct),g(!1),n(""),Ct;const Tt=await Ht();return y.current={data:Tt,timestamp:Date.now()},Mt(Tt),g(!1),n(""),console.log("\u5B8C\u6574markdown\u6587\u6863\u52A0\u8F7D\u5B8C\u6210"),Tt}catch(Ct){throw console.error("markdown\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"markdown\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Ct}},[Ht,xt]),Nt=useCallback(async()=>{try{const Ct={"Content-Type":"application/json"};w&&(Ct.Authorization=w),f&&(Ct["X-CSRF-TOKEN-IN"]=f);const Tt={convertedFilePath:m},$t=await axios.post(b,Tt,{headers:Ct,responseType:"arraybuffer"}),jt=$t.headers["x-csrf-token-out"]||$t.headers["X-CSRF-TOKEN-OUT"];return jt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",jt),P("request_finish",jt)),$t.data}catch(Ct){throw console.error("\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25:",Ct),new Error(`\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25: ${Ct.message}`)}},[m,w,b,P]),Xt=useCallback(async()=>{try{g(!0),n("\u6B63\u5728\u52A0\u8F7D\u56FE\u7247..."),e(null);const Ct=await Nt(),Tt=await Ft(Ct,{fileName:a||"\u56FE\u7247",fileType:"image",token:w});if(Tt.error)throw new Error(Tt.error);if(Tt.type!=="image"||!Tt.content)throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684\u56FE\u7247");return bt(Tt.content),g(!1),n(""),Tt.content}catch(Ct){throw console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Ct}},[w,a,Nt]),Gt=useCallback(async()=>{var Ct;try{console.log(`\u8BF7\u6C42\u901A\u7528\u6587\u4EF6\u6570\u636E\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);const Tt={"Content-Type":"application/json"};w&&(Tt.Authorization=w),f&&(Tt["X-CSRF-TOKEN-IN"]=f);const $t={convertedFilePath:m};console.log("\u53D1\u9001\u901A\u7528\u6587\u4EF6\u8BF7\u6C42:",$t);const jt=await axios.post(b,$t,{headers:Tt,responseType:"arraybuffer"}),Wt=jt.headers["x-csrf-token-out"]||jt.headers["X-CSRF-TOKEN-OUT"];return Wt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",Wt),P("request_finish",Wt)),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u72B6\u6001:",jt.status),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((Ct=jt.data)==null?void 0:Ct.byteLength)||0),jt.data}catch(Tt){throw console.error("\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25:",Tt),new Error(`\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25: ${Tt.message}`)}},[m,w,b,P]),Zt=useCallback(async()=>{try{if(console.log("=== loadGenericDocument \u88AB\u8C03\u7528 ==="),console.log("\u8C03\u7528\u6808:",new Error().stack),console.log("\u5F53\u524D\u65F6\u95F4:",new Date().toISOString()),W.current){console.log(`\u901A\u7528\u6587\u6863\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);return}if(i.current){console.log(`\u901A\u7528\u6587\u6863\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);return}const Ct=`${A}_${m}`,Tt=I[Ct];if(console.log(`\u68C0\u67E5\u901A\u7528\u6587\u6863\u7F13\u5B58\uFF0Ckey: ${Ct}, \u7F13\u5B58\u5B58\u5728: ${!!Tt}, \u7F13\u5B58\u65F6\u95F4: ${Tt?Date.now()-Tt.timestamp:"N/A"}ms`),Tt&&Date.now()-Tt.timestamp<CACHE_EXPIRY_TIME)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684\u901A\u7528\u6587\u6863\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`),A==="text"&&Tt.content?h(Tt.content):A==="html"&&Tt.content&&T(Tt.content),x(1),O(q||1),g(!1),n(""),Tt.content;W.current=!0,g(!0),n(`\u6B63\u5728\u52A0\u8F7D${A}\u6587\u6863...`),e(null),console.log(`\u5F00\u59CB\u52A0\u8F7D\u901A\u7528\u6587\u6863\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);const $t=await Gt(),jt=await Ft($t,{fileName:a||`${A}\u6587\u6863`,fileType:A,token:w});if(jt.error)throw new Error(jt.error);let Wt=null;if(jt.type==="text"&&jt.content)h(jt.content),Wt=jt.content;else if(jt.type==="html"&&jt.content)T(jt.content),Wt=jt.content;else if(jt.type==="image"&&jt.content)bt(jt.content),Wt=jt.content;else{const se=new TextDecoder("utf-8").decode($t);h({type:"text",content:se}),Wt={type:"text",content:se}}if(Wt){const Qt=`${A}_${m}`,se={...I,[Qt]:{content:Wt,timestamp:Date.now()}};$(se),console.log(`\u901A\u7528\u6587\u6863\u5185\u5BB9\u5DF2\u7F13\u5B58\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}, \u7F13\u5B58\u952E: ${Qt}`),console.log("\u5F53\u524D\u7F13\u5B58\u72B6\u6001:",se)}return g(!1),n(""),W.current=!1,i.current=!0,console.log(`\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5B8C\u6210\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`),jt}catch(Ct){throw console.error("\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),W.current=!1,i.current=!0,Ct}},[Gt,a,w]),zt=useCallback(async Ct=>{if(Ct===j.current)return;if(v){console.log("\u9875\u9762\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42");return}if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}console.log("PDF\u9875\u9762\u53D8\u5316:",Ct,"\u5F53\u524D\u9875:",j.current),console.log(`\u9875\u9762 ${Ct} \u662F\u5426\u5728\u7F13\u5B58\u4E2D:`,Rt(Ct)),j.current=Ct,x(Ct);try{await kt(Ct,!1),P("pageChange",{pageNumber:Ct,totalPages:q||L})}catch($t){console.error("PDF\u9875\u9762\u52A0\u8F7D\u5931\u8D25:",$t);const jt=j.current;x(jt)}},[kt,L,P,Rt,v,A]);useEffect(()=>{j.current=E,console.log("\u5F53\u524D\u9875\u72B6\u6001\u66F4\u65B0:",E)},[E]);const Vt=useCallback(Ct=>{St(Ct),P("zoomChange",{scale:Ct})},[P]),Yt=useCallback(()=>{P("viewer:close")},[P]),Jt=useCallback(()=>{const Ct=Math.min(3,yt+.1);Vt(Ct)},[yt,Vt]),oe=useCallback(()=>{const Ct=Math.max(.3,yt-.1);Vt(Ct)},[yt,Vt]),ce=useCallback(()=>{const Ct=(pt-90+360)%360;K(Ct),P("rotateChange",{rotation:Ct})},[pt,P]),de=useCallback(()=>{const Ct=(pt+90)%360;K(Ct),P("rotateChange",{rotation:Ct})},[pt,P]),Pt=useCallback(()=>{if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const Tt=j.current-1;Tt>=1&&zt(Tt)},[zt,A]),J=useCallback(()=>{if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const Tt=j.current+1,$t=q||L;$t&&Tt<=$t&&zt(Tt)},[L,zt,A]),Z=useCallback(()=>{const Ct=Date.now();Object.keys(d.current).forEach(Tt=>{const $t=d.current[parseInt(Tt)];Ct-$t.timestamp>CACHE_EXPIRY_TIME&&(delete d.current[parseInt(Tt)],console.log(`\u6E05\u7406\u8FC7\u671F\u9875\u9762\u7F13\u5B58: ${Tt}`))}),Object.keys(C.current).forEach(Tt=>{const $t=C.current[Tt];Ct-$t.timestamp>CACHE_EXPIRY_TIME&&(delete C.current[Tt],console.log(`\u6E05\u7406\u8FC7\u671Fchunk\u7F13\u5B58: ${Tt}`))}),y.current&&Ct-y.current.timestamp>CACHE_EXPIRY_TIME&&(y.current=null,console.log("\u6E05\u7406\u8FC7\u671Fmarkdown\u5185\u5BB9\u7F13\u5B58")),$(Tt=>{const $t={...Tt};return Object.keys($t).forEach(jt=>{Ct-$t[jt].timestamp>CACHE_EXPIRY_TIME&&(delete $t[jt],console.log(`\u6E05\u7406\u8FC7\u671F\u901A\u7528\u6587\u4EF6\u7F13\u5B58: ${jt}`))}),$t})},[]),Lt=useCallback(()=>{if(a)return a;try{const Ct=new URL(m);return decodeURIComponent(Ct.pathname.split("/").pop()||"")||"Stream\u6587\u6863"}catch{const Ct=m.split("/");return decodeURIComponent(Ct[Ct.length-1])||"Stream\u6587\u6863"}},[m,a]);useEffect(()=>{const Ct=setInterval(Z,CACHE_EXPIRY_TIME);return()=>clearInterval(Ct)},[Z]),useEffect(()=>()=>{d.current={},C.current={},y.current=null,$({}),console.log("\u7EC4\u4EF6\u5378\u8F7D\uFF0C\u6E05\u7406\u6240\u6709\u7F13\u5B58")},[]),useEffect(()=>{console.log("=== useEffect \u88AB\u89E6\u53D1 ==="),console.log("\u89E6\u53D1\u65F6\u95F4:",new Date().toISOString()),console.log("\u89E6\u53D1\u539F\u56E0:",{initialPage:_,fileType:A}),(async()=>{try{const Tt=A==="pdf"||A==="pdf_slides",$t=Tt&&_||1;console.log("\u5F00\u59CB\u521D\u59CB\u52A0\u8F7D\uFF0C\u6587\u4EF6\u7C7B\u578B:",A,"\u6709\u6548\u9875\u7801:",$t,"\u662F\u5426PDF:",Tt),A==="markdown"||A==="markdown_table"?(await Ut(),x(1),O(q||1),P("pageChange",{pageNumber:1,totalPages:q||1})):A==="image"?(await Xt(),x(1),O(q||1),K(0),P("pageChange",{pageNumber:1,totalPages:q||1})):Tt?(await kt($t,!0),x($t),setTimeout(()=>{P("pageChange",{pageNumber:$t,totalPages:q||L})},0)):(console.log("=== \u521D\u59CB\u52A0\u8F7D\uFF1A\u4F7F\u7528\u901A\u7528\u52A0\u8F7D\u51FD\u6570\u5904\u7406\u6587\u4EF6\u7C7B\u578B ===",A),await Zt(),x(1),O(q||1),P("pageChange",{pageNumber:1,totalPages:q||1}))}catch(Tt){console.error("\u521D\u59CB\u52A0\u8F7D\u5931\u8D25:",Tt),e((Tt==null?void 0:Tt.message)||"\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n("")}})()},[_,A,m]);const qt=useMemo(()=>Math.floor((E-1)/M)*M+1,[E,M]);return r?jsx(ReaderContainer,{$theme:p,className:t,children:c!=null&&c.ErrorComponent?jsx(c.ErrorComponent,{error:r,theme:p}):jsxs(ErrorContainer,{$theme:p,children:[jsx("div",{children:"\u52A0\u8F7D\u5931\u8D25"}),jsx("div",{style:{fontSize:"12px",marginTop:"8px"},children:r})]})}):v?jsxs(ReaderContainer,{$theme:p,className:t,children:[jsx(Header,{fileName:Lt(),currentPage:E,totalPage:L,scale:yt,isAnnotating:!1,tools:_t,styles:S,onPrevPage:()=>{},onNextPage:()=>{},onZoomIn:()=>{},onZoomOut:()=>{},onAnnotationToggle:()=>{},onDownload:()=>{},onClose:Yt,className:s}),c!=null&&c.LoadingComponent?jsx(c.LoadingComponent,{status:l,theme:p}):jsx(DefaultLoadingComponent,{status:l,theme:p})]}):jsxs(ReaderContainer,{$theme:p,className:t,children:[jsx(Header,{fileName:Lt(),currentPage:E,totalPage:L,scale:yt,isAnnotating:!1,tools:{..._t,navigation:A==="pdf"||A==="pdf_slides"?_t.navigation:!1,rotate:A==="image"},styles:S,onPrevPage:Pt,onNextPage:J,onZoomIn:Jt,onZoomOut:oe,onRotateLeft:A==="image"?ce:void 0,onRotateRight:A==="image"?de:void 0,onAnnotationToggle:()=>{},onDownload:()=>{},onClose:Yt,className:s}),A==="markdown"||A==="markdown_table"?jsxs("div",{ref:k,style:{flex:1,overflow:"auto",position:"relative"},className:o,children:[jsx(Xe,{data:{content:wt,...Lt()&&{fileName:Lt()},...A&&{fileType:A},...L&&{totalPages:L}},annotationData:Y,totalPage:L,currentPage:E,scale:yt,eventsEmit:(Ct,Tt)=>{console.log("Fviewer\u4E8B\u4EF6:",Ct,Tt),P(Ct==="md_annotation_add"?"md_annotation_add":Ct==="table_annotation_add"?"table_annotation_add":Ct,Tt)},styles:S,tools:_t,customComponents:c,contentClass:o}),(console.log("=== \u4F20\u9012\u7ED9Fviewer\u7684markdown\u5185\u5BB9 ==="),console.log("markdownContent:",wt),console.log("markdownContent\u957F\u5EA6:",wt.length),console.log("markdownContent\u524D100\u5B57\u7B26:",wt.substring(0,100)),console.log("markdownContent\u540E100\u5B57\u7B26:",wt.substring(wt.length-100)),null)]}):A==="image"?jsx(Xe,{data:{content:G,...Lt()&&{fileName:Lt()},...A&&{fileType:A}},annotationData:Y,totalPage:1,currentPage:1,scale:yt,rotation:pt,eventsEmit:P,styles:S,tools:{..._t,navigation:!1,rotate:!0},customComponents:c,contentClass:o}):A==="pdf"||A==="pdf_slides"?jsx(Xe,{data:{content:{document:N},...Lt()&&{fileName:Lt()},...A&&{fileType:A},...L&&{totalPages:L},pdfStartPage:qt},annotationData:Y,totalPage:L,currentPage:E,scale:yt,initialZoom:V,eventsEmit:(Ct,Tt)=>{console.log("Fviewer\u4E8B\u4EF6:",Ct,Tt),Ct==="scaleChange"&&console.log("\u6536\u5230\u7F29\u653E\u53D8\u5316\u4E8B\u4EF6:",Tt),P(Ct,Tt)},styles:S,tools:_t,customComponents:c,contentClass:o,setScale:St}):jsx(Xe,{data:{content:H||u||{type:"text",content:"\u6587\u4EF6\u5185\u5BB9\u52A0\u8F7D\u4E2D..."},...Lt()&&{fileName:Lt()},...A&&{fileType:A}},annotationData:Y,totalPage:1,currentPage:1,scale:yt,eventsEmit:P,styles:S,tools:{..._t,navigation:!1},customComponents:c,contentClass:o})]})};export{Bt as B,ChevronLeft as C,GientechStreamReader as G,commonjsRequire as c,require$$0 as r};
|