UNPKG

pdfjs-dist

Version:

Generic build of Mozilla's PDF.js library.

28 lines • 62.4 kB
/**
 * @licstart The following is the entire license notice for the
 * JavaScript code in this page
 *
 * Copyright 2024 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * @licend The above is the entire license notice for the
 * JavaScript code in this page
 */
/**
 * pdfjsVersion = 6.5.438
 * pdfjsBuild = 0a4153349
 */
class SandboxSupportBase{constructor(t){this.win=t;this.timeoutIds=new Map;this.commFun=null}destroy(){this.commFun=null;for(const t of this.timeoutIds.values())this.win.clearTimeout(t);this.timeoutIds=null}exportValueToSandbox(t){throw new Error("Not implemented")}importValueFromSandbox(t){throw new Error("Not implemented")}createErrorForSandbox(t){throw new Error("Not implemented")}callSandboxFunction(t,e){if(this.commFun)try{e=this.exportValueToSandbox(e);this.commFun(t,e)}catch(t){this.win.console.error(t)}}createSandboxExternals(){const t={setTimeout:(t,e)=>{if("number"!=typeof t||"number"!=typeof e)return;0===t&&this.win.clearTimeout(this.timeoutIds.get(t));const r=this.win.setTimeout(()=>{this.timeoutIds.delete(t);this.callSandboxFunction("timeoutCb",{callbackId:t,interval:!1})},e);this.timeoutIds.set(t,r)},clearTimeout:t=>{this.win.clearTimeout(this.timeoutIds.get(t));this.timeoutIds.delete(t)},setInterval:(t,e)=>{if("number"!=typeof t||"number"!=typeof e)return;const r=this.win.setInterval(()=>{this.callSandboxFunction("timeoutCb",{callbackId:t,interval:!0})},e);this.timeoutIds.set(t,r)},clearInterval:t=>{this.win.clearInterval(this.timeoutIds.get(t));this.timeoutIds.delete(t)},alert:t=>{"string"==typeof t&&this.win.alert(t)},confirm:t=>"string"==typeof t&&this.win.confirm(t),prompt:(t,e)=>"string"!=typeof t||"string"!=typeof e?null:this.win.prompt(t,e),parseURL:t=>{const e=new this.win.URL(t);return Object.fromEntries(["hash","host","hostname","href","origin","password","pathname","port","protocol","search","searchParams","username"].map(t=>[t,e[t].toString()]))},send:t=>{if(!t)return;const e=new this.win.CustomEvent("updatefromsandbox",{detail:this.importValueFromSandbox(t)});this.win.dispatchEvent(e)}};Object.setPrototypeOf(t,null);return(e,r)=>{try{const i=t[e](...r);return this.exportValueToSandbox(i)}catch(t){throw this.createErrorForSandbox(t?.toString()??"")}}}}class SandboxSupport extends SandboxSupportBase{exportValueToSandbox(t){return JSON.stringify(t,(t,e)=>e instanceof Map?Object.fromEntries(e):e)}importValueFromSandbox(t){return t}createErrorForSandbox(t){return new Error(t)}}class Sandbox{constructor(t,e){this.support=new SandboxSupport(t,this);e.externalCall=this.support.createSandboxExternals();this._module=e;this._alertOnError=0}create(t){const e=['(()=>{"use strict";const{apply:t}=Reflect;function uncurryThis(e){return(r,...i)=>t(e,r,i)}function serializeError(t,e=""){let r,i;try{r=String(t)}catch{r="Unknown error"}try{i=t?.stack}catch{}return{command:"error",value:`${e}${"string"==typeof i?`${r}\\n${i}`:r}`}}const makeArr=()=>[],makeMap=()=>new Map,e=new Map,r=new WeakSet;function addPublicFunctions(...t){for(const e of t)"function"==typeof e&&r.add(e)}function exposeObject(t,r=!1){const i=Object.getPrototypeOf(t);let s=!r&&e.get(i);if(!s){const n=Object.getOwnPropertyDescriptors(i);delete n.constructor;for(const e of Object.values(n)){const{value:i,get:s,set:n}=e;addPublicFunctions(i,s,n);r&&"function"==typeof i&&(e.value=i.bind(t))}s=Object.create(Object.prototype,n);r||e.set(i,s)}return Object.setPrototypeOf(t,s)}const i=Object.freeze({s:"solid",d:"dashed",b:"beveled",i:"inset",u:"underline"}),s=Object.freeze({visible:0,hidden:1,delay:2}),n=Object.freeze({visible:0,hidden:1,noPrint:2,noView:3}),a=Object.freeze({Times:"Times-Roman",TimesB:"Times-Bold",TimesI:"Times-Italic",TimesBI:"Times-BoldItalic",Helv:"Helvetica",HelvB:"Helvetica-Bold",HelvI:"Helvetica-Oblique",HelvBI:"Helvetica-BoldOblique",Cour:"Courier",CourB:"Courier-Bold",CourI:"Courier-Oblique",CourBI:"Courier-BoldOblique",Symbol:"Symbol",ZapfD:"ZapfDingbats",KaGo:"HeiseiKakuGo-W5-UniJIS-UCS2-H",KaMi:"HeiseiMin-W3-UniJIS-UCS2-H"}),o=Object.freeze({n:"none",i:"invert",p:"push",o:"outline"}),l=Object.freeze({textOnly:0,iconOnly:1,iconTextV:2,textIconV:3,iconTextH:4,textIconH:5,overlay:6}),c=Object.freeze({proportional:0,anamorphic:1}),u=Object.freeze({always:0,never:1,tooBig:2,tooSmall:3}),h=Object.freeze({ch:"check",cr:"cross",di:"diamond",ci:"circle",st:"star",sq:"square"}),d=Object.freeze({blindsH:"BlindsHorizontal",blindsV:"BlindsVertical",boxI:"BoxIn",boxO:"BoxOut",dissolve:"Dissolve",glitterD:"GlitterDown",glitterR:"GlitterRight",glitterRD:"GlitterRightDown",random:"Random",replace:"Replace",splitHI:"SplitHorizontalIn",splitHO:"SplitHorizontalOut",splitVI:"SplitVerticalIn",splitVO:"SplitVerticalOut",wipeD:"WipeDown",wipeL:"WipeLeft",wipeR:"WipeRight",wipeU:"WipeUp"}),g=Object.freeze({none:"NoVary",fitP:"FitPage",fitW:"FitWidth",fitH:"FitHeight",fitV:"FitVisibleWidth",pref:"Preferred",refW:"ReflowWidth"}),p=Object.freeze({IDS_GREATER_THAN:"Invalid value: must be greater than or equal to % s.",IDS_GT_AND_LT:"Invalid value: must be greater than or equal to % s and less than or equal to % s.",IDS_LESS_THAN:"Invalid value: must be less than or equal to % s.",IDS_INVALID_MONTH:"** Invalid **",IDS_INVALID_DATE:"Invalid date / time: please ensure that the date / time exists. Field",IDS_INVALID_DATE2:" should match format ",IDS_INVALID_VALUE:"The value entered does not match the format of the field",IDS_AM:"am",IDS_PM:"pm",IDS_MONTH_INFO:"January[1] February[2] March[3] April[4] May[5] June[6] July[7] August[8] September[9] October[10] November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov[11] Dec[12]",IDS_STARTUP_CONSOLE_MSG:"** ^ _ ^ **",RE_NUMBER_ENTRY_DOT_SEP:["[+-]?\\\\d*\\\\.?\\\\d*"],RE_NUMBER_COMMIT_DOT_SEP:["[+-]?\\\\d+(\\\\.\\\\d+)?","[+-]?\\\\.\\\\d+","[+-]?\\\\d+\\\\."],RE_NUMBER_ENTRY_COMMA_SEP:["[+-]?\\\\d*,?\\\\d*"],RE_NUMBER_COMMIT_COMMA_SEP:["[+-]?\\\\d+([.,]\\\\d+)?","[+-]?[.,]\\\\d+","[+-]?\\\\d+[.,]"],RE_ZIP_ENTRY:["\\\\d{0,5}"],RE_ZIP_COMMIT:["\\\\d{5}"],RE_ZIP4_ENTRY:["\\\\d{0,5}(\\\\.|[- ])?\\\\d{0,4}"],RE_ZIP4_COMMIT:["\\\\d{5}(\\\\.|[- ])?\\\\d{4}"],RE_PHONE_ENTRY:["\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}","\\\\(\\\\d{0,3}","\\\\(\\\\d{0,3}\\\\)(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}","\\\\(\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}","\\\\d{0,3}\\\\)(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}","011(\\\\.|[- \\\\d])*"],RE_PHONE_COMMIT:["\\\\d{3}(\\\\.|[- ])?\\\\d{4}","\\\\d{3}(\\\\.|[- ])?\\\\d{3}(\\\\.|[- ])?\\\\d{4}","\\\\(\\\\d{3}\\\\)(\\\\.|[- ])?\\\\d{3}(\\\\.|[- ])?\\\\d{4}","011(\\\\.|[- \\\\d])*"],RE_SSN_ENTRY:["\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,2}(\\\\.|[- ])?\\\\d{0,4}"],RE_SSN_COMMIT:["\\\\d{3}(\\\\.|[- ])?\\\\d{2}(\\\\.|[- ])?\\\\d{4}"]});class FullScreen{#t=[];#e=!0;#r=s.hidden;#i="";#s=!0;#n=!0;#a=!1;#o=3600;#l=!1;#c=!1;get backgroundColor(){return this.#t}set backgroundColor(t){}get clickAdvances(){return this.#e}set clickAdvances(t){}get cursor(){return this.#r}set cursor(t){}get defaultTransition(){return this.#i}set defaultTransition(t){}get escapeExits(){return this.#s}set escapeExits(t){}get isFullScreen(){return this.#n}set isFullScreen(t){}get loop(){return this.#a}set loop(t){}get timeDelay(){return this.#o}set timeDelay(t){}get transitions(){return["Replace","WipeRight","WipeLeft","WipeDown","WipeUp","SplitHorizontalIn","SplitHorizontalOut","SplitVerticalIn","SplitVerticalOut","BlindsHorizontal","BlindsVertical","BoxIn","BoxOut","GlitterRight","GlitterDown","GlitterRightDown","Dissolve","Random"]}set transitions(t){throw new Error("fullscreen.transitions is read-only")}get usePageTiming(){return this.#l}set usePageTiming(t){}get useTimer(){return this.#c}set useTimer(t){}}function MathClamp(t,e,r){return Math.min(Math.max(t,e),r)}function makeColorComp(t){return Math.floor(255*MathClamp(t,0,1)).toString(16).padStart(2,"0")}function scaleAndClamp(t){return 255*MathClamp(t,0,1)}class ColorConverters{static CMYK_G([t,e,r,i]){return["G",1-Math.min(1,.3*t+.59*r+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return[t=scaleAndClamp(t),t,t]}static G_HTML([t]){const e=makeColorComp(t);return`#${e}${e}${e}`}static RGB_G([t,e,r]){return["G",.3*t+.59*e+.11*r]}static RGB_rgb(t){return t.map(scaleAndClamp)}static RGB_HTML(t){return`#${t.map(makeColorComp).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,r,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,r+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,r,i]){return[scaleAndClamp(1-Math.min(1,t+i)),scaleAndClamp(1-Math.min(1,r+i)),scaleAndClamp(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,r]){const i=1-t,s=1-e,n=1-r;return["CMYK",i,s,n,Math.min(i,s,n)]}}const m=["m/d","m/d/yy","mm/dd/yy","mm/yy","d-mmm","d-mmm-yy","dd-mmm-yy","yy-mm-dd","mmm-yy","mmmm-yy","mmm d, yyyy","mmmm d, yyyy","m/d/yy h:MM tt","m/d/yy HH:MM"],f=["HH:MM","h:MM tt","HH:MM:ss","h:MM:ss tt"];function isValidSpace(t){return"string"==typeof t&&("T"===t||"G"===t||"RGB"===t||"CMYK"===t)}function isValidColor(t){if(!Array.isArray(t)||0===t.length)return!1;const e=t[0];if(!isValidSpace(e))return!1;const r={T:1,G:2,RGB:4,CMYK:5}[e];return t.length===r&&t.slice(1).every(t=>"number"==typeof t&&t>=0&&t<=1)}function getCorrectColor(t){return isValidColor(t)?t:["G",0]}class Color{transparent=["T"];black=["G",0];white=["G",1];red=["RGB",1,0,0];green=["RGB",0,1,0];blue=["RGB",0,0,1];cyan=["CMYK",1,0,0,0];magenta=["CMYK",0,1,0,0];yellow=["CMYK",0,0,1,0];dkGray=["G",.25];gray=["G",.5];ltGray=["G",.75];convert(t,e){return isValidSpace(e)?"T"===e?["T"]:(t=getCorrectColor(t))[0]===e?t:"T"===t[0]?this.convert(this.black,e):ColorConverters[`${t[0]}_${e}`](t.slice(1)):this.black}equal(t,e){t=getCorrectColor(t);e=getCorrectColor(e);if("T"===t[0]||"T"===e[0])return"T"===t[0]&&"T"===e[0];t[0]!==e[0]&&(e=this.convert(e,t[0]));return t.slice(1).every((t,r)=>t===e[r+1])}}class Thermometer{#u=!1;#h=100;#d="";#g=0;get cancelled(){return this.#u}set cancelled(t){throw new Error("thermometer.cancelled is read-only")}get duration(){return this.#h}set duration(t){this.#h=t}get text(){return this.#d}set text(t){this.#d=t}get value(){return this.#g}set value(t){this.#g=t}begin(){}end(){}}const b=uncurryThis(Map.prototype.delete),y=uncurryThis(Map.prototype.get),v=uncurryThis(Map.prototype.set),A=uncurryThis(WeakMap.prototype.delete),w=uncurryThis(WeakMap.prototype.get),C=uncurryThis(WeakMap.prototype.set),I=uncurryThis(FinalizationRegistry.prototype.register),S=uncurryThis(FinalizationRegistry.prototype.unregister),T=Object.create(null);class App{#p=null;#m=!0;#f=exposeObject(new FullScreen,!0);#b;#y=!1;#v;#A=!1;#w=["T"];#C=exposeObject(new Thermometer,!0);#I=!1;#S;#T=new WeakMap;#F=new FinalizationRegistry(this.#D.bind(this));#E=new Map;#O=1;#k;#P;#M;#x;constructor(t){this.#M=t.send;this.#x=t.userActivationData;this.#b=App.#V(t.language);this.#v=App.#N(t.platform);this.#S=t.doc;this.#k=t.globalEval;this.#P=t.externalCall}static{Object.assign(T,{evalCallback:(t,e)=>t.#_(e)})}#j(t){const e=this.#O++;v(this.#E,e,t);return e}#R(t){b(this.#E,t)}#_({callbackId:t,interval:e}){if(0===t){this.#x.userActivation=!1;return}const r=y(this.#E,t);e||this.#R(t);if(r){const t=this.#x.userActivation;this.#x.userActivation=!1;this.#k(r);this.#x.userActivation=t}}#H(t,e){const r=Object.create(null),i={callbackId:t,interval:e};C(this.#T,r,i);I(this.#F,r,i,r);return r}#z(t){const e=w(this.#T,t);if(e){A(this.#T,t);S(this.#F,t);this.#D(e)}}#D({callbackId:t,interval:e}){this.#R(t);e?this.#P("clearInterval",[t]):this.#P("clearTimeout",[t])}static#N(t){if("string"==typeof t){if((t=t.toLowerCase()).includes("win"))return"WIN";if(t.includes("mac"))return"MAC"}return"UNIX"}static#V(t){const[e,r]=t.toLowerCase().split(/[-_]/,2);switch(e){case"zh":return"cn"===r||"sg"===r?"CHS":"CHT";case"da":return"DAN";case"de":return"DEU";case"es":return"ESP";case"fr":return"FRA";case"it":return"ITA";case"ko":return"KOR";case"ja":return"JPN";case"nl":return"NLD";case"no":return"NOR";case"pt":return"br"===r?"PTB":"ENU";case"fi":return"SUO";case"SV":return"SVE";default:return"ENU"}}get activeDocs(){return[globalThis]}set activeDocs(t){throw new Error("app.activeDocs is read-only")}get calculate(){return this.#S.calculate}set calculate(t){this.#S.calculate=t}get constants(){return this.#p??=Object.freeze({align:Object.freeze({left:0,center:1,right:2,top:3,bottom:4})})}set constants(t){throw new Error("app.constants is read-only")}get focusRect(){return this.#m}set focusRect(t){this.#m=t}get formsVersion(){return 21.00720099}set formsVersion(t){throw new Error("app.formsVersion is read-only")}get fromPDFConverters(){return[]}set fromPDFConverters(t){throw new Error("app.fromPDFConverters is read-only")}get fs(){return this.#f}set fs(t){throw new Error("app.fs is read-only")}get language(){return this.#b}set language(t){throw new Error("app.language is read-only")}get media(){}set media(t){throw new Error("app.media is read-only")}get monitors(){return[]}set monitors(t){throw new Error("app.monitors is read-only")}get numPlugins(){return 0}set numPlugins(t){throw new Error("app.numPlugins is read-only")}get openInPlace(){return this.#y}set openInPlace(t){this.#y=t}get platform(){return this.#v}set platform(t){throw new Error("app.platform is read-only")}get plugins(){return[]}set plugins(t){throw new Error("app.plugins is read-only")}get printColorProfiles(){return[]}set printColorProfiles(t){throw new Error("app.printColorProfiles is read-only")}get printerNames(){return[]}set printerNames(t){throw new Error("app.printerNames is read-only")}get runtimeHighlight(){return this.#A}set runtimeHighlight(t){this.#A=t}get runtimeHighlightColor(){return this.#w}set runtimeHighlightColor(t){isValidColor(t)&&(this.#w=t)}get thermometer(){return this.#C}set thermometer(t){throw new Error("app.thermometer is read-only")}get toolbar(){return this.#I}set toolbar(t){this.#I=t}get toolbarHorizontal(){return this.toolbar}set toolbarHorizontal(t){this.toolbar=t}get toolbarVertical(){return this.toolbar}set toolbarVertical(t){this.toolbar=t}get viewerType(){return"PDF.js"}set viewerType(t){throw new Error("app.viewerType is read-only")}get viewerVariation(){return"Full"}set viewerVariation(t){throw new Error("app.viewerVariation is read-only")}get viewerVersion(){return 21.00720099}set viewerVersion(t){throw new Error("app.viewerVersion is read-only")}addMenuItem(){}addSubMenu(){}addToolButton(){}alert(t,e=0,r=0,i="PDF.js",s=null,n=null){if(!this.#x.userActivation)return 0;this.#x.userActivation=!1;if(t&&"object"==typeof t){r=t.nType;t=t.cMsg}if(!(t=(t||"").toString()))return 0;if((r="number"!=typeof r||isNaN(r)||r<0||r>3?0:r)>=2)return this.#P("confirm",[t])?4:3;this.#P("alert",[t]);return 1}beep(){}beginPriv(){}browseForDoc(){}clearInterval(t){this.#z(t)}clearTimeOut(t){this.#z(t)}endPriv(){}execDialog(){}execMenuItem(t){if(this.#x.userActivation){this.#x.userActivation=!1;switch(t){case"SaveAs":if(this.#x.disableSaving)return;this.#M({command:t});break;case"FirstPage":case"LastPage":case"NextPage":case"PrevPage":case"ZoomViewIn":case"ZoomViewOut":this.#M({command:t});break;case"FitPage":this.#M({command:"zoom",value:"page-fit"});break;case"Print":if(this.#x.disablePrinting)return;this.#M({command:"print"})}}}getNthPlugInName(){}getPath(){}goBack(){}goForward(){}hideMenuItem(){}hideToolbarButton(){}launchURL(){}listMenuItems(){}listToolbarButtons(){}loadPolicyFile(){}mailGetAddrs(){}mailMsg(){}newDoc(){}newCollection(){}newFDF(){}openDoc(){}openFDF(){}popUpMenu(){}popUpMenuEx(){}removeToolButton(){}response(t,e="",r="",i="",s=""){if(!this.#x.userActivation)return null;this.#x.userActivation=!1;if(t&&"object"==typeof t){r=t.cDefault;t=t.cQuestion}t=(t||"").toString();r=(r||"").toString();return this.#P("prompt",[t,r||""])}setInterval(t,e=0){if(t&&"object"==typeof t){e=t.nMilliseconds||0;t=t.cExpr}if("string"!=typeof t)throw new TypeError("First argument of app.setInterval must be a string");if("number"!=typeof e)throw new TypeError("Second argument of app.setInterval must be a number");const r=this.#j(t);this.#P("setInterval",[r,e]);return this.#H(r,!0)}setTimeOut(t,e=0){if(t&&"object"==typeof t){e=t.nMilliseconds||0;t=t.cExpr}if("string"!=typeof t)throw new TypeError("First argument of app.setTimeOut must be a string");if("number"!=typeof e)throw new TypeError("Second argument of app.setTimeOut must be a number");const r=this.#j(t);this.#P("setTimeout",[r,e]);return this.#H(r,!1)}trustedFunction(){}trustPropagatorFunction(){}}const F=0,D=1,E=2,O=3,k=4;function createMap(t){return t instanceof Map?t:new Map(t?Object.entries(t):null)}const P=Object.create(null);let M=null;const x=["display","editable","hidden","multipleSelection","print","readonly","required","userName"];class Field{#L;#W;#$;#B=null;#G=null;#U;#K=null;#Y=null;#X;#q;#Z;#J;#Q;#tt;#k;#et;#rt;#it;#st=!1;#nt;#at;#ot;#lt;#ct=null;#ut;#ht=null;#dt=null;#gt=null;#pt;#M;#mt;#ft;#bt;#yt;#g=null;#vt;constructor(t,e=[]){this.alignment=t.alignment||"left";this.borderStyle=t.borderStyle||"";this.buttonAlignX=t.buttonAlignX||50;this.buttonAlignY=t.buttonAlignY||50;this.buttonFitBounds=t.buttonFitBounds;this.buttonPosition=t.buttonPosition;this.buttonScaleHow=t.buttonScaleHow;this.ButtonScaleWhen=t.buttonScaleWhen;this.calcOrderIndex=t.calcOrderIndex;this.comb=t.comb;this.commitOnSelChange=t.commitOnSelChange;this.defaultStyle=t.defaultStyle;this.defaultValue=t.defaultValue;this.doNotScroll=t.doNotScroll;this.doNotSpellCheck=t.doNotSpellCheck;this.delay=t.delay;this.doc=globalThis;this.exportValues=t.exportValues;this.fileSelect=t.fileSelect;this.highlight=t.highlight;this.lineWidth=t.lineWidth;this.multiline=t.multiline;this.name=t.name;this.password=t.password;this.radiosInUnison=t.radiosInUnison;this.rect=t.rect;this.richText=t.richText;this.richValue=t.richValue;this.style=t.style;this.submitName=t.submitName;this.textFont=t.textFont;this.textSize=t.textSize;this.type=t.type;this.#L=createMap(t.actions);this.#W=t.appObjects;this.#$=t.browseForFileToSubmit||null;this.#U=t.charLimit;this.#X=t.currentValueIndices||0;this.#q=t.datetimeFormat||null;this.#Z=t.fieldPath;this.#J=function getFieldType(t){let e=t.get("Format");if(!e)return F;e=e[0].trim();return e.startsWith("AFNumber_")?D:e.startsWith("AFPercent_")?E:e.startsWith("AFDate_")?O:e.startsWith("AFTime_")?k:F}(this.#L);this.#Q=t.fillColor||["T"];this.#tt=t.getTerminalChildren;this.#k=t.globalEval;this.#et=!!t.hasDatetimeHTML;this.#rt=Object.hasOwn(t,"value");this.#it=t.id;this.#nt=Array.isArray(t.items);this.#at=t.items||[];this.#ot=t.kidIds||null;this.#ut=t.page||0;this.#pt=t.rotation||0;this.#M=t.send||(()=>{});this.#mt=t.sendError;this.#ft=t.strokeColor||["G",0];this.#bt=t.textColor||["G",0];this.#yt=t.util;this.#vt=Object.fromEntries(x.map(e=>[e,t[e]]));this.#vt.multipleSelection=!!t.multipleSelection;if("radiobutton"===t.type||"checkbox"===t.type){this.#st="checkbox"===t.type;this.exportValues=[this.exportValues];this.#dt=[this.#it];this.#ht=[this.#L];this.#gt=[this.#ut];for(const r of e){this.exportValues.push(r.exportValues);this.#dt.push(r.id);this.#ht.push(createMap(r.actions));this.#gt.push(r.page||0);t.value===r.exportValues&&(this.#it=r.id)}this.#g=t.value||""}else{e.length>0&&(this.#ct=e.map(t=>t.id));this.#At(t.value||"")}if(this.#ot){this.#Y={...this};M??=Field.#wt(Object.keys(this));Object.defineProperties(this,M)}}static#wt(t){const e=Object.create(null);for(const r of t){const t={get(){return this.#Y[r]},set(t){this.#Y[r]=t;this.#Ct(r,t)},enumerable:!0,configurable:!0};addPublicFunctions(t.get,t.set);e[r]=t}return e}static{Object.assign(P,{getComputedValue:t=>t.#lt??t.#g,getHasValue:t=>t.#rt,getInitialValue:t=>t.#et&&t.#lt||null,getIsChoice:t=>t.#nt,getKidIds:t=>t.#ot,getPageActions:t=>t.#It(),getValue:t=>t.#g,setValue:(t,e)=>t.#At(e),prepareEvent(t,e,r){if(t.#dt){t.#it=e;r.value=t.#st&&!r.value?"Off":t.exportValues[t.#St];"Action"===r.name&&(t.#g=r.value)}},runActions:(t,e)=>t.#Tt(e),send:(t,e)=>t.#Ft(e)});for(const t of x)Object.defineProperty(Field.prototype,t,{get(){return this.#vt[t]},set(e){this.#vt[t]=e;this.#Dt(t,e)},configurable:!0});for(const[t,{value:e}]of Object.entries(Object.getOwnPropertyDescriptors(Field.prototype)))"constructor"!==t&&"function"==typeof e&&Object.defineProperty(Field.prototype,t,{writable:!1})}get#Et(){return this.#dt?.filter(t=>t!==this.#it)??this.#ct}#It(){const t=this.#ht??[this.#L],e=this.#gt??[this.#ut],r=[];for(let i=0,s=t.length;i<s;i++)for(const s of["PageOpen","PageClose"]){const n=t[i].get(s);n&&r.push([e[i],s,n])}return r}#Ct(t,e){if(this.#ot)for(const r of this.#ot){const i=this.#W[r];i&&(i[t]=e)}}#Ft(t){const e=this.#Et;this.#M(e?{id:this.#it,siblings:e,...t}:{id:this.#it,...t})}#Dt(t,e,r=e){this.#Ct(t,e);this.#Ft({[t]:r})}get currentValueIndices(){return this.#nt?this.#X:0}set currentValueIndices(t){this.#Ct("currentValueIndices",t);if(this.#nt){Array.isArray(t)||(t=[t]);if(t.every(t=>Number.isInteger(t)&&t>=0&&t<this.numItems)){t.sort((t,e)=>t-e);if(this.#vt.multipleSelection){this.#X=t;this.#g=t.map(t=>this.#at[t].exportValue)}else if(t.length>0){t=[t[0]];this.#X=t[0];this.#g=this.#at[t[0]].exportValue}this.#M({id:this.#it,indices:t})}}}get fillColor(){return this.#Q}set fillColor(t){if(isValidColor(t)){this.#Q=t;this.#Dt("fillColor",t)}}get bgColor(){return this.fillColor}set bgColor(t){this.fillColor=t}get charLimit(){return this.#U}set charLimit(t){if("number"!=typeof t)throw new Error("Invalid argument value");this.#U=Math.max(0,Math.floor(t));this.#Dt("charLimit",this.#U)}get numItems(){if(!this.#nt)throw new Error("Not a choice widget");return this.#at.length}set numItems(t){throw new Error("field.numItems is read-only")}get strokeColor(){return this.#ft}set strokeColor(t){if(isValidColor(t)){this.#ft=t;this.#Dt("strokeColor",t)}}get borderColor(){return this.strokeColor}set borderColor(t){this.strokeColor=t}get page(){return this.#ut}set page(t){throw new Error("field.page is read-only")}get rotation(){return this.#pt}set rotation(t){if((t=Math.floor(t))%90!=0)throw new Error("Invalid rotation: must be a multiple of 90");(t%=360)<0&&(t+=360);this.#pt=t;this.#Dt("rotation",t)}get textColor(){return this.#bt}set textColor(t){if(isValidColor(t)){this.#bt=t;this.#Dt("textColor",t)}}get fgColor(){return this.textColor}set fgColor(t){this.textColor=t}get value(){return this.#g}set value(t){this.#At(t)&&this.#Dt("value",t,this.#lt??this.#g)}#At(t){if(this.#dt)return this.#Ot(t);if(this.#nt){this.#kt(t);return!0}if(this.#et&&t){const e=this.#yt.scand(this.#q,t);if(e){this.#lt=e.valueOf();t=this.#yt.printd(this.#q,e);this.#g=isNaN(t)?t:parseFloat(t);return!0}}if(""===t||"string"!=typeof t||this.#J>=O){this.#lt=void 0;this.#g=t;return!0}this.#lt=t;const e=t.trim().replace(",",".");this.#g=isNaN(e)?t:parseFloat(e);return!0}get#St(){return this.#dt.indexOf(this.#it)}#Pt(t){if(!this.#dt)return-1;const e=Number(t);return Number.isInteger(e)&&e>=0&&e<this.#dt.length&&`${e}`==`${t}`?e:-1}#Mt(t,e){this.#it=this.#dt[t];this.#g=e}#Ot(t){if(this.#st&&(!t||"Off"===t||!this.exportValues.includes(t))){this.#g="Off";return!0}if(null==t){this.#g="";return!0}const e=this.exportValues.indexOf(t);if(-1!==e){this.#Mt(e,t);return!0}if("Off"===t&&2===this.#dt.length){const t=(1+this.#St)%2;this.#Mt(t,this.exportValues[t]);return!0}return!1}#kt(t){if(this.#vt.multipleSelection){Array.isArray(t)||(t=[t]);const e=new Set(t);if(Array.isArray(this.#X)){this.#X.length=0;this.#g.length=0}else{this.#X=[];this.#g=[]}this.#at.forEach((t,r)=>{if(e.has(t.exportValue)){this.#X.push(r);this.#g.push(t.exportValue)}})}else{Array.isArray(t)&&(t=t[0]);const e=this.#at.findIndex(({exportValue:e})=>t===e);if(-1!==e){this.#X=e;this.#g=this.#at[e].exportValue}}}get valueAsString(){return(this.#g??"").toString()}set valueAsString(t){}browseForFileToSubmit(){this.#$&&this.#$()}buttonGetCaption(t=0){return this.#B?this.#B[t]:""}buttonGetIcon(t=0){return this.#G?this.#G[t]:null}buttonImportIcon(t=null,e=0){}buttonSetCaption(t,e=0){this.#B??=["","",""];this.#B[e]=t}buttonSetIcon(t,e=0){this.#G??=[null,null,null];this.#G[e]=t}checkThisBox(t,e=!0){const r=this.#Pt(t);if(-1===r||!e&&!this.#st)return;const i=e?this.exportValues[r]:"Off";this.#Mt(r,i);this.#M({id:this.#it,value:i})}clearItems(){if(!this.#nt)throw new Error("Not a choice widget");this.#at=[];this.#M({id:this.#it,clear:null})}deleteItemAt(t=null){if(!this.#nt)throw new Error("Not a choice widget");if(this.numItems){if(null===t){t=Array.isArray(this.#X)?this.#X[0]:this.#X;t||=0}(t<0||t>=this.numItems)&&(t=this.numItems-1);this.#at.splice(t,1);if(Array.isArray(this.#X)){let e=this.#X.findIndex(e=>e>=t);if(-1!==e){this.#X[e]===t&&this.#X.splice(e,1);for(const t=this.#X.length;e<t;e++)--this.#X[e]}}else this.#X===t?this.#X=this.numItems>0?0:-1:this.#X>t&&--this.#X;this.#M({id:this.#it,remove:t})}}getItemAt(t=-1,e=!1){if(!this.#nt)throw new Error("Not a choice widget");(t<0||t>=this.numItems)&&(t=this.numItems-1);const r=this.#at[t];return e?r.exportValue:r.displayValue}getArray(){if(this.#ot){const t=[],fillArrayWithKids=e=>{for(const r of e){const e=this.#W[r];if(e){e.#rt&&t.push(e);e.#ot&&fillArrayWithKids(e.#ot)}}};fillArrayWithKids(this.#ot);return t}return this.#K??=this.#tt(this.#Z)}getLock(){}isBoxChecked(t){const e=this.#Pt(t);return-1!==e&&this.#it===this.#dt[e]&&this.#g===this.exportValues[e]}isDefaultChecked(t){const e=this.#Pt(t);return-1!==e&&this.defaultValue===this.exportValues[e]}insertItemAt(t,e=void 0,r=0){if(!this.#nt)throw new Error("Not a choice widget");if(!t)return;(r<0||r>this.numItems)&&(r=this.numItems);if(this.#at.some(({displayValue:e})=>e===t))return;void 0===e&&(e=t);const i={displayValue:t,exportValue:e};this.#at.splice(r,0,i);if(Array.isArray(this.#X)){let t=this.#X.findIndex(t=>t>=r);if(-1!==t)for(const e=this.#X.length;t<e;t++)++this.#X[t]}else this.#X>=r&&++this.#X;this.#M({id:this.#it,insert:{index:r,...i}})}setAction(t,e){"string"==typeof t&&"string"==typeof e&&this.#L.getOrInsertComputed(t,makeArr).push(e)}setFocus(){this.#M({id:this.#it,focus:!0})}setItems(t){if(!this.#nt)throw new Error("Not a choice widget");this.#at.length=0;for(const e of t){let t,r;if(Array.isArray(e)){t=e[0]?.toString()||"";r=e[1]?.toString()||""}else t=r=e?.toString()||"";this.#at.push({displayValue:t,exportValue:r})}this.#X=0;this.#M({id:this.#it,items:this.#at})}setLock(){}signatureGetModifications(){}signatureGetSeedValue(){}signatureInfo(){}signatureSetSeedValue(){}signatureSign(){}signatureValidate(){}#Tt(t){this.#dt&&(this.#L=this.#ht[this.#St]);const e=t.name,r=this.#L.get(e);if(!r)return!1;for(const t of r)try{this.#k(t)}catch(t){this.#mt(serializeError(t,`Error when executing "${e}" for field "${this.#it}"\\n`))}return!0}}class PrintParams{binaryOk=!0;bitmapDPI=150;booklet={binding:0,duplexMode:0,subsetFrom:0,subsetTo:-1};colorOverride=0;colorProfile="";constants=Object.freeze({bookletBindings:Object.freeze({Left:0,Right:1,LeftTall:2,RightTall:3}),bookletDuplexMode:Object.freeze({BothSides:0,FrontSideOnly:1,BasicSideOnly:2}),colorOverrides:Object.freeze({auto:0,gray:1,mono:2}),fontPolicies:Object.freeze({everyPage:0,jobStart:1,pageRange:2}),handling:Object.freeze({none:0,fit:1,shrink:2,tileAll:3,tileLarge:4,nUp:5,booklet:6}),interactionLevel:Object.freeze({automatic:0,full:1,silent:2}),nUpPageOrders:Object.freeze({Horizontal:0,HorizontalReversed:1,Vertical:2}),printContents:Object.freeze({doc:0,docAndComments:1,formFieldsOnly:2}),flagValues:Object.freeze({applyOverPrint:1,applySoftProofSettings:2,applyWorkingColorSpaces:4,emitHalftones:8,emitPostScriptXObjects:16,emitFormsAsPSForms:32,maxJP2KRes:64,setPageSize:128,suppressBG:256,suppressCenter:512,suppressCJKFontSubst:1024,suppressCropClip:2048,suppressRotate:4096,suppressTransfer:8192,suppressUCR:16384,useTrapAnnots:32768,usePrintersMarks:65536}),rasterFlagValues:Object.freeze({textToOutline:1,strokesToOutline:2,allowComplexClip:4,preserveOverprint:8}),subsets:Object.freeze({all:0,even:1,odd:2}),tileMarks:Object.freeze({none:0,west:1,east:2}),usages:Object.freeze({auto:0,use:1,noUse:2})});downloadFarEastFonts=!1;fileName="";firstPage=0;flags=0;fontPolicy=0;gradientDPI=150;interactive=1;npUpAutoRotate=!1;npUpNumPagesH=2;npUpNumPagesV=2;npUpPageBorder=!1;npUpPageOrder=0;pageHandling=0;pageSubset=0;printAsImage=!1;printContent=0;printerName="";psLevel=0;rasterFlags=0;reversePages=!1;tileLabel=!1;tileMark=0;tileOverlap=0;tileScale=1;transparencyLevel=75;usePrinterCRD=0;useT1Conversion=0;constructor(t){this.lastPage=t.lastPage}}class InfoProxyHandler{static get(t,e){return t[e.toLowerCase()]}static set(t,e,r){throw new Error(`doc.info.${e} is read-only`)}}const V=Object.create(null);class Doc{#xt=null;#Vt=null;#Nt;#_t=!0;#jt=!1;#Rt=!1;#Ht=!1;#zt;#Lt;#Wt;#$t;#Bt=[];#Gt=[];#Ut;#Kt=new Map;#Yt=[];#Xt;#qt;#Zt;#Jt;#Qt;#te;#ee;#re;#ie;#se;#ne;#ae;#oe;#le;#ce;#ue;#he;#de=g.none;#ge;#L;#W;#k;#M;#x;#pe;constructor(t){this.#Nt=t.baseURL||"";this.#Lt=t.metadata||"";this.#Xt=t.Author||"";this.#qt=t.Creator||"";this.#Zt=this.#me(t.CreationDate)||null;this.#Jt=t.docID||["",""];this.#Qt=t.filename||"";this.#te=t.filesize||0;this.#ee=t.Keywords||"";this.#re=t.layout||"";this.#ie=this.#me(t.ModDate)||null;this.#se=t.numPages||1;this.#ne=t.pageNum||0;this.#ae=t.Producer||"";this.#oe=t.EncryptFilterName||null;this.#le=t.Subject||"";this.#ce=t.Title||"";this.#ue=t.URL||"";this.#he=new Proxy(Object.assign(Object.create(null),{title:this.#ce,author:this.#Xt,authors:t.authors||[this.#Xt],subject:this.#le,keywords:this.#ee,creator:this.#qt,producer:this.#ae,creationdate:this.#Zt,moddate:this.#ie,trapped:t.Trapped||"Unknown"}),InfoProxyHandler);this.#ge=t.zoom||100;this.#L=createMap(t.actions);this.#W=t.appObjects;this.#pe=t.calculateNow;this.#k=t.globalEval;this.#M=t.send;this.#x=t.userActivationData;this.#Ut=exposeObject(new PrintParams({lastPage:this.#se-1}),!0)}static{Object.assign(V,{addField:(t,e,r)=>t.#fe(e,r),dispatchDocEvent:(t,e)=>t.#be(e),dispatchPageEvent:(t,e,r,i)=>t.#ye(e,r,i),getTerminalChildren:(t,e)=>t.#tt(e),initActions:t=>t.#ve()})}#ve(){for(const t of this.#Kt.values()){const e=P.getInitialValue(t);e&&P.send(t,{value:e,formattedValue:P.getValue(t).toString()})}const t=new Set(["WillClose","WillSave","DidSave","WillPrint","DidPrint","OpenAction"]);this.#x.disableSaving=!0;for(const e of this.#L.keys())t.has(e)||this.#Tt(e);this.#x.disableSaving=!1}#be(t){switch(t){case"Open":this.#x.disableSaving=!0;this.#Tt("OpenAction");this.#x.disableSaving=!1;break;case"WillPrint":this.#x.disablePrinting=!0;try{this.#Tt(t)}catch(t){this.#M(serializeError(t))}this.#M({command:"WillPrintFinished"});this.#x.disablePrinting=!1;break;case"WillSave":this.#x.disableSaving=!0;try{this.#Tt(t)}catch(t){this.#M(serializeError(t))}this.#M({command:"WillSaveFinished"});this.#x.disableSaving=!1;break;default:this.#Tt(t)}}#ye(t,e,r){if("PageOpen"===t){this.#xt??=new Map;this.#xt.getOrInsertComputed(r,()=>createMap(e));this.#ne=r-1}for(const i of[this.#xt,this.#Vt]){e=i?.get(r)?.get(t);if(e)for(const t of e)this.#k(t)}}#Tt(t){const e=this.#L.get(t);if(e)for(const r of e)try{this.#k(r)}catch(e){this.#M(serializeError(e,`Error when executing "${t}" for document\\n`))}}#fe(t,e){this.#Kt.set(t,e);this.#Yt.push(t);for(const[t,r,i]of P.getPageActions(e)){this.#Vt??=new Map;this.#Vt.getOrInsertComputed(t+1,makeMap).getOrInsertComputed(r,makeArr).push(...i)}}#me(t){if(!t||t.length<15||!t.startsWith("D:"))return t;const e=(t=t.substring(2)).substring(0,4),r=t.substring(4,6),i=t.substring(6,8),s=t.substring(8,10),n=t.substring(10,12),a=t.charAt(12);let o,l;if("Z"===a||"+"===a||"-"===a){o="00";l=12}else{o=t.substring(12,14);l=14}const c=t.substring(l).replaceAll("\'","");return new Date(`${e}-${r}-${i}T${s}:${n}:${o}${c}`)}get author(){return this.#Xt}set author(t){throw new Error("doc.author is read-only")}get baseURL(){return this.#Nt}set baseURL(t){this.#Nt=t}get bookmarkRoot(){}set bookmarkRoot(t){throw new Error("doc.bookmarkRoot is read-only")}get calculate(){return this.#_t}set calculate(t){this.#_t=t}get creator(){return this.#qt}set creator(t){throw new Error("doc.creator is read-only")}get dataObjects(){return[]}set dataObjects(t){throw new Error("doc.dataObjects is read-only")}get delay(){return this.#jt}set delay(t){this.#jt=t}get dirty(){return this.#Rt}set dirty(t){this.#Rt=t}get disclosed(){return this.#Ht}set disclosed(t){this.#Ht=t}get docID(){return this.#Jt}set docID(t){throw new Error("doc.docID is read-only")}get documentFileName(){return this.#Qt}set documentFileName(t){throw new Error("doc.documentFileName is read-only")}get dynamicXFAForm(){return!1}set dynamicXFAForm(t){throw new Error("doc.dynamicXFAForm is read-only")}get external(){return false}set external(t){throw new Error("doc.external is read-only")}get filesize(){return this.#te}set filesize(t){throw new Error("doc.filesize is read-only")}get hidden(){return!1}set hidden(t){throw new Error("doc.hidden is read-only")}get hostContainer(){}set hostContainer(t){throw new Error("doc.hostContainer is read-only")}get icons(){}set icons(t){throw new Error("doc.icons is read-only")}get info(){return this.#he}set info(t){throw new Error("doc.info is read-only")}get innerAppWindowRect(){return[0,0,0,0]}set innerAppWindowRect(t){throw new Error("doc.innerAppWindowRect is read-only")}get innerDocWindowRect(){return[0,0,0,0]}set innerDocWindowRect(t){throw new Error("doc.innerDocWindowRect is read-only")}get isModal(){return!1}set isModal(t){throw new Error("doc.isModal is read-only")}get keywords(){return this.#ee}set keywords(t){throw new Error("doc.keywords is read-only")}get layout(){return this.#re}set layout(t){if(this.#x.userActivation){this.#x.userActivation=!1;if("string"==typeof t){"SinglePage"!==t&&"OneColumn"!==t&&"TwoColumnLeft"!==t&&"TwoPageLeft"!==t&&"TwoColumnRight"!==t&&"TwoPageRight"!==t&&(t="SinglePage");this.#M({command:"layout",value:t});this.#re=t}}}get media(){return this.#zt}set media(t){this.#zt=t}get metadata(){return this.#Lt}set metadata(t){this.#Lt=t}get modDate(){return this.#ie}set modDate(t){throw new Error("doc.modDate is read-only")}get mouseX(){return 0}set mouseX(t){throw new Error("doc.mouseX is read-only")}get mouseY(){return 0}set mouseY(t){throw new Error("doc.mouseY is read-only")}get noautocomplete(){return this.#Wt}set noautocomplete(t){this.#Wt=t}get nocache(){return this.#$t}set nocache(t){this.#$t=t}get numFields(){return this.#Yt.length}set numFields(t){throw new Error("doc.numFields is read-only")}get numPages(){return this.#se}set numPages(t){throw new Error("doc.numPages is read-only")}get numTemplates(){return 0}set numTemplates(t){throw new Error("doc.numTemplates is read-only")}get outerAppWindowRect(){return[0,0,0,0]}set outerAppWindowRect(t){throw new Error("doc.outerAppWindowRect is read-only")}get outerDocWindowRect(){return[0,0,0,0]}set outerDocWindowRect(t){throw new Error("doc.outerDocWindowRect is read-only")}get pageNum(){return this.#ne}set pageNum(t){if(this.#x.userActivation){this.#x.userActivation=!1;if(!("number"!=typeof t||t<0||t>=this.#se)){this.#M({command:"page-num",value:t});this.#ne=t}}}get pageWindowRect(){return[0,0,0,0]}set pageWindowRect(t){throw new Error("doc.pageWindowRect is read-only")}get path(){return""}set path(t){throw new Error("doc.path is read-only")}get permStatusReady(){return!0}set permStatusReady(t){throw new Error("doc.permStatusReady is read-only")}get producer(){return this.#ae}set producer(t){throw new Error("doc.producer is read-only")}get requiresFullSave(){return!1}set requiresFullSave(t){throw new Error("doc.requiresFullSave is read-only")}get securityHandler(){return this.#oe}set securityHandler(t){throw new Error("doc.securityHandler is read-only")}get selectedAnnots(){return[]}set selectedAnnots(t){throw new Error("doc.selectedAnnots is read-only")}get sounds(){return[]}set sounds(t){throw new Error("doc.sounds is read-only")}get spellDictionaryOrder(){return this.#Bt}set spellDictionaryOrder(t){this.#Bt=t}get spellLanguageOrder(){return this.#Gt}set spellLanguageOrder(t){this.#Gt=t}get subject(){return this.#le}set subject(t){throw new Error("doc.subject is read-only")}get templates(){return[]}set templates(t){throw new Error("doc.templates is read-only")}get title(){return this.#ce}set title(t){throw new Error("doc.title is read-only")}get URL(){return this.#ue}set URL(t){throw new Error("doc.URL is read-only")}get viewState(){}set viewState(t){throw new Error("doc.viewState is read-only")}get xfa(){}set xfa(t){throw new Error("doc.xfa is read-only")}get XFAForeground(){return!1}set XFAForeground(t){throw new Error("doc.XFAForeground is read-only")}get zoomType(){return this.#de}set zoomType(t){if(this.#x.userActivation){this.#x.userActivation=!1;if("string"==typeof t){switch(t){case g.none:this.#M({command:"zoom",value:1});break;case g.fitP:this.#M({command:"zoom",value:"page-fit"});break;case g.fitW:this.#M({command:"zoom",value:"page-width"});break;case g.fitH:this.#M({command:"zoom",value:"page-height"});break;case g.fitV:this.#M({command:"zoom",value:"auto"});break;case g.pref:case g.refW:break;default:return}this.#de=t}}}get zoom(){return this.#ge}set zoom(t){if(this.#x.userActivation){this.#x.userActivation=!1;"number"!=typeof t||t<8.33||t>6400||this.#M({command:"zoom",value:t/100})}}addAnnot(){}addField(){}addIcon(){}addLink(){}addRecipientListCryptFilter(){}addRequirement(){}addScript(){}addThumbnails(){}addWatermarkFromFile(){}addWatermarkFromText(){}addWeblinks(){}bringToFront(){}calculateNow(){this.#pe()}closeDoc(){}colorConvertPage(){}createDataObject(){}createTemplate(){}deletePages(){}deleteSound(){}embedDocAsDataObject(){}embedOutputIntent(){}encryptForRecipients(){}encryptUsingPolicy(){}exportAsFDF(){}exportAsFDFStr(){}exportAsText(){}exportAsXFDF(){}exportAsXFDFStr(){}exportDataObject(){}exportXFAData(){}extractPages(){}flattenPages(){}getAnnot(){}getAnnots(){}getAnnot3D(){}getAnnots3D(){}getColorConvertAction(){}getDataObject(){}getDataObjectContents(){}getField(t){t&&"object"==typeof t&&(t=t.cName);if("string"!=typeof t)throw new TypeError("Invalid field name: must be a string");const e=this.#Kt.get(t);if(e)return e;const r=t.split("#");let i=NaN;if(2===r.length){i=Math.floor(parseFloat(r[1]));t=r[0]}for(const[e,r]of this.#Kt)if(e.endsWith(t)){if(!isNaN(i)){const r=this.#Ae(e);(i<0||i>=r.length)&&(i=0);if(i<r.length){this.#Kt.set(t,r[i]);return r[i]}}this.#Kt.set(t,r);return r}return null}#Ae(t){const e=t.length,r=[],i=/^\\.[^.]+$/;for(const[s,n]of this.#Kt)if(s.startsWith(t)){const t=s.slice(e);i.test(t)&&r.push(n)}return r}#tt(t){const e=[],r=t.length;for(const[i,s]of this.#Kt)if(i.startsWith(t)){const t=i.slice(r);P.getHasValue(s)&&(""===t||t.startsWith("."))&&e.push(s)}return e}getIcon(){}getLegalWarnings(){}getLinks(){}getNthFieldName(t){t&&"object"==typeof t&&(t=t.nIndex);if("number"!=typeof t)throw new TypeError("Invalid field index: must be a number");return t>=0&&t<this.numFields?this.#Yt[Math.trunc(t)]:null}getNthTemplate(){return null}getOCGs(){}getOCGOrder(){}getPageBox(){}getPageLabel(){}getPageNthWord(){}getPageNthWordQuads(){}getPageNumWords(){}getPageRotation(){}getPageTransition(){}getPrintParams(){return this.#Ut}getSound(){}getTemplate(){}getURL(){}gotoNamedDest(){}importAnFDF(){}importAnXFDF(){}importDataObject(){}importIcon(){}importSound(){}importTextData(){}importXFAData(){}insertPages(){}mailDoc(){}mailForm(){}movePage(){}newPage(){}openDataObject(){}print(t=!0,e=0,r=-1,i=!1,s=!1,n=!1,a=!1,o=!0,l=null){if(!this.#x.disablePrinting&&this.#x.userActivation){this.#x.userActivation=!1;if(t&&"object"==typeof t){e=t.nStart;r=t.nEnd;t.bSilent;t.bShrinkToFit;t.bPrintAsImage;t.bReverse;t.bAnnotations;l=t.printParams;t=t.bUI}if(l){e=l.firstPage;r=l.lastPage}e="number"==typeof e?Math.max(0,Math.trunc(e)):0;r="number"==typeof r?Math.max(0,Math.trunc(r)):-1;this.#M({command:"print",start:e,end:r})}}removeDataObject(){}removeField(){}removeIcon(){}removeLinks(){}removeRequirement(){}removeScript(){}removeTemplate(){}removeThumbnails(){}removeWeblinks(){}replacePages(){}resetForm(t=null){t&&"object"==typeof t&&!Array.isArray(t)&&(t=t.aFields);t&&!Array.isArray(t)&&(t=[t]);let e,r=!1;if(t){e=new Set;for(const i of t){if(!i)continue;if("string"!=typeof i){e=null;break}const t=this.getField(i);if(t){e.add(t);r=!0}}}if(e)for(const t of e)for(const r of P.getKidIds(t)||[]){const t=this.#W[r];t&&e.add(t)}else{e=this.#Kt.values();r=0!==this.#Kt.size}for(const t of e){P.setValue(t,t.defaultValue);P.send(t,{value:t.defaultValue,formattedValue:null,selRange:[0,0]})}r&&this.calculateNow()}saveAs(){}scroll(){}selectPageNthWord(){}setAction(){}setDataObjectContents(){}setOCGOrder(){}setPageAction(){}setPageBoxes(){}setPageLabels(){}setPageRotations(){}setPageTabOrder(){}setPageTransitions(){}spawnPageFromTemplate(){}submitForm(){}syncAnnotScan(){}}const{values:N}=Object,_=Object.create(Object.prototype,{[Symbol.toStringTag]:{value:"Event"}});function createEvent(t){return{__proto__:_,change:t.change||"",changeEx:t.changeEx||null,commitKey:t.commitKey||0,fieldFull:t.fieldFull||!1,keyDown:t.keyDown||!1,modifier:t.modifier||!1,name:t.name,rc:!0,richChange:t.richChange||[],richChangeEx:t.richChangeEx||[],richValue:t.richValue||[],selEnd:t.selEnd??-1,selStart:t.selStart??-1,shift:t.shift||!1,source:t.source||null,target:t.target||null,targetName:"",type:"Field",value:t.value||"",willCommit:t.willCommit||!1}}function mergeChange(t){let e=t.value;if(Array.isArray(e))return e;"string"!=typeof e&&(e=e.toString());const r=t.selStart>=0?e.substring(0,t.selStart):"",i=t.selEnd>=0&&t.selEnd<=e.length?e.substring(t.selEnd):"";return`${r}${t.change}${i}`}class EventDispatcher{#we;#S;#P;#Ce=!1;#Ie;#x;constructor(t,e,r,i,s){this.#S=t;this.#we=e;this.#Ie=r;this.#P=i;this.#x=s}#Se(){this.#x.userActivation=!0;this.#P("setTimeout",[0,5e3])}dispatch(t){const e=t.id;if(!(e in this.#Ie)){let r;if("doc"===e||"page"===e){r=globalThis.event=createEvent(t);r.source=r.target=globalThis}if("doc"===e){const t=r.name;if("Open"===t){this.#Se();V.initActions(this.#S);this.#Te()}["DidPrint","DidSave","WillPrint","WillSave"].includes(t)||this.#Se();V.dispatchDocEvent(this.#S,r.name)}else if("page"===e){this.#Se();V.dispatchPageEvent(this.#S,r.name,t.actions,t.pageNumber)}else if("app"===e&&"ResetForm"===t.name){this.#Se();for(const e of t.ids){const t=this.#Ie[e];t&&P.setValue(t,t.defaultValue)}}return}const r=t.name,i=this.#Ie[e],s=globalThis.event=createEvent(t);let n;this.#Se();P.prepareEvent(i,e,s);switch(r){case"Keystroke":n={value:s.value,changeEx:s.changeEx,change:s.change,selStart:s.selStart,selEnd:s.selEnd};break;case"Blur":case"Focus":Object.defineProperty(s,"value",{configurable:!1,writable:!1,enumerable:!0,value:s.value});break;case"Validate":this.#Fe(i,s);return;case"Action":this.#Tt(i,i,s,r);this.#De(i,s);return}this.#Tt(i,i,s,r);if("Keystroke"===r)if(s.rc)if(s.willCommit)this.#Fe(i,s);else{if(P.getIsChoice(i)){P.setValue(i,n.changeEx);P.send(i,{value:P.getValue(i)});return}const t=mergeChange(s);P.setValue(i,t);let e,r;if(s.selStart!==n.selStart||s.selEnd!==n.selEnd){e=s.selStart;r=s.selEnd}else r=e=n.selStart+s.change.length;P.send(i,{value:t,selRange:[e,r]})}else s.willCommit?P.send(i,{value:"",formattedValue:null,selRange:[0,0]}):P.send(i,{value:n.value,selRange:[n.selStart,n.selEnd]})}#Te(){const t=globalThis.event=createEvent({});for(const e of N(this.#Ie)){t.value=P.getComputedValue(e);this.#Tt(e,e,t,"Format")}}#Fe(t,e){const r=this.#Tt(t,t,e,"Validate");if(e.rc){P.setValue(t,e.value);this.#De(t,e);const r=e.value=P.getComputedValue(t),i=this.#Tt(t,t,e,"Format")?e.value?.toString?.():null;P.send(t,{value:r,formattedValue:i});e.value=r}else r&&P.send(t,{value:"",formattedValue:null,selRange:[0,0],focus:!0})}#Tt(t,e,r,i){r.source=t;r.target=e;r.name=i;r.targetName=e.name;r.rc=!0;return P.runActions(e,r)}calculateNow(){if(!this.#we||this.#Ce||!this.#S.calculate)return;this.#Ce=!0;const t=this.#we[0],e=this.#Ie[t];globalThis.event=createEvent({});this.#De(e,globalThis.event);this.#Ce=!1}#De(t,e){if(this.#we&&this.#S.calculate)for(const r of this.#we){if(!(r in this.#Ie))continue;if(!this.#S.calculate)break;e.value=null;const i=this.#Ie[r];let s=P.getComputedValue(i);this.#Tt(t,i,e,"Calculate");if(!e.rc)continue;null!==e.value?P.setValue(i,e.value):e.value=P.getComputedValue(i);this.#Tt(i,i,e,"Validate");if(!e.rc){P.getComputedValue(i)!==s&&(i.value=s);continue}null===e.value&&(e.value=P.getComputedValue(i));s=P.getComputedValue(i);const n=this.#Tt(i,i,e,"Format")?e.value?.toString?.():null;P.send(i,{value:s,formattedValue:n})}}}class AForm{#Ee;#Oe;#yt;#ke;#Pe=new RegExp("^[\\\\w.!#$%&\'*+/=?^`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$");constructor(t,e,r,i){this.#Ee=t;this.#Oe=e;this.#yt=r;this.#ke=i}#Me(t){return t.target?`[ ${t.target.name} ]`:""}#xe(t,e){let r=null;try{r=this.#yt.scand(t,e)}catch{}if(r)return r;r=Date.parse(e);return isNaN(r)?null:new Date(r)}AFMergeChange(t=globalThis.event){return t.willCommit?t.value.toString():mergeChange(t)}AFParseDateEx(t,e){return this.#xe(e,t)}AFExtractNums(t){if("number"==typeof t)return[t];if(!t||"string"!=typeof t)return null;const e=t.charAt(0);"."!==e&&","!==e||(t=`0${t}`);const r=t.match(/(\\d+)/g);return 0===r.length?null:r}AFMakeNumber(t){if("number"==typeof t)return t;if("string"!=typeof t)return null;t=t.trim().replace(",",".");const e=parseFloat(t);return isNaN(e)||!isFinite(e)?null:e}AFMakeArrayFromList(t){return"string"==typeof t?t.split(/, ?/g):t}AFNumber_Format(t,e,r,i,s,n){const a=globalThis.event;let o=this.AFMakeNumber(a.value);if(null===o){a.value="";return}const l=Math.sign(o),c=[];let u=!1;-1===l&&n&&0===r&&c.push("-");if((2===r||3===r)&&-1===l){c.push("(");u=!0}n&&c.push(s);e=MathClamp(Math.floor(e),0,4);c.push("%,",e,".",t.toString(),"f");n||c.push(s);u&&c.push(")");1!==r&&3!==r||(a.target.textColor=1===l?this.#ke.black:this.#ke.red);0===r&&!n||-1!==l||(o=-o);const h=c.join("");a.value=this.#yt.printf(h,o)}AFNumber_Keystroke(t,e,r,i,s,n){const a=globalThis.event;let o,l=this.AFMergeChange(a);if(l){l=l.trim();o=e>1?a.willCommit?/^[+-]?(\\d+(,\\d*)?|,\\d+)$/:/^[+-]?\\d*(?:,\\d*)?$/:a.willCommit?/^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)$/:/^[+-]?\\d*(?:\\.\\d*)?$/;if(!o.test(l)){if(a.willCommit){const t=`${p.IDS_INVALID_VALUE} ${this.#Me(a)}`;this.#Oe.alert(t)}a.rc=!1}a.willCommit&&e>1&&(a.value=parseFloat(l.replace(",",".")))}}AFPercent_Format(t,e,r=!1){if("number"!=typeof t||"number"!=typeof e)return;if(t<0)throw new Error("Invalid nDec value in AFPercent_Format");const i=globalThis.event;if(t>512){i.value="%";return}t=Math.floor(t);e=MathClamp(Math.floor(e),0,4);let s=this.AFMakeNumber(i.value);if(null===s){i.value="%";return}const n=`%,${e}.${t}f`;s=this.#yt.printf(n,100*s);i.value=r?`%${s}`:`${s}%`}AFPercent_Keystroke(t,e){this.AFNumber_Keystroke(t,e,0,0,"",!0)}AFDate_FormatEx(t){const e=globalThis.event,r=e.value;if(!r)return;const i=this.#xe(t,r);null!==i&&(e.value=this.#yt.printd(t,i))}AFDate_Format(t){this.AFDate_FormatEx(m[t]??t)}AFDate_KeystrokeEx(t){const e=globalThis.event;if(!e.willCommit)return;const r=this.AFMergeChange(e);if(r&&null===this.#xe(t,r)){const r=p.IDS_INVALID_DATE,i=p.IDS_INVALID_DATE2,s=`${r} ${this.#Me(e)}${i}${t}`;this.#Oe.alert(s);e.rc=!1}}AFDate_Keystroke(t){t>=0&&t<m.length&&this.AFDate_KeystrokeEx(m[t])}AFRange_Validate(t,e,r,i){const s=globalThis.event;if(!s.value)return;const n=this.AFMakeNumber(s.value);if(null===n)return;r=!!r;if((t=!!t)&&null===(e=this.AFMakeNumber(e)))return;if(r&&null===(i=this.AFMakeNumber(i)))return;let a="";t&&r?(n<e||n>i)&&(a=this.#yt.printf(p.IDS_GT_AND_LT,e,i)):t?n<e&&(a=this.#yt.printf(p.IDS_GREATER_THAN,e)):n>i&&(a=this.#yt.printf(p.IDS_LESS_THAN,i));if(a){this.#Oe.alert(a);s.rc=!1}}AFSimple(t,e,r){const i=this.AFMakeNumber(e);if(null===i)throw new Error("Invalid nValue1 in AFSimple");const s=this.AFMakeNumber(r);if(null===s)throw new Error("Invalid nValue2 in AFSimple");switch(t){case"AVG":return(i+s)/2;case"SUM":return i+s;case"PRD":return i*s;case"MIN":return Math.min(i,s);case"MAX":return Math.max(i,s)}throw new Error("Invalid cFunction in AFSimple")}AFSimple_Calculate(t,e){const r={AVG:t=>Math.sumPrecise(t)/t.length,SUM:t=>Math.sumPrecise(t),PRD:t=>t.reduce((t,e)=>t*e,1),MIN:t=>Math.min(...t),MAX:t=>Math.max(...t)};if(!(t in r))throw new TypeError("Invalid function in AFSimple_Calculate");const i=globalThis.event,s=[];e=this.AFMakeArrayFromList(e);for(const t of e){const e=this.#Ee.getField(t);if(e)for(const t of e.getArray()){const e=this.AFMakeNumber(t.value);s.push(e??0)}}if(0===s.length){i.value=0;return}const n=r[t](s);i.value=Math.round(1e6*n)/1e6}AFSpecial_Format(t){const e=globalThis.event;if(!e.value)return;let r;switch(t=this.AFMakeNumber(t)){case 0:r="99999";break;case 1:r="99999-9999";break;case 2:r=this.#yt.printx("9999999999",e.value).length>=10?"(999) 999-9999":"999-9999";break;case 3:r="999-99-9999";break;default:throw new Error("Invalid psf in AFSpecial_Format")}e.value=this.#yt.printx(r,e.value)}AFSpecial_KeystrokeEx(t){const e=globalThis.event,r=t.replaceAll(/[^9AOX]/g,"");this.#Ve(r,null,!1);if(!e.rc){e.rc=!0;this.#Ve(t,null,!0)}}#Ve(t,e,r){if(!t)return;const i=globalThis.event;e||=this.AFMergeChange(i);if(!e)return;const s=new Map([["9",t=>t>="0"&&t<="9"],["A",t=>"a"<=t&&t<="z"||"A"<=t&&t<="Z"],["O",t=>"a"<=t&&t<="z"||"A"<=t&&t<="Z"||"0"<=t&&t<="9"],["X",t=>!0]]);function _checkValidity(t,e){for(let r=0,i=t.length;r<i;r++){const i=e.charAt(r),n=t.charAt(r),a=s.get(i);if(a){if(!a(n))return!1}else if(i!==n)return!1}return!0}const n=`${p.IDS_INVALID_VALUE} = "${t}"`;if(e.length>t.length){r&&this.#Oe.alert(n);i.rc=!1}else if(i.willCommit){if(e.length<t.length){r&&this.#Oe.alert(n);i.rc=!1;return}if(!_checkValidity(e,t)){r&&this.#Oe.alert(n);i.rc=!1;return}i.value+=t.substring(e.length)}else{e.length<t.length&&(t=t.substring(0,e.length));if(!_checkValidity(e,t)){r&&this.#Oe.alert(n);i.rc=!1}}}AFSpecial_Keystroke(t){const e=globalThis.event;t=this.AFMakeNumber(t);let r,i,s=this.AFMergeChange(e);switch(t){case 0:r="99999";break;case 1:r="99999-9999";break;case 2:r="999-9999";i="(999) 999-9999";break;case 3:r="999-99-9999";break;default:throw new Error("Invalid psf in AFSpecial_Keystroke")}const n=i?[r,i]:[r];for(const t of n){this.#Ve(t,s,!1);if(e.rc)return;e.rc=!0}const a=/[-()\\s]+/g;s=s.replaceAll(a,"");for(const t of n){this.#Ve(t.replaceAll(a,""),s,!1);if(e.rc)return;e.rc=!0}this.AFSpecial_KeystrokeEx((i&&s.match(/\\d/g)||[]).length>7?i:r)}AFTime_FormatEx(t){this.AFDate_FormatEx(t)}AFTime_Format(t){this.AFDate_FormatEx(f[t]??t)}AFTime_KeystrokeEx(t){this.AFDate_KeystrokeEx(t)}AFTime_Keystroke(t){t>=0&&t<f.length&&this.AFDate_KeystrokeEx(f[t])}eMailValidate(t){return this.#Pe.test(t)}AFExactMatch(t,e){return t instanceof RegExp?e.match(t)?.[0]===e||0:t.findIndex(t=>e.match(t)?.[0]===e)+1}}class Console{#M;constructor({send:t}){this.#M=t}clear(){this.#M({id:"clear"})}hide(){}println(t){if("string"!=typeof t)try{t=JSON.stringify(t)}catch{t=t.toString?.()||"[Unserializable object]"}this.#M({command:"println",value:`PDF.js Console:: ${t}`})}show(){}}class Util{#Ne=this.#_e.bind(this);#je=this.#Re.bind(this);#He=null;#ze=null;#Le=["January","February","March","April","May","June","July","August","September","October","November","December"];#We=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];MILLISECONDS_IN_DAY=864e5;MILLISECONDS_IN_WEEK=6048e5;printf(...t){if(0===t.length)throw new Error("Invalid number of params in printf");if("string"!=typeof t[0])throw new TypeError("First argument of printf must be a string");let e=0;return t[0].replaceAll(/%(,[0-4])?([+ 0#]+)?(\\d+)?(\\.\\d+)?(.)/g,function(r,i,s,n,a,o){if("d"!==o&&"f"!==o&&"s"!==o&&"x"!==o){const t=["%"];for(const e of[i,s,n,a,o])e&&t.push(e);return t.join("")}e++;if(e===t.length)throw new Error("Not enough arguments in printf");const l=t[e];if("s"===o)return l.toString();let c=0;if(s)for(const t of s)switch(t){case"+":c|=1;break;case" ":c|=2;break;case"0":c|=4;break;case"#":c|=8}s=c;n&&=parseInt(n);let u=Math.trunc(l);if("x"===o){let t=Math.abs(u).toString(16).toUpperCase();void 0!==n&&(t=t.padStart(n,4&s?"0":" "));8&s&&(t=`0x${t}`);return t}a&&=parseInt(a.substring(1));i=i?i.substring(1):"0";const[h,d]={0:[",","."],1:["","."],2:[".",","],3:["",","],4:["\'","."]}[i];let g="";if("f"===o){g=void 0!==a?Math.abs(l-u).toFixed(a):Math.abs(l-u).toString();if(g.length>2)if(/^1\\.0+$/.test(g)){u+=Math.sign(l);g=`${d}${g.split(".")[1]}`}else g=`${d}${g.substring(2)}`;else{"1"===g&&(u+=Math.sign(l));g=8&s?".":""}}let p="";if(u<0||"f"===o&&l<0){p="-";u=-u}else 1&s?p="+":2&s&&(p=" ");if(h&&u>=1e3){const t=[];for(;;){t.push((u%1e3).toString().padStart(3,"0"));u=Math.trunc(u/1e3);if(u<1e3){t.push(u.toString());break}}u=t.reverse().join(h)}else u=u.toString();let m=`${u}${g}`;void 0!==n&&(m=m.padStart(n-p.length,4&s?"0":" "));return`${p}${m}`})}iconStreamFromIcon(){}printd(t,e){switch(t){case 0:return this.printd("D:yyyymmddHHMMss",e);case 1:return this.printd("yyyy.mm.dd HH:MM:ss",e);case 2:return this.printd("m/d/yy h:MM:ss tt",e)}const r={mmmm:t=>this.#Le[t.month],mmm:t=>this.#Le[t.month].substring(0,3),mm:t=>(t.month+1).toString().padStart(2,"0"),m:t=>(t.month+1).toString(),dddd:t=>this.#We[t.dayOfWeek],ddd:t=>this.#We[t.dayOfWeek].substring(0,3),dd:t=>t.day.toString().padStart(2,"0"),d:t=>t.day.toString(),yyyy:t=>t.year.toString().padStart(4,"0"),yy:t=>(t.year%100).toString().padStart(2,"0"),HH:t=>t.hours.toString().padStart(2,"0"),H:t=>t.hours.toString(),hh:t=>(1+(t.hours+11)%12).toString().padStart(2,"0"),h:t=>(1+(t.hours+11)%12).toString(),MM:t=>t.minutes.toString().padStart(2,"0"),M:t=>t.minutes.toString(),ss:t=>t.seconds.toString().padStart(2,"0"),s:t=>t.seconds.toString(),tt:t=>t.hours<12?"am":"pm",t:t=>t.hours<12?"a":"p"},i={year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),dayOfWeek:e.getDay(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()};return t.replaceAll(/(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t|\\\\.)/g,(t,e)=>e in r?r[e](i):e.charAt(1))}printx(t,e){const r=[t=>t,t=>t.toUpperCase(),t=>t.toLowerCase()],i=[];let s=0;const n=(e=(e??"").toString()).length;let a=r[0],o=!1;for(const l of t)if(o){i.push(l);o=!1}else{if(s>=n)break;switch(l){case"?":i.push(a(e.charAt(s++)));break;case"X":for(;s<n;){const t=e.charAt(s++);if("a"<=t&&t<="z"||"A"<=t&&t<="Z"||"0"<=t&&t<="9"){i.push(a(t));break}}break;case"A":for(;s<n;){const t=e.charAt(s++);if("a"<=t&&t<="z"||"A"<=t&&t<="Z"){i.push(a(t));break}}break;case"9":for(;s<n;){const t=e.charAt(s++);if("0"<=t&&t<="9"){i.push(t);break}}break;case"*":for(;s<n;)i.push(a(e.charAt(s++)));break;case"\\\\":o=!0;break;case">":a=r[1];break;case"<":a=r[2];break;case"=":a=r[0];break;default:i.push(l)}}return i.join("")}#_e(t){const e=[];t.replaceAll(/(d+)|(m+)|(y+)|(H+)|(M+)|(s+)/g,function(t,r,i,s,n,a,o){r?e.push((t,e)=>{if(t>=1&&t<=31){e.day=t;return!0}return!1}):i?e.push((t,e)=>{if(t>=1&&t<=12){e.month=t-1;return!0}return!1}):s?e.push((t,e)=>{t<50?t+=2e3:t<100&&(t+=1900);e.year=t;return!0}):n?e.push((t,e)=>{if(t>=0&&t<=23){e.hours=t;return!0}return!1}):a?e.push((t,e)=>{if(t>=0&&t<=59){e.minutes=t;return!0}return!1}):o&&e.push((t,e)=>{if(t>=0&&t<=59){e.seconds=t;return!0}return!1});return""});return e}#$e(t,e){const r=(this.#He??=new Map).getOrInsertComputed(t,this.#Ne),i=/\\d+/g;let s,n=0;const a={year:(new Date).getFullYear(),month:0,day:1,hours:12,minutes:0,seconds:0};for(;null!==(s=i.exec(e))&&n<r.length;)if(!r[n++](parseInt(s[0]),a))return null;return 0===n?null:new Date(a.year,a.month,a.day,a.hours,a.minutes,a.seconds)}#Re(t){const e=this.#Le,r=this.#We,i={mmmm:{pattern:`(${e.join("|")})`,action:(t,r)=>{r.month=e.indexOf(t)}},mmm:{pattern:`(${e.map(t=>t.substring(0,3)).join("|")})`,action:(t,r)=>{r.month=e.findIndex(e=>e.substring(0,3)===t)}},mm:{pattern:"(\\\\d{2})",action:(t,e)=>{e.month=parseInt(t)-1}},m:{pattern:"(\\\\d{1,2})",action:(t,e)=>{e.month=parseInt(t)-1}},dddd:{pattern:`(${r.join("|")})`,action:(t,e)=>{e.day=r.indexOf(t)}},ddd:{pattern:`(${r.map(t=>t.substring(0,3)).join("|")})`,action:(t,e)=>{e.day=r.findIndex(e=>e.substring(0,3)===t)}},dd:{pattern:"(\\\\d{2})",action:(t,e)=>{e.day=parseInt(t)}},d:{pattern:"(\\\\d{1,2})",action:(t,e)=>{e.day=parseInt(t)}},yyyy:{pattern:"(\\\\d{4})",action:(t,e)=>{e.year=parseInt(t)}},yy:{pattern:"(\\\\d{2})",action:(t,e)=>{e.year=2e3+parseInt(t)}},HH:{pattern:"(\\\\d{2})",action:(t,e)=>{e.hours=parseInt(t)}},H:{pattern:"(\\\\d{1,2})",action:(t,e)=>{e.hours=parseInt(t)}},hh:{pattern:"(\\\\d{2})",action:(t,e)=>{e.hours=parseInt(t)}},h:{pattern:"(\\\\d{1,2})",action:(t,e)=>{e.hours=parseInt(t)}},MM:{pattern:"(\\\\d{2})",action:(t,e)=>{e.minutes=parseInt(t)}},M:{pattern:"(\\\\d{1,2})",action:(t,e)=>{e.minutes=parseInt(t)}},ss:{pattern:"(\\\\d{2})",action:(t,e)=>{e.seconds=parseInt(t)}},s:{pattern:"(\\\\d{1,2})",action:(t,e)=>{e.seconds=parseInt(t)}},tt:{pattern:"([aApP][mM])",action:(t,e)=>{const r=t.charAt(0);e.am="a"===r||"A"===r}},t:{pattern:"([aApP])",action:(t,e)=>{e.am="a"===t||"A"===t}}},s=t.replaceAll(/[.*+\\-?^${}()|[\\]\\\\]/g,"\\\\$&"),n=[],a=s.replaceAll(/(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t)/g,function(t,e){const{pattern:r,action:s}=i[e];n.push(s);return r.includes(",")?`(?=${r})\\\\${n.length}`:r});return[new RegExp(`^${a}$`),n]}scand(t,e){if("string"!=typeof e)return new Date(e);if(""===e)return new Date;switch(t){case 0:return this.scand("D:yyyymmddHHMMss",e);case 1:return this.scand("yyyy.mm.dd HH:MM:ss",e);case 2:return this.scand("m/d/yy h:MM:ss tt",e)}const[r,i]=(this.#ze??=new Map).getOrInsertComputed(t,this.#je),s=r.exec(e);if(!s||s.length!==i.length+1)return this.#$e(t,e);const n={year:2e3,month:0,day:1,hours:0,minutes:0,seconds:0,am:null};i.forEach((t,e)=>t(s[e+1],n));null!==n.am&&(n.hours=n.hours%12+(n.am?0:12));return new Date(n.year,n.month,n.day,n.hours,n.minutes,n.seconds)}spansToXML(){}stringFromStream(){}xmlToSpans(){}}globalThis.pdfjsScripting={initSandbox:function initSandbox(e){delete globalThis.pdfjsScripting;const m=globalThis.callExternalFunction;delete globalThis.callExternalFunction;const f=globalThis.eval.bind(globalThis),send=t=>m("send",[t]),{data:b}=e,y=Object.create(null),v={userActivation:!1,disablePrinting:!1,disableSaving:!1};let A=null;const w=new Doc({...b.docInfo,send,globalEval:f,appObjects:y,userActivationData:v,calculateNow:()=>A.calculateNow()});A=new EventDispatcher(w,b.calculationOrder,y,m,v);const C=new App({...b.appInfo,send,globalEval:f,externalCall:m,doc:w,userActivationData:v}),I=new Util,getTerminalChildren=t=>V.getTerminalChildren(w,t);for(const[t,e]of createMap(b.objects)){const r=[];let i=null;for(const t of e)""!==t.type?r.push(t):i=t;let s=i;if(r.length>0){s=r[0];s.send=send}s.globalEval=f;s.sendError=send;s.fieldPath=t;s.appObjects=y;s.util=I;s.getTerminalChildren=getTerminalChildren;const n=exposeObject(new Field(s,r.slice(1)));V.addField(w,t,n);for(const t of e)y[t.id]=n;i&&(y[i.id]=n)}const S=exposeObject(new Color,!0);globalThis.event=null;globalThis.global=Object.create(null);globalThis.app=exposeObject(C,!0);globalThis.color=S;globalThis.console=exposeObject(new Console({send}),!0);globalThis.util=exposeObject(I,!0);globalThis.border=i;globalThis.cursor=s;globalThis.display=n;globalThis.font=a;globalThis.highlight=o;globalThis.position=l;globalThis.scaleHow=c;globalThis.scaleWhen=u;globalThis.style=h;globalThis.trans=d;globalThis.zoomtype=g;globalThis.ADBE={Reader_Value_Asked:!0,Viewer_Value_Asked:!0};const F=new AForm(w,C,I,S);for(const t of Object.getOwnPropertyNames(AForm.prototype))"constructor"!==t&&(globalThis[t]=F[t].bind(F));for(const[t,e]of Object.entries(p))Object.defineProperty(globalThis,t,{value:e,writable:!1});Object.defineProperties(globalThis,{ColorConvert:{value:S.convert.bind(S),writable:!0},ColorEqual:{value:S.equal.bind(S),writable:!0}});const D=Object.create(null);for(const t of Object.getOwnPropertyNames(Doc.prototype)){if("constructor"===t)continue;const e=Object.getOwnPropertyDescriptor(Doc.prototype,t);e.get?D[t]={get:e.get.bind(w),set:e.set.bind(w)}:D[t]={value:Doc.prototype[t].bind(w)}}Object.defineProperties(globalThis,D);!function useNativeToStringForPublicFunctions(){const e=Function.prototype.toString,i=uncurryThis(WeakSet.prototype.has),[s,n]=t(e,e,[]).split("toString"),{toString:a}={toString(){return i(r,this)?`${s}${this.name}${n}`:t(e,this,[])}};r.add(a);Object.defineProperty(Function.prototype,"toString",{value:a,writable:!0,configurable:!0})}();const E={dispatchEvent:t=>A.dispatch(t),timeoutCb:t=>T.evalCallback(C,t)};return(t,e)=>{try{E[t](e)}catch(t){send(serializeError(t))}}}}})();'];e.push("delete dump;");let r=!1,i=0;try{const s=this.support.exportValueToSandbox(t);e.push(`pdfjsScripting.initSandbox({ data: ${s} })`);i=this._module.stringToNewUTF8(e.join("\n"));r=!!this._module.ccall("init","number",["number","number"],[i,this._alertOnError])}catch(t){console.error(t)}finally{i&&this._module.ccall("free","number",["number"],[i])}if(!r){this.nukeSandbox();throw new Error("Cannot start sandbox")}this.support.commFun=this._module.cwrap("commFun",null,["string","string"])}dispatchEvent(t){this.support?.callSandboxFunction("dispatchEvent",t)}dumpMemoryUse(){this._module?.ccall("dumpMemoryUse",null,[])}nukeSandbox(){if(null!==this._module){this.support.destroy();this.support=null;this._module.ccall("nukeSandbox",null,[]);this._module=null}}evalForTesting(t,e){throw new Error("Not implemented: evalForTesting")}}async function QuickJSSandbox(t="../web/wasm/"){const{default:e}=await(import(
/*webpackIgnore: true*/
/*@vite-ignore*/
`${t}quickjs-eval.js`)),r=await e();return new Sandbox(window,r)}globalThis.pdfjsSandbox={QuickJSSandbox};export{QuickJSSandbox};