Files
openmaxio-object-browser/web-app/build/static/js/5067.2702d94c.chunk.js
Alex 9a3063b7da Release v1.7.4 (#3472)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-11-26 14:47:40 -06:00

3 lines
397 KiB
JavaScript

/*! For license information please see 5067.2702d94c.chunk.js.LICENSE.txt */
(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5067],{18628:(t,e)=>{"use strict";e.A=function(t,e){if(t&&e){var i=Array.isArray(e)?e:e.split(",");if(0===i.length)return!0;var n=t.name||"",s=(t.type||"").toLowerCase(),a=s.replace(/\/.*$/,"");return i.some((function(t){var e=t.trim().toLowerCase();return"."===e.charAt(0)?n.toLowerCase().endsWith(e):e.endsWith("/*")?a===e.replace(/\/.*$/,""):s===e}))}return!0}},75270:(t,e,i)=>{"use strict";var n=i(40139),s={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(t,e){var i,a,r,o,l,c,d=!1;e||(e={}),i=e.debug||!1;try{if(r=n(),o=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=t,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(n){if(n.stopPropagation(),e.format)if(n.preventDefault(),"undefined"===typeof n.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var a=s[e.format]||s.default;window.clipboardData.setData(a,t)}else n.clipboardData.clearData(),n.clipboardData.setData(e.format,t);e.onCopy&&(n.preventDefault(),e.onCopy(n.clipboardData))})),document.body.appendChild(c),o.selectNodeContents(c),l.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");d=!0}catch(h){i&&console.error("unable to copy using execCommand: ",h),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),d=!0}catch(h){i&&console.error("unable to copy using clipboardData: ",h),i&&console.error("falling back to prompt"),a=function(t){var e=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}("message"in e?e.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,t)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(o):l.removeAllRanges()),c&&document.body.removeChild(c),r()}return d}},24480:(t,e,i)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.CopyToClipboard=void 0;var s=o(i(65043)),a=o(i(75270)),r=["text","onCopy","options","children"];function o(t){return t&&t.__esModule?t:{default:t}}function l(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function c(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?l(Object(i),!0).forEach((function(e){f(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):l(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function d(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i,n,s={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}function h(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function p(t,e){return p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},p(t,e)}function u(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,s=g(t);if(e){var a=g(this).constructor;i=Reflect.construct(s,arguments,a)}else i=s.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"===typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return m(t)}(this,i)}}function m(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function f(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var v=function(t){!function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(l,t);var e,i,n,o=u(l);function l(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return f(m(t=o.call.apply(o,[this].concat(i))),"onClick",(function(e){var i=t.props,n=i.text,r=i.onCopy,o=i.children,l=i.options,c=s.default.Children.only(o),d=(0,a.default)(n,l);r&&r(n,d),c&&c.props&&"function"===typeof c.props.onClick&&c.props.onClick(e)})),t}return e=l,(i=[{key:"render",value:function(){var t=this.props,e=(t.text,t.onCopy,t.options,t.children),i=d(t,r),n=s.default.Children.only(e);return s.default.cloneElement(n,c(c({},i),{},{onClick:this.onClick}))}}])&&h(e.prototype,i),n&&h(e,n),Object.defineProperty(e,"prototype",{writable:!1}),l}(s.default.PureComponent);e.CopyToClipboard=v,f(v,"defaultProps",{onCopy:void 0,options:void 0})},61476:(t,e,i)=>{"use strict";var n=i(24480).CopyToClipboard;n.CopyToClipboard=n,t.exports=n},68424:(t,e,i)=>{"use strict";i.d(e,{VB:()=>rt});var n=i(65043),s=i(65173),a=i.n(s);function r(t,e,i,n){return new(i||(i=Promise))((function(s,a){function r(t){try{l(n.next(t))}catch(e){a(e)}}function o(t){try{l(n.throw(t))}catch(e){a(e)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,o)}l((n=n.apply(t,e||[])).next())}))}Object.create;Object.create;"function"===typeof SuppressedError&&SuppressedError;const o=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function l(t,e,i){const n=function(t){const{name:e}=t;if(e&&-1!==e.lastIndexOf(".")&&!t.type){const i=e.split(".").pop().toLowerCase(),n=o.get(i);n&&Object.defineProperty(t,"type",{value:n,writable:!1,configurable:!1,enumerable:!0})}return t}(t),{webkitRelativePath:s}=t,a="string"===typeof e?e:"string"===typeof s&&s.length>0?s:`./${t.name}`;return"string"!==typeof n.path&&c(n,"path",a),void 0!==i&&Object.defineProperty(n,"handle",{value:i,writable:!1,configurable:!1,enumerable:!0}),c(n,"relativePath",a),n}function c(t,e,i){Object.defineProperty(t,e,{value:i,writable:!1,configurable:!1,enumerable:!0})}const d=[".DS_Store","Thumbs.db"];function h(t){return"object"===typeof t&&null!==t}function p(t){return t.filter((t=>-1===d.indexOf(t.name)))}function u(t){if(null===t)return[];const e=[];for(let i=0;i<t.length;i++){const n=t[i];e.push(n)}return e}function m(t){if("function"!==typeof t.webkitGetAsEntry)return f(t);const e=t.webkitGetAsEntry();return e&&e.isDirectory?b(e):f(t,e)}function g(t){return t.reduce(((t,e)=>[...t,...Array.isArray(e)?g(e):[e]]),[])}function f(t,e){var i;if("function"===typeof t.getAsFileSystemHandle)return t.getAsFileSystemHandle().then((t=>r(this,void 0,void 0,(function*(){const e=yield t.getFile();return e.handle=t,l(e)}))));const n=t.getAsFile();if(!n)return Promise.reject(`${t} is not a File`);const s=l(n,null!==(i=null===e||void 0===e?void 0:e.fullPath)&&void 0!==i?i:void 0);return Promise.resolve(s)}function v(t){return r(this,void 0,void 0,(function*(){return t.isDirectory?b(t):function(t){return r(this,void 0,void 0,(function*(){return new Promise(((e,i)=>{t.file((i=>{const n=l(i,t.fullPath);e(n)}),(t=>{i(t)}))}))}))}(t)}))}function b(t){const e=t.createReader();return new Promise(((t,i)=>{const n=[];!function s(){e.readEntries((e=>r(this,void 0,void 0,(function*(){if(e.length){const t=Promise.all(e.map(v));n.push(t),s()}else try{const e=yield Promise.all(n);t(e)}catch(a){i(a)}}))),(t=>{i(t)}))}()}))}var x=i(18628);function y(t){return function(t){if(Array.isArray(t))return S(t)}(t)||function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||C(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function A(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?w(Object(i),!0).forEach((function(e){_(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):w(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function _(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function E(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,s,a=[],r=!0,o=!1;try{for(i=i.call(t);!(r=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);r=!0);}catch(l){o=!0,s=l}finally{try{r||null==i.return||i.return()}finally{if(o)throw s}}return a}(t,e)||C(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(t,e){if(t){if("string"===typeof t)return S(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?S(t,e):void 0}}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var k="function"===typeof x.A?x.A:x.A.default,T="file-invalid-type",M="file-too-large",P="file-too-small",R="too-many-files",D=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(","),e=t.length>1?"one of ".concat(t.join(", ")):t[0];return{code:T,message:"File type must be ".concat(e)}},L=function(t){return{code:M,message:"File is larger than ".concat(t," ").concat(1===t?"byte":"bytes")}},I=function(t){return{code:P,message:"File is smaller than ".concat(t," ").concat(1===t?"byte":"bytes")}},F={code:R,message:"Too many files"};function O(t,e){var i="application/x-moz-file"===t.type||k(t,e);return[i,i?null:D(e)]}function N(t,e,i){if(j(t.size))if(j(e)&&j(i)){if(t.size>i)return[!1,L(i)];if(t.size<e)return[!1,I(e)]}else{if(j(e)&&t.size<e)return[!1,I(e)];if(j(i)&&t.size>i)return[!1,L(i)]}return[!0,null]}function j(t){return void 0!==t&&null!==t}function z(t){return"function"===typeof t.isPropagationStopped?t.isPropagationStopped():"undefined"!==typeof t.cancelBubble&&t.cancelBubble}function B(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,(function(t){return"Files"===t||"application/x-moz-file"===t})):!!t.target&&!!t.target.files}function H(t){t.preventDefault()}function $(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];return e.some((function(e){return!z(t)&&e&&e.apply(void 0,[t].concat(n)),z(t)}))}}function U(t){return"audio/*"===t||"video/*"===t||"image/*"===t||"text/*"===t||"application/*"===t||/\w+\/[-+.\w]+/g.test(t)}function q(t){return/^.*\.[\w]+$/.test(t)}var V=["children"],G=["open"],W=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],K=["refKey","onChange","onClick"];function X(t){return function(t){if(Array.isArray(t))return J(t)}(t)||function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Q(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,s,a=[],r=!0,o=!1;try{for(i=i.call(t);!(r=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);r=!0);}catch(l){o=!0,s=l}finally{try{r||null==i.return||i.return()}finally{if(o)throw s}}return a}(t,e)||Q(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(t,e){if(t){if("string"===typeof t)return J(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?J(t,e):void 0}}function J(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Z(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function tt(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(i),!0).forEach((function(e){et(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Z(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function et(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function it(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i,n,s={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}var nt=(0,n.forwardRef)((function(t,e){var i=t.children,s=rt(it(t,V)),a=s.open,r=it(s,G);return(0,n.useImperativeHandle)(e,(function(){return{open:a}}),[a]),n.createElement(n.Fragment,null,i(tt(tt({},r),{},{open:a})))}));nt.displayName="Dropzone";var st={disabled:!1,getFilesFromEvent:function(t){return r(this,void 0,void 0,(function*(){return h(t)&&h(t.dataTransfer)?function(t,e){return r(this,void 0,void 0,(function*(){if(t.items){const i=u(t.items).filter((t=>"file"===t.kind));if("drop"!==e)return i;return p(g(yield Promise.all(i.map(m))))}return p(u(t.files).map((t=>l(t))))}))}(t.dataTransfer,t.type):function(t){return h(t)&&h(t.target)}(t)?function(t){return u(t.target.files).map((t=>l(t)))}(t):Array.isArray(t)&&t.every((t=>"getFile"in t&&"function"===typeof t.getFile))?function(t){return r(this,void 0,void 0,(function*(){return(yield Promise.all(t.map((t=>t.getFile())))).map((t=>l(t)))}))}(t):[]}))},maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};nt.defaultProps=st,nt.propTypes={children:a().func,accept:a().objectOf(a().arrayOf(a().string)),multiple:a().bool,preventDropOnDocument:a().bool,noClick:a().bool,noKeyboard:a().bool,noDrag:a().bool,noDragEventsBubbling:a().bool,minSize:a().number,maxSize:a().number,maxFiles:a().number,disabled:a().bool,getFilesFromEvent:a().func,onFileDialogCancel:a().func,onFileDialogOpen:a().func,useFsAccessApi:a().bool,autoFocus:a().bool,onDragEnter:a().func,onDragLeave:a().func,onDragOver:a().func,onDrop:a().func,onDropAccepted:a().func,onDropRejected:a().func,onError:a().func,validator:a().func};var at={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function rt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=tt(tt({},st),t),i=e.accept,s=e.disabled,a=e.getFilesFromEvent,r=e.maxSize,o=e.minSize,l=e.multiple,c=e.maxFiles,d=e.onDragEnter,h=e.onDragLeave,p=e.onDragOver,u=e.onDrop,m=e.onDropAccepted,g=e.onDropRejected,f=e.onFileDialogCancel,v=e.onFileDialogOpen,b=e.useFsAccessApi,x=e.autoFocus,w=e.preventDropOnDocument,C=e.noClick,S=e.noKeyboard,k=e.noDrag,T=e.noDragEventsBubbling,M=e.onError,P=e.validator,R=(0,n.useMemo)((function(){return function(t){if(j(t))return Object.entries(t).reduce((function(t,e){var i=E(e,2),n=i[0],s=i[1];return[].concat(y(t),[n],y(s))}),[]).filter((function(t){return U(t)||q(t)})).join(",")}(i)}),[i]),D=(0,n.useMemo)((function(){return function(t){return j(t)?[{description:"Files",accept:Object.entries(t).filter((function(t){var e=E(t,2),i=e[0],n=e[1],s=!0;return U(i)||(console.warn('Skipped "'.concat(i,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),s=!1),Array.isArray(n)&&n.every(q)||(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),s=!1),s})).reduce((function(t,e){var i=E(e,2),n=i[0],s=i[1];return A(A({},t),{},_({},n,s))}),{})}]:t}(i)}),[i]),L=(0,n.useMemo)((function(){return"function"===typeof v?v:lt}),[v]),I=(0,n.useMemo)((function(){return"function"===typeof f?f:lt}),[f]),V=(0,n.useRef)(null),G=(0,n.useRef)(null),Q=Y((0,n.useReducer)(ot,at),2),J=Q[0],Z=Q[1],nt=J.isFocused,rt=J.isFileDialogActive,ct=(0,n.useRef)("undefined"!==typeof window&&window.isSecureContext&&b&&"showOpenFilePicker"in window),dt=function(){!ct.current&&rt&&setTimeout((function(){G.current&&(G.current.files.length||(Z({type:"closeDialog"}),I()))}),300)};(0,n.useEffect)((function(){return window.addEventListener("focus",dt,!1),function(){window.removeEventListener("focus",dt,!1)}}),[G,rt,I,ct]);var ht=(0,n.useRef)([]),pt=function(t){V.current&&V.current.contains(t.target)||(t.preventDefault(),ht.current=[])};(0,n.useEffect)((function(){return w&&(document.addEventListener("dragover",H,!1),document.addEventListener("drop",pt,!1)),function(){w&&(document.removeEventListener("dragover",H),document.removeEventListener("drop",pt))}}),[V,w]),(0,n.useEffect)((function(){return!s&&x&&V.current&&V.current.focus(),function(){}}),[V,x,s]);var ut=(0,n.useCallback)((function(t){M?M(t):console.error(t)}),[M]),mt=(0,n.useCallback)((function(t){t.preventDefault(),t.persist(),kt(t),ht.current=[].concat(X(ht.current),[t.target]),B(t)&&Promise.resolve(a(t)).then((function(e){if(!z(t)||T){var i=e.length,n=i>0&&function(t){var e=t.files,i=t.accept,n=t.minSize,s=t.maxSize,a=t.multiple,r=t.maxFiles,o=t.validator;return!(!a&&e.length>1||a&&r>=1&&e.length>r)&&e.every((function(t){var e=E(O(t,i),1)[0],a=E(N(t,n,s),1)[0],r=o?o(t):null;return e&&a&&!r}))}({files:e,accept:R,minSize:o,maxSize:r,multiple:l,maxFiles:c,validator:P});Z({isDragAccept:n,isDragReject:i>0&&!n,isDragActive:!0,type:"setDraggedFiles"}),d&&d(t)}})).catch((function(t){return ut(t)}))}),[a,d,ut,T,R,o,r,l,c,P]),gt=(0,n.useCallback)((function(t){t.preventDefault(),t.persist(),kt(t);var e=B(t);if(e&&t.dataTransfer)try{t.dataTransfer.dropEffect="copy"}catch(i){}return e&&p&&p(t),!1}),[p,T]),ft=(0,n.useCallback)((function(t){t.preventDefault(),t.persist(),kt(t);var e=ht.current.filter((function(t){return V.current&&V.current.contains(t)})),i=e.indexOf(t.target);-1!==i&&e.splice(i,1),ht.current=e,e.length>0||(Z({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),B(t)&&h&&h(t))}),[V,h,T]),vt=(0,n.useCallback)((function(t,e){var i=[],n=[];t.forEach((function(t){var e=Y(O(t,R),2),s=e[0],a=e[1],l=Y(N(t,o,r),2),c=l[0],d=l[1],h=P?P(t):null;if(s&&c&&!h)i.push(t);else{var p=[a,d];h&&(p=p.concat(h)),n.push({file:t,errors:p.filter((function(t){return t}))})}})),(!l&&i.length>1||l&&c>=1&&i.length>c)&&(i.forEach((function(t){n.push({file:t,errors:[F]})})),i.splice(0)),Z({acceptedFiles:i,fileRejections:n,isDragReject:n.length>0,type:"setFiles"}),u&&u(i,n,e),n.length>0&&g&&g(n,e),i.length>0&&m&&m(i,e)}),[Z,l,R,o,r,c,u,m,g,P]),bt=(0,n.useCallback)((function(t){t.preventDefault(),t.persist(),kt(t),ht.current=[],B(t)&&Promise.resolve(a(t)).then((function(e){z(t)&&!T||vt(e,t)})).catch((function(t){return ut(t)})),Z({type:"reset"})}),[a,vt,ut,T]),xt=(0,n.useCallback)((function(){if(ct.current){Z({type:"openDialog"}),L();var t={multiple:l,types:D};window.showOpenFilePicker(t).then((function(t){return a(t)})).then((function(t){vt(t,null),Z({type:"closeDialog"})})).catch((function(t){var e;(e=t)instanceof DOMException&&("AbortError"===e.name||e.code===e.ABORT_ERR)?(I(t),Z({type:"closeDialog"})):!function(t){return t instanceof DOMException&&("SecurityError"===t.name||t.code===t.SECURITY_ERR)}(t)?ut(t):(ct.current=!1,G.current?(G.current.value=null,G.current.click()):ut(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.")))}))}else G.current&&(Z({type:"openDialog"}),L(),G.current.value=null,G.current.click())}),[Z,L,I,b,vt,ut,D,l]),yt=(0,n.useCallback)((function(t){V.current&&V.current.isEqualNode(t.target)&&(" "!==t.key&&"Enter"!==t.key&&32!==t.keyCode&&13!==t.keyCode||(t.preventDefault(),xt()))}),[V,xt]),wt=(0,n.useCallback)((function(){Z({type:"focus"})}),[]),At=(0,n.useCallback)((function(){Z({type:"blur"})}),[]),_t=(0,n.useCallback)((function(){C||(!function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.navigator.userAgent;return function(t){return-1!==t.indexOf("MSIE")||-1!==t.indexOf("Trident/")}(t)||function(t){return-1!==t.indexOf("Edge/")}(t)}()?xt():setTimeout(xt,0))}),[C,xt]),Et=function(t){return s?null:t},Ct=function(t){return S?null:Et(t)},St=function(t){return k?null:Et(t)},kt=function(t){T&&t.stopPropagation()},Tt=(0,n.useMemo)((function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.refKey,i=void 0===e?"ref":e,n=t.role,a=t.onKeyDown,r=t.onFocus,o=t.onBlur,l=t.onClick,c=t.onDragEnter,d=t.onDragOver,h=t.onDragLeave,p=t.onDrop,u=it(t,W);return tt(tt(et({onKeyDown:Ct($(a,yt)),onFocus:Ct($(r,wt)),onBlur:Ct($(o,At)),onClick:Et($(l,_t)),onDragEnter:St($(c,mt)),onDragOver:St($(d,gt)),onDragLeave:St($(h,ft)),onDrop:St($(p,bt)),role:"string"===typeof n&&""!==n?n:"presentation"},i,V),s||S?{}:{tabIndex:0}),u)}}),[V,yt,wt,At,_t,mt,gt,ft,bt,S,k,s]),Mt=(0,n.useCallback)((function(t){t.stopPropagation()}),[]),Pt=(0,n.useMemo)((function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.refKey,i=void 0===e?"ref":e,n=t.onChange,s=t.onClick,a=it(t,K);return tt(tt({},et({accept:R,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:Et($(n,bt)),onClick:Et($(s,Mt)),tabIndex:-1},i,G)),a)}}),[G,i,l,bt,s]);return tt(tt({},J),{},{isFocused:nt&&!s,getRootProps:Tt,getInputProps:Pt,rootRef:V,inputRef:G,open:Et(xt)})}function ot(t,e){switch(e.type){case"focus":return tt(tt({},t),{},{isFocused:!0});case"blur":return tt(tt({},t),{},{isFocused:!1});case"openDialog":return tt(tt({},at),{},{isFileDialogActive:!0});case"closeDialog":return tt(tt({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return tt(tt({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return tt(tt({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return tt({},at);default:return t}}function lt(){}},40139:t=>{t.exports=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,i=[],n=0;n<t.rangeCount;n++)i.push(t.getRangeAt(n));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null}return t.removeAllRanges(),function(){"Caret"===t.type&&t.removeAllRanges(),t.rangeCount||i.forEach((function(e){t.addRange(e)})),e&&e.focus()}}},96440:t=>{"use strict";var e=function(){};t.exports=e},40645:(t,e,i)=>{"use strict";function n(t){var e=!1;return{promise:new Promise((function(i,n){t.then((function(t){return!e&&i(t)})).catch((function(t){return!e&&n(t)}))})),cancel:function(){e=!0}}}i.d(e,{A:()=>n})},77906:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>a});var n=function(t,e,i){if(i||2===arguments.length)for(var n,s=0,a=e.length;s<a;s++)!n&&s in e||(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return t.concat(n||Array.prototype.slice.call(e))},s=n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n([],["onCopy","onCut","onPaste"],!0),["onCompositionEnd","onCompositionStart","onCompositionUpdate"],!0),["onFocus","onBlur"],!0),["onInput","onInvalid","onReset","onSubmit"],!0),["onLoad","onError"],!0),["onKeyDown","onKeyPress","onKeyUp"],!0),["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],!0),["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],!0),["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],!0),["onSelect"],!0),["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],!0),["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],!0),["onScroll"],!0),["onWheel"],!0),["onAnimationStart","onAnimationEnd","onAnimationIteration"],!0),["onTransitionEnd"],!0),["onChange"],!0),["onToggle"],!0);function a(t,e){var i={};return s.forEach((function(n){var s=t[n];s&&(i[n]=e?function(t){return s(t,e(n))}:s)})),i}},79355:(t,e,i)=>{"use strict";i.d(e,{D6:()=>_s,EA:()=>ws,Tm:()=>As,YE:()=>Es,dU:()=>xs,ng:()=>ys});var n={d:(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},s=globalThis.pdfjsLib={};n.d(s,{AbortException:()=>ft,AnnotationEditorLayer:()=>vs,AnnotationEditorParamsType:()=>b,AnnotationEditorType:()=>v,AnnotationEditorUIManager:()=>be,AnnotationLayer:()=>as,AnnotationMode:()=>f,CMapCompressionType:()=>Q,ColorPicker:()=>us,DOMSVGFactory:()=>Gt,DrawLayer:()=>bs,FeatureTest:()=>yt,GlobalWorkerOptions:()=>ci,ImageKind:()=>S,InvalidPDFException:()=>pt,MissingPDFException:()=>ut,OPS:()=>J,Outliner:()=>ls,PDFDataRangeTransport:()=>pn,PDFDateString:()=>se,PDFWorker:()=>vn,PasswordResponses:()=>Z,PermissionFlag:()=>x,PixelsPerInch:()=>$t,RenderingCancelledException:()=>Kt,TextLayer:()=>Zi,UnexpectedResponseException:()=>mt,Util:()=>At,VerbosityLevel:()=>Y,XfaLayer:()=>Tn,build:()=>En,createValidAbsoluteUrl:()=>ot,fetchData:()=>Ut,getDocument:()=>cn,getFilenameFromUrl:()=>Qt,getPdfFilenameFromUrl:()=>Jt,getXfaPageViewport:()=>ae,isDataScheme:()=>Xt,isPdfFile:()=>Yt,noContextMenu:()=>ee,normalizeUnicode:()=>Ct,renderTextLayer:()=>tn,setLayerDimensions:()=>ce,shadow:()=>lt,updateTextLayer:()=>en,version:()=>_n});const a="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),r=[1,0,0,1,0,0],o=[.001,0,0,.001,0,0],l=1.35,c=1,d=2,h=4,p=16,u=32,m=64,g=256,f={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},v={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},b={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},x={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},y=0,w=1,A=2,_=3,E=3,C=4,S={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},k=1,T=2,M=3,P=4,R=5,D=6,L=7,I=8,F=9,O=10,N=11,j=12,z=13,B=14,H=15,$=16,U=17,q=20,V=1,G=2,W=3,K=4,X=5,Y={ERRORS:0,WARNINGS:1,INFOS:5},Q={NONE:0,BINARY:1},J={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,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},Z={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let tt=Y.WARNINGS;function et(t){Number.isInteger(t)&&(tt=t)}function it(){return tt}function nt(t){tt>=Y.INFOS&&console.log(`Info: ${t}`)}function st(t){tt>=Y.WARNINGS&&console.log(`Warning: ${t}`)}function at(t){throw new Error(t)}function rt(t,e){t||at(e)}function ot(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"===typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch{}}const n=e?new URL(t,e):new URL(t);if(function(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch{}return null}function lt(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const ct=function(){function t(e,i){this.constructor===t&&at("Cannot initialize BaseException."),this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();class dt extends ct{constructor(t,e){super(t,"PasswordException"),this.code=e}}class ht extends ct{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class pt extends ct{constructor(t){super(t,"InvalidPDFException")}}class ut extends ct{constructor(t){super(t,"MissingPDFException")}}class mt extends ct{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class gt extends ct{constructor(t){super(t,"FormatError")}}class ft extends ct{constructor(t){super(t,"AbortException")}}function vt(t){"object"===typeof t&&void 0!==t?.length||at("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const n=[];for(let s=0;s<e;s+=i){const a=Math.min(s+i,e),r=t.subarray(s,a);n.push(String.fromCharCode.apply(null,r))}return n.join("")}function bt(t){"string"!==typeof t&&at("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let n=0;n<e;++n)i[n]=255&t.charCodeAt(n);return i}function xt(t){const e=Object.create(null);for(const[i,n]of t)e[i]=n;return e}class yt{static get isLittleEndian(){return lt(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return lt(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return lt(this,"isOffscreenCanvasSupported","undefined"!==typeof OffscreenCanvas)}static get platform(){return"undefined"!==typeof navigator&&"string"===typeof navigator?.platform?lt(this,"platform",{isMac:navigator.platform.includes("Mac")}):lt(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return lt(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const wt=Array.from(Array(256).keys(),(t=>t.toString(16).padStart(2,"0")));class At{static makeHexColor(t,e,i){return`#${wt[t]}${wt[e]}${wt[i]}`}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const i=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){const i=this.applyTransform(t,e),n=this.applyTransform(t.slice(2,4),e),s=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],n[0],s[0],a[0]),Math.min(i[1],n[1],s[1],a[1]),Math.max(i[0],n[0],s[0],a[0]),Math.max(i[1],n[1],s[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],n=t[0]*e[1]+t[1]*e[3],s=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],r=(i+a)/2,o=Math.sqrt((i+a)**2-4*(i*a-s*n))/2,l=r+o||1,c=r-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;const s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>a?null:[i,s,n,a]}static#t(t,e,i,n,s,a,r,o,l,c){if(l<=0||l>=1)return;const d=1-l,h=l*l,p=h*l,u=d*(d*(d*t+3*l*e)+3*h*i)+p*n,m=d*(d*(d*s+3*l*a)+3*h*r)+p*o;c[0]=Math.min(c[0],u),c[1]=Math.min(c[1],m),c[2]=Math.max(c[2],u),c[3]=Math.max(c[3],m)}static#e(t,e,i,n,s,a,r,o,l,c,d,h){if(Math.abs(l)<1e-12)return void(Math.abs(c)>=1e-12&&this.#t(t,e,i,n,s,a,r,o,-d/c,h));const p=c**2-4*d*l;if(p<0)return;const u=Math.sqrt(p),m=2*l;this.#t(t,e,i,n,s,a,r,o,(-c+u)/m,h),this.#t(t,e,i,n,s,a,r,o,(-c-u)/m,h)}static bezierBoundingBox(t,e,i,n,s,a,r,o,l){return l?(l[0]=Math.min(l[0],t,r),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,r),l[3]=Math.max(l[3],e,o)):l=[Math.min(t,r),Math.min(e,o),Math.max(t,r),Math.max(e,o)],this.#e(t,i,s,r,e,n,a,o,3*(3*(i-s)-t+r),6*(t-2*i+s),3*(i-t),l),this.#e(t,i,s,r,e,n,a,o,3*(3*(n-a)-e+o),6*(e-2*n+a),3*(n-e),l),l}}let _t=null,Et=null;function Ct(t){return _t||(_t=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Et=new Map([["\ufb05","\u017ft"]])),t.replaceAll(_t,((t,e,i)=>e?e.normalize("NFKC"):Et.get(i)))}const St="pdfjs_internal_id_",kt=0,Tt=1,Mt=2,Pt=3,Rt=4,Dt=5,Lt=6,It=7,Ft=8;class Ot{constructor(){this.constructor===Ot&&at("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,n,s){return"none"}destroy(){}}class Nt{#i=!1;constructor(){let{enableHWA:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.constructor===Nt&&at("Cannot initialize BaseCanvasFactory."),this.#i=t}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#i})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){at("Abstract method `_createCanvas` called.")}}class jt{constructor(t){let{baseUrl:e=null,isCompressed:i=!0}=t;this.constructor===jt&&at("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":""),n=this.isCompressed?Q.BINARY:Q.NONE;return this._fetchData(i,n).catch((t=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)}))}_fetchData(t,e){at("Abstract method `_fetchData` called.")}}class zt{constructor(t){let{baseUrl:e=null}=t;this.constructor===zt&&at("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const i=`${this.baseUrl}${e}`;return this._fetchData(i).catch((t=>{throw new Error(`Unable to load font data at: ${i}`)}))}_fetchData(t){at("Abstract method `_fetchData` called.")}}class Bt{constructor(){this.constructor===Bt&&at("Cannot initialize BaseSVGFactory.")}create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${t}px`),n.setAttribute("height",`${e}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${t} ${e}`),n}createElement(t){if("string"!==typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){at("Abstract method `_createSVG` called.")}}const Ht="http://www.w3.org/2000/svg";class $t{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=(()=>this.CSS/this.PDF)()}async function Ut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(te(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise(((i,n)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(200!==s.status&&0!==s.status)n(new Error(s.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(s.response)}i(s.responseText)}},s.send(null)}))}class qt extends jt{_fetchData(t,e){return Ut(t,this.isCompressed?"arraybuffer":"text").then((t=>({cMapData:t instanceof ArrayBuffer?new Uint8Array(t):bt(t),compressionType:e})))}}class Vt extends zt{_fetchData(t){return Ut(t,"arraybuffer").then((t=>new Uint8Array(t)))}}class Gt extends Bt{_createSVG(t){return document.createElementNS(Ht,t)}}class Wt{constructor(t){let{viewBox:e,scale:i,rotation:n,offsetX:s=0,offsetY:a=0,dontFlip:r=!1}=t;this.viewBox=e,this.scale=i,this.rotation=n,this.offsetX=s,this.offsetY=a;const o=(e[2]+e[0])/2,l=(e[3]+e[1])/2;let c,d,h,p,u,m,g,f;switch(n%=360,n<0&&(n+=360),n){case 180:c=-1,d=0,h=0,p=1;break;case 90:c=0,d=1,h=1,p=0;break;case 270:c=0,d=-1,h=-1,p=0;break;case 0:c=1,d=0,h=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(h=-h,p=-p),0===c?(u=Math.abs(l-e[1])*i+s,m=Math.abs(o-e[0])*i+a,g=(e[3]-e[1])*i,f=(e[2]-e[0])*i):(u=Math.abs(o-e[0])*i+s,m=Math.abs(l-e[1])*i+a,g=(e[2]-e[0])*i,f=(e[3]-e[1])*i),this.transform=[c*i,d*i,h*i,p*i,u-c*i*o-h*i*l,m-d*i*o-p*i*l],this.width=g,this.height=f}get rawDims(){const{viewBox:t}=this;return lt(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Wt({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(t,e){return At.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=At.applyTransform([t[0],t[1]],this.transform),i=At.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return At.applyInverseTransform([t,e],this.transform)}}class Kt extends ct{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t,"RenderingCancelledException"),this.extraDelay=e}}function Xt(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function Yt(t){return"string"===typeof t&&/\.pdf$/i.test(t)}function Qt(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function Jt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof t)return e;if(Xt(t))return st('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let s=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(s&&(s=s[0],s.includes("%")))try{s=i.exec(decodeURIComponent(s))[0]}catch{}return s||e}class Zt{started=(()=>Object.create(null))();times=[];time(t){t in this.started&&st(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||st(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:n,end:s}of this.times)t.push(`${i.padEnd(e)} ${s-n}ms\n`);return t.join("")}}function te(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch{return!1}}function ee(t){t.preventDefault()}function ie(t){console.log("Deprecated API usage: "+t)}let ne;class se{static toDateObject(t){if(!t||"string"!==typeof t)return null;ne||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const e=ne.exec(t);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let r=parseInt(e[5],10);r=r>=0&&r<=59?r:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;const l=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===l?(a+=c,r+=d):"+"===l&&(a-=c,r-=d),new Date(Date.UTC(i,n,s,a,r,o))}}function ae(t,e){let{scale:i=1,rotation:n=0}=e;const{width:s,height:a}=t.attributes.style,r=[0,0,parseInt(s),parseInt(a)];return new Wt({viewBox:r,scale:i,rotation:n})}function re(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map((t=>parseInt(t))):t.startsWith("rgba(")?t.slice(5,-1).split(",").map((t=>parseInt(t))).slice(0,3):(st(`Not a valid color format: "${t}"`),[0,0,0])}function oe(t){const{a:e,b:i,c:n,d:s,e:a,f:r}=t.getTransform();return[e,i,n,s,a,r]}function le(t){const{a:e,b:i,c:n,d:s,e:a,f:r}=t.getTransform().invertSelf();return[e,i,n,s,a,r]}function ce(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof Wt){const{pageWidth:n,pageHeight:s}=e.rawDims,{style:a}=t,r=yt.isCSSRoundSupported,o=`var(--scale-factor) * ${n}px`,l=`var(--scale-factor) * ${s}px`,c=r?`round(${o}, 1px)`:`calc(${o})`,d=r?`round(${l}, 1px)`:`calc(${l})`;i&&e.rotation%180!==0?(a.width=d,a.height=c):(a.width=c,a.height=d)}n&&t.setAttribute("data-main-rotation",e.rotation)}class de{#n=null;#s=null;#a;#r=null;constructor(t){this.#a=t}render(){const t=this.#n=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");const e=this.#a._uiManager._signal;t.addEventListener("contextmenu",ee,{signal:e}),t.addEventListener("pointerdown",de.#o,{signal:e});const i=this.#r=document.createElement("div");i.className="buttons",t.append(i);const n=this.#a.toolbarPosition;if(n){const{style:e}=t,i="ltr"===this.#a._uiManager.direction?1-n[0]:n[0];e.insetInlineEnd=100*i+"%",e.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return this.#l(),t}static#o(t){t.stopPropagation()}#c(t){this.#a._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#d(t){this.#a._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#h(t){const e=this.#a._uiManager._signal;t.addEventListener("focusin",this.#c.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#d.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",ee,{signal:e})}hide(){this.#n.classList.add("hidden"),this.#s?.hideDropdown()}show(){this.#n.classList.remove("hidden")}#l(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#a.editorType}-button`),this.#h(t),t.addEventListener("click",(t=>{this.#a._uiManager.delete()}),{signal:this.#a._uiManager._signal}),this.#r.append(t)}get#p(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#h(t),this.#r.prepend(t,this.#p)}addColorPicker(t){this.#s=t;const e=t.renderButton();this.#h(e),this.#r.prepend(e,this.#p)}remove(){this.#n.remove(),this.#s?.destroy(),this.#s=null}}class he{#r=null;#n=null;#u;constructor(t){this.#u=t}#m(){const t=this.#n=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",ee,{signal:this.#u._signal});const e=this.#r=document.createElement("div");return e.className="buttons",t.append(e),this.#g(),t}#f(t,e){let i=0,n=0;for(const s of t){const t=s.y+s.height;if(t<i)continue;const a=s.x+(e?s.width:0);t>i?(n=a,i=t):e?a>n&&(n=a):a<n&&(n=a)}return[e?1-n:n,i]}show(t,e,i){const[n,s]=this.#f(e,i),{style:a}=this.#n||=this.#m();t.append(this.#n),a.insetInlineEnd=100*n+"%",a.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){this.#n.remove()}#g(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=this.#u._signal;t.addEventListener("contextmenu",ee,{signal:i}),t.addEventListener("click",(()=>{this.#u.highlightSelection("floating_button")}),{signal:i}),this.#r.append(t)}}function pe(t,e,i){for(const n of i)e.addEventListener(n,t[n].bind(t))}class ue{#v=0;get id(){return"pdfjs_internal_editor_"+this.#v++}}class me{#b=(()=>function(){if("undefined"!==typeof crypto&&"function"===typeof crypto?.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);if("undefined"!==typeof crypto&&"function"===typeof crypto?.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<32;e++)t[e]=Math.floor(255*Math.random());return vt(t)}())();#v=0;#x=null;static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';return lt(this,"_isSVGFittingCanvas",e.decode().then((()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]))))}async#y(t,e){this.#x||=new Map;let i=this.#x.get(t);if(null===i)return null;if(i?.bitmap)return i.refCounter+=1,i;try{let t;if(i||={bitmap:null,id:`image_${this.#b}_${this.#v++}`,refCounter:0,isSvg:!1},"string"===typeof e?(i.url=e,t=await Ut(e,"blob")):t=i.file=e,"image/svg+xml"===t.type){const e=me._isSVGFittingCanvas,n=new FileReader,s=new Image,a=new Promise(((t,a)=>{s.onload=()=>{i.bitmap=s,i.isSvg=!0,t()},n.onload=async()=>{const t=i.svgUrl=n.result;s.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},s.onerror=n.onerror=a}));n.readAsDataURL(t),await a}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(n){console.error(n),i=null}return this.#x.set(t,i),i&&this.#x.set(i.id,i),i}async getFromFile(t){const{lastModified:e,name:i,size:n,type:s}=t;return this.#y(`${e}_${i}_${n}_${s}`,t)}async getFromUrl(t){return this.#y(t,t)}async getFromId(t){this.#x||=new Map;const e=this.#x.get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=this.#x.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#x||=new Map;const e=this.#x.get(t);e&&(e.refCounter-=1,0===e.refCounter&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#b}_`)}}class ge{#w=[];#A=!1;#_;#E=-1;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;this.#_=t}add(t){let{cmd:e,undo:i,post:n,mustExec:s,type:a=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}=t;if(s&&e(),this.#A)return;const l={cmd:e,undo:i,post:n,type:a};if(-1===this.#E)return this.#w.length>0&&(this.#w.length=0),this.#E=0,void this.#w.push(l);if(r&&this.#w[this.#E].type===a)return o&&(l.undo=this.#w[this.#E].undo),void(this.#w[this.#E]=l);const c=this.#E+1;c===this.#_?this.#w.splice(0,1):(this.#E=c,c<this.#w.length&&this.#w.splice(c)),this.#w.push(l)}undo(){if(-1===this.#E)return;this.#A=!0;const{undo:t,post:e}=this.#w[this.#E];t(),e?.(),this.#A=!1,this.#E-=1}redo(){if(this.#E<this.#w.length-1){this.#E+=1,this.#A=!0;const{cmd:t,post:e}=this.#w[this.#E];t(),e?.(),this.#A=!1}}hasSomethingToUndo(){return-1!==this.#E}hasSomethingToRedo(){return this.#E<this.#w.length-1}destroy(){this.#w=null}}class fe{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=yt.platform;for(const[i,n,s={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:n,options:s}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:n,options:s}),this.allKeys.add(t.split("+").at(-1)))}}#C(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(this.#C(e));if(!i)return;const{callback:n,options:{bubbles:s=!1,args:a=[],checker:r=null}}=i;r&&!r(t,e)||(n.bind(t,...a,e)(),s||(e.stopPropagation(),e.preventDefault()))}}class ve{static _colorsMapping=(()=>new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]))();get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const i of t.keys()){e.style.color=i;const n=window.getComputedStyle(e).color;t.set(i,re(n))}e.remove()}(t),lt(this,"_colors",t)}convert(t){const e=re(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,n]of this._colors)if(n.every(((t,i)=>t===e[i])))return ve._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?At.makeHexColor(...e):t}}class be{#S=(()=>new AbortController)();#k=null;#T=(()=>new Map)();#M=(()=>new Map)();#P=null;#R=null;#D=null;#L=(()=>new ge)();#I=0;#F=(()=>new Set)();#O=null;#N=null;#j=(()=>new Set)();#z=!1;#B=null;#H=null;#$=null;#U=!1;#q=null;#V=(()=>new ue)();#G=!1;#W=!1;#K=null;#X=null;#Y=null;#Q=(()=>v.NONE)();#J=(()=>new Set)();#Z=null;#tt=null;#et=null;#it=this.blur.bind(this);#nt=this.focus.bind(this);#st=this.copy.bind(this);#at=this.cut.bind(this);#rt=this.paste.bind(this);#ot=this.keydown.bind(this);#lt=this.keyup.bind(this);#ct=this.onEditingAction.bind(this);#dt=this.onPageChanging.bind(this);#ht=this.onScaleChanging.bind(this);#pt=this.onRotationChanging.bind(this);#ut={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#mt=[0,0];#gt=null;#ft=null;#vt=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=be.prototype,e=t=>t.#ft.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){const{type:t}=i;return"text"!==t&&"number"!==t}return!0},n=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return lt(this,"_keyboardManager",new fe([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&t.#ft.contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&t.#ft.contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}constructor(t,e,i,n,s,a,r,o,l){this._signal=this.#S.signal,this.#ft=t,this.#vt=e,this.#P=i,this._eventBus=n,this._eventBus._on("editingaction",this.#ct),this._eventBus._on("pagechanging",this.#dt),this._eventBus._on("scalechanging",this.#ht),this._eventBus._on("rotationchanging",this.#pt),this.#bt(),this.#xt(),this.#yt(),this.#R=s.annotationStorage,this.#B=s.filterFactory,this.#tt=a,this.#$=r||null,this.#z=o,this.#Y=l||null,this.viewParameters={realScale:$t.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#S?.abort(),this.#S=null,this._signal=null,this._eventBus._off("editingaction",this.#ct),this._eventBus._off("pagechanging",this.#dt),this._eventBus._off("scalechanging",this.#ht),this._eventBus._off("rotationchanging",this.#pt);for(const t of this.#M.values())t.destroy();this.#M.clear(),this.#T.clear(),this.#j.clear(),this.#k=null,this.#J.clear(),this.#L.destroy(),this.#P?.destroy(),this.#q?.hide(),this.#q=null,this.#H&&(clearTimeout(this.#H),this.#H=null),this.#gt&&(clearTimeout(this.#gt),this.#gt=null)}async mlGuess(t){return this.#Y?.guess(t)||null}get hasMLManager(){return!!this.#Y}get hcmFilter(){return lt(this,"hcmFilter",this.#tt?this.#B.addHCMFilter(this.#tt.foreground,this.#tt.background):"none")}get direction(){return lt(this,"direction",getComputedStyle(this.#ft).direction)}get highlightColors(){return lt(this,"highlightColors",this.#$?new Map(this.#$.split(",").map((t=>t.split("=").map((t=>t.trim()))))):null)}get highlightColorNames(){return lt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(t=>t.reverse()))):null)}setMainHighlightColorPicker(t){this.#X=t}editAltText(t){this.#P?.editAltText(this,t)}onPageChanging(t){let{pageNumber:e}=t;this.#I=e-1}focusMainContainer(){this.#ft.focus()}findParent(t,e){for(const i of this.#M.values()){const{x:n,y:s,width:a,height:r}=i.div.getBoundingClientRect();if(t>=n&&t<=n+a&&e>=s&&e<=s+r)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#vt.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#j.add(t)}removeShouldRescale(t){this.#j.delete(t)}onScaleChanging(t){let{scale:e}=t;this.commitOrRemove(),this.viewParameters.realScale=e*$t.PDF_TO_CSS_UNITS;for(const i of this.#j)i.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}#wt(t){let{anchorNode:e}=t;return e.nodeType===Node.TEXT_NODE?e.parentElement:e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:a}=e,r=e.toString(),o=this.#wt(e).closest(".textLayer"),l=this.getSelectionBoxes(o);if(l){e.empty(),this.#Q===v.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:v.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const e of this.#M.values())if(e.hasTextLayer(o)){e.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:l,anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:a,text:r});break}}}#At(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=this.#wt(t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(this.#q||=new he(this),this.#q.show(e,i,"ltr"===this.direction))}addToAnnotationStorage(t){t.isEmpty()||!this.#R||this.#R.has(t.id)||this.#R.setValue(t.id,t)}#_t(){const t=document.getSelection();if(!t||t.isCollapsed)return void(this.#Z&&(this.#q?.hide(),this.#Z=null,this.#Et({hasSelectedText:!1})));const{anchorNode:e}=t;if(e===this.#Z)return;if(this.#wt(t).closest(".textLayer")){if(this.#q?.hide(),this.#Z=e,this.#Et({hasSelectedText:!0}),(this.#Q===v.HIGHLIGHT||this.#Q===v.NONE)&&(this.#Q===v.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#U=this.isShiftKeyDown,!this.isShiftKeyDown)){const t=this._signal,e=t=>{"pointerup"===t.type&&0!==t.button||(window.removeEventListener("pointerup",e),window.removeEventListener("blur",e),"pointerup"===t.type&&this.#Ct("main_toolbar"))};window.addEventListener("pointerup",e,{signal:t}),window.addEventListener("blur",e,{signal:t})}}else this.#Z&&(this.#q?.hide(),this.#Z=null,this.#Et({hasSelectedText:!1}))}#Ct(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.#Q===v.HIGHLIGHT?this.highlightSelection(t):this.#z&&this.#At()}#bt(){document.addEventListener("selectionchange",this.#_t.bind(this),{signal:this._signal})}#St(){const t=this._signal;window.addEventListener("focus",this.#nt,{signal:t}),window.addEventListener("blur",this.#it,{signal:t})}#kt(){window.removeEventListener("focus",this.#nt),window.removeEventListener("blur",this.#it)}blur(){if(this.isShiftKeyDown=!1,this.#U&&(this.#U=!1,this.#Ct("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of this.#J)if(e.div.contains(t)){this.#K=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#K)return;const[t,e]=this.#K;this.#K=null,e.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),e.focus()}#yt(){const t=this._signal;window.addEventListener("keydown",this.#ot,{signal:t}),window.addEventListener("keyup",this.#lt,{signal:t})}#Tt(){window.removeEventListener("keydown",this.#ot),window.removeEventListener("keyup",this.#lt)}#Mt(){const t=this._signal;document.addEventListener("copy",this.#st,{signal:t}),document.addEventListener("cut",this.#at,{signal:t}),document.addEventListener("paste",this.#rt,{signal:t})}#Pt(){document.removeEventListener("copy",this.#st),document.removeEventListener("cut",this.#at),document.removeEventListener("paste",this.#rt)}#xt(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#yt(),this.#Mt()}removeEditListeners(){this.#Tt(),this.#Pt()}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of this.#N)if(i.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const i of this.#N)if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){if(t.preventDefault(),this.#k?.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of this.#J){const t=i.serialize(!0);t&&e.push(t)}0!==e.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:e}=t;for(const a of e.items)for(const t of this.#N)if(t.isHandlingMimeForPasting(a.type))return void t.paste(a,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(s){return void st(`paste: "${s.message}".`)}if(!Array.isArray(i))return;this.unselectAll();const n=this.currentLayer;try{const t=[];for(const a of i){const e=n.deserialize(a);if(!e)return;t.push(e)}const e=()=>{for(const e of t)this.#Rt(e);this.#Dt(t)},s=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:s,mustExec:!0})}catch(s){st(`paste: "${s.message}".`)}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),this.#Q===v.NONE||this.isEditorHandlingKeyboard||be._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#U&&(this.#U=!1,this.#Ct("main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#Et(t){Object.entries(t).some((t=>{let[e,i]=t;return this.#ut[e]!==i}))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#ut,t)}),this.#Q===v.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#Lt([[b.HIGHLIGHT_FREE,!0]]))}#Lt(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#St(),this.#Mt(),this.#Et({isEditing:this.#Q!==v.NONE,isEmpty:this.#It(),hasSomethingToUndo:this.#L.hasSomethingToUndo(),hasSomethingToRedo:this.#L.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#kt(),this.#Pt(),this.#Et({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#N){this.#N=t;for(const t of this.#N)this.#Lt(t.defaultPropertiesToUpdate)}}getId(){return this.#V.id}get currentLayer(){return this.#M.get(this.#I)}getLayer(t){return this.#M.get(t)}get currentPageIndex(){return this.#I}addLayer(t){this.#M.set(t.pageIndex,t),this.#G?t.enable():t.disable()}removeLayer(t){this.#M.delete(t.pageIndex)}updateMode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.#Q!==t){if(this.#Q=t,t===v.NONE)return this.setEditingState(!1),void this.#Ft();this.setEditingState(!0),this.#Ot(),this.unselectAll();for(const e of this.#M.values())e.updateMode(t);if(e||!i){if(e)for(const t of this.#T.values())if(t.annotationElementId===e){this.setSelected(t),t.enterInEditMode();break}}else this.addNewEditorFromKeyboard()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#Q&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if(this.#N){switch(t){case b.CREATE:return void this.currentLayer.addNewEditor();case b.HIGHLIGHT_DEFAULT_COLOR:this.#X?.updateColor(e);break;case b.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#et||=new Map).set(t,e),this.showAllEditors("highlight",e)}for(const i of this.#J)i.updateParams(t,e);for(const i of this.#N)i.updateDefaultParams(t,e)}}showAllEditors(t,e){for(const i of this.#T.values())i.editorType===t&&i.show(e);(this.#et?.get(b.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#Lt([[b.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.#W!==t){this.#W=t;for(const e of this.#M.values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}#Ot(){if(!this.#G){this.#G=!0;for(const t of this.#M.values())t.enable();for(const t of this.#T.values())t.enable()}}#Ft(){if(this.unselectAll(),this.#G){this.#G=!1;for(const t of this.#M.values())t.disable();for(const t of this.#T.values())t.disable()}}getEditors(t){const e=[];for(const i of this.#T.values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return this.#T.get(t)}addEditor(t){this.#T.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#H&&clearTimeout(this.#H),this.#H=setTimeout((()=>{this.focusMainContainer(),this.#H=null}),0)),this.#T.delete(t.id),this.unselect(t),t.annotationElementId&&this.#F.has(t.annotationElementId)||this.#R?.remove(t.id)}addDeletedAnnotationElement(t){this.#F.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#F.has(t)}removeDeletedAnnotationElement(t){this.#F.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#Rt(t){const e=this.#M.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#k!==t&&(this.#k=t,t&&this.#Lt(t.propertiesToUpdate))}get#Nt(){let t=null;for(t of this.#J);return t}updateUI(t){this.#Nt===t&&this.#Lt(t.propertiesToUpdate)}toggleSelected(t){if(this.#J.has(t))return this.#J.delete(t),t.unselect(),void this.#Et({hasSelectedEditor:this.hasSelection});this.#J.add(t),t.select(),this.#Lt(t.propertiesToUpdate),this.#Et({hasSelectedEditor:!0})}setSelected(t){for(const e of this.#J)e!==t&&e.unselect();this.#J.clear(),this.#J.add(t),t.select(),this.#Lt(t.propertiesToUpdate),this.#Et({hasSelectedEditor:!0})}isSelected(t){return this.#J.has(t)}get firstSelectedEditor(){return this.#J.values().next().value}unselect(t){t.unselect(),this.#J.delete(t),this.#Et({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#J.size}get isEnterHandled(){return 1===this.#J.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#L.undo(),this.#Et({hasSomethingToUndo:this.#L.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#It()})}redo(){this.#L.redo(),this.#Et({hasSomethingToUndo:!0,hasSomethingToRedo:this.#L.hasSomethingToRedo(),isEmpty:this.#It()})}addCommands(t){this.#L.add(t),this.#Et({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#It()})}#It(){if(0===this.#T.size)return!0;if(1===this.#T.size)for(const t of this.#T.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...this.#J];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)this.#Rt(e)},mustExec:!0})}commitOrRemove(){this.#k?.commitOrRemove()}hasSomethingToControl(){return this.#k||this.hasSelection}#Dt(t){for(const e of this.#J)e.unselect();this.#J.clear();for(const e of t)e.isEmpty()||(this.#J.add(e),e.select());this.#Et({hasSelectedEditor:this.hasSelection})}selectAll(){for(const t of this.#J)t.commit();this.#Dt(this.#T.values())}unselectAll(){if((!this.#k||(this.#k.commitOrRemove(),this.#Q===v.NONE))&&this.hasSelection){for(const t of this.#J)t.unselect();this.#J.clear(),this.#Et({hasSelectedEditor:!1})}}translateSelectedEditors(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),!this.hasSelection)return;this.#mt[0]+=t,this.#mt[1]+=e;const[i,n]=this.#mt,s=[...this.#J];this.#gt&&clearTimeout(this.#gt),this.#gt=setTimeout((()=>{this.#gt=null,this.#mt[0]=this.#mt[1]=0,this.addCommands({cmd:()=>{for(const t of s)this.#T.has(t.id)&&t.translateInPage(i,n)},undo:()=>{for(const t of s)this.#T.has(t.id)&&t.translateInPage(-i,-n)},mustExec:!1})}),1e3);for(const a of s)a.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#O=new Map;for(const t of this.#J)this.#O.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#O)return!1;this.disableUserSelect(!1);const t=this.#O;this.#O=null;let e=!1;for(const[{x:n,y:s,pageIndex:a},r]of t)r.newX=n,r.newY=s,r.newPageIndex=a,e||=n!==r.savedX||s!==r.savedY||a!==r.savedPageIndex;if(!e)return!1;const i=(t,e,i,n)=>{if(this.#T.has(t.id)){const s=this.#M.get(n);s?t._setParentAndPosition(s,e,i):(t.pageIndex=n,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:n,newY:s,newPageIndex:a}]of t)i(e,n,s,a)},undo:()=>{for(const[e,{savedX:n,savedY:s,savedPageIndex:a}]of t)i(e,n,s,a)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#O)for(const i of this.#O.keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#J.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#k===t}getActive(){return this.#k}getMode(){return this.#Q}get imageManager(){return lt(this,"imageManager",new me)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,c=e.rangeCount;l<c;l++)if(!t.contains(e.getRangeAt(l).commonAncestorContainer))return null;const{x:i,y:n,width:s,height:a}=t.getBoundingClientRect();let r;switch(t.getAttribute("data-main-rotation")){case"90":r=(t,e,r,o)=>({x:(e-n)/a,y:1-(t+r-i)/s,width:o/a,height:r/s});break;case"180":r=(t,e,r,o)=>({x:1-(t+r-i)/s,y:1-(e+o-n)/a,width:r/s,height:o/a});break;case"270":r=(t,e,r,o)=>({x:1-(e+o-n)/a,y:(t-i)/s,width:o/a,height:r/s});break;default:r=(t,e,r,o)=>({x:(t-i)/s,y:(e-n)/a,width:r/s,height:o/a})}const o=[];for(let l=0,c=e.rangeCount;l<c;l++){const t=e.getRangeAt(l);if(!t.collapsed)for(const{x:e,y:i,width:n,height:s}of t.getClientRects())0!==n&&0!==s&&o.push(r(e,i,n,s))}return 0===o.length?null:o}addChangedExistingAnnotation(t){let{annotationElementId:e,id:i}=t;(this.#D||=new Map).set(e,i)}removeChangedExistingAnnotation(t){let{annotationElementId:e}=t;this.#D?.delete(e)}renderAnnotationElement(t){const e=this.#D?.get(t.data.id);if(!e)return;const i=this.#R.getRawValue(e);i&&(this.#Q!==v.NONE||i.hasBeenModified)&&i.renderAnnotationElement(t)}}class xe{#jt="";#zt=!1;#Bt=null;#Ht=null;#$t=null;#Ut=!1;#a=null;static _l10nPromise=null;constructor(t){this.#a=t}static initialize(t){xe._l10nPromise||=t}async render(){const t=this.#Bt=document.createElement("button");t.className="altText";const e=await xe._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0";const i=this.#a._uiManager._signal;t.addEventListener("contextmenu",ee,{signal:i}),t.addEventListener("pointerdown",(t=>t.stopPropagation()),{signal:i});const n=t=>{t.preventDefault(),this.#a._uiManager.editAltText(this.#a)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",(e=>{e.target===t&&"Enter"===e.key&&(this.#Ut=!0,n(e))}),{signal:i}),await this.#qt(),t}finish(){this.#Bt&&(this.#Bt.focus({focusVisible:this.#Ut}),this.#Ut=!1)}isEmpty(){return!this.#jt&&!this.#zt}get data(){return{altText:this.#jt,decorative:this.#zt}}set data(t){let{altText:e,decorative:i}=t;this.#jt===e&&this.#zt===i||(this.#jt=e,this.#zt=i,this.#qt())}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#Bt&&(!t&&this.#$t&&(clearTimeout(this.#$t),this.#$t=null),this.#Bt.disabled=!t)}destroy(){this.#Bt?.remove(),this.#Bt=null,this.#Ht=null}async#qt(){const t=this.#Bt;if(!t)return;if(!this.#jt&&!this.#zt)return t.classList.remove("done"),void this.#Ht?.remove();t.classList.add("done"),xe._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then((e=>{t.setAttribute("aria-label",e)}));let e=this.#Ht;if(!e){this.#Ht=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip");const i=e.id=`alt-text-tooltip-${this.#a.id}`;t.setAttribute("aria-describedby",i);const n=100,s=this.#a._uiManager._signal;s.addEventListener("abort",(()=>{clearTimeout(this.#$t),this.#$t=null}),{once:!0}),t.addEventListener("mouseenter",(()=>{this.#$t=setTimeout((()=>{this.#$t=null,this.#Ht.classList.add("show"),this.#a._reportTelemetry({action:"alt_text_tooltip"})}),n)}),{signal:s}),t.addEventListener("mouseleave",(()=>{this.#$t&&(clearTimeout(this.#$t),this.#$t=null),this.#Ht?.classList.remove("show")}),{signal:s})}e.innerText=this.#zt?await xe._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#jt,e.parentNode||t.append(e);const i=this.#a.getImageForAltText();i?.setAttribute("aria-describedby",e.id)}}class ye{#Vt=null;#Gt=null;#jt=null;#Wt=!1;#Kt=!1;#Xt=null;#Yt=null;#Qt=this.focusin.bind(this);#Jt=this.focusout.bind(this);#Zt=null;#te="";#ee=!1;#ie=null;#ne=!1;#se=!1;#ae=!1;#re=null;#oe=0;#le=0;#ce=null;_initialOptions=(()=>Object.create(null))();_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#de=!1;#he=(()=>ye._zIndex++)();static _borderLineWidth=-1;static _colorManager=(()=>new ve)();static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=ye.prototype._resizeWithKeyboard,e=be.TRANSLATE_SMALL,i=be.TRANSLATE_BIG;return lt(this,"_resizerKeyboardManager",new fe([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],ye.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===ye&&at("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[s,a];const[r,o]=this.parentDimensions;this.x=t.x/r,this.y=t.y/o,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return lt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new we({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e,i){if(ye._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map((e=>[e,t.get(e.replaceAll(/([A-Z])/g,(t=>`-${t.toLowerCase()}`)))]))),i?.strings)for(const s of i.strings)ye._l10nPromise.set(s,t.get(s));if(-1!==ye._borderLineWidth)return;const n=getComputedStyle(document.documentElement);ye._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){at("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#de}set _isDraggable(t){this.#de=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#he}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#pe(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#ee?this.#ee=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const e=t.relatedTarget;e?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,n){const[s,a]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/s,this.y=(e+n)/a,this.fixAndSetPosition()}#ue(t,e,i){let[n,s]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/n,this.y+=i/s,this.fixAndSetPosition()}translate(t,e){this.#ue(this.parentDimensions,t,e)}translateInPage(t,e){this.#ie||=[this.x,this.y],this.#ue(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){this.#ie||=[this.x,this.y];const[i,n]=this.parentDimensions;if(this.x+=t/i,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:a}=this;const[r,o]=this.getBaseTranslation();s+=r,a+=o,this.div.style.left=`${(100*s).toFixed(2)}%`,this.div.style.top=`${(100*a).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#ie&&(this.#ie[0]!==this.x||this.#ie[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=ye,n=i/t,s=i/e;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const[e,i]=this.pageDimensions;let{x:n,y:s,width:a,height:r}=this;if(a*=e,r*=i,n*=e,s*=i,this._mustFixPosition)switch(t){case 0:n=Math.max(0,Math.min(e-a,n)),s=Math.max(0,Math.min(i-r,s));break;case 90:n=Math.max(0,Math.min(e-r,n)),s=Math.min(i,Math.max(a,s));break;case 180:n=Math.min(e,Math.max(a,n)),s=Math.min(i,Math.max(r,s));break;case 270:n=Math.min(e,Math.max(r,n)),s=Math.max(0,Math.min(i-a,s))}this.x=n/=e,this.y=s/=i;const[o,l]=this.getBaseTranslation();n+=o,s+=l;const{style:c}=this.div;c.left=`${(100*n).toFixed(2)}%`,c.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static#me(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return ye.#me(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return ye.#me(t,e,360-this.parentRotation)}#ge(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,i]}=this,n=e*t,s=i*t;return yt.isCSSRoundSupported?[Math.round(n),Math.round(s)]:[n,s]}setDims(t,e){const[i,n]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,this.#Kt||(this.div.style.height=`${(100*e/n).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:i}=t,n=i.endsWith("%"),s=!this.#Kt&&e.endsWith("%");if(n&&s)return;const[a,r]=this.parentDimensions;n||(t.width=`${(100*parseFloat(i)/a).toFixed(2)}%`),this.#Kt||s||(t.height=`${(100*parseFloat(e)/r).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#fe(){if(this.#Xt)return;this.#Xt=document.createElement("div"),this.#Xt.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const t=document.createElement("div");this.#Xt.append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",this.#ve.bind(this,i),{signal:e}),t.addEventListener("contextmenu",ee,{signal:e}),t.tabIndex=-1}this.div.prepend(this.#Xt)}#ve(t,e){e.preventDefault();const{isMac:i}=yt.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#jt?.toggle(!1);const n=this.#be.bind(this,t),s=this._isDraggable;this._isDraggable=!1;const a=this._uiManager._signal,r={passive:!0,capture:!0,signal:a};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",n,r),window.addEventListener("contextmenu",ee,{signal:a});const o=this.x,l=this.y,c=this.width,d=this.height,h=this.parent.div.style.cursor,p=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const u=()=>{this.parent.togglePointerEvents(!0),this.#jt?.toggle(!0),this._isDraggable=s,window.removeEventListener("pointerup",u),window.removeEventListener("blur",u),window.removeEventListener("pointermove",n,r),window.removeEventListener("contextmenu",ee),this.parent.div.style.cursor=h,this.div.style.cursor=p,this.#xe(o,l,c,d)};window.addEventListener("pointerup",u,{signal:a}),window.addEventListener("blur",u,{signal:a})}#xe(t,e,i,n){const s=this.x,a=this.y,r=this.width,o=this.height;s===t&&a===e&&r===i&&o===n||this.addCommands({cmd:()=>{this.width=r,this.height=o,this.x=s,this.y=a;const[t,e]=this.parentDimensions;this.setDims(t*r,e*o),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=n,this.x=t,this.y=e;const[s,a]=this.parentDimensions;this.setDims(s*i,a*n),this.fixAndSetPosition()},mustExec:!0})}#be(t,e){const[i,n]=this.parentDimensions,s=this.x,a=this.y,r=this.width,o=this.height,l=ye.MIN_SIZE/i,c=ye.MIN_SIZE/n,d=t=>Math.round(1e4*t)/1e4,h=this.#ge(this.rotation),p=(t,e)=>[h[0]*t+h[2]*e,h[1]*t+h[3]*e],u=this.#ge(360-this.rotation);let m,g,f=!1,v=!1;switch(t){case"topLeft":f=!0,m=(t,e)=>[0,0],g=(t,e)=>[t,e];break;case"topMiddle":m=(t,e)=>[t/2,0],g=(t,e)=>[t/2,e];break;case"topRight":f=!0,m=(t,e)=>[t,0],g=(t,e)=>[0,e];break;case"middleRight":v=!0,m=(t,e)=>[t,e/2],g=(t,e)=>[0,e/2];break;case"bottomRight":f=!0,m=(t,e)=>[t,e],g=(t,e)=>[0,0];break;case"bottomMiddle":m=(t,e)=>[t/2,e],g=(t,e)=>[t/2,0];break;case"bottomLeft":f=!0,m=(t,e)=>[0,e],g=(t,e)=>[t,0];break;case"middleLeft":v=!0,m=(t,e)=>[0,e/2],g=(t,e)=>[t,e/2]}const b=m(r,o),x=g(r,o);let y=p(...x);const w=d(s+y[0]),A=d(a+y[1]);let _=1,E=1,[C,S]=this.screenToPageTranslation(e.movementX,e.movementY);var k,T;if([C,S]=(k=C/i,T=S/n,[u[0]*k+u[2]*T,u[1]*k+u[3]*T]),f){const t=Math.hypot(r,o);_=E=Math.max(Math.min(Math.hypot(x[0]-b[0]-C,x[1]-b[1]-S)/t,1/r,1/o),l/r,c/o)}else v?_=Math.max(l,Math.min(1,Math.abs(x[0]-b[0]-C)))/r:E=Math.max(c,Math.min(1,Math.abs(x[1]-b[1]-S)))/o;const M=d(r*_),P=d(o*E);y=p(...g(M,P));const R=w-y[0],D=A-y[1];this.width=M,this.height=P,this.x=R,this.y=D,this.setDims(i*M,n*P),this.fixAndSetPosition()}altTextFinish(){this.#jt?.finish()}async addEditToolbar(){return this.#Zt||this.#se||(this.#Zt=new de(this),this.div.append(this.#Zt.render()),this.#jt&&this.#Zt.addAltTextButton(await this.#jt.render())),this.#Zt}removeEditToolbar(){this.#Zt&&(this.#Zt.remove(),this.#Zt=null,this.#jt?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#jt||(xe.initialize(ye._l10nPromise),this.#jt=new xe(this),this.#Vt&&(this.#jt.data=this.#Vt,this.#Vt=null),await this.addEditToolbar())}get altTextData(){return this.#jt?.data}set altTextData(t){this.#jt&&(this.#jt.data=t)}hasAltText(){return!this.#jt?.isEmpty()}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.tabIndex=this.#Wt?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const t=this._uiManager._signal;this.div.addEventListener("focusin",this.#Qt,{signal:t}),this.div.addEventListener("focusout",this.#Jt,{signal:t});const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*i/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/i).toFixed(2)}%`);const[n,s]=this.getInitialTranslation();return this.translate(n,s),pe(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=yt.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#ee=!0,this._isDraggable?this.#ye(t):this.#we(t))}#we(t){const{isMac:e}=yt.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#ye(t){const e=this._uiManager.isSelected(this);let i,n;this._uiManager.setUpDragSession();const s=this._uiManager._signal;e&&(this.div.classList.add("moving"),i={passive:!0,capture:!0,signal:s},this.#oe=t.clientX,this.#le=t.clientY,n=t=>{const{clientX:e,clientY:i}=t,[n,s]=this.screenToPageTranslation(e-this.#oe,i-this.#le);this.#oe=e,this.#le=i,this._uiManager.dragSelectedEditors(n,s)},window.addEventListener("pointermove",n,i));const a=()=>{window.removeEventListener("pointerup",a),window.removeEventListener("blur",a),e&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",n,i)),this.#ee=!1,this._uiManager.endDragSession()||this.#we(t)};window.addEventListener("pointerup",a,{signal:s}),window.addEventListener("blur",a,{signal:s})}moveInDOM(){this.#re&&clearTimeout(this.#re),this.#re=setTimeout((()=>{this.#re=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const n=this.parentScale,[s,a]=this.pageDimensions,[r,o]=this.pageTranslation,l=t/n,c=e/n,d=this.x*s,h=this.y*a,p=this.width*s,u=this.height*a;switch(i){case 0:return[d+l+r,a-h-c-u+o,d+l+p+r,a-h-c+o];case 90:return[d+c+r,a-h+l+o,d+c+u+r,a-h+l+p+o];case 180:return[d-l-p+r,a-h+c+o,d-l+r,a-h+c+u+o];case 270:return[d-c-u+r,a-h-l-p+o,d-c+r,a-h-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,n,s,a]=t,r=s-i,o=a-n;switch(this.rotation){case 0:return[i,e-a,r,o];case 90:return[i,e-n,o,r];case 180:return[s,e-n,r,o];case 270:return[s,e-a,o,r];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#se=!0}disableEditMode(){this.#se=!1}isInEditMode(){return this.#se}shouldGetKeyboardEvents(){return this.#ae}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){const t=this._uiManager._signal;this.div?.addEventListener("focusin",this.#Qt,{signal:t}),this.div?.addEventListener("focusout",this.#Jt,{signal:t})}rotate(t){}serialize(){at("An editor must be serializable")}static deserialize(t,e,i){const n=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});n.rotation=t.rotation,n.#Vt=t.accessibilityData;const[s,a]=n.pageDimensions,[r,o,l,c]=n.getRectInCurrentCoords(t.rect,a);return n.x=r/s,n.y=o/a,n.width=l/s,n.height=c/a,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.div.removeEventListener("focusin",this.#Qt),this.div.removeEventListener("focusout",this.#Jt),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#re&&(clearTimeout(this.#re),this.#re=null),this.#pe(),this.removeEditToolbar(),this.#ce){for(const t of this.#ce.values())clearTimeout(t);this.#ce=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#fe(),this.#Xt.classList.remove("hidden"),pe(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#Yt={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const e=this.#Xt.children;if(!this.#Gt){this.#Gt=Array.from(e);const t=this.#Ae.bind(this),i=this.#_e.bind(this),n=this._uiManager._signal;for(const e of this.#Gt){const s=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:n}),e.addEventListener("blur",i,{signal:n}),e.addEventListener("focus",this.#Ee.bind(this,s),{signal:n}),ye._l10nPromise.get(`pdfjs-editor-resizer-label-${s}`).then((t=>e.setAttribute("aria-label",t)))}}const i=this.#Gt[0];let n=0;for(const a of e){if(a===i)break;n++}const s=(360-this.rotation+this.parentRotation)%360/90*(this.#Gt.length/4);if(s!==n){if(s<n)for(let e=0;e<n-s;e++)this.#Xt.append(this.#Xt.firstChild);else if(s>n)for(let e=0;e<s-n;e++)this.#Xt.firstChild.before(this.#Xt.lastChild);let t=0;for(const i of e){const e=this.#Gt[t++].getAttribute("data-resizer-name");ye._l10nPromise.get(`pdfjs-editor-resizer-label-${e}`).then((t=>i.setAttribute("aria-label",t)))}}this.#Ce(0),this.#ae=!0,this.#Xt.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#Ae(t){ye._resizerKeyboardManager.exec(this,t)}#_e(t){this.#ae&&t.relatedTarget?.parentNode!==this.#Xt&&this.#pe()}#Ee(t){this.#te=this.#ae?t:""}#Ce(t){if(this.#Gt)for(const e of this.#Gt)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#ae&&this.#be(this.#te,{movementX:t,movementY:e})}#pe(){if(this.#ae=!1,this.#Ce(-1),this.#Yt){const{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=this.#Yt;this.#xe(t,e,i,n),this.#Yt=null}}_stopResizingWithKeyboard(){this.#pe(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this.#Zt?this.#Zt?.show():this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this.#Zt?.show()}))}unselect(){this.#Xt?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#Zt?.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#ne}set isEditing(t){this.#ne=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){this.#Kt=!0;const i=t/e,{style:n}=this.div;n.aspectRatio=i,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){this.#ce||=new Map;const{action:e}=t;let i=this.#ce.get(e);return i&&clearTimeout(i),i=setTimeout((()=>{this._reportTelemetry(t),this.#ce.delete(e),0===this.#ce.size&&(this.#ce=null)}),ye._telemetryTimeout),void this.#ce.set(e,i)}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#Wt=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#Wt=!0}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;"DIV"===e.nodeName&&e.classList.contains("annotationContent")&&e.remove()}}class we extends ye{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const Ae=3285377520,_e=4294901760,Ee=65535;class Ce{constructor(t){this.h1=t?4294967295&t:Ae,this.h2=t?4294967295&t:Ae}update(t){let e,i;if("string"===typeof t){e=new Uint8Array(2*t.length),i=0;for(let n=0,s=t.length;n<s;n++){const s=t.charCodeAt(n);s<=255?e[i++]=s:(e[i++]=s>>>8,e[i++]=255&s)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const n=i>>2,s=i-4*n,a=new Uint32Array(e.buffer,0,n);let r=0,o=0,l=this.h1,c=this.h2;const d=3432918353,h=461845907,p=11601,u=13715;for(let m=0;m<n;m++)1&m?(r=a[m],r=r*d&_e|r*p&Ee,r=r<<15|r>>>17,r=r*h&_e|r*u&Ee,l^=r,l=l<<13|l>>>19,l=5*l+3864292196):(o=a[m],o=o*d&_e|o*p&Ee,o=o<<15|o>>>17,o=o*h&_e|o*u&Ee,c^=o,c=c<<13|c>>>19,c=5*c+3864292196);switch(r=0,s){case 3:r^=e[4*n+2]<<16;case 2:r^=e[4*n+1]<<8;case 1:r^=e[4*n],r=r*d&_e|r*p&Ee,r=r<<15|r>>>17,r=r*h&_e|r*u&Ee,1&n?l^=r:c^=r}this.h1=l,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&_e|36045*t&Ee,e=4283543511*e&_e|(2950163797*(e<<16|t>>>16)&_e)>>>16,t^=e>>>1,t=444984403*t&_e|60499*t&Ee,e=3301882366*e&_e|(3120437893*(e<<16|t>>>16)&_e)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Se=Object.freeze({map:null,hash:"",transfer:void 0});class ke{#Se=!1;#ke=(()=>new Map)();constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=this.#ke.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#ke.get(t)}remove(t){if(this.#ke.delete(t),0===this.#ke.size&&this.resetModified(),"function"===typeof this.onAnnotationEditor){for(const t of this.#ke.values())if(t instanceof ye)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=this.#ke.get(t);let n=!1;if(void 0!==i)for(const[s,a]of Object.entries(e))i[s]!==a&&(n=!0,i[s]=a);else n=!0,this.#ke.set(t,e);n&&this.#Te(),e instanceof ye&&"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#ke.has(t)}getAll(){return this.#ke.size>0?xt(this.#ke):null}setAll(t){for(const[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return this.#ke.size}#Te(){this.#Se||(this.#Se=!0,"function"===typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#Se&&(this.#Se=!1,"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new Te(this)}get serializable(){if(0===this.#ke.size)return Se;const t=new Map,e=new Ce,i=[],n=Object.create(null);let s=!1;for(const[a,r]of this.#ke){const i=r instanceof ye?r.serialize(!1,n):r;i&&(t.set(a,i),e.update(`${a}:${JSON.stringify(i)}`),s||=!!i.bitmap)}if(s)for(const a of t.values())a.bitmap&&i.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Se}get editorStats(){let t=null;const e=new Map;for(const i of this.#ke.values()){if(!(i instanceof ye))continue;const n=i.telemetryFinalData;if(!n)continue;const{type:s}=n;e.has(s)||e.set(s,Object.getPrototypeOf(i).constructor),t||=Object.create(null);const a=t[s]||=new Map;for(const[t,e]of Object.entries(n)){if("type"===t)continue;let i=a.get(t);i||(i=new Map,a.set(t,i));const n=i.get(e)??0;i.set(e,n+1)}}for(const[i,n]of e)t[i]=n.computeTelemetryFinalData(t[i]);return t}}class Te extends ke{#Me;constructor(t){super();const{map:e,hash:i,transfer:n}=t.serializable,s=structuredClone(e,n?{transfer:n}:null);this.#Me={map:s,hash:i,transfer:n}}get print(){at("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#Me}}class Me{#Pe=(()=>new Set)();constructor(t){let{ownerDocument:e=globalThis.document,styleElement:i=null}=t;this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#Pe.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,_inspectFont:i}=t;if(e&&!this.#Pe.has(e.loadedName))if(rt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:n,style:s}=e,a=new FontFace(t,n,s);this.addNativeFontFace(a);try{await a.load(),this.#Pe.add(t),i?.(e)}catch{st(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}}else at("Not implemented: loadSystemFont without the Font Loading API.")}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw st(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)}))}}get isFontLoadingAPISupported(){return lt(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let t=!1;return(a||"undefined"!==typeof navigator&&"string"===typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),lt(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(rt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return lt(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function n(t,e,i,n){return t.substring(0,e)+n+t.substring(e+i)}let s,a;const r=this._document.createElement("canvas");r.width=1,r.height=1;const o=r.getContext("2d");let l=0;const c=`lt${Date.now()}${this.loadTestFontId++}`;let d=this._loadTestFont;d=n(d,976,c.length,c);const h=1482184792;let p=i(d,16);for(s=0,a=c.length-3;s<a;s+=4)p=p-h+i(c,s)|0;var u;s<c.length&&(p=p-h+i(c+"XXX",s)|0),d=n(d,16,4,(u=p,String.fromCharCode(u>>24&255,u>>16&255,u>>8&255,255&u)));const m=`@font-face {font-family:"${c}";src:${`url(data:font/opentype;base64,${btoa(d)});`}}`;this.insertRule(m);const g=this._document.createElement("div");g.style.visibility="hidden",g.style.width=g.style.height="10px",g.style.position="absolute",g.style.top=g.style.left="0px";for(const f of[t.loadedName,c]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=f,g.append(t)}this._document.body.append(g),function t(e,i){if(++l>30)return st("Load test font never loaded."),void i();o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(c,(()=>{g.remove(),e.complete()}))}}class Pe{constructor(t,e){let{disableFontFace:i=!1,inspectFont:n=null}=e;this.compiledGlyphs=Object.create(null);for(const s in t)this[s]=t[s];this.disableFontFace=!0===i,this._inspectFont=n}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(this.cssFontInfo){const e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=vt(this.data),e=`url(data:${this.mimetype};base64,${btoa(t)});`;let i;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${e}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this._inspectFont?.(this,e),i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let i;try{i=t.get(this.loadedName+"_path_"+e)}catch(s){st(`getPathGenerator - ignoring character: "${s}".`)}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(t,e){};const n=[];for(let a=0,r=i.length;a<r;)switch(i[a++]){case kt:{const[t,e,s,r,o,l]=i.slice(a,a+6);n.push((i=>i.bezierCurveTo(t,e,s,r,o,l))),a+=6}break;case Tt:{const[t,e]=i.slice(a,a+2);n.push((i=>i.moveTo(t,e))),a+=2}break;case Mt:{const[t,e]=i.slice(a,a+2);n.push((i=>i.lineTo(t,e))),a+=2}break;case Pt:{const[t,e,s,r]=i.slice(a,a+4);n.push((i=>i.quadraticCurveTo(t,e,s,r))),a+=4}break;case Rt:n.push((t=>t.restore()));break;case Dt:n.push((t=>t.save()));break;case Lt:rt(2===n.length,"Scale command is only valid at the third position.");break;case It:{const[t,e,s,r,o,l]=i.slice(a,a+6);n.push((i=>i.transform(t,e,s,r,o,l))),a+=6}break;case Ft:{const[t,e]=i.slice(a,a+2);n.push((i=>i.translate(t,e))),a+=2}}return this.compiledGlyphs[e]=function(t,e){n[0](t),n[1](t),t.scale(e,-e);for(let i=2,s=n.length;i<s;i++)n[i](t)}}}if(a){var Re=Promise.withResolvers(),De=null;(async()=>{const t=await import("fs"),e=await import("http"),i=await import("https"),n=await import("url");return new Map(Object.entries({fs:t,http:e,https:i,url:n,canvas:undefined,path2d:undefined}))})().then((t=>{De=t,Re.resolve()}),(t=>{st(`loadPackages: ${t}`),De=new Map,Re.resolve()}))}class Le{static get promise(){return Re.promise}static get(t){return De?.get(t)}}const Ie=function(t){return Le.get("fs").promises.readFile(t).then((t=>new Uint8Array(t)))};const Fe="Fill",Oe="Stroke",Ne="Shading";function je(t,e){if(!e)return;const i=e[2]-e[0],n=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],i,n),t.clip(s)}class ze{constructor(){this.constructor===ze&&at("Cannot initialize BaseShadingPattern.")}getPattern(){at("Abstract method `getPattern` called.")}}class Be extends ze{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,n){let s;if(n===Oe||n===Fe){const a=e.current.getClippedPathBoundingBox(n,oe(t))||[0,0,0,0],r=Math.ceil(a[2]-a[0])||1,o=Math.ceil(a[3]-a[1])||1,l=e.cachedCanvases.getCanvas("pattern",r,o,!0),c=l.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-a[0],-a[1]),i=At.transform(i,[1,0,0,1,a[0],a[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),je(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),s=t.createPattern(l.canvas,"no-repeat");const d=new DOMMatrix(i);s.setTransform(d)}else je(t,this._bbox),s=this._createGradient(t);return s}}function He(t,e,i,n,s,a,r,o){const l=e.coords,c=e.colors,d=t.data,h=4*t.width;let p;l[i+1]>l[n+1]&&(p=i,i=n,n=p,p=a,a=r,r=p),l[n+1]>l[s+1]&&(p=n,n=s,s=p,p=r,r=o,o=p),l[i+1]>l[n+1]&&(p=i,i=n,n=p,p=a,a=r,r=p);const u=(l[i]+e.offsetX)*e.scaleX,m=(l[i+1]+e.offsetY)*e.scaleY,g=(l[n]+e.offsetX)*e.scaleX,f=(l[n+1]+e.offsetY)*e.scaleY,v=(l[s]+e.offsetX)*e.scaleX,b=(l[s+1]+e.offsetY)*e.scaleY;if(m>=b)return;const x=c[a],y=c[a+1],w=c[a+2],A=c[r],_=c[r+1],E=c[r+2],C=c[o],S=c[o+1],k=c[o+2],T=Math.round(m),M=Math.round(b);let P,R,D,L,I,F,O,N;for(let j=T;j<=M;j++){if(j<f){const t=j<m?0:(m-j)/(m-f);P=u-(u-g)*t,R=x-(x-A)*t,D=y-(y-_)*t,L=w-(w-E)*t}else{let t;t=j>b?1:f===b?0:(f-j)/(f-b),P=g-(g-v)*t,R=A-(A-C)*t,D=_-(_-S)*t,L=E-(E-k)*t}let t;t=j<m?0:j>b?1:(m-j)/(m-b),I=u-(u-v)*t,F=x-(x-C)*t,O=y-(y-S)*t,N=w-(w-k)*t;const e=Math.round(Math.min(P,I)),i=Math.round(Math.max(P,I));let n=h*j+4*e;for(let s=e;s<=i;s++)t=(P-s)/(P-I),t<0?t=0:t>1&&(t=1),d[n++]=R-(R-F)*t|0,d[n++]=D-(D-O)*t|0,d[n++]=L-(L-N)*t|0,d[n++]=255}}function $e(t,e,i){const n=e.coords,s=e.colors;let a,r;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(n.length/o)-1,c=o-1;for(a=0;a<l;a++){let e=a*o;for(let a=0;a<c;a++,e++)He(t,i,n[e],n[e+1],n[e+o],s[e],s[e+1],s[e+o]),He(t,i,n[e+o+1],n[e+1],n[e+o],s[e+o+1],s[e+1],s[e+o])}break;case"triangles":for(a=0,r=n.length;a<r;a+=3)He(t,i,n[a],n[a+1],n[a+2],s[a],s[a+1],s[a+2]);break;default:throw new Error("illegal figure")}}class Ue extends ze{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,i){const n=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),a=Math.ceil(this._bounds[2])-n,r=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(a*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(r*t[1]*1.1)),3e3),c=a/o,d=r/l,h={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-s,scaleX:1/c,scaleY:1/d},p=o+4,u=l+4,m=i.getCanvas("mesh",p,u,!1),g=m.context,f=g.createImageData(o,l);if(e){const t=f.data;for(let i=0,n=t.length;i<n;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const v of this._figures)$e(f,v,h);g.putImageData(f,2,2);return{canvas:m.canvas,offsetX:n-2*c,offsetY:s-2*d,scaleX:c,scaleY:d}}getPattern(t,e,i,n){let s;if(je(t,this._bbox),n===Ne)s=At.singularValueDecompose2dScale(oe(t));else if(s=At.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=At.singularValueDecompose2dScale(this.matrix);s=[s[0]*t[0],s[1]*t[1]]}const a=this._createMeshCanvas(s,n===Ne?null:this._background,e.cachedCanvases);return n!==Ne&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class qe extends ze{getPattern(){return"hotpink"}}const Ve=1,Ge=2;class We{static MAX_PATTERN_SIZE=3e3;constructor(t,e,i,n,s){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=i,this.canvasGraphicsFactory=n,this.baseTransform=s}createPatternCanvas(t){const e=this.operatorList,i=this.bbox,n=this.xstep,s=this.ystep,a=this.paintType,r=this.tilingType,o=this.color,l=this.canvasGraphicsFactory;nt("TilingType: "+r);const c=i[0],d=i[1],h=i[2],p=i[3],u=At.singularValueDecompose2dScale(this.matrix),m=At.singularValueDecompose2dScale(this.baseTransform),g=[u[0]*m[0],u[1]*m[1]],f=this.getSizeAndScale(n,this.ctx.canvas.width,g[0]),v=this.getSizeAndScale(s,this.ctx.canvas.height,g[1]),b=t.cachedCanvases.getCanvas("pattern",f.size,v.size,!0),x=b.context,y=l.createCanvasGraphics(x);y.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(y,a,o);let w=c,A=d,_=h,E=p;return c<0&&(w=0,_+=Math.abs(c)),d<0&&(A=0,E+=Math.abs(d)),x.translate(-f.scale*w,-v.scale*A),y.transform(f.scale,0,0,v.scale,0,0),x.save(),this.clipBbox(y,w,A,_,E),y.baseTransform=oe(y.ctx),y.executeOperatorList(e),y.endDrawing(),{canvas:b.canvas,scaleX:f.scale,scaleY:v.scale,offsetX:w,offsetY:A}}getSizeAndScale(t,e,i){t=Math.abs(t);const n=Math.max(We.MAX_PATTERN_SIZE,e);let s=Math.ceil(t*i);return s>=n?s=n:i=s/t,{scale:i,size:s}}clipBbox(t,e,i,n,s){const a=n-e,r=s-i;t.ctx.rect(e,i,a,r),t.current.updateRectMinMax(oe(t.ctx),[e,i,n,s]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const n=t.ctx,s=t.current;switch(e){case Ve:const t=this.ctx;n.fillStyle=t.fillStyle,n.strokeStyle=t.strokeStyle,s.fillColor=t.fillStyle,s.strokeColor=t.strokeStyle;break;case Ge:const a=At.makeHexColor(i[0],i[1],i[2]);n.fillStyle=a,n.strokeStyle=a,s.fillColor=a,s.strokeColor=a;break;default:throw new gt(`Unsupported paint type: ${e}`)}}getPattern(t,e,i,n){let s=i;n!==Ne&&(s=At.transform(s,e.baseTransform),this.matrix&&(s=At.transform(s,this.matrix)));const a=this.createPatternCanvas(e);let r=new DOMMatrix(s);r=r.translate(a.offsetX,a.offsetY),r=r.scale(1/a.scaleX,1/a.scaleY);const o=t.createPattern(a.canvas,"repeat");return o.setTransform(r),o}}function Ke(t){let{src:e,srcPos:i=0,dest:n,width:s,height:a,nonBlackColor:r=4294967295,inverseDecode:o=!1}=t;const l=yt.isLittleEndian?4278190080:255,[c,d]=o?[r,l]:[l,r],h=s>>3,p=7&s,u=e.length;n=new Uint32Array(n.buffer);let m=0;for(let g=0;g<a;g++){for(const s=i+h;i<s;i++){const t=i<u?e[i]:255;n[m++]=128&t?d:c,n[m++]=64&t?d:c,n[m++]=32&t?d:c,n[m++]=16&t?d:c,n[m++]=8&t?d:c,n[m++]=4&t?d:c,n[m++]=2&t?d:c,n[m++]=1&t?d:c}if(0===p)continue;const t=i<u?e[i++]:255;for(let e=0;e<p;e++)n[m++]=t&1<<7-e?d:c}return{srcPos:i,destPos:m}}const Xe=16;class Ye{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let n;return void 0!==this.cache[t]?(n=this.cache[t],this.canvasFactory.reset(n,e,i)):(n=this.canvasFactory.create(e,i),this.cache[t]=n),n}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function Qe(t,e,i,n,s,a,r,o,l,c){const[d,h,p,u,m,g]=oe(t);if(0===h&&0===p){const f=r*d+m,v=Math.round(f),b=o*u+g,x=Math.round(b),y=(r+l)*d+m,w=Math.abs(Math.round(y)-v)||1,A=(o+c)*u+g,_=Math.abs(Math.round(A)-x)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(u),v,x),t.drawImage(e,i,n,s,a,0,0,w,_),t.setTransform(d,h,p,u,m,g),[w,_]}if(0===d&&0===u){const f=o*p+m,v=Math.round(f),b=r*h+g,x=Math.round(b),y=(o+c)*p+m,w=Math.abs(Math.round(y)-v)||1,A=(r+l)*h+g,_=Math.abs(Math.round(A)-x)||1;return t.setTransform(0,Math.sign(h),Math.sign(p),0,v,x),t.drawImage(e,i,n,s,a,0,0,_,w),t.setTransform(d,h,p,u,m,g),[_,w]}t.drawImage(e,i,n,s,a,r,o,l,c);return[Math.hypot(d,h)*l,Math.hypot(p,u)*c]}class Je{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=r,this.textMatrixScale=1,this.fontMatrix=o,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=y,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="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,i){[e,i]=At.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){const i=At.applyTransform(e,t),n=At.applyTransform(e.slice(2),t),s=At.applyTransform([e[0],e[3]],t),a=At.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],n[0],s[0],a[0]),this.minY=Math.min(this.minY,i[1],n[1],s[1],a[1]),this.maxX=Math.max(this.maxX,i[0],n[0],s[0],a[0]),this.maxY=Math.max(this.maxY,i[1],n[1],s[1],a[1])}updateScalingPathMinMax(t,e){At.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,i,n,s,a,r,o,l,c){const d=At.bezierBoundingBox(e,i,n,s,a,r,o,l,c);c||this.updateRectMinMax(t,d)}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fe,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[this.minX,this.minY,this.maxX,this.maxY];if(t===Oe){e||at("Stroke bounding box must include transform.");const t=At.singularValueDecompose2dScale(e),n=t[0]*this.lineWidth/2,s=t[1]*this.lineWidth/2;i[0]-=n,i[1]-=s,i[2]+=n,i[3]+=s}return i}updateClipFromPath(){const t=At.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fe,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return At.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Ze(t,e){if("undefined"!==typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,n=e.width,s=i%Xe,a=(i-s)/Xe,r=0===s?a:a+1,o=t.createImageData(n,Xe);let l,c=0;const d=e.data,h=o.data;let p,u,m,g;if(e.kind===S.GRAYSCALE_1BPP){const e=d.byteLength,i=new Uint32Array(h.buffer,0,h.byteLength>>2),g=i.length,f=n+7>>3,v=4294967295,b=yt.isLittleEndian?4278190080:255;for(p=0;p<r;p++){for(m=p<a?Xe:s,l=0,u=0;u<m;u++){const t=e-c;let s=0;const a=t>f?n:8*t-7,r=-8&a;let o=0,h=0;for(;s<r;s+=8)h=d[c++],i[l++]=128&h?v:b,i[l++]=64&h?v:b,i[l++]=32&h?v:b,i[l++]=16&h?v:b,i[l++]=8&h?v:b,i[l++]=4&h?v:b,i[l++]=2&h?v:b,i[l++]=1&h?v:b;for(;s<a;s++)0===o&&(h=d[c++],o=128),i[l++]=h&o?v:b,o>>=1}for(;l<g;)i[l++]=0;t.putImageData(o,0,p*Xe)}}else if(e.kind===S.RGBA_32BPP){for(u=0,g=n*Xe*4,p=0;p<a;p++)h.set(d.subarray(c,c+g)),c+=g,t.putImageData(o,0,u),u+=Xe;p<r&&(g=n*s*4,h.set(d.subarray(c,c+g)),t.putImageData(o,0,u))}else{if(e.kind!==S.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);for(m=Xe,g=n*m,p=0;p<r;p++){for(p>=a&&(m=s,g=n*m),l=0,u=g;u--;)h[l++]=d[c++],h[l++]=d[c++],h[l++]=d[c++],h[l++]=255;t.putImageData(o,0,p*Xe)}}}function ti(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,n=e.width,s=i%Xe,a=(i-s)/Xe,r=0===s?a:a+1,o=t.createImageData(n,Xe);let l=0;const c=e.data,d=o.data;for(let h=0;h<r;h++){const e=h<a?Xe:s;({srcPos:l}=Ke({src:c,srcPos:l,dest:d,width:n,height:e,nonBlackColor:0})),t.putImageData(o,0,h*Xe)}}function ei(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of i)void 0!==t[n]&&(e[n]=t[n]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function ii(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!a){const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function ni(t,e){if(e)return!0;const i=At.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*$t.PDF_TO_CSS_UNITS);return i[0]<=n&&i[1]<=n}const si=["butt","round","square"],ai=["miter","round","bevel"],ri={},oi={};class li{constructor(t,e,i,n,s,a,r,o){let{optionalContentConfig:l,markedContentStack:c=null}=a;this.ctx=t,this.current=new Je(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=n,this.filterFactory=s,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=c||[],this.optionalContentConfig=l,this.cachedCanvases=new Ye(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=r,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=o,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"===typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:n=!1,background:s=null}=t;const a=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,a,r),this.ctx.fillStyle=o,n){const t=this.cachedCanvases.getCanvas("transparent",a,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...oe(this.compositeCtx))}this.ctx.save(),ii(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=oe(this.ctx)}executeOperatorList(t,e,i,n){const s=t.argsArray,a=t.fnArray;let r=e||0;const o=s.length;if(o===r)return r;const l=o-r>10&&"function"===typeof i,c=l?Date.now()+15:0;let d=0;const h=this.commonObjs,p=this.objs;let u;for(;;){if(void 0!==n&&r===n.nextBreakPoint)return n.breakIt(r,i),r;if(u=a[r],u!==J.dependency)this[u].apply(this,s[r]);else for(const t of s[r]){const e=t.startsWith("g_")?h:p;if(!e.has(t))return e.get(t,i),r}if(r++,r===o)return r;if(l&&++d>10){if(Date.now()>c)return i(),r;d=0}}}#Re(){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)}endDrawing(){this.#Re(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#De()}#De(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){const i=t.width,n=t.height;let s,a,r=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=i,c=n,d="prescale1";for(;r>2&&l>1||o>2&&c>1;){let e=l,i=c;r>2&&l>1&&(e=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),r/=l/e),o>2&&c>1&&(i=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/i),s=this.cachedCanvases.getCanvas(d,e,i),a=s.context,a.clearRect(0,0,e,i),a.drawImage(t,0,0,l,c,0,0,e,i),t=s.canvas,l=e,c=i,d="prescale1"===d?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:n}=t,s=this.current.fillColor,a=this.current.patternFill,r=oe(e);let o,l,c,d;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer;l=JSON.stringify(a?r:[r.slice(0,4),s]),o=this._cachedBitmapsMap.get(e),o||(o=new Map,this._cachedBitmapsMap.set(e,o));const i=o.get(l);if(i&&!a){return{canvas:i,offsetX:Math.round(Math.min(r[0],r[2])+r[4]),offsetY:Math.round(Math.min(r[1],r[3])+r[5])}}c=i}c||(d=this.cachedCanvases.getCanvas("maskCanvas",i,n),ti(d.context,t));let h=At.transform(r,[1/i,0,0,-1/n,0,0]);h=At.transform(h,[1,0,0,1,0,-n]);const[p,u,m,g]=At.getAxialAlignedBoundingBox([0,0,i,n],h),f=Math.round(m-p)||1,v=Math.round(g-u)||1,b=this.cachedCanvases.getCanvas("fillCanvas",f,v),x=b.context,y=p,w=u;x.translate(-y,-w),x.transform(...h),c||(c=this._scaleImage(d.canvas,le(x)),c=c.img,o&&a&&o.set(l,c)),x.imageSmoothingEnabled=ni(oe(x),t.interpolate),Qe(x,c,0,0,c.width,c.height,0,0,i,n),x.globalCompositeOperation="source-in";const A=At.transform(le(x),[1,0,0,1,-y,-w]);return x.fillStyle=a?s.getPattern(e,this,A,Fe):s,x.fillRect(0,0,i,n),o&&!a&&(this.cachedCanvases.delete("fillCanvas"),o.set(l,b.canvas)),{canvas:b.canvas,offsetX:Math.round(y),offsetY:Math.round(w)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=si[t]}setLineJoin(t){this.ctx.lineJoin=ai[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=n.context;const s=this.ctx;s.setTransform(...oe(this.suspendedCtx)),ei(this.suspendedCtx,s),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,n,s,a,r){e.transform(t,i,n,s,a,r),this.__originalTransform(t,i,n,s,a,r)},t.setTransform=function(t,i,n,s,a,r){e.setTransform(t,i,n,s,a,r),this.__originalSetTransform(t,i,n,s,a,r)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,n,s,a,r){e.bezierCurveTo(t,i,n,s,a,r),this.__originalBezierCurveTo(t,i,n,s,a,r)},t.rect=function(t,i,n,s){e.rect(t,i,n,s),this.__originalRect(t,i,n,s)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(s,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(),ei(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),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()}composeSMask(t,e,i,n){const s=n[0],a=n[1],r=n[2]-s,o=n[3]-a;0!==r&&0!==o&&(this.genericComposeSMask(e.context,i,r,o,e.subtype,e.backdrop,e.transferMap,s,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,n,s,a,r,o,l,c,d){let h=t.canvas,p=o-c,u=l-d;if(a)if(p<0||u<0||p+i>h.width||u+n>h.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,n),e=t.context;e.drawImage(h,-p,-u),a.some((t=>0!==t))&&(e.globalCompositeOperation="destination-atop",e.fillStyle=At.makeHexColor(...a),e.fillRect(0,0,i,n),e.globalCompositeOperation="source-over"),h=t.canvas,p=u=0}else if(a.some((t=>0!==t))){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const e=new Path2D;e.rect(p,u,i,n),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=At.makeHexColor(...a),t.fillRect(p,u,i,n),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===s&&r?e.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===s&&(e.filter=this.filterFactory.addLuminosityFilter(r));const m=new Path2D;m.rect(o,l,i,n),e.clip(m),e.globalCompositeOperation="destination-in",e.drawImage(h,p,u,i,n,o,l,i,n),e.restore()}save(){this.inSMaskMode?(ei(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),ei(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,n,s,a){this.ctx.transform(t,e,i,n,s,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){const n=this.ctx,s=this.current;let a,r,o=s.x,l=s.y;const c=oe(n),d=0===c[0]&&0===c[3]||0===c[1]&&0===c[2],h=d?i.slice(0):null;for(let p=0,u=0,m=t.length;p<m;p++)switch(0|t[p]){case J.rectangle:o=e[u++],l=e[u++];const t=e[u++],i=e[u++],p=o+t,m=l+i;n.moveTo(o,l),0===t||0===i?n.lineTo(p,m):(n.lineTo(p,l),n.lineTo(p,m),n.lineTo(o,m)),d||s.updateRectMinMax(c,[o,l,p,m]),n.closePath();break;case J.moveTo:o=e[u++],l=e[u++],n.moveTo(o,l),d||s.updatePathMinMax(c,o,l);break;case J.lineTo:o=e[u++],l=e[u++],n.lineTo(o,l),d||s.updatePathMinMax(c,o,l);break;case J.curveTo:a=o,r=l,o=e[u+4],l=e[u+5],n.bezierCurveTo(e[u],e[u+1],e[u+2],e[u+3],o,l),s.updateCurvePathMinMax(c,a,r,e[u],e[u+1],e[u+2],e[u+3],o,l,h),u+=6;break;case J.curveTo2:a=o,r=l,n.bezierCurveTo(o,l,e[u],e[u+1],e[u+2],e[u+3]),s.updateCurvePathMinMax(c,a,r,o,l,e[u],e[u+1],e[u+2],e[u+3],h),o=e[u+2],l=e[u+3],u+=4;break;case J.curveTo3:a=o,r=l,o=e[u+2],l=e[u+3],n.bezierCurveTo(e[u],e[u+1],o,l,o,l),s.updateCurvePathMinMax(c,a,r,e[u],e[u+1],o,l,o,l,h),u+=4;break;case J.closePath:n.closePath()}d&&s.updateScalingPathMinMax(c,h),s.setCurrentPoint(o,l)}closePath(){this.ctx.closePath()}stroke(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"===typeof i&&i?.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,le(e),Oe),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,i=this.current.fillColor;let n=!1;this.current.patternFill&&(e.save(),e.fillStyle=i.getPattern(e,this,le(e),Fe),n=!0);const s=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==s&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),n&&e.restore(),t&&this.consumePath(s)}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=ri}eoClip(){this.pendingClip=oi}beginText(){this.current.textMatrix=r,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(void 0!==t){e.save(),e.beginPath();for(const i of t)e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}else e.beginPath()}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){const i=this.commonObjs.get(t),n=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(n.fontMatrix=i.fontMatrix||o,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||st("Invalid font matrix for font "+t),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;const s=i.loadedName||"sans-serif",a=i.systemFontInfo?.css||`"${s}", ${i.fallbackName}`;let r="normal";i.black?r="900":i.bold&&(r="bold");const l=i.italic?"italic":"normal";let c=e;e<16?c=16:e>100&&(c=100),this.current.fontSizeScale=e/c,this.ctx.font=`${l} ${r} ${c}px ${a}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,n,s,a){this.current.textMatrix=[t,e,i,n,s,a],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,n){const s=this.ctx,a=this.current,r=a.font,o=a.textRenderingMode,l=a.fontSize/a.fontSizeScale,c=o&E,d=!!(o&C),h=a.patternFill&&!r.missingFile;let p;if((r.disableFontFace||d||h)&&(p=r.getPathGenerator(this.commonObjs,t)),r.disableFontFace||h?(s.save(),s.translate(e,i),s.beginPath(),p(s,l),n&&s.setTransform(...n),c!==y&&c!==A||s.fill(),c!==w&&c!==A||s.stroke(),s.restore()):(c!==y&&c!==A||s.fillText(t,e,i),c!==w&&c!==A||s.strokeText(t,e,i)),d){(this.pendingTextPaths||=[]).push({transform:oe(s),x:e,y:i,fontSize:l,addToPath:p})}}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let n=3;n<e.length;n+=4)if(e[n]>0&&e[n]<255){i=!0;break}return lt(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const n=e.fontSize;if(0===n)return;const s=this.ctx,a=e.fontSizeScale,r=e.charSpacing,o=e.wordSpacing,l=e.fontDirection,c=e.textHScale*l,d=t.length,h=i.vertical,p=h?1:-1,u=i.defaultVMetrics,m=n*e.fontMatrix[0],g=e.textRenderingMode===y&&!i.disableFontFace&&!e.patternFill;let f;if(s.save(),s.transform(...e.textMatrix),s.translate(e.x,e.y+e.textRise),l>0?s.scale(c,-1):s.scale(c,1),e.patternFill){s.save();const t=e.fillColor.getPattern(s,this,le(s),Fe);f=oe(s),s.restore(),s.fillStyle=t}let v=e.lineWidth;const b=e.textMatrixScale;if(0===b||0===v){const t=e.textRenderingMode&E;t!==w&&t!==A||(v=this.getSinglePixelWidth())}else v/=b;if(1!==a&&(s.scale(a,a),v/=a),s.lineWidth=v,i.isInvalidPDFjsFont){const i=[];let n=0;for(const e of t)i.push(e.unicode),n+=e.width;return s.fillText(i.join(""),0,0),e.x+=n*m*c,s.restore(),void this.compose()}let x,_=0;for(x=0;x<d;++x){const e=t[x];if("number"===typeof e){_+=p*e*n/1e3;continue}let c=!1;const d=(e.isSpace?o:0)+r,v=e.fontChar,b=e.accent;let y,w,A=e.width;if(h){const t=e.vmetric||u,i=-(e.vmetric?t[1]:.5*A)*m,n=t[2]*m;A=t?-t[0]:A,y=i/a,w=(_+n)/a}else y=_/a,w=0;if(i.remeasure&&A>0){const t=1e3*s.measureText(v).width/n*a;if(A<t&&this.isFontSubpixelAAEnabled){const e=A/t;c=!0,s.save(),s.scale(e,1),y/=e}else A!==t&&(y+=(A-t)/2e3*n/a)}if(this.contentVisible&&(e.isInFont||i.missingFile))if(g&&!b)s.fillText(v,y,w);else if(this.paintChar(v,y,w,f),b){const t=y+n*b.offset.x/a,e=w-n*b.offset.y/a;this.paintChar(b.fontChar,t,e,f)}_+=h?A*m-d*l:A*m+d*l,c&&s.restore()}h?e.y-=_:e.x+=_*c,s.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,n=i.font,s=i.fontSize,a=i.fontDirection,r=n.vertical?1:-1,l=i.charSpacing,c=i.wordSpacing,d=i.textHScale*a,h=i.fontMatrix||o,p=t.length;let u,m,g,f;if(!(i.textRenderingMode===_)&&0!==s){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(d,a),u=0;u<p;++u){if(m=t[u],"number"===typeof m){f=r*m*s/1e3,this.ctx.translate(f,0),i.x+=f*d;continue}const a=(m.isSpace?c:0)+l,o=n.charProcOperatorList[m.operatorListId];if(!o){st(`Type3 character "${m.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=m,this.save(),e.scale(s,s),e.transform(...h),this.executeOperatorList(o),this.restore());g=At.applyTransform([m.width,0],h)[0]*s+a,e.translate(g,0),i.x+=g*d}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,n,s,a){this.ctx.rect(i,n,s-i,a-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const i=t[1],n=this.baseTransform||oe(this.ctx),s={createCanvasGraphics:t=>new li(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new We(t,i,this.ctx,s,n)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){const n=At.makeHexColor(t,e,i);this.ctx.strokeStyle=n,this.current.strokeColor=n}setFillRGBColor(t,e,i){const n=At.makeHexColor(t,e,i);this.ctx.fillStyle=n,this.current.fillColor=n,this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=function(t){switch(t[0]){case"RadialAxial":return new Be(t);case"Mesh":return new Ue(t);case"Dummy":return new qe}throw new Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,le(e),Ne);const n=le(e);if(n){const{width:t,height:i}=e.canvas,[s,a,r,o]=At.getAxialAlignedBoundingBox([0,0,t,i],n);this.ctx.fillRect(s,a,r-s,o-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){at("Should not call beginInlineImage")}beginImageData(){at("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=oe(this.ctx),e)){const t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax(oe(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||nt("TODO: Support non-isolated groups."),t.knockout&&st("Knockout groups not supported.");const i=oe(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let n=At.getAxialAlignedBoundingBox(t.bbox,oe(e));const s=[0,0,e.canvas.width,e.canvas.height];n=At.intersect(n,s)||[0,0,0,0];const a=Math.floor(n[0]),r=Math.floor(n[1]),o=Math.max(Math.ceil(n[2])-a,1),l=Math.max(Math.ceil(n[3])-r,1);this.current.startNewPathAndClipBox([0,0,o,l]);let c="groupAt"+this.groupLevel;t.smask&&(c+="_smask_"+this.smaskCounter++%2);const d=this.cachedCanvases.getCanvas(c,o,l),h=d.context;h.translate(-a,-r),h.transform(...i),t.smask?this.smaskStack.push({canvas:d.canvas,context:h,offsetX:a,offsetY:r,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,r),e.save()),ei(e,h),this.ctx=h,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const t=oe(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const i=At.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,n,s){if(this.#Re(),ii(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const n=e[2]-e[0],a=e[3]-e[1];if(s&&this.annotationCanvasMap){(i=i.slice())[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=n,e[3]=a;const[s,r]=At.singularValueDecompose2dScale(oe(this.ctx)),{viewportScale:o}=this,l=Math.ceil(n*this.outputScaleX*o),c=Math.ceil(a*this.outputScaleY*o);this.annotationCanvas=this.canvasFactory.create(l,c);const{canvas:d,context:h}=this.annotationCanvas;this.annotationCanvasMap.set(t,d),this.annotationCanvas.savedCtx=this.ctx,this.ctx=h,this.ctx.save(),this.ctx.setTransform(s,0,0,-r,0,a*r),ii(this.ctx)}else ii(this.ctx),this.ctx.rect(e[0],e[1],n,a),this.ctx.clip(),this.endPath()}this.current=new Je(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#De(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;(t=this.getObject(t.data,t)).count=e;const i=this.ctx,n=this.processingType3;if(n&&(void 0===n.compiled&&(n.compiled=function(t){const{width:e,height:i}=t;if(e>1e3||i>1e3)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),s=e+1;let a,r,o,l=new Uint8Array(s*(i+1));const c=e+7&-8;let d=new Uint8Array(c*i),h=0;for(const g of t.data){let t=128;for(;t>0;)d[h++]=g&t?0:255,t>>=1}let p=0;for(h=0,0!==d[h]&&(l[0]=1,++p),r=1;r<e;r++)d[h]!==d[h+1]&&(l[r]=d[h]?2:1,++p),h++;for(0!==d[h]&&(l[r]=2,++p),a=1;a<i;a++){h=a*c,o=a*s,d[h-c]!==d[h]&&(l[o]=d[h]?1:8,++p);let t=(d[h]?4:0)+(d[h-c]?8:0);for(r=1;r<e;r++)t=(t>>2)+(d[h+1]?4:0)+(d[h-c+1]?8:0),n[t]&&(l[o+r]=n[t],++p),h++;if(d[h-c]!==d[h]&&(l[o+r]=d[h]?2:4,++p),p>1e3)return null}for(h=c*(i-1),o=a*s,0!==d[h]&&(l[o]=8,++p),r=1;r<e;r++)d[h]!==d[h+1]&&(l[o+r]=d[h]?4:8,++p),h++;if(0!==d[h]&&(l[o+r]=4,++p),p>1e3)return null;const u=new Int32Array([0,s,-1,0,-s,0,0,0,1]),m=new Path2D;for(a=0;p&&a<=i;a++){let t=a*s;const i=t+e;for(;t<i&&!l[t];)t++;if(t===i)continue;m.moveTo(t%s,a);const n=t;let r=l[t];do{const e=u[r];do{t+=e}while(!l[t]);const i=l[t];5!==i&&10!==i?(r=i,l[t]=0):(r=i&51*r>>4,l[t]&=r>>2|r<<2),m.lineTo(t%s,t/s|0),l[t]||--p}while(n!==t);--a}return d=null,l=null,function(t){t.save(),t.scale(1/e,-1/i),t.translate(0,-i),t.fill(m),t.beginPath(),t.restore()}}(t)),n.compiled))return void n.compiled(i);const s=this._createMaskCanvas(t),a=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);const r=this.ctx;r.save();const o=oe(r);r.transform(e,i,n,s,0,0);const l=this._createMaskCanvas(t);r.setTransform(1,0,0,1,l.offsetX-o[4],l.offsetY-o[5]);for(let c=0,d=a.length;c<d;c+=2){const t=At.transform(o,[e,i,n,s,a[c],a[c+1]]),[d,h]=At.applyTransform([0,0],t);r.drawImage(l.canvas,d,h)}r.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,n=this.current.patternFill;for(const s of t){const{data:t,width:a,height:r,transform:o}=s,l=this.cachedCanvases.getCanvas("maskCanvas",a,r),c=l.context;c.save();ti(c,this.getObject(t,s)),c.globalCompositeOperation="source-in",c.fillStyle=n?i.getPattern(c,this,le(e),Fe):i,c.fillRect(0,0,a,r),c.restore(),e.save(),e.transform(...o),e.scale(1,-1),Qe(e,l.canvas,0,0,a,r,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):st("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,n){if(!this.contentVisible)return;const s=this.getObject(t);if(!s)return void st("Dependent image isn't ready yet");const a=s.width,r=s.height,o=[];for(let l=0,c=n.length;l<c;l+=2)o.push({transform:[e,0,0,i,n[l],n[l+1]],x:0,y:0,w:a,h:r});this.paintInlineImageXObjectGroup(s,o)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const{bitmap:e,width:i,height:n}=t,s=this.cachedCanvases.getCanvas("inlineImage",i,n),a=s.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",s.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,i=t.height,n=this.ctx;if(this.save(),!a){const{filter:t}=n;"none"!==t&&""!==t&&(n.filter="none")}let s;if(n.scale(1/e,-1/i),t.bitmap)s=this.applyTransferMapsToBitmap(t);else if("function"===typeof HTMLElement&&t instanceof HTMLElement||!t.data)s=t;else{const n=this.cachedCanvases.getCanvas("inlineImage",e,i).context;Ze(n,t),s=this.applyTransferMapsToCanvas(n)}const r=this._scaleImage(s,le(n));n.imageSmoothingEnabled=ni(oe(n),t.interpolate),Qe(n,r.img,0,0,r.paintWidth,r.paintHeight,0,-i,e,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx;let n;if(t.bitmap)n=t.bitmap;else{const e=t.width,i=t.height,s=this.cachedCanvases.getCanvas("inlineImage",e,i).context;Ze(s,t),n=this.applyTransferMapsToCanvas(s)}for(const s of e)i.save(),i.transform(...s.transform),i.scale(1,-1),Qe(i,n,s.x,s.y,s.w,s.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const i=this.ctx;this.pendingClip&&(e||(this.pendingClip===oi?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=oe(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),n=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:n,d:s}=this.ctx.getTransform();let a,r;if(0===i&&0===n){const i=Math.abs(e),n=Math.abs(s);if(i===n)if(0===t)a=r=1/i;else{const e=i*t;a=r=e<1?1/e:1}else if(0===t)a=1/i,r=1/n;else{const e=i*t,s=n*t;a=e<1?1/e:1,r=s<1?1/s:1}}else{const o=Math.abs(e*s-i*n),l=Math.hypot(e,i),c=Math.hypot(n,s);if(0===t)a=c/o,r=l/o;else{const e=t*o;a=c>e?c/e:1,r=l>e?l/e:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:i}=this.current,[n,s]=this.getScaleForStroking();if(e.lineWidth=i||1,1===n&&1===s)return void e.stroke();const a=e.getLineDash();if(t&&e.save(),e.scale(n,s),a.length>0){const t=Math.max(n,s);e.setLineDash(a.map((e=>e/t))),e.lineDashOffset/=t}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(const Cs in J)void 0!==li.prototype[Cs]&&(li.prototype[J[Cs]]=li.prototype[Cs]);class ci{static#Le=null;static#Ie="";static get workerPort(){return this.#Le}static set workerPort(t){if(!("undefined"!==typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");this.#Le=t}static get workerSrc(){return this.#Ie}static set workerSrc(t){if("string"!==typeof t)throw new Error("Invalid `workerSrc` type.");this.#Ie=t}}const di=1,hi=2,pi=1,ui=2,mi=3,gi=4,fi=5,vi=6,bi=7,xi=8;function yi(t){switch(t instanceof Error||"object"===typeof t&&null!==t||at('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new ft(t.message);case"MissingPDFException":return new ut(t.message);case"PasswordException":return new dt(t.message,t.code);case"UnexpectedResponseException":return new mt(t.message,t.status);case"UnknownErrorException":return new ht(t.message,t.details);default:return new ht(t.message,t.toString())}}class wi{constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,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=t=>{const e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#Fe(e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===di)i.resolve(e.data);else{if(e.callback!==hi)throw new Error("Unexpected callback case");i.reject(yi(e.reason))}return}const n=this.actionHandler[e.action];if(!n)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const t=this.sourceName,s=e.sourceName;new Promise((function(t){t(n(e.data))})).then((function(n){i.postMessage({sourceName:t,targetName:s,callback:di,callbackId:e.callbackId,data:n})}),(function(n){i.postMessage({sourceName:t,targetName:s,callback:hi,callbackId:e.callbackId,reason:yi(n)})}))}else e.streamId?this.#Oe(e):n(e.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:n,data:e},i)}catch(a){s.reject(a)}return s.promise}sendWithStream(t,e,i,n){const s=this.streamId++,a=this.sourceName,r=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[s]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:a,targetName:r,action:t,streamId:s,data:e,desiredSize:i.desiredSize},n),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[s].pullCall=e,o.postMessage({sourceName:a,targetName:r,stream:vi,streamId:s,desiredSize:t.desiredSize}),e.promise},cancel:t=>{rt(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[s].cancelCall=e,this.streamControllers[s].isClosed=!0,o.postMessage({sourceName:a,targetName:r,stream:pi,streamId:s,reason:yi(t)}),e.promise}},i)}#Oe(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,a=this,r=this.actionHandler[t.action],o={enqueue(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=a,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:i,targetName:n,stream:gi,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:mi,streamId:e}),delete a.streamSinks[e])},error(t){rt(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:fi,streamId:e,reason:yi(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,new Promise((function(e){e(r(t.data,o))})).then((function(){s.postMessage({sourceName:i,targetName:n,stream:xi,streamId:e,success:!0})}),(function(t){s.postMessage({sourceName:i,targetName:n,stream:xi,streamId:e,reason:yi(t)})}))}#Fe(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,a=this.streamControllers[e],r=this.streamSinks[e];switch(t.stream){case xi:t.success?a.startCall.resolve():a.startCall.reject(yi(t.reason));break;case bi:t.success?a.pullCall.resolve():a.pullCall.reject(yi(t.reason));break;case vi:if(!r){s.postMessage({sourceName:i,targetName:n,stream:bi,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,new Promise((function(t){t(r.onPull?.())})).then((function(){s.postMessage({sourceName:i,targetName:n,stream:bi,streamId:e,success:!0})}),(function(t){s.postMessage({sourceName:i,targetName:n,stream:bi,streamId:e,reason:yi(t)})}));break;case gi:if(rt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case mi:if(rt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#Ne(a,e);break;case fi:rt(a,"error should have stream controller"),a.controller.error(yi(t.reason)),this.#Ne(a,e);break;case ui:t.success?a.cancelCall.resolve():a.cancelCall.reject(yi(t.reason)),this.#Ne(a,e);break;case pi:if(!r)break;new Promise((function(e){e(r.onCancel?.(yi(t.reason)))})).then((function(){s.postMessage({sourceName:i,targetName:n,stream:ui,streamId:e,success:!0})}),(function(t){s.postMessage({sourceName:i,targetName:n,stream:ui,streamId:e,reason:yi(t)})})),r.sinkCapability.reject(yi(t.reason)),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#Ne(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class Ai{#je;#ze;constructor(t){let{parsedData:e,rawData:i}=t;this.#je=e,this.#ze=i}getRaw(){return this.#ze}get(t){return this.#je.get(t)??null}getAll(){return xt(this.#je)}has(t){return this.#je.has(t)}}const _i=Symbol("INTERNAL");class Ei{#Be=!1;#He=!1;#$e=!1;#Ue=!0;constructor(t,e){let{name:i,intent:n,usage:s}=e;this.#Be=!!(t&d),this.#He=!!(t&h),this.name=i,this.intent=n,this.usage=s}get visible(){if(this.#$e)return this.#Ue;if(!this.#Ue)return!1;const{print:t,view:e}=this.usage;return this.#Be?"OFF"!==e?.viewState:!this.#He||"OFF"!==t?.printState}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==_i&&at("Internal method `_setVisible` called."),this.#$e=i,this.#Ue=e}}class Ci{#qe=null;#Ve=(()=>new Map)();#Ge=null;#We=null;constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;if(this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,this.#We=t.order;for(const i of t.groups)this.#Ve.set(i.id,new Ei(e,i));if("OFF"===t.baseState)for(const t of this.#Ve.values())t._setVisible(_i,!1);for(const e of t.on)this.#Ve.get(e)._setVisible(_i,!0);for(const e of t.off)this.#Ve.get(e)._setVisible(_i,!1);this.#Ge=this.getHash()}}#Ke(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let n=1;n<e;n++){const e=t[n];let s;if(Array.isArray(e))s=this.#Ke(e);else{if(!this.#Ve.has(e))return st(`Optional content group not found: ${e}`),!0;s=this.#Ve.get(e).visible}switch(i){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return"And"===i}isVisible(t){if(0===this.#Ve.size)return!0;if(!t)return nt("Optional content group not defined."),!0;if("OCG"===t.type)return this.#Ve.has(t.id)?this.#Ve.get(t.id).visible:(st(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#Ke(t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!this.#Ve.has(e))return st(`Optional content group not found: ${e}`),!0;if(this.#Ve.get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!this.#Ve.has(e))return st(`Optional content group not found: ${e}`),!0;if(!this.#Ve.get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!this.#Ve.has(e))return st(`Optional content group not found: ${e}`),!0;if(!this.#Ve.get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!this.#Ve.has(e))return st(`Optional content group not found: ${e}`),!0;if(this.#Ve.get(e).visible)return!1}return!0}return st(`Unknown optional content policy ${t.policy}.`),!0}return st(`Unknown group type ${t.type}.`),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this.#Ve.get(t);i?(i._setVisible(_i,!!e,!0),this.#qe=null):st(`Optional content group not found: ${t}`)}setOCGState(t){let e,{state:i,preserveRB:n}=t;for(const s of i){switch(s){case"ON":case"OFF":case"Toggle":e=s;continue}const t=this.#Ve.get(s);if(t)switch(e){case"ON":t._setVisible(_i,!0);break;case"OFF":t._setVisible(_i,!1);break;case"Toggle":t._setVisible(_i,!t.visible)}}this.#qe=null}get hasInitialVisibility(){return null===this.#Ge||this.getHash()===this.#Ge}getOrder(){return this.#Ve.size?this.#We?this.#We.slice():[...this.#Ve.keys()]:null}getGroups(){return this.#Ve.size>0?xt(this.#Ve):null}getGroup(t){return this.#Ve.get(t)||null}getHash(){if(null!==this.#qe)return this.#qe;const t=new Ce;for(const[e,i]of this.#Ve)t.update(`${e}:${i.visible}`);return this.#qe=t.hexdigest()}}class Si{constructor(t,e){let{disableRange:i=!1,disableStream:n=!1}=e;rt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:a,progressiveDone:r,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=o,a?.length>0){const t=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!i,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener(((t,e)=>{this._onReceiveData({begin:t,chunk:e})})),t.addProgressListener(((t,e)=>{this._onProgress({loaded:t,total:e})})),t.addProgressiveReadListener((t=>{this._onReceiveData({chunk:t})})),t.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),t.transportReady()}_onReceiveData(t){let{begin:e,chunk:i}=t;const n=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{rt(this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(n),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){void 0===t.total?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){rt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new ki(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Ti(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}}class ki{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=Yt(n)?n:null,this._queuedChunks=e||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Ti{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.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 t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Mi(t){let{getResponseHeader:e,isHttp:i,rangeChunkSize:n,disableRange:s}=t;const a={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e("Content-Length"),10);if(!Number.isInteger(r))return a;if(a.suggestedLength=r,r<=2*n)return a;if(s||!i)return a;if("bytes"!==e("Accept-Ranges"))return a;return"identity"!==(e("Content-Encoding")||"identity")||(a.allowRangeRequests=!0),a}function Pi(t){const e=t("Content-Disposition");if(e){let t=function(t){let e=!0,i=n("filename\\*","i").exec(t);if(i){i=i[1];let t=r(i);return t=unescape(t),t=o(t),t=l(t),a(t)}if(i=function(t){const e=[];let i;const s=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=s.exec(t));){let[,t,n,s]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[n,s]}const a=[];for(let n=0;n<e.length&&n in e;++n){let[t,i]=e[n];i=r(i),t&&(i=unescape(i),0===n&&(i=o(i))),a.push(i)}return a.join("")}(t),i)return a(l(i));if(i=n("filename","i").exec(t),i){i=i[1];let t=r(i);return t=l(t),a(t)}function n(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function s(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const n=new TextDecoder(t,{fatal:!0}),s=bt(i);i=n.decode(s),e=!1}catch{}}return i}function a(t){return e&&/[\x80-\xff]/.test(t)&&(t=s("utf-8",t),e&&(t=s("iso-8859-1",t))),t}function r(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){const e=t.indexOf("'");return-1===e?t:s(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,e,i,n){if("q"===i||"Q"===i)return s(e,n=(n=n.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})));try{n=atob(n)}catch{}return s(e,n)}))}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(Yt(t))return t}return null}function Ri(t,e){return 404===t||0===t&&e.startsWith("file:")?new ut('Missing PDF "'+e+'".'):new mt(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)}function Di(t){return 200===t||206===t}function Li(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Ii(t){const e=new Headers;for(const i in t){const n=t[i];void 0!==n&&e.append(i,n)}return e}function Fi(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(st(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class Oi{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return rt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Ni(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new ji(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class Ni{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._headers=Ii(this._stream.httpHeaders);const i=e.url;fetch(i,Li(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!Di(t.status))throw Ri(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();const e=e=>t.headers.get(e),{allowRangeRequests:n,suggestedLength:s}=Mi({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=s||this._contentLength,this._filename=Pi(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ft("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:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Fi(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class ji{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const n=t.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController,this._headers=Ii(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${i-1}`);const s=n.url;fetch(s,Li(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!Di(t.status))throw Ri(t.status,s);this._readCapability.resolve(),this._reader=t.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Fi(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class zi{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null),this.withCredentials=e.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,i){const n={begin:t,end:e};for(const s in i)n[s]=i[s];return this.request(n)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,n=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const s in this.httpHeaders){const t=this.httpHeaders[s];void 0!==t&&e.setRequestHeader(s,t)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(i){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=t.onHeadersReceived,n.onDone=t.onDone,n.onError=t.onError,n.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){const i=this.pendingRequests[t];i&&i.onProgress?.(e)}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const n=i.xhr;if(n.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==n.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===n.status&&this.isHttp)return void i.onError?.(n.status);const s=n.status||200;if(!(200===s&&206===i.expectedStatus)&&s!==i.expectedStatus)return void i.onError?.(n.status);const a=function(t){const e=t.response;return"string"!==typeof e?e:bt(e).buffer}(n);if(206===s){const t=n.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);i.onDone({begin:parseInt(e[1],10),chunk:a})}else a?i.onDone({begin:0,chunk:a}):i.onError?.(n.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class Bi{constructor(t){this._source=t,this._manager=new zi(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return rt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Hi(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new $i(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class Hi{constructor(t,e){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(i),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.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 t=this._fullRequestId,e=this._manager.getRequestXhr(t),i=t=>e.getResponseHeader(t),{allowRangeRequests:n,suggestedLength:s}=Mi({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=Pi(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=Ri(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class $i{constructor(t,e,i){this._manager=t;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,n),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=Ri(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Ui=/^file:\/\/\/[a-zA-Z]:\//;class qi{constructor(t){this.source=t,this.url=function(t){const e=Le.get("url"),i=e.parse(t);return"file:"===i.protocol||i.host?i:/^[a-z]:[/\\]/i.test(t)?e.parse(`file:///${t}`):(i.host||(i.protocol="file:"),i)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return rt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new Yi(this):new Ki(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=this.isFsUrl?new Qi(this,t,e):new Xi(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class Vi{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}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 t=this._readableStream.read();if(null===t)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(t).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",(()=>{this._readCapability.resolve()})),t.on("end",(()=>{t.destroy(),this._done=!0,this._readCapability.resolve()})),t.on("error",(t=>{this._error(t)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ft("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Gi{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.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 t=this._readableStream.read();if(null===t)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=t.length,this.onProgress?.({loaded:this._loaded});return{value:new Uint8Array(t).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",(()=>{this._readCapability.resolve()})),t.on("end",(()=>{t.destroy(),this._done=!0,this._readCapability.resolve()})),t.on("error",(t=>{this._error(t)})),this._storedError&&this._readableStream.destroy(this._storedError)}}function Wi(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class Ki extends Vi{constructor(t){super(t);const e=e=>{if(404===e.statusCode){const t=new ut(`Missing PDF "${this._url}".`);return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const i=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:n,suggestedLength:s}=Mi({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=s||this._contentLength,this._filename=Pi(i)};if(this._request=null,"http:"===this._url.protocol){const i=Le.get("http");this._request=i.request(Wi(this._url,t.httpHeaders),e)}else{const i=Le.get("https");this._request=i.request(Wi(this._url,t.httpHeaders),e)}this._request.on("error",(t=>{this._storedError=t,this._headersCapability.reject(t)})),this._request.end()}}class Xi extends Gi{constructor(t,e,i){super(t),this._httpHeaders={};for(const s in t.httpHeaders){const e=t.httpHeaders[s];void 0!==e&&(this._httpHeaders[s]=e)}this._httpHeaders.Range=`bytes=${e}-${i-1}`;const n=t=>{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new ut(`Missing PDF "${this._url}".`);this._storedError=t}};if(this._request=null,"http:"===this._url.protocol){const t=Le.get("http");this._request=t.request(Wi(this._url,this._httpHeaders),n)}else{const t=Le.get("https");this._request=t.request(Wi(this._url,this._httpHeaders),n)}this._request.on("error",(t=>{this._storedError=t})),this._request.end()}}class Yi extends Vi{constructor(t){super(t);let e=decodeURIComponent(this._url.path);Ui.test(this._url.href)&&(e=e.replace(/^\//,""));const i=Le.get("fs");i.promises.lstat(e).then((t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(e)),this._headersCapability.resolve()}),(t=>{"ENOENT"===t.code&&(t=new ut(`Missing PDF "${e}".`)),this._storedError=t,this._headersCapability.reject(t)}))}}class Qi extends Gi{constructor(t,e,i){super(t);let n=decodeURIComponent(this._url.path);Ui.test(this._url.href)&&(n=n.replace(/^\//,""));const s=Le.get("fs");this._setReadableStream(s.createReadStream(n,{start:e,end:i-1}))}}const Ji=30;class Zi{#Xe=(()=>Promise.withResolvers())();#ft=null;#Ye=!1;#Qe=(()=>!!globalThis.FontInspector?.enabled)();#Je=null;#Ze=null;#ti=0;#ei=0;#ii=null;#ni=null;#si=0;#ai=0;#ri=(()=>Object.create(null))();#oi=[];#li=null;#ci=[];#di=(()=>new WeakMap)();#hi=null;static#pi=(()=>new Map)();static#ui=(()=>new Map)();static#mi=null;static#gi=(()=>new Set)();constructor(t){let{textContentSource:e,container:i,viewport:n}=t;if(e instanceof ReadableStream)this.#li=e;else{if("object"!==typeof e)throw new Error('No "textContentSource" parameter specified.');this.#li=new ReadableStream({start(t){t.enqueue(e),t.close()}})}this.#ft=this.#ni=i,this.#ai=n.scale*(globalThis.devicePixelRatio||1),this.#si=n.rotation,this.#Ze={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null};const{pageWidth:s,pageHeight:a,pageX:r,pageY:o}=n.rawDims;this.#hi=[1,0,0,-1,-r,o+a],this.#ei=s,this.#ti=a,Zi.#fi(),ce(i,n),this.#Xe.promise.catch((()=>{})).then((()=>{Zi.#gi.delete(this),this.#Ze=null,this.#ri=null}))}render(){const t=()=>{this.#ii.read().then((e=>{let{value:i,done:n}=e;n?this.#Xe.resolve():(this.#Je??=i.lang,Object.assign(this.#ri,i.styles),this.#vi(i.items),t())}),this.#Xe.reject)};return this.#ii=this.#li.getReader(),Zi.#gi.add(this),t(),this.#Xe.promise}update(t){let{viewport:e,onBefore:i=null}=t;const n=e.scale*(globalThis.devicePixelRatio||1),s=e.rotation;if(s!==this.#si&&(i?.(),this.#si=s,ce(this.#ni,{rotation:s})),n!==this.#ai){i?.(),this.#ai=n;const t={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:Zi.#bi(this.#Je)};for(const e of this.#ci)t.properties=this.#di.get(e),t.div=e,this.#xi(t)}}cancel(){const t=new ft("TextLayer task cancelled.");this.#ii?.cancel(t).catch((()=>{})),this.#ii=null,this.#Xe.reject(t)}get textDivs(){return this.#ci}get textContentItemsStr(){return this.#oi}#vi(t){if(this.#Ye)return;this.#Ze.ctx??=Zi.#bi(this.#Je);const e=this.#ci,i=this.#oi;for(const n of t){if(e.length>1e5)return st("Ignoring additional textDivs for performance reasons."),void(this.#Ye=!0);if(void 0!==n.str)i.push(n.str),this.#yi(n);else if("beginMarkedContentProps"===n.type||"beginMarkedContent"===n.type){const t=this.#ft;this.#ft=document.createElement("span"),this.#ft.classList.add("markedContent"),null!==n.id&&this.#ft.setAttribute("id",`${n.id}`),t.append(this.#ft)}else"endMarkedContent"===n.type&&(this.#ft=this.#ft.parentNode)}}#yi(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#ci.push(e);const n=At.transform(this.#hi,t.transform);let s=Math.atan2(n[1],n[0]);const a=this.#ri[t.fontName];a.vertical&&(s+=Math.PI/2);const r=this.#Qe&&a.fontSubstitution||a.fontFamily,o=Math.hypot(n[2],n[3]),l=o*Zi.#wi(r,this.#Je);let c,d;0===s?(c=n[4],d=n[5]-l):(c=n[4]+l*Math.sin(s),d=n[5]-l*Math.cos(s));const h="calc(var(--scale-factor)*",p=e.style;this.#ft===this.#ni?(p.left=`${(100*c/this.#ei).toFixed(2)}%`,p.top=`${(100*d/this.#ti).toFixed(2)}%`):(p.left=`${h}${c.toFixed(2)}px)`,p.top=`${h}${d.toFixed(2)}px)`),p.fontSize=`${h}${(Zi.#mi*o).toFixed(2)}px)`,p.fontFamily=r,i.fontSize=o,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#Qe&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),0!==s&&(i.angle=s*(180/Math.PI));let u=!1;if(t.str.length>1)u=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(u=!0)}if(u&&(i.canvasWidth=a.vertical?t.height:t.width),this.#di.set(e,i),this.#Ze.div=e,this.#Ze.properties=i,this.#xi(this.#Ze),i.hasText&&this.#ft.append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),this.#ft.append(t)}}#xi(t){const{div:e,properties:i,ctx:n,prevFontSize:s,prevFontFamily:a}=t,{style:r}=e;let o="";if(Zi.#mi>1&&(o=`scale(${1/Zi.#mi})`),0!==i.canvasWidth&&i.hasText){const{fontFamily:l}=r,{canvasWidth:c,fontSize:d}=i;s===d&&a===l||(n.font=`${d*this.#ai}px ${l}`,t.prevFontSize=d,t.prevFontFamily=l);const{width:h}=n.measureText(e.textContent);h>0&&(o=`scaleX(${c*this.#ai/h}) ${o}`)}0!==i.angle&&(o=`rotate(${i.angle}deg) ${o}`),o.length>0&&(r.transform=o)}static cleanup(){if(!(this.#gi.size>0)){this.#pi.clear();for(const{canvas:t}of this.#ui.values())t.remove();this.#ui.clear()}}static#bi(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.#ui.get(t||="");if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#ui.set(t,e)}return e}static#fi(){if(null!==this.#mi)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.textContent="X",document.body.append(t),this.#mi=t.getBoundingClientRect().height,t.remove()}static#wi(t,e){const i=this.#pi.get(t);if(i)return i;const n=this.#bi(e),s=n.font;n.canvas.width=n.canvas.height=Ji,n.font=`30px ${t}`;const a=n.measureText("");let r=a.fontBoundingBoxAscent,o=Math.abs(a.fontBoundingBoxDescent);if(r){const e=r/(r+o);return this.#pi.set(t,e),n.canvas.width=n.canvas.height=0,n.font=s,e}n.strokeStyle="red",n.clearRect(0,0,Ji,Ji),n.strokeText("g",0,0);let l=n.getImageData(0,0,Ji,Ji).data;o=0;for(let d=l.length-1-3;d>=0;d-=4)if(l[d]>0){o=Math.ceil(d/4/Ji);break}n.clearRect(0,0,Ji,Ji),n.strokeText("A",0,Ji),l=n.getImageData(0,0,Ji,Ji).data,r=0;for(let d=0,h=l.length;d<h;d+=4)if(l[d]>0){r=Ji-Math.floor(d/4/Ji);break}n.canvas.width=n.canvas.height=0,n.font=s;const c=r?r/(r+o):.8;return this.#pi.set(t,c),c}}function tn(){ie("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:t,container:e,viewport:i,...n}=arguments[0],s=Object.keys(n);s.length>0&&st("Ignoring `renderTextLayer` parameters: "+s.join(", "));const a=new Zi({textContentSource:t,container:e,viewport:i}),{textDivs:r,textContentItemsStr:o}=a;return{promise:a.render(),textDivs:r,textContentItemsStr:o}}function en(){ie("`updateTextLayer`, please use `TextLayer` instead.")}class nn{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){if(!i)return;let n=null;const s=i.name;if("#text"===s)n=i.value;else{if(!nn.shouldBuildText(s))return;i?.attributes?.textContent?n=i.attributes.textContent:i.value&&(n=i.value)}if(null!==n&&e.push({str:n}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}const sn=65536,an=a?class extends Nt{_createCanvas(t,e){return Le.get("canvas").createCanvas(t,e)}}:class extends Nt{constructor(){let{ownerDocument:t=globalThis.document,enableHWA:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({enableHWA:e}),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},rn=a?class extends jt{_fetchData(t,e){return Ie(t).then((t=>({cMapData:t,compressionType:e})))}}:qt,on=a?class extends Ot{}:class extends Ot{#Ai;#_i;#Ei;#Ci;#Si;#v=0;constructor(){let{docId:t,ownerDocument:e=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.#Ei=t,this.#Ci=e}get#x(){return this.#Ai||=new Map}get#ki(){return this.#Si||=new Map}get#Ti(){if(!this.#_i){const t=this.#Ci.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;const i=this.#Ci.createElementNS(Ht,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#_i=this.#Ci.createElementNS(Ht,"defs"),t.append(i),i.append(this.#_i),this.#Ci.body.append(t)}return this.#_i}#Mi(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const n=i.join(",");return[n,n,n]}const[e,i,n]=t,s=new Array(256),a=new Array(256),r=new Array(256);for(let o=0;o<256;o++)s[o]=e[o]/255,a[o]=i[o]/255,r[o]=n[o]/255;return[s.join(","),a.join(","),r.join(",")]}addFilter(t){if(!t)return"none";let e=this.#x.get(t);if(e)return e;const[i,n,s]=this.#Mi(t),a=1===t.length?i:`${i}${n}${s}`;if(e=this.#x.get(a),e)return this.#x.set(t,e),e;const r=`g_${this.#Ei}_transfer_map_${this.#v++}`,o=`url(#${r})`;this.#x.set(t,o),this.#x.set(a,o);const l=this.#Pi(r);return this.#Ri(i,n,s,l),o}addHCMFilter(t,e){const i=`${t}-${e}`,n="base";let s=this.#ki.get(n);if(s?.key===i)return s.url;if(s?(s.filter?.remove(),s.key=i,s.url="none",s.filter=null):(s={key:i,url:"none",filter:null},this.#ki.set(n,s)),!t||!e)return s.url;const a=this.#Di(t);t=At.makeHexColor(...a);const r=this.#Di(e);if(e=At.makeHexColor(...r),this.#Ti.style.color="","#000000"===t&&"#ffffff"===e||t===e)return s.url;const o=new Array(256);for(let p=0;p<=255;p++){const t=p/255;o[p]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=o.join(","),c=`g_${this.#Ei}_hcm_filter`,d=s.filter=this.#Pi(c);this.#Ri(l,l,l,d),this.#Li(d);const h=(t,e)=>{const i=a[t]/255,n=r[t]/255,s=new Array(e+1);for(let a=0;a<=e;a++)s[a]=i+a/e*(n-i);return s.join(",")};return this.#Ri(h(0,5),h(1,5),h(2,5),d),s.url=`url(#${c})`,s.url}addAlphaFilter(t){let e=this.#x.get(t);if(e)return e;const[i]=this.#Mi([t]),n=`alpha_${i}`;if(e=this.#x.get(n),e)return this.#x.set(t,e),e;const s=`g_${this.#Ei}_alpha_map_${this.#v++}`,a=`url(#${s})`;this.#x.set(t,a),this.#x.set(n,a);const r=this.#Pi(s);return this.#Ii(i,r),a}addLuminosityFilter(t){let e,i,n=this.#x.get(t||"luminosity");if(n)return n;if(t?([e]=this.#Mi([t]),i=`luminosity_${e}`):i="luminosity",n=this.#x.get(i),n)return this.#x.set(t,n),n;const s=`g_${this.#Ei}_luminosity_map_${this.#v++}`,a=`url(#${s})`;this.#x.set(t,a),this.#x.set(i,a);const r=this.#Pi(s);return this.#Fi(r),t&&this.#Ii(e,r),a}addHighlightHCMFilter(t,e,i,n,s){const a=`${e}-${i}-${n}-${s}`;let r=this.#ki.get(t);if(r?.key===a)return r.url;if(r?(r.filter?.remove(),r.key=a,r.url="none",r.filter=null):(r={key:a,url:"none",filter:null},this.#ki.set(t,r)),!e||!i)return r.url;const[o,l]=[e,i].map(this.#Di.bind(this));let c=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[h,p]=[n,s].map(this.#Di.bind(this));d<c&&([c,d,h,p]=[d,c,p,h]),this.#Ti.style.color="";const u=(t,e,i)=>{const n=new Array(256),s=(d-c)/i,a=t/255,r=(e-t)/(255*i);let o=0;for(let l=0;l<=i;l++){const t=Math.round(c+l*s),e=a+l*r;for(let i=o;i<=t;i++)n[i]=e;o=t+1}for(let l=o;l<256;l++)n[l]=n[o-1];return n.join(",")},m=`g_${this.#Ei}_hcm_${t}_filter`,g=r.filter=this.#Pi(m);return this.#Li(g),this.#Ri(u(h[0],p[0],5),u(h[1],p[1],5),u(h[2],p[2],5),g),r.url=`url(#${m})`,r.url}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&0!==this.#ki.size||(this.#_i&&(this.#_i.parentNode.parentNode.remove(),this.#_i=null),this.#Ai&&(this.#Ai.clear(),this.#Ai=null),this.#v=0)}#Fi(t){const e=this.#Ci.createElementNS(Ht,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}#Li(t){const e=this.#Ci.createElementNS(Ht,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}#Pi(t){const e=this.#Ci.createElementNS(Ht,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#Ti.append(e),e}#Oi(t,e,i){const n=this.#Ci.createElementNS(Ht,e);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)}#Ri(t,e,i,n){const s=this.#Ci.createElementNS(Ht,"feComponentTransfer");n.append(s),this.#Oi(s,"feFuncR",t),this.#Oi(s,"feFuncG",e),this.#Oi(s,"feFuncB",i)}#Ii(t,e){const i=this.#Ci.createElementNS(Ht,"feComponentTransfer");e.append(i),this.#Oi(i,"feFuncA",t)}#Di(t){return this.#Ti.style.color=t,re(getComputedStyle(this.#Ti).getPropertyValue("color"))}},ln=a?class extends zt{_fetchData(t){return Ie(t)}}:Vt;function cn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"===typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new hn,{docId:i}=e,n=t.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(a&&"string"===typeof t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,s=t.data?function(t){if(a&&"undefined"!==typeof Buffer&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"===typeof t)return bt(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"===typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(t.data):null,r=t.httpHeaders||null,o=!0===t.withCredentials,l=t.password??null,c=t.range instanceof pn?t.range:null,d=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:sn;let h=t.worker instanceof vn?t.worker:null;const p=t.verbosity,u="string"!==typeof t.docBaseUrl||Xt(t.docBaseUrl)?null:t.docBaseUrl,m="string"===typeof t.cMapUrl?t.cMapUrl:null,g=!1!==t.cMapPacked,f=t.CMapReaderFactory||rn,v="string"===typeof t.standardFontDataUrl?t.standardFontDataUrl:null,b=t.StandardFontDataFactory||ln,x=!0!==t.stopAtErrors,y=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,w=!1!==t.isEvalSupported,A="boolean"===typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!a,_=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,E="boolean"===typeof t.disableFontFace?t.disableFontFace:a,C=!0===t.fontExtraProperties,S=!0===t.enableXfa,k=t.ownerDocument||globalThis.document,T=!0===t.disableRange,M=!0===t.disableStream,P=!0===t.disableAutoFetch,R=!0===t.pdfBug,D=!0===t.enableHWA,L=c?c.length:t.length??NaN,I="boolean"===typeof t.useSystemFonts?t.useSystemFonts:!a&&!E,F="boolean"===typeof t.useWorkerFetch?t.useWorkerFetch:f===qt&&b===Vt&&m&&v&&te(m,document.baseURI)&&te(v,document.baseURI),O=t.canvasFactory||new an({ownerDocument:k,enableHWA:D}),N=t.filterFactory||new on({docId:i,ownerDocument:k});et(p);const j={canvasFactory:O,filterFactory:N};if(F||(j.cMapReaderFactory=new f({baseUrl:m,isCompressed:g}),j.standardFontDataFactory=new b({baseUrl:v})),!h){const t={verbosity:p,port:ci.workerPort};h=t.port?vn.fromPort(t):new vn(t),e._worker=h}const z={docId:i,apiVersion:"4.4.168",data:s,password:l,disableAutoFetch:P,rangeChunkSize:d,length:L,docBaseUrl:u,enableXfa:S,evaluatorOptions:{maxImageSize:y,disableFontFace:E,ignoreErrors:x,isEvalSupported:w,isOffscreenCanvasSupported:A,canvasMaxAreaInBytes:_,fontExtraProperties:C,useSystemFonts:I,cMapUrl:F?m:null,standardFontDataUrl:F?v:null}},B={disableFontFace:E,fontExtraProperties:C,ownerDocument:k,pdfBug:R,styleElement:null,loadingParams:{disableAutoFetch:P,enableXfa:S}};return h.promise.then((function(){if(e.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const t=h.messageHandler.sendWithPromise("GetDocRequest",z,s?[s.buffer]:null);let l;if(c)l=new Si(c,{disableRange:T,disableStream:M});else if(!s){if(!n)throw new Error("getDocument - no `url` parameter provided.");l=(t=>{if(a){return function(){return"undefined"!==typeof fetch&&"undefined"!==typeof Response&&"body"in Response.prototype}()&&te(t.url)?new Oi(t):new qi(t)}return te(t.url)?new Oi(t):new Bi(t)})({url:n,length:L,httpHeaders:r,withCredentials:o,rangeChunkSize:d,disableRange:T,disableStream:M})}return t.then((t=>{if(e.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const n=new wi(i,t,h.port),s=new bn(n,e,l,B,j);e._transport=s,n.send("Ready",null)}))})).catch(e._capability.reject),e}function dn(t){return"object"===typeof t&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0}class hn{static#Ei=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+hn.#Ei++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await(this._transport?.destroy())}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}class pn{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}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,e){for(const i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(t,e)}))}onDataProgressiveRead(t){this._readyCapability.promise.then((()=>{for(const e of this._progressiveReadListeners)e(t)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const t of this._progressiveDoneListeners)t()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){at("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class un{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return lt(this,"isPureXfa",!!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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class mn{#Ni=null;#ji=!1;constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=n?new Zt:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new yn,this._maybeCleanupAfterRender=!1,this._intentStates=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(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Wt({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return lt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render(t){let{canvasContext:e,viewport:i,intent:n="display",annotationMode:s=f.ENABLE,transform:a=null,background:r=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:c=null,printAnnotationStorage:d=null}=t;this._stats?.time("Overall");const p=this._transport.getRenderingIntent(n,s,d),{renderingIntent:u,cacheKey:m}=p;this.#ji=!1,this.#zi(),o||=this._transport.getOptionalContentConfig(u);let g=this._intentStates.get(m);g||(g=Object.create(null),this._intentStates.set(m,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const v=!!(u&h);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(p));const b=t=>{g.renderTasks.delete(x),(this._maybeCleanupAfterRender||v)&&(this.#ji=!0),this.#Bi(!v),t?(x.capability.reject(t),this._abortOperatorList({intentState:g,reason:t instanceof Error?t:new Error(t)})):x.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},x=new An({callback:b,params:{canvasContext:e,viewport:i,transform:a,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!v,pdfBug:this._pdfBug,pageColors:c});(g.renderTasks||=new Set).add(x);const y=x.task;return Promise.all([g.displayReadyCapability.promise,o]).then((t=>{let[e,i]=t;if(this.destroyed)b();else{if(this._stats?.time("Rendering"),!(i.renderingIntent&u))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:e,optionalContentConfig:i}),x.operatorListChanged()}})).catch(b),y}getOperatorList(){let{intent:t="display",annotationMode:e=f.ENABLE,printAnnotationStorage:i=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this._transport.getRenderingIntent(t,e,i,!0);let s,a=this._intentStates.get(n.cacheKey);return a||(a=Object.create(null),this._intentStates.set(n.cacheKey,a)),a.opListReadCapability||(s=Object.create(null),s.operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(s))},a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(s),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),a.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((t=>nn.textContent(t)));const e=this.streamTextContent(t);return new Promise((function(t,i){const n=e.getReader(),s={items:[],styles:Object.create(null),lang:null};!function e(){n.read().then((function(i){let{value:n,done:a}=i;a?t(s):(s.lang??=n.lang,Object.assign(s.styles,n.styles),s.items.push(...n.items),e())}),i)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#ji=!1,this.#zi(),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#ji=!0;const e=this.#Bi(!1);return t&&e&&(this._stats&&=new Zt),e}#Bi(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.#zi(),!this.#ji||this.destroyed)return!1;if(t)return this.#Ni=setTimeout((()=>{this.#Ni=null,this.#Bi(!1)}),5e3),!1;for(const{renderTasks:e,operatorList:i}of this._intentStates.values())if(e.size>0||!i.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#ji=!1,!0}#zi(){this.#Ni&&(clearTimeout(this.#Ni),this.#Ni=null)}_startRenderPage(t,e){const i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i<n;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&this.#Bi(!0)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:n}=t;const{map:s,transfer:a}=n,r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:s},a).getReader(),o=this._intentStates.get(i);o.streamReader=r;const l=()=>{r.read().then((t=>{let{value:e,done:i}=t;i?o.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,o),l())}),(t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(const t of o.renderTasks)t.operatorListChanged();this.#Bi(!0)}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else{if(!o.opListReadCapability)throw t;o.opListReadCapability.reject(t)}}}))};l()}_abortOperatorList(t){let{intentState:e,reason:i,force:n=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(i instanceof Kt){let t=100;return i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})}),t))}}if(e.streamReader.cancel(new ft(i.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}class gn{#Hi=(()=>new Set)();#$i=(()=>Promise.resolve())();postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};this.#$i.then((()=>{for(const t of this.#Hi)t.call(this,i)}))}addEventListener(t,e){this.#Hi.add(e)}removeEventListener(t,e){this.#Hi.delete(e)}terminate(){this.#Hi.clear()}}const fn={isWorkerDisabled:!1,fakeWorkerId:0};a&&(fn.isWorkerDisabled=!0,ci.workerSrc||="./pdf.worker.mjs"),fn.isSameOrigin=function(t,e){let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch{return!1}const n=new URL(e,i);return i.origin===n.origin},fn.createCDNWrapper=function(t){const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};class vn{static#Ui;constructor(){let{name:t=null,port:e=null,verbosity:i=it()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if(vn.#Ui?.has(e))throw new Error("Cannot use more than one PDFWorker per port.");return(vn.#Ui||=new WeakMap).set(e,this),void this._initializeFromPort(e)}this._initialize()}get promise(){return a?Promise.all([Le.promise,this._readyCapability.promise]):this._readyCapability.promise}#qi(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new wi("main","worker",t),this._messageHandler.on("ready",(function(){})),this.#qi()}_initialize(){if(fn.isWorkerDisabled||vn.#Vi)return void this._setupFakeWorker();let{workerSrc:t}=vn;try{fn.isSameOrigin(window.location.href,t)||(t=fn.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new wi("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=new AbortController;e.addEventListener("error",(()=>{this._webWorker||n()}),{signal:s.signal}),i.on("test",(t=>{s.abort(),!this.destroyed&&t?(this._messageHandler=i,this._port=e,this._webWorker=e,this.#qi()):n()})),i.on("ready",(t=>{if(s.abort(),this.destroyed)n();else try{a()}catch{this._setupFakeWorker()}}));const a=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void a()}catch{nt("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){fn.isWorkerDisabled||(st("Setting up fake worker."),fn.isWorkerDisabled=!0),vn._setupFakeWorkerGlobal.then((t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new gn;this._port=e;const i="fake"+fn.fakeWorkerId++,n=new wi(i+"_worker",i,e);t.setup(n,e),this._messageHandler=new wi(i,i+"_worker",e),this.#qi()})).catch((t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),vn.#Ui?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const e=this.#Ui?.get(t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new vn(t)}static get workerSrc(){if(ci.workerSrc)return ci.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#Vi(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return lt(this,"_setupFakeWorkerGlobal",(async()=>{if(this.#Vi)return this.#Vi;return(await import(this.workerSrc)).WorkerMessageHandler})())}}class bn{#Gi=(()=>new Map)();#Wi=(()=>new Map)();#Ki=(()=>new Map)();#Xi=(()=>new Map)();#Yi=null;constructor(t,e,i,n,s){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new yn,this.fontLoader=new Me({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#Qi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.#Gi.get(t);if(i)return i;const n=this.messageHandler.sendWithPromise(t,e);return this.#Gi.set(t,n),n}get annotationStorage(){return lt(this,"annotationStorage",new ke)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=d,a=Se;switch(t){case"any":s=c;break;case"display":break;case"print":s=h;break;default:st(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case f.DISABLE:s+=m;break;case f.ENABLE:break;case f.ENABLE_FORMS:s+=p;break;case f.ENABLE_STORAGE:s+=u;a=(s&h&&i instanceof Te?i:this.annotationStorage).serializable;break;default:st(`getRenderingIntent - invalid annotationMode: ${e}`)}return n&&(s+=g),{renderingIntent:s,cacheKey:`${s}_${a.hash}`,annotationStorageSerializable:a}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#Yi?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of this.#Wi.values())t.push(i._destroy());this.#Wi.clear(),this.#Ki.clear(),this.#Xi.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#Gi.clear(),this.filterFactory.destroy(),Zi.cleanup(),this._networkStream?.cancelAllRequests(new ft("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:e}=this;t.on("GetReader",((t,e)=>{rt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then((function(t){let{value:i,done:n}=t;n?e.close():(rt(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}})),t.on("ReaderHeadersReady",(t=>{const i=Promise.withResolvers(),n=this._fullReader;return n.headersReady.then((()=>{n.isStreamingSupported&&n.isRangeSupported||(this._lastProgress&&e.onProgress?.(this._lastProgress),n.onProgress=t=>{e.onProgress?.({loaded:t.loaded,total:t.total})}),i.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})}),i.reject),i.promise})),t.on("GetRangeReader",((t,e)=>{rt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then((function(t){let{value:i,done:n}=t;n?e.close():(rt(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{i.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}):e.close()})),t.on("GetDoc",(t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new un(i,this))})),t.on("DocException",(function(t){let i;switch(t.name){case"PasswordException":i=new dt(t.message,t.code);break;case"InvalidPDFException":i=new pt(t.message);break;case"MissingPDFException":i=new ut(t.message);break;case"UnexpectedResponseException":i=new mt(t.message,t.status);break;case"UnknownErrorException":i=new ht(t.message,t.details);break;default:at("DocException - expected a valid Error.")}e._capability.reject(i)})),t.on("PasswordRequest",(t=>{if(this.#Yi=Promise.withResolvers(),e.onPassword){const n=t=>{t instanceof Error?this.#Yi.reject(t):this.#Yi.resolve({password:t})};try{e.onPassword(n,t.code)}catch(i){this.#Yi.reject(i)}}else this.#Yi.reject(new dt(t.message,t.code));return this.#Yi.promise})),t.on("DataLoaded",(t=>{e.onProgress?.({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)})),t.on("StartRenderPage",(t=>{if(this.destroyed)return;this.#Wi.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)})),t.on("commonobj",(e=>{let[i,n,s]=e;if(this.destroyed)return null;if(this.commonObjs.has(i))return null;switch(n){case"Font":const{disableFontFace:e,fontExtraProperties:a,pdfBug:r}=this._params;if("error"in s){const t=s.error;st(`Error during font loading: ${t}`),this.commonObjs.resolve(i,t);break}const o=r&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,l=new Pe(s,{disableFontFace:e,inspectFont:o});this.fontLoader.bind(l).catch((()=>t.sendWithPromise("FontFallback",{id:i}))).finally((()=>{!a&&l.data&&(l.data=null),this.commonObjs.resolve(i,l)}));break;case"CopyLocalImage":const{imageRef:c}=s;rt(c,"The imageRef must be defined.");for(const t of this.#Wi.values())for(const[,e]of t.objs)if(e?.ref===c)return e.dataLen?(this.commonObjs.resolve(i,structuredClone(e)),e.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,s);break;default:throw new Error(`Got unknown common object type ${n}`)}return null})),t.on("obj",(t=>{let[e,i,n,s]=t;if(this.destroyed)return;const a=this.#Wi.get(i);if(!a.objs.has(e))if(0!==a._intentStates.size)switch(n){case"Image":a.objs.resolve(e,s),s?.dataLen>1e7&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(e,s);break;default:throw new Error(`Got unknown object type ${n}`)}else s?.bitmap?.close()})),t.on("DocProgress",(t=>{this.destroyed||e.onProgress?.({loaded:t.loaded,total:t.total})})),t.on("FetchBuiltInCMap",(t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(t):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.")))),t.on("FetchStandardFontData",(t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(t):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&st("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally((()=>{this.annotationStorage.resetModified()}))}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=this.#Ki.get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&this.#Xi.set(i.refStr,t);const n=new mn(e,i,this,this._params.pdfBug);return this.#Wi.set(e,n),n}));return this.#Ki.set(e,n),n}getPageIndex(t){return dn(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#Qi("GetFieldObjects")}hasJSActions(){return this.#Qi("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!==typeof t?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)}getDocJSActions(){return this.#Qi("GetDocJSActions")}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(t){return this.#Qi("GetOptionalContentConfig").then((e=>new Ci(e,t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=this.#Gi.get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then((t=>({info:t[0],metadata:t[1]?new Ai(t[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#Gi.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of this.#Wi.values()){if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`)}this.commonObjs.clear(),t||this.fontLoader.clear(),this.#Gi.clear(),this.filterFactory.destroy(!0),Zi.cleanup()}}cachedPageNumber(t){if(!dn(t))return null;const e=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;return this.#Xi.get(e)??null}}const xn=Symbol("INITIAL_DATA");class yn{#Ji=(()=>Object.create(null))();#Zi(t){return this.#Ji[t]||={...Promise.withResolvers(),data:xn}}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=this.#Zi(t);return i.promise.then((()=>e(i.data))),null}const i=this.#Ji[t];if(!i||i.data===xn)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const e=this.#Ji[t];return!!e&&e.data!==xn}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.#Zi(t);i.data=e,i.resolve()}clear(){for(const t in this.#Ji){const{data:e}=this.#Ji[t];e?.bitmap?.close()}this.#Ji=Object.create(null)}*[Symbol.iterator](){for(const t in this.#Ji){const{data:e}=this.#Ji[t];e!==xn&&(yield[t,e])}}}class wn{#tn=null;constructor(t){this.#tn=t,this.onContinue=null}get promise(){return this.#tn.capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.#tn.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#tn.operatorList;if(!t)return!1;const{annotationCanvasMap:e}=this.#tn;return t.form||t.canvas&&e?.size>0}}class An{#en=null;static#in=(()=>new WeakSet)();constructor(t){let{callback:e,params:i,objs:n,commonObjs:s,annotationCanvasMap:a,operatorList:r,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:p=null}=t;this.callback=e,this.params=i,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=h,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===d&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new wn(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=i.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics(t){let{transparency:e=!1,optionalContentConfig:i}=t;if(this.cancelled)return;if(this._canvas){if(An.#in.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.");An.#in.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:s,transform:a,background:r}=this.params;this.gfx=new li(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:a,viewport:s,transparency:e,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#en&&(window.cancelAnimationFrame(this.#en),this.#en=null),An.#in.delete(this._canvas),this.callback(t||new Kt(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#en=window.requestAnimationFrame((()=>{this.#en=null,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(),An.#in.delete(this._canvas),this.callback())))}}const _n="4.4.168",En="19fbc8998";function Cn(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function Sn(t){return Math.max(0,Math.min(255,255*t))}class kn{static CMYK_G(t){let[e,i,n,s]=t;return["G",1-Math.min(1,.3*e+.59*n+.11*i+s)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return e=Sn(e),[e,e,e]}static G_HTML(t){let[e]=t;const i=Cn(e);return`#${i}${i}${i}`}static RGB_G(t){let[e,i,n]=t;return["G",.3*e+.59*i+.11*n]}static RGB_rgb(t){return t.map(Sn)}static RGB_HTML(t){return`#${t.map(Cn).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,n,s]=t;return["RGB",1-Math.min(1,e+s),1-Math.min(1,n+s),1-Math.min(1,i+s)]}static CMYK_rgb(t){let[e,i,n,s]=t;return[Sn(1-Math.min(1,e+s)),Sn(1-Math.min(1,n+s)),Sn(1-Math.min(1,i+s))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,n]=t;const s=1-e,a=1-i,r=1-n;return["CMYK",s,a,r,Math.min(s,a,r)]}}class Tn{static setupStorage(t,e,i,n,s){const a=n.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==a.value&&(t.textContent=a.value),"print"===s)break;t.addEventListener("input",(t=>{n.setValue(e,{value:t.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(a.value===i.attributes.xfaOn?t.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===s)break;t.addEventListener("change",(t=>{n.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})}))}else{if(null!==a.value&&t.setAttribute("value",a.value),"print"===s)break;t.addEventListener("input",(t=>{n.setValue(e,{value:t.target.value})}))}break;case"select":if(null!==a.value){t.setAttribute("value",a.value);for(const t of i.children)t.attributes.value===a.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",(t=>{const i=t.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(e,{value:s})}))}}static setAttributes(t){let{html:e,element:i,storage:n=null,intent:s,linkService:a}=t;const{attributes:r}=i,o=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${s}`);for(const[l,c]of Object.entries(r))if(null!==c&&void 0!==c)switch(l){case"class":c.length&&e.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!o||"href"!==l&&"newWindow"!==l)&&e.setAttribute(l,c)}o&&a.addLinkAttributes(e,r.href,r.newWindow),n&&r.dataId&&this.setupStorage(e,r.dataId,i,n)}static render(t){const e=t.annotationStorage,i=t.linkService,n=t.xfaHtml,s=t.intent||"display",a=document.createElement(n.name);n.attributes&&this.setAttributes({html:a,element:n,intent:s,linkService:i});const r="richText"!==s,o=t.div;if(o.append(a),t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;o.style.transform=e}r&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===n.children.length){if(n.value){const t=document.createTextNode(n.value);a.append(t),r&&nn.shouldBuildText(n.name)&&l.push(t)}return{textDivs:l}}const c=[[n,-1,a]];for(;c.length>0;){const[t,n,a]=c.at(-1);if(n+1===t.children.length){c.pop();continue}const o=t.children[++c.at(-1)[1]];if(null===o)continue;const{name:d}=o;if("#text"===d){const t=document.createTextNode(o.value);l.push(t),a.append(t);continue}const h=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,d):document.createElement(d);if(a.append(h),o.attributes&&this.setAttributes({html:h,element:o,storage:e,intent:s,linkService:i}),o.children?.length>0)c.push([o,-1,h]);else if(o.value){const t=document.createTextNode(o.value);r&&nn.shouldBuildText(d)&&l.push(t),h.append(t)}}for(const d of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))d.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const Mn=1e3,Pn=new WeakSet;function Rn(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class Dn{static create(t){switch(t.data.annotationType){case T:return new In(t);case k:return new Fn(t);case q:switch(t.data.fieldType){case"Tx":return new Nn(t);case"Btn":return t.data.radioButton?new Bn(t):t.data.checkBox?new zn(t):new Hn(t);case"Ch":return new $n(t);case"Sig":return new jn(t)}return new On(t);case $:return new Un(t);case M:return new Vn(t);case P:return new Gn(t);case R:return new Wn(t);case D:return new Kn(t);case I:return new Xn(t);case B:return new Qn(t);case H:return new Jn(t);case L:return new Yn(t);case F:return new Zn(t);case O:return new ts(t);case N:return new es(t);case j:return new is(t);case z:return new ns(t);case U:return new ss(t);default:return new Ln(t)}}}class Ln{#nn=null;#sn=!1;#an=null;constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData(t){let{titleObj:e,contentsObj:i,richText:n}=t;return!!(e?.str||i?.str||n?.str)}get hasPopupData(){return Ln._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#nn||={rect:this.data.rect.slice(0)};const{rect:e}=t;e&&this.#rn(e),this.#an?.popup.updateEdited(t)}resetEdited(){this.#nn&&(this.#rn(this.#nn.rect),this.#an?.popup.resetEdited(),this.#nn=null)}#rn(t){const{container:{style:e},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:a,pageX:r,pageY:o}}}}=this;i?.splice(0,4,...t);const{width:l,height:c}=Rn(t);e.left=100*(t[0]-r)/s+"%",e.top=100*(a-t[3]+o)/a+"%",0===n?(e.width=100*l/s+"%",e.height=100*c/a+"%"):this.setRotation(n)}_createContainer(t){const{data:e,parent:{page:i,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),this instanceof On||(s.tabIndex=Mn);const{style:a}=s;if(a.zIndex=this.parent.zIndex++,e.popupRef&&s.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof Un){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,s),s}const{width:r,height:o}=Rn(e.rect);if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e=`calc(${t}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;a.borderRadius=e}else if(this instanceof Bn){const t=`calc(${r}px * var(--scale-factor)) / calc(${o}px * var(--scale-factor))`;a.borderRadius=t}switch(e.borderStyle.style){case V:a.borderStyle="solid";break;case G:a.borderStyle="dashed";break;case W:st("Unimplemented border style: beveled");break;case K:st("Unimplemented border style: inset");break;case X:a.borderBottomStyle="solid"}const n=e.borderColor||null;n?(this.#sn=!0,a.borderColor=At.makeHexColor(0|n[0],0|n[1],0|n[2])):a.borderWidth=0}const l=At.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:c,pageHeight:d,pageX:h,pageY:p}=n.rawDims;a.left=100*(l[0]-h)/c+"%",a.top=100*(l[1]-p)/d+"%";const{rotation:u}=e;return e.hasOwnCanvas||0===u?(a.width=100*r/c+"%",a.height=100*o/d+"%"):this.setRotation(u,s),s}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims,{width:s,height:a}=Rn(this.data.rect);let r,o;t%180===0?(r=100*s/i,o=100*a/n):(r=100*a/i,o=100*s/n),e.style.width=`${r}%`,e.style.height=`${o}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const n=i.detail[t],s=n[0],a=n.slice(1);i.target.style[e]=kn[`${s}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[e]:kn[`${s}_rgb`](a)})};return lt(this,"_commonActions",{display:t=>{const{display:e}=t.detail,i=e%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout((()=>t.target.focus({preventScroll:!1})),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const n of Object.keys(e.detail)){const s=t[n]||i[n];s?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,s]of Object.entries(e)){const a=i[n];if(a){a({detail:{[n]:s},target:t}),delete e[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,n,s]=this.data.rect.map((t=>Math.fround(t)));if(8===t.length){const[a,r,o,l]=t.subarray(2,6);if(n===a&&s===r&&e===o&&i===l)return}const{style:a}=this.container;let r;if(this.#sn){const{borderColor:t,borderWidth:e}=a;a.borderWidth=0,r=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${t}" stroke-width="${e}">`],this.container.classList.add("hasBorder")}const o=n-e,l=s-i,{svgFactory:c}=this,d=c.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);const h=c.createElement("defs");d.append(h);const p=c.createElement("clipPath"),u=`clippath_${this.data.id}`;p.setAttribute("id",u),p.setAttribute("clipPathUnits","objectBoundingBox"),h.append(p);for(let m=2,g=t.length;m<g;m+=8){const i=t[m],n=t[m+1],a=t[m+2],d=t[m+3],h=c.createElement("rect"),u=(a-e)/o,g=(s-n)/l,f=(i-a)/o,v=(n-d)/l;h.setAttribute("x",u),h.setAttribute("y",g),h.setAttribute("width",f),h.setAttribute("height",v),p.append(h),r?.push(`<rect vector-effect="non-scaling-stroke" x="${u}" y="${g}" width="${f}" height="${v}"/>`)}this.#sn&&(r.push("</g></svg>')"),a.backgroundImage=r.join("")),this.container.append(d),this.container.style.clipPath=`url(#${u})`}_createPopup(){const{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");const i=this.#an=new Un({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(i.render())}render(){at("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const n=this._fieldObjects[t];if(n)for(const{page:t,id:s,exportValues:a}of n){if(-1===t)continue;if(s===e)continue;const n="string"===typeof a?a:null,r=document.querySelector(`[data-element-id="${s}"]`);!r||Pn.has(r)?i.push({id:s,exportValue:n,domElement:r}):st(`_getElementsByName - element not allowed: ${s}`)}return i}for(const n of document.getElementsByName(t)){const{exportValue:t}=n,s=n.getAttribute("data-element-id");s!==e&&(Pn.has(n)&&i.push({id:s,exportValue:t,domElement:n}))}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})}))}}class In extends Ln{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action),n=!0):t.attachment?(this.#on(i,t.attachment,t.attachmentDest),n=!0):t.setOCGState?(this.#ln(i,t.setOCGState),n=!0):t.dest?(this._bindLink(i,t.dest),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}#cn(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&this.#cn()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#cn()}#on(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#cn()}#ln(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#cn()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(e.actions)){const s=i.get(n);s&&(t[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:n}}),!1))}t.onclick||(t.onclick=()=>!1),this.#cn()}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#cn(),!this._fieldObjects)return st('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{i?.();const{fields:t,refs:n,include:s}=e,a=[];if(0!==t.length||0!==n.length){const e=new Set(n);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===s&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const r=this.annotationStorage,o=[];for(const e of a){const{id:t}=e;switch(o.push(t),e.type){case"text":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;r.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(Pn.has(i)?i.dispatchEvent(new Event("resetform")):st(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}),!1}}}class Fn extends Ln{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class On extends Ln{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&("CANVAS"===t.previousSibling?.nodeName&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return yt.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,n,s){i.includes("mouse")?t.addEventListener(i,(t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})})):t.addEventListener(i,(t=>{if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(t)}})}))}_setEventListeners(t,e,i,n){for(const[s,a]of i)("Action"===a||this.data.actions?.[a])&&("Focus"!==a&&"Blur"!==a||(e||={focused:!1}),this._setEventListener(t,e,s,a,n),"Focus"!==a||this.data.actions?.Blur?"Blur"!==a||this.data.actions?.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":At.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,s=t.style;let a;const r=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(l*n))||1);a=Math.min(n,r(e/l))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(n,r(t/l))}s.fontSize=`calc(${a}px * var(--scale-factor))`,s.color=At.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(s.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Nn extends On{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,n){const s=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),s.setValue(a.id,{[n]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const n=t.getValue(e,{value:this.data.fieldValue});let s=n.value||"";const a=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;a&&s.length>a&&(s=s.slice(0,a));let r=n.formattedValue||this.data.textContent?.join("\n")||null;r&&this.data.comb&&(r=r.replaceAll(/\s+/g,""));const o={userValue:s,formattedValue:r,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=r??s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",r??s),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),Pn.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=Mn,this._setRequired(i,this.data.required),a&&(i.maxLength=a),i.addEventListener("input",(n=>{t.setValue(e,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value"),o.formattedValue=null})),i.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null}));let l=t=>{const{formattedValue:e}=o;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(t=>{if(o.focused)return;const{target:e}=t;o.userValue&&(e.value=o.userValue),o.lastCommittedValue=e.value,o.commitKey=1,this.data.actions?.Focus||(o.focused=!0)})),i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const n={value(i){o.userValue=i.detail.value??"",t.setValue(e,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){const{formattedValue:n}=i.detail;o.formattedValue=n,null!==n&&void 0!==n&&i.target!==document.activeElement&&(i.target.value=n),t.setValue(e,{formattedValue:n})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{const{charLimit:n}=i.detail,{target:s}=i;if(0===n)return void s.removeAttribute("maxLength");s.setAttribute("maxLength",n);let a=o.userValue;!a||a.length<=n||(a=a.slice(0,n),s.value=o.userValue=a,t.setValue(e,{value:a}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}}))}};this._dispatchEventFromSandbox(n,i)})),i.addEventListener("keydown",(t=>{o.commitKey=1;let i=-1;if("Escape"===t.key?i=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(o.commitKey=3):i=2,-1===i)return;const{value:n}=t.target;o.lastCommittedValue!==n&&(o.lastCommittedValue=n,o.userValue=n,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}));const n=l;l=null,i.addEventListener("blur",(t=>{if(!o.focused||!t.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);const{value:i}=t.target;o.userValue=i,o.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:i,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}),n(t)})),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",(t=>{o.lastCommittedValue=null;const{data:i,target:n}=t,{value:s,selectionStart:a,selectionEnd:r}=n;let l=a,c=r;switch(t.inputType){case"deleteWordBackward":{const t=s.substring(0,a).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=s.substring(a).match(/^[^\w]*\w*/);t&&(c+=t[0].length);break}case"deleteContentBackward":a===r&&(l-=1);break;case"deleteContentForward":a===r&&(c+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:l,selEnd:c}})})),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.value))}if(l&&i.addEventListener("blur",l),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/a;i.classList.add("comb"),i.style.letterSpacing=`calc(${t}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class jn extends On{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class zn extends On{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"===typeof n&&(n="Off"!==n,t.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return Pn.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=Mn,s.addEventListener("change",(n=>{const{name:s,checked:a}=n.target;for(const r of this._getElementsByName(s,i)){const i=a&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:a})})),s.addEventListener("resetform",(t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue})),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",(e=>{const n={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(n,e)})),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.checked))),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Bn extends On{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"===typeof n&&(n=n!==e.buttonValue,t.setValue(i,{value:n})),n)for(const a of this._getElementsByName(e.fieldName,i))t.setValue(a.id,{value:!1});const s=document.createElement("input");if(Pn.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=Mn,s.addEventListener("change",(e=>{const{name:n,checked:s}=e.target;for(const a of this._getElementsByName(n,i))t.setValue(a.id,{value:!1});t.setValue(i,{value:s})})),s.addEventListener("resetform",(t=>{const i=e.defaultFieldValue;t.target.checked=null!==i&&void 0!==i&&i===e.buttonValue})),this.enableScripting&&this.hasJSActions){const n=e.buttonValue;s.addEventListener("updatefromsandbox",(e=>{const s={value:e=>{const s=n===e.detail.value;for(const n of this._getElementsByName(e.target.name)){const e=s&&n.id===i;n.domElement&&(n.domElement.checked=e),t.setValue(n.id,{value:e})}}};this._dispatchEventFromSandbox(s,e)})),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.checked))}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Hn extends In{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",(t=>{this._dispatchEventFromSandbox({},t)}))),t}}class $n extends On{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");Pn.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=Mn;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue;for(const i of n.options)i.selected=i.value===e}));for(const c of this.data.options){const t=document.createElement("option");t.textContent=c.displayValue,t.value=c.exportValue,i.value.includes(c.exportValue)&&(t.setAttribute("selected",!0),s=!1),n.append(t)}let a=null;if(s){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),n.prepend(t),a=()=>{t.remove(),n.removeEventListener("input",a),a=null},n.addEventListener("input",a)}const r=t=>{const e=t?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,(t=>t.selected)).map((t=>t[e])):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=r(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,(t=>({displayValue:t.textContent,exportValue:t.value})))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(i=>{const s={value(i){a?.();const s=i.detail.value,l=new Set(Array.isArray(s)?s:[s]);for(const t of n.options)t.selected=l.has(t.value);t.setValue(e,{value:r(!0)}),o=r(!1)},multipleSelection(t){n.multiple=!0},remove(i){const s=n.options,a=i.detail.remove;if(s[a].selected=!1,n.remove(a),s.length>0){-1===Array.prototype.findIndex.call(s,(t=>t.selected))&&(s[0].selected=!0)}t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},clear(i){for(;0!==n.length;)n.remove(0);t.setValue(e,{value:null,items:[]}),o=r(!1)},insert(i){const{index:s,displayValue:a,exportValue:c}=i.detail.insert,d=n.children[s],h=document.createElement("option");h.textContent=a,h.value=c,d?d.before(h):n.append(h),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},items(i){const{items:s}=i.detail;for(;0!==n.length;)n.remove(0);for(const t of s){const{displayValue:e,exportValue:i}=t,s=document.createElement("option");s.textContent=e,s.value=i,n.append(s)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},indices(i){const n=new Set(i.detail.indices);for(const t of i.target.options)t.selected=n.has(t.index);t.setValue(e,{value:r(!0)}),o=r(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(s,i)})),n.addEventListener("input",(i=>{const n=r(!0),s=r(!1);t.setValue(e,{value:n}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:s,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(t=>t.target.value))):n.addEventListener("input",(function(i){t.setValue(e,{value:r(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Un extends Ln{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:Ln._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new qn({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(const i of this.elements)i.popup=t,e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map((t=>`${St}${t}`)).join(",")),this.container}}class qn{#dn=this.#hn.bind(this);#pn=this.#un.bind(this);#mn=this.#gn.bind(this);#fn=this.#vn.bind(this);#bn=null;#ft=null;#xn=null;#yn=null;#wn=null;#An=null;#_n=null;#En=!1;#Cn=null;#E=null;#Sn=null;#kn=null;#Tn=null;#nn=null;#Mn=!1;constructor(t){let{container:e,color:i,elements:n,titleObj:s,modificationDate:a,contentsObj:r,richText:o,parent:l,rect:c,parentRect:d,open:h}=t;this.#ft=e,this.#Tn=s,this.#xn=r,this.#kn=o,this.#An=l,this.#bn=i,this.#Sn=c,this.#_n=d,this.#wn=n,this.#yn=se.toDateObject(a),this.trigger=n.flatMap((t=>t.getElementsToTriggerPopup()));for(const p of this.trigger)p.addEventListener("click",this.#fn),p.addEventListener("mouseenter",this.#mn),p.addEventListener("mouseleave",this.#pn),p.classList.add("popupTriggerArea");for(const p of n)p.container?.addEventListener("keydown",this.#dn);this.#ft.hidden=!0,h&&this.#vn()}render(){if(this.#Cn)return;const t=this.#Cn=document.createElement("div");if(t.className="popup",this.#bn){const e=t.style.outlineColor=At.makeHexColor(...this.#bn);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))t.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`;else{const e=.7;t.style.backgroundColor=At.makeHexColor(...this.#bn.map((t=>Math.floor(e*(255-t)+t))))}}const e=document.createElement("span");e.className="header";const i=document.createElement("h1");if(e.append(i),({dir:i.dir,str:i.textContent}=this.#Tn),t.append(e),this.#yn){const t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),t.setAttribute("data-l10n-args",JSON.stringify({date:this.#yn.toLocaleDateString(),time:this.#yn.toLocaleTimeString()})),e.append(t)}const n=this.#Pn;if(n)Tn.render({xfaHtml:n,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const e=this._formatContents(this.#xn);t.append(e)}this.#ft.append(t)}get#Pn(){const t=this.#kn,e=this.#xn;return!t?.str||e?.str&&e.str!==t.str?null:this.#kn.html||null}get#Rn(){return this.#Pn?.attributes?.style?.fontSize||0}get#Dn(){return this.#Pn?.attributes?.style?.color||null}#Ln(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:this.#Dn,fontSize:this.#Rn?`calc(${this.#Rn}px * var(--scale-factor))`:""}};for(const s of t.split("\n"))e.push({name:"span",value:s,attributes:n});return i}_formatContents(t){let{str:e,dir:i}=t;const n=document.createElement("p");n.classList.add("popupContent"),n.dir=i;const s=e.split(/(?:\r\n?|\n)/);for(let a=0,r=s.length;a<r;++a){const t=s[a];n.append(document.createTextNode(t)),a<r-1&&n.append(document.createElement("br"))}return n}#hn(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#En)&&this.#vn()}updateEdited(t){let{rect:e,popupContent:i}=t;this.#nn||={contentsObj:this.#xn,richText:this.#kn},e&&(this.#E=null),i&&(this.#kn=this.#Ln(i),this.#xn=null),this.#Cn?.remove(),this.#Cn=null}resetEdited(){this.#nn&&(({contentsObj:this.#xn,richText:this.#kn}=this.#nn),this.#nn=null,this.#Cn?.remove(),this.#Cn=null,this.#E=null)}#In(){if(null!==this.#E)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=this.#An;let a=!!this.#_n,r=a?this.#_n:this.#Sn;for(const p of this.#wn)if(!r||null!==At.intersect(p.data.rect,r)){r=p.data.rect,a=!0;break}const o=At.normalizeRect([r[0],t[3]-r[1]+t[1],r[2],t[3]-r[3]+t[1]]),l=a?r[2]-r[0]+5:0,c=o[0]+l,d=o[1];this.#E=[100*(c-n)/e,100*(d-s)/i];const{style:h}=this.#ft;h.left=`${this.#E[0]}%`,h.top=`${this.#E[1]}%`}#vn(){this.#En=!this.#En,this.#En?(this.#gn(),this.#ft.addEventListener("click",this.#fn),this.#ft.addEventListener("keydown",this.#dn)):(this.#un(),this.#ft.removeEventListener("click",this.#fn),this.#ft.removeEventListener("keydown",this.#dn))}#gn(){this.#Cn||this.render(),this.isVisible?this.#En&&this.#ft.classList.add("focused"):(this.#In(),this.#ft.hidden=!1,this.#ft.style.zIndex=parseInt(this.#ft.style.zIndex)+1e3)}#un(){this.#ft.classList.remove("focused"),!this.#En&&this.isVisible&&(this.#ft.hidden=!0,this.#ft.style.zIndex=parseInt(this.#ft.style.zIndex)-1e3)}forceHide(){this.#Mn=this.isVisible,this.#Mn&&(this.#ft.hidden=!0)}maybeShow(){this.#Mn&&(this.#Cn||this.#gn(),this.#Mn=!1,this.#ft.hidden=!1)}get isVisible(){return!1===this.#ft.hidden}}class Vn extends Ln{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=v.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class Gn extends Ln{#Fn=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:e,height:i}=Rn(t.rect),n=this.svgFactory.create(e,i,!0),s=this.#Fn=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Fn}addHighlightArea(){this.container.classList.add("highlightArea")}}class Wn extends Ln{#On=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:e,height:i}=Rn(t.rect),n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,a=this.#On=this.svgFactory.createElement("svg:rect");return a.setAttribute("x",s/2),a.setAttribute("y",s/2),a.setAttribute("width",e-s),a.setAttribute("height",i-s),a.setAttribute("stroke-width",s||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#On}addHighlightArea(){this.container.classList.add("highlightArea")}}class Kn extends Ln{#Nn=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:e,height:i}=Rn(t.rect),n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,a=this.#Nn=this.svgFactory.createElement("svg:ellipse");return a.setAttribute("cx",e/2),a.setAttribute("cy",i/2),a.setAttribute("rx",e/2-s/2),a.setAttribute("ry",i/2-s/2),a.setAttribute("stroke-width",s||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Nn}addHighlightArea(){this.container.classList.add("highlightArea")}}class Xn extends Ln{#jn=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:n}}=this;if(!e)return this.container;const{width:s,height:a}=Rn(t),r=this.svgFactory.create(s,a,!0);let o=[];for(let c=0,d=e.length;c<d;c+=2){const i=e[c]-t[0],n=t[3]-e[c+1];o.push(`${i},${n}`)}o=o.join(" ");const l=this.#jn=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#jn}addHighlightArea(){this.container.classList.add("highlightArea")}}class Yn extends Xn{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Qn extends Ln{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class Jn extends Ln{#zn=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=v.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:e,borderStyle:i,popupRef:n}}=this,{width:s,height:a}=Rn(t),r=this.svgFactory.create(s,a,!0);for(const o of e){let e=[];for(let i=0,n=o.length;i<n;i+=2){const n=o[i]-t[0],s=t[3]-o[i+1];e.push(`${n},${s}`)}e=e.join(" ");const s=this.svgFactory.createElement(this.svgElementName);this.#zn.push(s),s.setAttribute("points",e),s.setAttribute("stroke-width",i.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),!n&&this.hasPopupData&&this._createPopup(),r.append(s)}return this.container.append(r),this.container}getElementsToTriggerPopup(){return this.#zn}addHighlightArea(){this.container.classList.add("highlightArea")}}class Zn extends Ln{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class ts extends Ln{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class es extends Ln{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class is extends Ln{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class ns extends Ln{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class ss extends Ln{#Bn=null;constructor(t){super(t,{isRenderable:!0});const{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...e})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*e.fillAlpha)}%);`)),i.addEventListener("dblclick",this.#Hn.bind(this)),this.#Bn=i;const{isMac:n}=yt.platform;return t.addEventListener("keydown",(t=>{"Enter"===t.key&&(n?t.metaKey:t.ctrlKey)&&this.#Hn()})),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return this.#Bn}addHighlightArea(){this.container.classList.add("highlightArea")}#Hn(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class as{#$n=null;#Un=null;#qn=(()=>new Map)();constructor(t){let{div:e,accessibilityManager:i,annotationCanvasMap:n,annotationEditorUIManager:s,page:a,viewport:r}=t;this.div=e,this.#$n=i,this.#Un=n,this.page=a,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=s}#Vn(t,e){const i=t.firstChild||t;i.id=`${St}${e}`,this.div.append(t),this.#$n?.moveElementInDOM(this.div,t,i,!1)}async render(t){const{annotations:e}=t,i=this.div;ce(i,this.viewport);const n=new Map,s={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new Gt,annotationStorage:t.annotationStorage||new ke,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const a of e){if(a.noHTML)continue;const t=a.annotationType===$;if(t){const t=n.get(a.id);if(!t)continue;s.elements=t}else{const{width:t,height:e}=Rn(a.rect);if(t<=0||e<=0)continue}s.data=a;const e=Dn.create(s);if(!e.isRenderable)continue;if(!t&&a.popupRef){const t=n.get(a.popupRef);t?t.push(e):n.set(a.popupRef,[e])}const i=e.render();a.hidden&&(i.style.visibility="hidden"),this.#Vn(i,a.id),e.annotationEditorType>0&&(this.#qn.set(e.data.id,e),this._annotationEditorUIManager?.renderAnnotationElement(e))}this.#Gn()}update(t){let{viewport:e}=t;const i=this.div;this.viewport=e,ce(i,{rotation:e.rotation}),this.#Gn(),i.hidden=!1}#Gn(){if(!this.#Un)return;const t=this.div;for(const[e,i]of this.#Un){const n=t.querySelector(`[data-annotation-id="${e}"]`);if(!n)continue;i.className="annotationContent";const{firstChild:s}=n;s?"CANVAS"===s.nodeName?s.replaceWith(i):s.classList.contains("annotationContent")?s.after(i):s.before(i):n.append(i)}this.#Un.clear()}getEditableAnnotations(){return Array.from(this.#qn.values())}getEditableAnnotation(t){return this.#qn.get(t)}}const rs=/\r\n?|\n/g;class os extends ye{#Wn=this.editorDivBlur.bind(this);#Kn=this.editorDivFocus.bind(this);#Xn=this.editorDivInput.bind(this);#Yn=this.editorDivKeydown.bind(this);#Qn=this.editorDivPaste.bind(this);#bn;#Jn="";#Zn=`${this.id}-editor`;#Rn;#ts=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const t=os.prototype,e=t=>t.isEmpty(),i=be.TRANSLATE_SMALL,n=be.TRANSLATE_BIG;return lt(this,"_keyboardManager",new fe([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}]]))}static _type="freetext";static _editorType=(()=>v.FREETEXT)();constructor(t){super({...t,name:"freeTextEditor"}),this.#bn=t.color||os._defaultColor||ye._defaultLineColor,this.#Rn=t.fontSize||os._defaultFontSize}static initialize(t,e){ye.initialize(t,e,{strings:["pdfjs-free-text-default-content"]});const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case b.FREETEXT_SIZE:os._defaultFontSize=e;break;case b.FREETEXT_COLOR:os._defaultColor=e}}updateParams(t,e){switch(t){case b.FREETEXT_SIZE:this.#es(e);break;case b.FREETEXT_COLOR:this.#is(e)}}static get defaultPropertiesToUpdate(){return[[b.FREETEXT_SIZE,os._defaultFontSize],[b.FREETEXT_COLOR,os._defaultColor||ye._defaultLineColor]]}get propertiesToUpdate(){return[[b.FREETEXT_SIZE,this.#Rn],[b.FREETEXT_COLOR,this.#bn]]}#es(t){const e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-this.#Rn)*this.parentScale),this.#Rn=t,this.#ns()},i=this.#Rn;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:b.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#is(t){const e=t=>{this.#bn=this.editorDiv.style.color=t},i=this.#bn;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:b.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-os._internalPadding*t,-(os._internalPadding+this.#Rn)*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(v.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant");const t=this._uiManager._signal;this.editorDiv.addEventListener("keydown",this.#Yn,{signal:t}),this.editorDiv.addEventListener("focus",this.#Kn,{signal:t}),this.editorDiv.addEventListener("blur",this.#Wn,{signal:t}),this.editorDiv.addEventListener("input",this.#Xn,{signal:t}),this.editorDiv.addEventListener("paste",this.#Qn,{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#Zn),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#Yn),this.editorDiv.removeEventListener("focus",this.#Kn),this.editorDiv.removeEventListener("blur",this.#Wn),this.editorDiv.removeEventListener("input",this.#Xn),this.editorDiv.removeEventListener("paste",this.#Qn),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#ss(){const t=[];this.editorDiv.normalize();for(const e of this.editorDiv.childNodes)t.push(os.#as(e));return t.join("\n")}#ns(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,n=e.style.display,s=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=n,e.classList.toggle("hidden",s)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=this.#Jn,e=this.#Jn=this.#ss().trimEnd();if(t===e)return;const i=t=>{this.#Jn=t,t?(this.#rs(),this._uiManager.rebuild(this),this.#ns()):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#ns()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){os._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}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 t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#Zn),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),ye._l10nPromise.get("pdfjs-free-text-default-content").then((t=>this.editorDiv?.setAttribute("default-content",t))),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#Rn}px * var(--scale-factor))`,i.color=this.#bn,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),pe(this,this.div,["dblclick","keydown"]),this.width){const[i,n]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this.#ts;let[a,r]=this.getInitialTranslation();[a,r]=this.pageTranslationToScreen(a,r);const[o,l]=this.pageDimensions,[c,d]=this.pageTranslation;let h,p;switch(this.rotation){case 0:h=t+(s[0]-c)/o,p=e+this.height-(s[1]-d)/l;break;case 90:h=t+(s[0]-c)/o,p=e-(s[1]-d)/l,[a,r]=[r,-a];break;case 180:h=t-this.width+(s[0]-c)/o,p=e-(s[1]-d)/l,[a,r]=[-a,-r];break;case 270:h=t+(s[0]-c-this.height*l)/o,p=e+(s[1]-d-this.width*o)/l,[a,r]=[-r,a]}this.setAt(h*i,p*n,a,r)}else this.setAt(t*i,e*n,this.width*i,this.height*n);this.#rs(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#as(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(rs,"")}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const n=os.#os(e.getData("text")||"").replaceAll(rs,"\n");if(!n)return;const s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();const a=s.getRangeAt(0);if(!n.includes("\n"))return a.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),void s.collapseToStart();const{startContainer:r,startOffset:o}=a,l=[],c=[];if(r.nodeType===Node.TEXT_NODE){const t=r.parentElement;if(c.push(r.nodeValue.slice(o).replaceAll(rs,"")),t!==this.editorDiv){let e=l;for(const i of this.editorDiv.childNodes)i!==t?e.push(os.#as(i)):e=c}l.push(r.nodeValue.slice(0,o).replaceAll(rs,""))}else if(r===this.editorDiv){let t=l,e=0;for(const i of this.editorDiv.childNodes)e++===o&&(t=c),t.push(os.#as(i))}this.#Jn=`${l.join("\n")}${n}${c.join("\n")}`,this.#rs();const d=new Range;let h=l.reduce(((t,e)=>t+e.length),0);for(const{firstChild:p}of this.editorDiv.childNodes)if(p.nodeType===Node.TEXT_NODE){const t=p.nodeValue.length;if(h<=t){d.setStart(p,h),d.setEnd(p,h);break}h-=t}s.removeAllRanges(),s.addRange(d)}#rs(){if(this.editorDiv.replaceChildren(),this.#Jn)for(const t of this.#Jn.split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#ls(){return this.#Jn.replaceAll("\xa0"," ")}static#os(t){return t.replaceAll(" ","\xa0")}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){let n=null;if(t instanceof Vn){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:s,rotation:a,id:r},textContent:o,textPosition:l,parent:{page:{pageNumber:c}}}=t;if(!o||0===o.length)return null;n=t={annotationType:v.FREETEXT,color:Array.from(i),fontSize:e,value:o.join("\n"),position:l,pageIndex:c-1,rect:s.slice(0),rotation:a,id:r,deleted:!1}}const s=super.deserialize(t,e,i);return s.#Rn=t.fontSize,s.#bn=At.makeHexColor(...t.color),s.#Jn=os.#os(t.value),s.annotationElementId=t.id||null,s.#ts=n,s}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const e=os._internalPadding*this.parentScale,i=this.getRect(e,e),n=ye._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#bn),s={annotationType:v.FREETEXT,color:n,fontSize:this.#Rn,value:this.#ls(),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?s:this.annotationElementId&&!this.#cs(s)?null:(s.id=this.annotationElementId,s)}#cs(t){const{value:e,fontSize:i,color:n,pageIndex:s}=this.#ts;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some(((t,e)=>t!==n[e]))||t.pageIndex!==s}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(this.deleted)return e;const{style:i}=e;i.fontSize=`calc(${this.#Rn}px * var(--scale-factor))`,i.color=this.#bn,e.replaceChildren();for(const s of this.#Jn.split("\n")){const t=document.createElement("div");t.append(s?document.createTextNode(s):document.createElement("br")),e.append(t)}const n=os._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(n,n),popupContent:this.#Jn}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class ls{#ds;#hs=[];#ps=[];constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=1/0,a=-1/0,r=1/0,o=-1/0;const l=10**-4;for(const{x:g,y:f,width:v,height:b}of t){const t=Math.floor((g-e)/l)*l,i=Math.ceil((g+v+e)/l)*l,n=Math.floor((f-e)/l)*l,c=Math.ceil((f+b+e)/l)*l,d=[t,n,c,!0],h=[i,n,c,!1];this.#hs.push(d,h),s=Math.min(s,t),a=Math.max(a,i),r=Math.min(r,n),o=Math.max(o,c)}const c=a-s+2*i,d=o-r+2*i,h=s-i,p=r-i,u=this.#hs.at(n?-1:-2),m=[u[0],u[2]];for(const g of this.#hs){const[t,e,i]=g;g[0]=(t-h)/c,g[1]=(e-p)/d,g[2]=(i-p)/d}this.#ds={x:h,y:p,width:c,height:d,lastPoint:m}}getOutlines(){this.#hs.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]));const t=[];for(const e of this.#hs)e[3]?(t.push(...this.#us(e)),this.#ms(e)):(this.#gs(e),t.push(...this.#us(e)));return this.#fs(t)}#fs(t){const e=[],i=new Set;for(const a of t){const[t,i,n]=a;e.push([t,i,a],[t,n,a])}e.sort(((t,e)=>t[1]-e[1]||t[0]-e[0]));for(let a=0,r=e.length;a<r;a+=2){const t=e[a][2],n=e[a+1][2];t.push(n),n.push(t),i.add(t),i.add(n)}const n=[];let s;for(;i.size>0;){const t=i.values().next().value;let[e,a,r,o,l]=t;i.delete(t);let c=e,d=a;for(s=[e,r],n.push(s);;){let t;if(i.has(o))t=o;else{if(!i.has(l))break;t=l}i.delete(t),[e,a,r,o,l]=t,c!==e&&(s.push(c,d,e,d===a?a:r),c=e),d=d===a?r:a}s.push(c,d)}return new ds(n,this.#ds)}#vs(t){const e=this.#ps;let i=0,n=e.length-1;for(;i<=n;){const s=i+n>>1,a=e[s][0];if(a===t)return s;a<t?i=s+1:n=s-1}return n+1}#ms(t){let[,e,i]=t;const n=this.#vs(e);this.#ps.splice(n,0,[e,i])}#gs(t){let[,e,i]=t;const n=this.#vs(e);for(let s=n;s<this.#ps.length;s++){const[t,n]=this.#ps[s];if(t!==e)break;if(t===e&&n===i)return void this.#ps.splice(s,1)}for(let s=n-1;s>=0;s--){const[t,n]=this.#ps[s];if(t!==e)break;if(t===e&&n===i)return void this.#ps.splice(s,1)}}#us(t){const[e,i,n]=t,s=[[e,i,n]],a=this.#vs(n);for(let r=0;r<a;r++){const[t,i]=this.#ps[r];for(let n=0,a=s.length;n<a;n++){const[,r,o]=s[n];if(!(i<=r||o<=t))if(r>=t)if(o>i)s[n][1]=i;else{if(1===a)return[];s.splice(n,1),n--,a--}else s[n][2]=t,o>i&&s.push([e,i,o])}}return s}}class cs{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof ps}}class ds extends cs{#ds;#bs;constructor(t,e){super(),this.#bs=t,this.#ds=e}toSVGPath(){const t=[];for(const e of this.#bs){let[i,n]=e;t.push(`M${i} ${n}`);for(let s=2;s<e.length;s+=2){const a=e[s],r=e[s+1];a===i?(t.push(`V${r}`),n=r):r===n&&(t.push(`H${a}`),i=a)}t.push("Z")}return t.join(" ")}serialize(t,e){let[i,n,s,a]=t;const r=[],o=s-i,l=a-n;for(const c of this.#bs){const t=new Array(c.length);for(let e=0;e<c.length;e+=2)t[e]=i+c[e]*o,t[e+1]=a-c[e+1]*l;r.push(t)}return r}get box(){return this.#ds}}class hs{#ds;#xs=[];#ys;#ws;#As=[];#_s=(()=>new Float64Array(18))();#Es;#Cs;#Ss;#ks;#Ts;#Ms;#Ps=[];static#Rs=8;static#Ds=2;static#Ls=(()=>hs.#Rs+hs.#Ds)();constructor(t,e,i,n,s){let{x:a,y:r}=t,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.#ds=e,this.#Ms=n*i,this.#ws=s,this.#_s.set([NaN,NaN,NaN,NaN,a,r],6),this.#ys=o,this.#ks=hs.#Rs*i,this.#Ss=hs.#Ls*i,this.#Ts=i,this.#Ps.push(a,r)}get free(){return!0}isEmpty(){return isNaN(this.#_s[8])}#Is(){const t=this.#_s.subarray(4,6),e=this.#_s.subarray(16,18),[i,n,s,a]=this.#ds;return[(this.#Es+(t[0]-e[0])/2-i)/s,(this.#Cs+(t[1]-e[1])/2-n)/a,(this.#Es+(e[0]-t[0])/2-i)/s,(this.#Cs+(e[1]-t[1])/2-n)/a]}add(t){let{x:e,y:i}=t;this.#Es=e,this.#Cs=i;const[n,s,a,r]=this.#ds;let[o,l,c,d]=this.#_s.subarray(8,12);const h=e-c,p=i-d,u=Math.hypot(h,p);if(u<this.#Ss)return!1;const m=u-this.#ks,g=m/u,f=g*h,v=g*p;let b=o,x=l;o=c,l=d,c+=f,d+=v,this.#Ps?.push(e,i);const y=f/m,w=-v/m*this.#Ms,A=y*this.#Ms;if(this.#_s.set(this.#_s.subarray(2,8),0),this.#_s.set([c+w,d+A],4),this.#_s.set(this.#_s.subarray(14,18),12),this.#_s.set([c-w,d-A],16),isNaN(this.#_s[6]))return 0===this.#As.length&&(this.#_s.set([o+w,l+A],2),this.#As.push(NaN,NaN,NaN,NaN,(o+w-n)/a,(l+A-s)/r),this.#_s.set([o-w,l-A],14),this.#xs.push(NaN,NaN,NaN,NaN,(o-w-n)/a,(l-A-s)/r)),this.#_s.set([b,x,o,l,c,d],6),!this.isEmpty();this.#_s.set([b,x,o,l,c,d],6);return Math.abs(Math.atan2(x-l,b-o)-Math.atan2(v,f))<Math.PI/2?([o,l,c,d]=this.#_s.subarray(2,6),this.#As.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/a,((l+d)/2-s)/r),[o,l,b,x]=this.#_s.subarray(14,18),this.#xs.push(NaN,NaN,NaN,NaN,((b+o)/2-n)/a,((x+l)/2-s)/r),!0):([b,x,o,l,c,d]=this.#_s.subarray(0,6),this.#As.push(((b+5*o)/6-n)/a,((x+5*l)/6-s)/r,((5*o+c)/6-n)/a,((5*l+d)/6-s)/r,((o+c)/2-n)/a,((l+d)/2-s)/r),[c,d,o,l,b,x]=this.#_s.subarray(12,18),this.#xs.push(((b+5*o)/6-n)/a,((x+5*l)/6-s)/r,((5*o+c)/6-n)/a,((5*l+d)/6-s)/r,((o+c)/2-n)/a,((l+d)/2-s)/r),!0)}toSVGPath(){if(this.isEmpty())return"";const t=this.#As,e=this.#xs,i=this.#_s.subarray(4,6),n=this.#_s.subarray(16,18),[s,a,r,o]=this.#ds,[l,c,d,h]=this.#Is();if(isNaN(this.#_s[6])&&!this.isEmpty())return`M${(this.#_s[2]-s)/r} ${(this.#_s[3]-a)/o} L${(this.#_s[4]-s)/r} ${(this.#_s[5]-a)/o} L${l} ${c} L${d} ${h} L${(this.#_s[16]-s)/r} ${(this.#_s[17]-a)/o} L${(this.#_s[14]-s)/r} ${(this.#_s[15]-a)/o} Z`;const p=[];p.push(`M${t[4]} ${t[5]}`);for(let u=6;u<t.length;u+=6)isNaN(t[u])?p.push(`L${t[u+4]} ${t[u+5]}`):p.push(`C${t[u]} ${t[u+1]} ${t[u+2]} ${t[u+3]} ${t[u+4]} ${t[u+5]}`);p.push(`L${(i[0]-s)/r} ${(i[1]-a)/o} L${l} ${c} L${d} ${h} L${(n[0]-s)/r} ${(n[1]-a)/o}`);for(let u=e.length-6;u>=6;u-=6)isNaN(e[u])?p.push(`L${e[u+4]} ${e[u+5]}`):p.push(`C${e[u]} ${e[u+1]} ${e[u+2]} ${e[u+3]} ${e[u+4]} ${e[u+5]}`);return p.push(`L${e[4]} ${e[5]} Z`),p.join(" ")}getOutlines(){const t=this.#As,e=this.#xs,i=this.#_s,n=i.subarray(4,6),s=i.subarray(16,18),[a,r,o,l]=this.#ds,c=new Float64Array((this.#Ps?.length??0)+2);for(let f=0,v=c.length-2;f<v;f+=2)c[f]=(this.#Ps[f]-a)/o,c[f+1]=(this.#Ps[f+1]-r)/l;c[c.length-2]=(this.#Es-a)/o,c[c.length-1]=(this.#Cs-r)/l;const[d,h,p,u]=this.#Is();if(isNaN(i[6])&&!this.isEmpty()){const t=new Float64Array(36);return t.set([NaN,NaN,NaN,NaN,(i[2]-a)/o,(i[3]-r)/l,NaN,NaN,NaN,NaN,(i[4]-a)/o,(i[5]-r)/l,NaN,NaN,NaN,NaN,d,h,NaN,NaN,NaN,NaN,p,u,NaN,NaN,NaN,NaN,(i[16]-a)/o,(i[17]-r)/l,NaN,NaN,NaN,NaN,(i[14]-a)/o,(i[15]-r)/l],0),new ps(t,c,this.#ds,this.#Ts,this.#ys,this.#ws)}const m=new Float64Array(this.#As.length+24+this.#xs.length);let g=t.length;for(let f=0;f<g;f+=2)isNaN(t[f])?m[f]=m[f+1]=NaN:(m[f]=t[f],m[f+1]=t[f+1]);m.set([NaN,NaN,NaN,NaN,(n[0]-a)/o,(n[1]-r)/l,NaN,NaN,NaN,NaN,d,h,NaN,NaN,NaN,NaN,p,u,NaN,NaN,NaN,NaN,(s[0]-a)/o,(s[1]-r)/l],g),g+=24;for(let f=e.length-6;f>=6;f-=6)for(let t=0;t<6;t+=2)isNaN(e[f+t])?(m[g]=m[g+1]=NaN,g+=2):(m[g]=e[f+t],m[g+1]=e[f+t+1],g+=2);return m.set([NaN,NaN,NaN,NaN,e[4],e[5]],g),new ps(m,c,this.#ds,this.#Ts,this.#ys,this.#ws)}}class ps extends cs{#ds;#Fs=null;#ys;#ws;#Ps;#Ts;#Os;constructor(t,e,i,n,s,a){super(),this.#Os=t,this.#Ps=e,this.#ds=i,this.#Ts=n,this.#ys=s,this.#ws=a,this.#Ns(a);const{x:r,y:o,width:l,height:c}=this.#Fs;for(let d=0,h=t.length;d<h;d+=2)t[d]=(t[d]-r)/l,t[d+1]=(t[d+1]-o)/c;for(let d=0,h=e.length;d<h;d+=2)e[d]=(e[d]-r)/l,e[d+1]=(e[d+1]-o)/c}toSVGPath(){const t=[`M${this.#Os[4]} ${this.#Os[5]}`];for(let e=6,i=this.#Os.length;e<i;e+=6)isNaN(this.#Os[e])?t.push(`L${this.#Os[e+4]} ${this.#Os[e+5]}`):t.push(`C${this.#Os[e]} ${this.#Os[e+1]} ${this.#Os[e+2]} ${this.#Os[e+3]} ${this.#Os[e+4]} ${this.#Os[e+5]}`);return t.push("Z"),t.join(" ")}serialize(t,e){let[i,n,s,a]=t;const r=s-i,o=a-n;let l,c;switch(e){case 0:l=this.#js(this.#Os,i,a,r,-o),c=this.#js(this.#Ps,i,a,r,-o);break;case 90:l=this.#zs(this.#Os,i,n,r,o),c=this.#zs(this.#Ps,i,n,r,o);break;case 180:l=this.#js(this.#Os,s,n,-r,o),c=this.#js(this.#Ps,s,n,-r,o);break;case 270:l=this.#zs(this.#Os,s,a,-r,-o),c=this.#zs(this.#Ps,s,a,-r,-o)}return{outline:Array.from(l),points:[Array.from(c)]}}#js(t,e,i,n,s){const a=new Float64Array(t.length);for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r]*n,a[r+1]=i+t[r+1]*s;return a}#zs(t,e,i,n,s){const a=new Float64Array(t.length);for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r+1]*n,a[r+1]=i+t[r]*s;return a}#Ns(t){const e=this.#Os;let i=e[4],n=e[5],s=i,a=n,r=i,o=n,l=i,c=n;const d=t?Math.max:Math.min;for(let g=6,f=e.length;g<f;g+=6){if(isNaN(e[g]))s=Math.min(s,e[g+4]),a=Math.min(a,e[g+5]),r=Math.max(r,e[g+4]),o=Math.max(o,e[g+5]),c<e[g+5]?(l=e[g+4],c=e[g+5]):c===e[g+5]&&(l=d(l,e[g+4]));else{const t=At.bezierBoundingBox(i,n,...e.slice(g,g+6));s=Math.min(s,t[0]),a=Math.min(a,t[1]),r=Math.max(r,t[2]),o=Math.max(o,t[3]),c<t[3]?(l=t[2],c=t[3]):c===t[3]&&(l=d(l,t[2]))}i=e[g+4],n=e[g+5]}const h=s-this.#ys,p=a-this.#ys,u=r-s+2*this.#ys,m=o-a+2*this.#ys;this.#Fs={x:h,y:p,width:u,height:m,lastPoint:[l,c]}}get box(){return this.#Fs}getNewOutline(t,e){const{x:i,y:n,width:s,height:a}=this.#Fs,[r,o,l,c]=this.#ds,d=s*l,h=a*c,p=i*l+r,u=n*c+o,m=new hs({x:this.#Ps[0]*d+p,y:this.#Ps[1]*h+u},this.#ds,this.#Ts,t,this.#ws,e??this.#ys);for(let g=2;g<this.#Ps.length;g+=2)m.add({x:this.#Ps[g]*d+p,y:this.#Ps[g+1]*h+u});return m.getOutlines()}}class us{#dn=this.#hn.bind(this);#Bs=this.#o.bind(this);#Hs=null;#$s=null;#Us;#qs=null;#Vs=!1;#Gs=!1;#a=null;#Ws;#u=null;#Ks;static get _keyboardManager(){return lt(this,"_keyboardManager",new fe([[["Escape","mac+Escape"],us.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],us.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],us.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],us.prototype._moveToPrevious],[["Home","mac+Home"],us.prototype._moveToBeginning],[["End","mac+End"],us.prototype._moveToEnd]]))}constructor(t){let{editor:e=null,uiManager:i=null}=t;e?(this.#Gs=!1,this.#Ks=b.HIGHLIGHT_COLOR,this.#a=e):(this.#Gs=!0,this.#Ks=b.HIGHLIGHT_DEFAULT_COLOR),this.#u=e?._uiManager||i,this.#Ws=this.#u._eventBus,this.#Us=e?.color||this.#u?.highlightColors.values().next().value||"#FFFF98"}renderButton(){const t=this.#Hs=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=this.#u._signal;t.addEventListener("click",this.#Xs.bind(this),{signal:e}),t.addEventListener("keydown",this.#dn,{signal:e});const i=this.#$s=document.createElement("span");return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=this.#Us,t.append(i),t}renderMainDropdown(){const t=this.#qs=this.#Ys();return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#Ys(){const t=document.createElement("div"),e=this.#u._signal;t.addEventListener("contextmenu",ee,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[i,n]of this.#u.highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=i,s.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${i}`);const a=document.createElement("span");s.append(a),a.className="swatch",a.style.backgroundColor=n,s.setAttribute("aria-selected",n===this.#Us),s.addEventListener("click",this.#Qs.bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",this.#dn,{signal:e}),t}#Qs(t,e){e.stopPropagation(),this.#Ws.dispatch("switchannotationeditorparams",{source:this,type:this.#Ks,value:t})}_colorSelectFromKeyboard(t){if(t.target===this.#Hs)return void this.#Xs(t);const e=t.target.getAttribute("data-color");e&&this.#Qs(e,t)}_moveToNext(t){this.#Js?t.target!==this.#Hs?t.target.nextSibling?.focus():this.#qs.firstChild?.focus():this.#Xs(t)}_moveToPrevious(t){t.target!==this.#qs?.firstChild&&t.target!==this.#Hs?(this.#Js||this.#Xs(t),t.target.previousSibling?.focus()):this.#Js&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){this.#Js?this.#qs.firstChild?.focus():this.#Xs(t)}_moveToEnd(t){this.#Js?this.#qs.lastChild?.focus():this.#Xs(t)}#hn(t){us._keyboardManager.exec(this,t)}#Xs(t){if(this.#Js)return void this.hideDropdown();if(this.#Vs=0===t.detail,window.addEventListener("pointerdown",this.#Bs,{signal:this.#u._signal}),this.#qs)return void this.#qs.classList.remove("hidden");const e=this.#qs=this.#Ys();this.#Hs.append(e)}#o(t){this.#qs?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#qs?.classList.add("hidden"),window.removeEventListener("pointerdown",this.#Bs)}get#Js(){return this.#qs&&!this.#qs.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#Gs||(this.#Js?(this.hideDropdown(),this.#Hs.focus({preventScroll:!0,focusVisible:this.#Vs})):this.#a?.unselect())}updateColor(t){if(this.#$s&&(this.#$s.style.backgroundColor=t),!this.#qs)return;const e=this.#u.highlightColors.values();for(const i of this.#qs.children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#Hs?.remove(),this.#Hs=null,this.#$s=null,this.#qs?.remove(),this.#qs=null}}class ms extends ye{#Zs=null;#ta=0;#ea;#ia=null;#s=null;#na=null;#sa=null;#aa=0;#ra=null;#oa=null;#v=null;#la=!1;#ot=this.#ca.bind(this);#da=null;#ha;#pa=null;#ua="";#Ms;#ma="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _l10nPromise;static _type="highlight";static _editorType=(()=>v.HIGHLIGHT)();static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const t=ms.prototype;return lt(this,"_keyboardManager",new fe([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||ms._defaultColor,this.#Ms=t.thickness||ms._defaultThickness,this.#ha=t.opacity||ms._defaultOpacity,this.#ea=t.boxes||null,this.#ma=t.methodOfCreation||"",this.#ua=t.text||"",this._isDraggable=!1,t.highlightId>-1?(this.#la=!0,this.#ga(t),this.#fa()):(this.#Zs=t.anchorNode,this.#ta=t.anchorOffset,this.#sa=t.focusNode,this.#aa=t.focusOffset,this.#va(),this.#fa(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#la?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#Ms,methodOfCreation:this.#ma}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#va(){const t=new ls(this.#ea,.001);this.#oa=t.getOutlines(),({x:this.x,y:this.y,width:this.width,height:this.height}=this.#oa.box);const e=new ls(this.#ea,.0025,.001,"ltr"===this._uiManager.direction);this.#na=e.getOutlines();const{lastPoint:i}=this.#na.box;this.#da=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#ga(t){let{highlightOutlines:e,highlightId:i,clipPathId:n}=t;this.#oa=e;if(this.#na=e.getNewOutline(this.#Ms/2+1.5,.0025),i>=0)this.#v=i,this.#ia=n,this.parent.drawLayer.finalizeLine(i,e),this.#pa=this.parent.drawLayer.highlightOutline(this.#na);else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#v,e),this.parent.drawLayer.updateBox(this.#v,ms.#ba(this.#oa.box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#pa,this.#na),this.parent.drawLayer.updateBox(this.#pa,ms.#ba(this.#na.box,t))}const{x:s,y:a,width:r,height:o}=e.box;switch(this.rotation){case 0:this.x=s,this.y=a,this.width=r,this.height=o;break;case 90:{const[t,e]=this.parentDimensions;this.x=a,this.y=1-s,this.width=r*e/t,this.height=o*t/e;break}case 180:this.x=1-s,this.y=1-a,this.width=r,this.height=o;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-a,this.y=s,this.width=r*e/t,this.height=o*t/e;break}}const{lastPoint:l}=this.#na.box;this.#da=[(l[0]-s)/r,(l[1]-a)/o]}static initialize(t,e){ye.initialize(t,e),ms._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case b.HIGHLIGHT_DEFAULT_COLOR:ms._defaultColor=e;break;case b.HIGHLIGHT_THICKNESS:ms._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#da}updateParams(t,e){switch(t){case b.HIGHLIGHT_COLOR:this.#is(e);break;case b.HIGHLIGHT_THICKNESS:this.#xa(e)}}static get defaultPropertiesToUpdate(){return[[b.HIGHLIGHT_DEFAULT_COLOR,ms._defaultColor],[b.HIGHLIGHT_THICKNESS,ms._defaultThickness]]}get propertiesToUpdate(){return[[b.HIGHLIGHT_COLOR,this.color||ms._defaultColor],[b.HIGHLIGHT_THICKNESS,this.#Ms||ms._defaultThickness],[b.HIGHLIGHT_FREE,this.#la]]}#is(t){const e=t=>{this.color=t,this.parent?.drawLayer.changeColor(this.#v,t),this.#s?.updateColor(t)},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:b.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#xa(t){const e=this.#Ms,i=t=>{this.#Ms=t,this.#ya(t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:b.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#s=new us({editor:this}),t.addColorPicker(this.#s)),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#wa())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#wa())}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#Aa(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#fa(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#Aa():t&&(this.#fa(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#ya(t){if(!this.#la)return;this.#ga({highlightOutlines:this.#oa.getNewOutline(t/2)}),this.fixAndSetPosition();const[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}#Aa(){null!==this.#v&&this.parent&&(this.parent.drawLayer.remove(this.#v),this.#v=null,this.parent.drawLayer.remove(this.#pa),this.#pa=null)}#fa(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===this.#v&&(({id:this.#v,clipPathId:this.#ia}=t.drawLayer.highlight(this.#oa,this.color,this.#ha)),this.#pa=t.drawLayer.highlightOutline(this.#na),this.#ra&&(this.#ra.style.clipPath=this.#ia))}static#ba(t,e){let{x:i,y:n,width:s,height:a}=t;switch(e){case 90:return{x:1-n-a,y:i,width:a,height:s};case 180:return{x:1-i-s,y:1-n-a,width:s,height:a};case 270:return{x:n,y:1-i-s,width:a,height:s}}return{x:i,y:n,width:s,height:a}}rotate(t){const{drawLayer:e}=this.parent;let i;this.#la?(t=(t-this.rotation+360)%360,i=ms.#ba(this.#oa.box,t)):i=ms.#ba(this,t),e.rotate(this.#v,t),e.rotate(this.#pa,t),e.updateBox(this.#v,i),e.updateBox(this.#pa,ms.#ba(this.#na.box,t))}render(){if(this.div)return this.div;const t=super.render();this.#ua&&(t.setAttribute("aria-label",this.#ua),t.setAttribute("role","mark")),this.#la?t.classList.add("free"):this.div.addEventListener("keydown",this.#ot,{signal:this._uiManager._signal});const e=this.#ra=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#ia;const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),pe(this,this.#ra,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(this.#pa,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#pa,"hovered")}#ca(t){ms._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#_a(!0);break;case 1:case 3:this.#_a(!1)}}#_a(t){if(!this.#Zs)return;const e=window.getSelection();t?e.setPosition(this.#Zs,this.#ta):e.setPosition(this.#sa,this.#aa)}select(){super.select(),this.#pa&&(this.parent?.drawLayer.removeClass(this.#pa,"hovered"),this.parent?.drawLayer.addClass(this.#pa,"selected"))}unselect(){super.unselect(),this.#pa&&(this.parent?.drawLayer.removeClass(this.#pa,"selected"),this.#la||this.#_a(!1))}get _mustFixPosition(){return!this.#la}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.show(this.#v,t),this.parent.drawLayer.show(this.#pa,t))}#wa(){return this.#la?this.rotation:0}#Ea(){if(this.#la)return null;const[t,e]=this.pageDimensions,i=this.#ea,n=new Float32Array(8*i.length);let s=0;for(const{x:a,y:r,width:o,height:l}of i){const i=a*t,c=(1-r-l)*e;n[s]=n[s+4]=i,n[s+1]=n[s+3]=c,n[s+2]=n[s+6]=i+o*t,n[s+5]=n[s+7]=c+l*e,s+=8}return n}#Ca(t){return this.#oa.serialize(t,this.#wa())}static startHighlighting(t,e,i){let{target:n,x:s,y:a}=i;const{x:r,y:o,width:l,height:c}=n.getBoundingClientRect(),d=e=>{this.#Sa(t,e)},h=t._signal,p={capture:!0,passive:!1,signal:h},u=t=>{t.preventDefault(),t.stopPropagation()},m=e=>{n.removeEventListener("pointermove",d),window.removeEventListener("blur",m),window.removeEventListener("pointerup",m),window.removeEventListener("pointerdown",u,p),window.removeEventListener("contextmenu",ee),this.#ka(t,e)};window.addEventListener("blur",m,{signal:h}),window.addEventListener("pointerup",m,{signal:h}),window.addEventListener("pointerdown",u,p),window.addEventListener("contextmenu",ee,{signal:h}),n.addEventListener("pointermove",d,{signal:h}),this._freeHighlight=new hs({x:s,y:a},[r,o,l,c],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static#Sa(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#ka(t,e){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static deserialize(t,e,i){const n=super.deserialize(t,e,i),{rect:[s,a,r,o],color:l,quadPoints:c}=t;n.color=At.makeHexColor(...l),n.#ha=t.opacity;const[d,h]=n.pageDimensions;n.width=(r-s)/d,n.height=(o-a)/h;const p=n.#ea=[];for(let u=0;u<c.length;u+=8)p.push({x:(c[4]-r)/d,y:(o-(1-c[u+5]))/h,width:(c[u+2]-c[u])/d,height:(c[u+5]-c[u+1])/h});return n.#va(),n}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;const e=this.getRect(0,0),i=ye._colorManager.convert(this.color);return{annotationType:v.HIGHLIGHT,color:i,opacity:this.#ha,thickness:this.#Ms,quadPoints:this.#Ea(),outlines:this.#Ca(e),pageIndex:this.pageIndex,rect:e,rotation:this.#wa(),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}}class gs extends ye{#Ta=0;#Ma=0;#Pa=this.canvasPointermove.bind(this);#Ra=this.canvasPointerleave.bind(this);#Da=this.canvasPointerup.bind(this);#La=this.canvasPointerdown.bind(this);#Ia=null;#Fa=(()=>new Path2D)();#Oa=!1;#Na=!1;#ja=!1;#za=null;#Ba=0;#Ha=0;#$a=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=(()=>v.INK)();constructor(t){super({...t,name:"inkEditor"}),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,e){ye.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case b.INK_THICKNESS:gs._defaultThickness=e;break;case b.INK_COLOR:gs._defaultColor=e;break;case b.INK_OPACITY:gs._defaultOpacity=e/100}}updateParams(t,e){switch(t){case b.INK_THICKNESS:this.#xa(e);break;case b.INK_COLOR:this.#is(e);break;case b.INK_OPACITY:this.#Ua(e)}}static get defaultPropertiesToUpdate(){return[[b.INK_THICKNESS,gs._defaultThickness],[b.INK_COLOR,gs._defaultColor||ye._defaultLineColor],[b.INK_OPACITY,Math.round(100*gs._defaultOpacity)]]}get propertiesToUpdate(){return[[b.INK_THICKNESS,this.thickness||gs._defaultThickness],[b.INK_COLOR,this.color||gs._defaultColor||ye._defaultLineColor],[b.INK_OPACITY,Math.round(100*(this.opacity??gs._defaultOpacity))]]}#xa(t){const e=t=>{this.thickness=t,this.#qa()},i=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:b.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#is(t){const e=t=>{this.color=t,this.#Va()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:b.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#Ua(t){const e=t=>{this.opacity=t,this.#Va()};t/=100;const i=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:b.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#Ga(),this.#Wa()),this.isAttachedToDOM||(this.parent.add(this),this.#Ka()),this.#qa()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#Ia&&(clearTimeout(this.#Ia),this.#Ia=null),this.#za?.disconnect(),this.#za=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,e]=this.parentDimensions,i=this.width*t,n=this.height*e;this.setDimensions(i,n)}enableEditMode(){this.#Oa||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#La,{signal:this._uiManager._signal}))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#La))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#Xa(){const{parentRotation:t,parentDimensions:[e,i]}=this;switch(t){case 90:return[0,i,i,e];case 180:return[e,i,e,i];case 270:return[e,0,i,e];default:return[0,0,e,i]}}#Ya(){const{ctx:t,color:e,opacity:i,thickness:n,parentScale:s,scaleFactor:a}=this;t.lineWidth=n*s/a,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${function(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")}(i)}`}#Qa(t,e){const i=this._uiManager._signal;this.canvas.addEventListener("contextmenu",ee,{signal:i}),this.canvas.addEventListener("pointerleave",this.#Ra,{signal:i}),this.canvas.addEventListener("pointermove",this.#Pa,{signal:i}),this.canvas.addEventListener("pointerup",this.#Da,{signal:i}),this.canvas.removeEventListener("pointerdown",this.#La),this.isEditing=!0,this.#ja||(this.#ja=!0,this.#Ka(),this.thickness||=gs._defaultThickness,this.color||=gs._defaultColor||ye._defaultLineColor,this.opacity??=gs._defaultOpacity),this.currentPath.push([t,e]),this.#Na=!1,this.#Ya(),this.#$a=()=>{this.#Ja(),this.#$a&&window.requestAnimationFrame(this.#$a)},window.requestAnimationFrame(this.#$a)}#Za(t,e){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===n)return;const s=this.currentPath;let a=this.#Fa;if(s.push([t,e]),this.#Na=!0,s.length<=2)return a.moveTo(...s[0]),void a.lineTo(t,e);3===s.length&&(this.#Fa=a=new Path2D,a.moveTo(...s[0])),this.#tr(a,...s.at(-3),...s.at(-2),t,e)}#er(){if(0===this.currentPath.length)return;const t=this.currentPath.at(-1);this.#Fa.lineTo(...t)}#ir(t,e){let i;if(this.#$a=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#Za(t,e),this.#er(),1!==this.currentPath.length)i=this.#nr();else{const n=[t,e];i=[[n,n.slice(),n.slice(),n]]}const n=this.#Fa,s=this.currentPath;this.currentPath=[],this.#Fa=new Path2D;this.addCommands({cmd:()=>{this.allRawPaths.push(s),this.paths.push(i),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#Ga(),this.#Wa()),this.#qa())},mustExec:!0})}#Ja(){if(!this.#Na)return;this.#Na=!1;const t=Math.ceil(this.thickness*this.parentScale),e=this.currentPath.slice(-3),i=e.map((t=>t[0])),n=e.map((t=>t[1])),{ctx:s}=(Math.min(...i),Math.max(...i),Math.min(...n),Math.max(...n),this);s.save(),s.clearRect(0,0,this.canvas.width,this.canvas.height);for(const a of this.bezierPath2D)s.stroke(a);s.stroke(this.#Fa),s.restore()}#tr(t,e,i,n,s,a,r){const o=(e+n)/2,l=(i+s)/2,c=(n+a)/2,d=(s+r)/2;t.bezierCurveTo(o+2*(n-o)/3,l+2*(s-l)/3,c+2*(n-c)/3,d+2*(s-d)/3,c,d)}#nr(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let i,[n,s]=t[0];for(i=1;i<t.length-2;i++){const[a,r]=t[i],[o,l]=t[i+1],c=(a+o)/2,d=(r+l)/2,h=[n+2*(a-n)/3,s+2*(r-s)/3],p=[c+2*(a-c)/3,d+2*(r-d)/3];e.push([[n,s],h,p,[c,d]]),[n,s]=[c,d]}const[a,r]=t[i],[o,l]=t[i+1],c=[n+2*(a-n)/3,s+2*(r-s)/3],d=[o+2*(a-o)/3,l+2*(r-l)/3];return e.push([[n,s],c,d,[o,l]]),e}#Va(){if(this.isEmpty())return void this.#sr();this.#Ya();const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),this.#sr();for(const i of this.bezierPath2D)e.stroke(i)}commit(){this.#Oa||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#Oa=!0,this.div.classList.add("disabled"),this.#qa(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){0===t.button&&this.isInEditMode()&&!this.#Oa&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#Qa(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#Za(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#ar(t)}canvasPointerleave(t){this.#ar(t)}#ar(t){this.canvas.removeEventListener("pointerleave",this.#Ra),this.canvas.removeEventListener("pointermove",this.#Pa),this.canvas.removeEventListener("pointerup",this.#Da),this.canvas.addEventListener("pointerdown",this.#La,{signal:this._uiManager._signal}),this.#Ia&&clearTimeout(this.#Ia),this.#Ia=setTimeout((()=>{this.#Ia=null,this.canvas.removeEventListener("contextmenu",ee)}),10),this.#ir(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#Ga(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#Wa(){this.#za=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)})),this.#za.observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{this.#za?.disconnect(),this.#za=null}),{once:!0})}get isResizable(){return!this.isEmpty()&&this.#Oa}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,n,s,a]=this.#Xa();if(this.setAt(i,n,0,0),this.setDims(s,a),this.#Ga(),this.width){const[i,n]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*n),this.setAt(t*i,e*n,this.width*i,this.height*n),this.#ja=!0,this.#Ka(),this.setDims(this.width*i,this.height*n),this.#Va(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#Wa(),this.div}#Ka(){if(!this.#ja)return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#sr()}setDimensions(t,e){const i=Math.round(t),n=Math.round(e);if(this.#Ba===i&&this.#Ha===n)return;this.#Ba=i,this.#Ha=n,this.canvas.style.visibility="hidden";const[s,a]=this.parentDimensions;this.width=t/s,this.height=e/a,this.fixAndSetPosition(),this.#Oa&&this.#rr(t,e),this.#Ka(),this.#Va(),this.canvas.style.visibility="visible",this.fixDims()}#rr(t,e){const i=this.#or(),n=(t-i)/this.#Ma,s=(e-i)/this.#Ta;this.scaleFactor=Math.min(n,s)}#sr(){const t=this.#or()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#lr(t){const e=new Path2D;for(let i=0,n=t.length;i<n;i++){const[n,s,a,r]=t[i];0===i&&e.moveTo(...n),e.bezierCurveTo(s[0],s[1],a[0],a[1],r[0],r[1])}return e}static#cr(t,e,i){const[n,s,a,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]+=n,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=t[e+1]+n,t[e+1]=i+s}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]+=s;break;case 270:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=a-t[e+1],t[e+1]=r-i}break;default:throw new Error("Invalid rotation")}return t}static#dr(t,e,i){const[n,s,a,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]-=n,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=t[e+1]-s,t[e+1]=i-n}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]-=s;break;case 270:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=r-t[e+1],t[e+1]=a-i}break;default:throw new Error("Invalid rotation")}return t}#hr(t,e,i,n){const s=[],a=this.thickness/2,r=t*e+a,o=t*i+a;for(const l of this.paths){const e=[],i=[];for(let n=0,s=l.length;n<s;n++){const[a,c,d,h]=l[n];if(a[0]===h[0]&&a[1]===h[1]&&1===s){const n=t*a[0]+r,s=t*a[1]+o;e.push(n,s),i.push(n,s);break}const p=t*a[0]+r,u=t*a[1]+o,m=t*c[0]+r,g=t*c[1]+o,f=t*d[0]+r,v=t*d[1]+o,b=t*h[0]+r,x=t*h[1]+o;0===n&&(e.push(p,u),i.push(p,u)),e.push(m,g,f,v,b,x),i.push(m,g),n===s-1&&i.push(b,x)}s.push({bezier:gs.#cr(e,n,this.rotation),points:gs.#cr(i,n,this.rotation)})}return s}#pr(){let t=1/0,e=-1/0,i=1/0,n=-1/0;for(const s of this.paths)for(const[a,r,o,l]of s){const s=At.bezierBoundingBox(...a,...r,...o,...l);t=Math.min(t,s[0]),i=Math.min(i,s[1]),e=Math.max(e,s[2]),n=Math.max(n,s[3])}return[t,i,e,n]}#or(){return this.#Oa?Math.ceil(this.thickness*this.parentScale):0}#qa(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!this.#Oa)return void this.#Va();const e=this.#pr(),i=this.#or();this.#Ma=Math.max(ye.MIN_SIZE,e[2]-e[0]),this.#Ta=Math.max(ye.MIN_SIZE,e[3]-e[1]);const n=Math.ceil(i+this.#Ma*this.scaleFactor),s=Math.ceil(i+this.#Ta*this.scaleFactor),[a,r]=this.parentDimensions;this.width=n/a,this.height=s/r,this.setAspectRatio(n,s);const o=this.translationX,l=this.translationY;this.translationX=-e[0],this.translationY=-e[1],this.#Ka(),this.#Va(),this.#Ba=n,this.#Ha=s,this.setDims(n,s);const c=t?i/this.scaleFactor/2:0;this.translate(o-this.translationX-c,l-this.translationY-c)}static deserialize(t,e,i){if(t instanceof Jn)return null;const n=super.deserialize(t,e,i);n.thickness=t.thickness,n.color=At.makeHexColor(...t.color),n.opacity=t.opacity;const[s,a]=n.pageDimensions,r=n.width*s,o=n.height*a,l=n.parentScale,c=t.thickness/2;n.#Oa=!0,n.#Ba=Math.round(r),n.#Ha=Math.round(o);const{paths:d,rect:h,rotation:p}=t;for(let{bezier:m}of d){m=gs.#dr(m,h,p);const t=[];n.paths.push(t);let e=l*(m[0]-c),i=l*(m[1]-c);for(let n=2,a=m.length;n<a;n+=6){const s=l*(m[n]-c),a=l*(m[n+1]-c),r=l*(m[n+2]-c),o=l*(m[n+3]-c),d=l*(m[n+4]-c),h=l*(m[n+5]-c);t.push([[e,i],[s,a],[r,o],[d,h]]),e=d,i=h}const s=this.#lr(t);n.bezierPath2D.push(s)}const u=n.#pr();return n.#Ma=Math.max(ye.MIN_SIZE,u[2]-u[0]),n.#Ta=Math.max(ye.MIN_SIZE,u[3]-u[1]),n.#rr(r,o),n}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=ye._colorManager.convert(this.ctx.strokeStyle);return{annotationType:v.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:this.#hr(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class fs extends ye{#ur=null;#mr=null;#gr=null;#fr=null;#vr=null;#br="";#xr=null;#za=null;#yr=null;#wr=!1;#Ar=!1;static _type="stamp";static _editorType=(()=>v.STAMP)();constructor(t){super({...t,name:"stampEditor"}),this.#fr=t.bitmapUrl,this.#vr=t.bitmapFile}static initialize(t,e){ye.initialize(t,e)}static get supportedTypes(){return lt(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((t=>`image/${t}`)))}static get supportedTypesStr(){return lt(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(v.STAMP,{bitmapFile:t.getAsFile()})}#_r(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?(this.#ur=t.bitmap,e||(this.#mr=t.id,this.#wr=t.isSvg),t.file&&(this.#br=t.file.name),this.#Ga()):this.remove()}#Er(){this.#gr=null,this._uiManager.enableWaiting(!1),this.#xr&&this.div.focus()}#Cr(){if(this.#mr)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#mr).then((t=>this.#_r(t,!0))).finally((()=>this.#Er()));if(this.#fr){const t=this.#fr;return this.#fr=null,this._uiManager.enableWaiting(!0),void(this.#gr=this._uiManager.imageManager.getFromUrl(t).then((t=>this.#_r(t))).finally((()=>this.#Er())))}if(this.#vr){const t=this.#vr;return this.#vr=null,this._uiManager.enableWaiting(!0),void(this.#gr=this._uiManager.imageManager.getFromFile(t).then((t=>this.#_r(t))).finally((()=>this.#Er())))}const t=document.createElement("input");t.type="file",t.accept=fs.supportedTypesStr;const e=this._uiManager._signal;this.#gr=new Promise((i=>{t.addEventListener("change",(async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#_r(e)}else this.remove();i()}),{signal:e}),t.addEventListener("cancel",(()=>{this.remove(),i()}),{signal:e})})).finally((()=>this.#Er())),t.click()}remove(){this.#mr&&(this.#ur=null,this._uiManager.imageManager.deleteId(this.#mr),this.#xr?.remove(),this.#xr=null,this.#za?.disconnect(),this.#za=null,this.#yr&&(clearTimeout(this.#yr),this.#yr=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#mr&&null===this.#xr&&this.#Cr(),this.isAttachedToDOM||this.parent.add(this))):this.#mr&&this.#Cr()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#gr||this.#ur||this.#fr||this.#vr||this.#mr)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),this.#ur?this.#Ga():this.#Cr(),this.width){const[i,n]=this.parentDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n)}return this.div}#Ga(){const{div:t}=this;let{width:e,height:i}=this.#ur;const[n,s]=this.pageDimensions,a=.75;if(this.width)e=this.width*n,i=this.height*s;else if(e>a*n||i>a*s){const t=Math.min(a*n/e,a*s/i);e*=t,i*=t}const[r,o]=this.parentDimensions;this.setDims(e*r/n,i*o/s),this._uiManager.enableWaiting(!1);const l=this.#xr=document.createElement("canvas");t.append(l),t.hidden=!1,this.#Sr(e,i),this.#Wa(),this.#Ar||(this.parent.addUndoableEditor(this),this.#Ar=!0),this._reportTelemetry({action:"inserted_image"}),this.#br&&l.setAttribute("aria-label",this.#br)}#kr(t,e){const[i,n]=this.parentDimensions;this.width=t/i,this.height=e/n,this.setDims(t,e),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#yr&&clearTimeout(this.#yr);this.#yr=setTimeout((()=>{this.#yr=null,this.#Sr(t,e)}),200)}#Tr(t,e){const{width:i,height:n}=this.#ur;let s=i,a=n,r=this.#ur;for(;s>2*t||a>2*e;){const i=s,n=a;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const o=new OffscreenCanvas(s,a);o.getContext("2d").drawImage(r,0,0,i,n,0,0,s,a),r=o.transferToImageBitmap()}return r}#Sr(t,e){t=Math.ceil(t),e=Math.ceil(e);const i=this.#xr;if(!i||i.width===t&&i.height===e)return;i.width=t,i.height=e;const n=this.#wr?this.#ur:this.#Tr(t,e);if(this._uiManager.hasMLManager&&!this.hasAltText()){const i=new OffscreenCanvas(t,e).getContext("2d");i.drawImage(n,0,0,n.width,n.height,0,0,t,e),this._uiManager.mlGuess({service:"image-to-text",request:{data:i.getImageData(0,0,t,e).data,width:t,height:e,channels:4}}).then((t=>{const e=t?.output||"";this.parent&&e&&!this.hasAltText()&&(this.altTextData={altText:e,decorative:!1})}))}const s=i.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(n,0,0,n.width,n.height,0,0,t,e)}getImageForAltText(){return this.#xr}#Mr(t){if(t){if(this.#wr){const t=this._uiManager.imageManager.getSvgUrl(this.#mr);if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=this.#ur);return t.getContext("2d").drawImage(this.#ur,0,0),t.toDataURL()}if(this.#wr){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*$t.PDF_TO_CSS_UNITS),n=Math.round(this.height*e*$t.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,n);return s.getContext("2d").drawImage(this.#ur,0,0,this.#ur.width,this.#ur.height,0,0,i,n),s.transferToImageBitmap()}return structuredClone(this.#ur)}#Wa(){this._uiManager._signal&&(this.#za=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.#kr(e.width,e.height)})),this.#za.observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{this.#za?.disconnect(),this.#za=null}),{once:!0}))}static deserialize(t,e,i){if(t instanceof ns)return null;const n=super.deserialize(t,e,i),{rect:s,bitmapUrl:a,bitmapId:r,isSvg:o,accessibilityData:l}=t;r&&i.imageManager.isValidId(r)?n.#mr=r:n.#fr=a,n.#wr=o;const[c,d]=n.pageDimensions;return n.width=(s[2]-s[0])/c,n.height=(s[3]-s[1])/d,l&&(n.altTextData=l),n}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;const i={annotationType:v.STAMP,bitmapId:this.#mr,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#wr,structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=this.#Mr(!0),i.accessibilityData=this.altTextData,i;const{decorative:n,altText:s}=this.altTextData;if(!n&&s&&(i.accessibilityData={type:"Figure",alt:s}),null===e)return i;e.stamps||=new Map;const a=this.#wr?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#mr)){if(this.#wr){const t=e.stamps.get(this.#mr);a>t.area&&(t.area=a,t.serialized.bitmap.close(),t.serialized.bitmap=this.#Mr(!1))}}else e.stamps.set(this.#mr,{area:a,serialized:i}),i.bitmap=this.#Mr(!1);return i}}class vs{#$n;#Pr=!1;#Rr=null;#Dr=null;#Lr=null;#Ir=null;#Fr=null;#Or=(()=>new Map)();#Nr=!1;#jr=!1;#zr=!1;#Br=null;#u;static _initialized=!1;static#N=(()=>new Map([os,gs,fs,ms].map((t=>[t._editorType,t]))))();constructor(t){let{uiManager:e,pageIndex:i,div:n,accessibilityManager:s,annotationLayer:a,drawLayer:r,textLayer:o,viewport:l,l10n:c}=t;const d=[...vs.#N.values()];if(!vs._initialized){vs._initialized=!0;for(const t of d)t.initialize(c,e)}e.registerEditorTypes(d),this.#u=e,this.pageIndex=i,this.div=n,this.#$n=s,this.#Rr=a,this.viewport=l,this.#Br=o,this.drawLayer=r,this.#u.addLayer(this)}get isEmpty(){return 0===this.#Or.size}get isInvisible(){return this.isEmpty&&this.#u.getMode()===v.NONE}updateToolbar(t){this.#u.updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#u.getMode();switch(this.#Hr(),t){case v.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case v.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case v.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const i of vs.#N.values())e.toggle(`${i._type}Editing`,t===i._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#Br?.div}addInkEditorIfNeeded(t){if(this.#u.getMode()!==v.INK)return;if(!t)for(const e of this.#Or.values())if(e.isEmpty())return void e.setInBackground();this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){this.#u.setEditingState(t)}addCommands(t){this.#u.addCommands(t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#Rr?.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const i of this.#Or.values())i.enableEditing(),i.show(!0),i.annotationElementId&&(this.#u.removeChangedExistingAnnotation(i),t.add(i.annotationElementId));if(!this.#Rr)return;const e=this.#Rr.getEditableAnnotations();for(const i of e){if(i.hide(),this.#u.isDeletedAnnotationElement(i.data.id))continue;if(t.has(i.data.id))continue;const e=this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}}disable(){this.#zr=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of this.#Or.values())n.disableEditing(),n.annotationElementId&&(null===n.serialize()?(e.set(n.annotationElementId,n),this.getEditableAnnotation(n.annotationElementId)?.show(),n.remove()):t.set(n.annotationElementId,n));if(this.#Rr){const i=this.#Rr.getEditableAnnotations();for(const n of i){const{id:i}=n.data;if(this.#u.isDeletedAnnotationElement(i))continue;let s=e.get(i);s?(s.resetAnnotationElement(n),s.show(!1),n.show()):(s=t.get(i),s&&(this.#u.addChangedExistingAnnotation(s),s.renderAnnotationElement(n),s.show(!1)),n.show())}}this.#Hr(),this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const n of vs.#N.values())i.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#zr=!1}getEditableAnnotation(t){return this.#Rr?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#u.getActive()!==t&&this.#u.setActiveEditor(t)}enableTextSelection(){this.div.tabIndex=-1,this.#Br?.div&&!this.#Ir&&(this.#Ir=this.#$r.bind(this),this.#Br.div.addEventListener("pointerdown",this.#Ir,{signal:this.#u._signal}),this.#Br.div.classList.add("highlighting"))}disableTextSelection(){this.div.tabIndex=0,this.#Br?.div&&this.#Ir&&(this.#Br.div.removeEventListener("pointerdown",this.#Ir),this.#Ir=null,this.#Br.div.classList.remove("highlighting"))}#$r(t){if(this.#u.unselectAll(),t.target===this.#Br.div){const{isMac:e}=yt.platform;if(0!==t.button||t.ctrlKey&&e)return;this.#u.showAllEditors("highlight",!0,!0),this.#Br.div.classList.add("free"),ms.startHighlighting(this,"ltr"===this.#u.direction,t),this.#Br.div.addEventListener("pointerup",(()=>{this.#Br.div.classList.remove("free")}),{once:!0,signal:this.#u._signal}),t.preventDefault()}}enableClick(){if(this.#Lr)return;const t=this.#u._signal;this.#Lr=this.pointerdown.bind(this),this.#Dr=this.pointerup.bind(this),this.div.addEventListener("pointerdown",this.#Lr,{signal:t}),this.div.addEventListener("pointerup",this.#Dr,{signal:t})}disableClick(){this.#Lr&&(this.div.removeEventListener("pointerdown",this.#Lr),this.div.removeEventListener("pointerup",this.#Dr),this.#Lr=null,this.#Dr=null)}attach(t){this.#Or.set(t.id,t);const{annotationElementId:e}=t;e&&this.#u.isDeletedAnnotationElement(e)&&this.#u.removeDeletedAnnotationElement(t)}detach(t){this.#Or.delete(t.id),this.#$n?.removePointerInTextLayer(t.contentDiv),!this.#zr&&t.annotationElementId&&this.#u.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#u.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#jr||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#u.addDeletedAnnotationElement(t.annotationElementId),ye.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),this.#u.addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#u.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!this.#Fr&&(t._focusEventsAllowed=!1,this.#Fr=setTimeout((()=>{this.#Fr=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:this.#u._signal}),e.focus())}),0)),t._structTreeParentId=this.#$n?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#u.getId()}get#Ur(){return vs.#N.get(this.#u.getMode())}get _signal(){return this.#u._signal}#qr(t){const e=this.#Ur;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#Ur?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#u.updateToolbar(t),this.#u.updateMode(t);const{offsetX:i,offsetY:n}=this.#Vr(),s=this.getNextId(),a=this.#qr({parent:this,id:s,x:i,y:n,uiManager:this.#u,isCentered:!0,...e});a&&this.add(a)}deserialize(t){return vs.#N.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#u)||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getNextId(),s=this.#qr({parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:this.#u,isCentered:e,...i});return s&&this.add(s),s}#Vr(){const{x:t,y:e,width:i,height:n}=this.div.getBoundingClientRect(),s=Math.max(0,t),a=Math.max(0,e),r=(s+Math.min(window.innerWidth,t+i))/2-t,o=(a+Math.min(window.innerHeight,e+n))/2-e,[l,c]=this.viewport.rotation%180===0?[r,o]:[o,r];return{offsetX:l,offsetY:c}}addNewEditor(){this.createAndAddNewEditor(this.#Vr(),!0)}setSelected(t){this.#u.setSelected(t)}toggleSelected(t){this.#u.toggleSelected(t)}isSelected(t){return this.#u.isSelected(t)}unselect(t){this.#u.unselect(t)}pointerup(t){const{isMac:e}=yt.platform;0!==t.button||t.ctrlKey&&e||t.target===this.div&&this.#Nr&&(this.#Nr=!1,this.#Pr?this.#u.getMode()!==v.STAMP?this.createAndAddNewEditor(t,!1):this.#u.unselectAll():this.#Pr=!0)}pointerdown(t){if(this.#u.getMode()===v.HIGHLIGHT&&this.enableTextSelection(),this.#Nr)return void(this.#Nr=!1);const{isMac:e}=yt.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;this.#Nr=!0;const i=this.#u.getActive();this.#Pr=!i||i.isEmpty()}findNewParent(t,e,i){const n=this.#u.findParent(e,i);return null!==n&&n!==this&&(n.changeParent(t),!0)}destroy(){this.#u.getActive()?.parent===this&&(this.#u.commitOrRemove(),this.#u.setActiveEditor(null)),this.#Fr&&(clearTimeout(this.#Fr),this.#Fr=null);for(const t of this.#Or.values())this.#$n?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#Or.clear(),this.#u.removeLayer(this)}#Hr(){this.#jr=!0;for(const t of this.#Or.values())t.isEmpty()&&t.remove();this.#jr=!1}render(t){let{viewport:e}=t;this.viewport=e,ce(this.div,e);for(const i of this.#u.getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update(t){let{viewport:e}=t;this.#u.commitOrRemove(),this.#Hr();const i=this.viewport.rotation,n=e.rotation;if(this.viewport=e,ce(this.div,{rotation:n}),i!==n)for(const s of this.#Or.values())s.rotate(n);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#u.viewParameters.realScale}}class bs{#An=null;#v=0;#Gr=(()=>new Map)();#Wr=(()=>new Map)();constructor(t){let{pageIndex:e}=t;this.pageIndex=e}setParent(t){if(this.#An){if(this.#An!==t){if(this.#Gr.size>0)for(const e of this.#Gr.values())e.remove(),t.append(e);this.#An=t}}else this.#An=t}static get _svgFactory(){return lt(this,"_svgFactory",new Gt)}static#Kr(t){let{x:e=0,y:i=0,width:n=1,height:s=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{style:a}=t;a.top=100*i+"%",a.left=100*e+"%",a.width=100*n+"%",a.height=100*s+"%"}#Xr(t){const e=bs._svgFactory.create(1,1,!0);return this.#An.append(e),e.setAttribute("aria-hidden",!0),bs.#Kr(e,t),e}#Yr(t,e){const i=bs._svgFactory.createElement("clipPath");t.append(i);const n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");const s=bs._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),n}highlight(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=this.#v++,a=this.#Xr(t.box);a.classList.add("highlight"),t.free&&a.classList.add("free");const r=bs._svgFactory.createElement("defs");a.append(r);const o=bs._svgFactory.createElement("path");r.append(o);const l=`path_p${this.pageIndex}_${s}`;o.setAttribute("id",l),o.setAttribute("d",t.toSVGPath()),n&&this.#Wr.set(s,o);const c=this.#Yr(r,l),d=bs._svgFactory.createElement("use");return a.append(d),a.setAttribute("fill",e),a.setAttribute("fill-opacity",i),d.setAttribute("href",`#${l}`),this.#Gr.set(s,a),{id:s,clipPathId:`url(#${c})`}}highlightOutline(t){const e=this.#v++,i=this.#Xr(t.box);i.classList.add("highlightOutline");const n=bs._svgFactory.createElement("defs");i.append(n);const s=bs._svgFactory.createElement("path");n.append(s);const a=`path_p${this.pageIndex}_${e}`;let r;if(s.setAttribute("id",a),s.setAttribute("d",t.toSVGPath()),s.setAttribute("vector-effect","non-scaling-stroke"),t.free){i.classList.add("free");const t=bs._svgFactory.createElement("mask");n.append(t),r=`mask_p${this.pageIndex}_${e}`,t.setAttribute("id",r),t.setAttribute("maskUnits","objectBoundingBox");const s=bs._svgFactory.createElement("rect");t.append(s),s.setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","white");const o=bs._svgFactory.createElement("use");t.append(o),o.setAttribute("href",`#${a}`),o.setAttribute("stroke","none"),o.setAttribute("fill","black"),o.setAttribute("fill-rule","nonzero"),o.classList.add("mask")}const o=bs._svgFactory.createElement("use");i.append(o),o.setAttribute("href",`#${a}`),r&&o.setAttribute("mask",`url(#${r})`);const l=o.cloneNode();return i.append(l),o.classList.add("mainOutline"),l.classList.add("secondaryOutline"),this.#Gr.set(e,i),e}finalizeLine(t,e){const i=this.#Wr.get(t);this.#Wr.delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){this.#Gr.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),this.#Wr.delete(t)}updatePath(t,e){this.#Wr.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){bs.#Kr(this.#Gr.get(t),e)}show(t,e){this.#Gr.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#Gr.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#Gr.get(t).setAttribute("fill",e)}changeOpacity(t,e){this.#Gr.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#Gr.get(t).classList.add(e)}removeClass(t,e){this.#Gr.get(t).classList.remove(e)}remove(t){null!==this.#An&&(this.#Gr.get(t).remove(),this.#Gr.delete(t))}destroy(){this.#An=null;for(const t of this.#Gr.values())t.remove();this.#Gr.clear()}}var xs=s.AnnotationLayer,ys=s.AnnotationMode,ws=s.GlobalWorkerOptions,As=s.PDFDataRangeTransport,_s=s.TextLayer,Es=s.getDocument},97806:(t,e,i)=>{"use strict";i.d(e,{A:()=>C});var n=i(70579),s=i(65043),a=i(77906),r=i(40645),o=i(58387),l=i(3404),c=i(96440),d=Object.prototype.hasOwnProperty;function h(t,e,i){for(i of t.keys())if(p(i,e))return i}function p(t,e){var i,n,s;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((n=t.length)===e.length)for(;n--&&p(t[n],e[n]););return-1===n}if(i===Set){if(t.size!==e.size)return!1;for(n of t){if((s=n)&&"object"===typeof s&&!(s=h(e,s)))return!1;if(!e.has(s))return!1}return!0}if(i===Map){if(t.size!==e.size)return!1;for(n of t){if((s=n[0])&&"object"===typeof s&&!(s=h(e,s)))return!1;if(!p(n[1],e.get(s)))return!1}return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((n=t.byteLength)===e.byteLength)for(;n--&&t.getInt8(n)===e.getInt8(n););return-1===n}if(ArrayBuffer.isView(t)){if((n=t.byteLength)===e.byteLength)for(;n--&&t[n]===e[n];);return-1===n}if(!i||"object"===typeof t){for(i in n=0,t){if(d.call(t,i)&&++n&&!d.call(e,i))return!1;if(!(i in e)||!p(t[i],e[i]))return!1}return Object.keys(e).length===n}}return t!==t&&e!==e}var u=i(79355),m=i(16512),g=i(48599);class f{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return(0,l.A)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){(0,l.A)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise((e=>{(0,l.A)(this.pdfDocument,"PDF document not loaded."),(0,l.A)(t,"Destination is not specified."),"string"===typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)})).then((t=>{(0,l.A)(Array.isArray(t),`"${t}" is not a valid destination array.`);const e=t[0];new Promise((t=>{(0,l.A)(this.pdfDocument,"PDF document not loaded."),e instanceof Object?this.pdfDocument.getPageIndex(e).then((e=>{t(e)})).catch((()=>{(0,l.A)(!1,`"${e}" is not a valid page reference.`)})):"number"===typeof e?t(e):(0,l.A)(!1,`"${e}" is not a valid destination reference.`)})).then((e=>{const i=e+1;(0,l.A)(this.pdfViewer,"PDF viewer is not initialized."),(0,l.A)(i>=1&&i<=this.pagesCount,`"${i}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})}))}))}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;(0,l.A)(this.pdfViewer,"PDF viewer is not initialized."),(0,l.A)(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const v={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};var b=i(20665),x=i(28234),y=function(t,e,i,n){return new(i||(i=Promise))((function(s,a){function r(t){try{l(n.next(t))}catch(e){a(e)}}function o(t){try{l(n.throw(t))}catch(e){a(e)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,o)}l((n=n.apply(t,e||[])).next())}))},w=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(i[n[s]]=t[n[s]])}return i};const{Tm:A}=u,_=(t,e)=>{switch(e){case v.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case v.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."));break}};function E(t){return"object"===typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const C=(0,s.forwardRef)((function(t,e){var{children:i,className:d,error:h="Failed to load PDF file.",externalLinkRel:v,externalLinkTarget:C,file:S,inputRef:k,imageResourcesPath:T,loading:M="Loading PDF\u2026",noData:P="No PDF file specified.",onItemClick:R,onLoadError:D,onLoadProgress:L,onLoadSuccess:I,onPassword:F=_,onSourceError:O,onSourceSuccess:N,options:j,renderMode:z,rotate:B}=t,H=w(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[$,U]=(0,x.A)(),{value:q,error:V}=$,[G,W]=(0,x.A)(),{value:K,error:X}=G,Y=(0,s.useRef)(new f),Q=(0,s.useRef)([]),J=(0,s.useRef)(void 0),Z=(0,s.useRef)(void 0);S&&S!==J.current&&E(S)&&(c(!p(S,J.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),J.current=S),j&&j!==Z.current&&(c(!p(j,Z.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),Z.current=j);const tt=(0,s.useRef)({scrollPageIntoView:t=>{const{dest:e,pageNumber:i,pageIndex:n=i-1}=t;if(R)return void R({dest:e,pageIndex:n,pageNumber:i});const s=Q.current[n];s?s.scrollIntoView():c(!1,`An internal link leading to page ${i} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});(0,s.useImperativeHandle)(e,(()=>({linkService:Y,pages:Q,viewer:tt})),[]),(0,s.useEffect)((function(){U({type:"RESET"})}),[S,U]);const et=(0,s.useCallback)((()=>y(this,void 0,void 0,(function*(){if(!S)return null;if("string"===typeof S){if((0,b.zL)(S)){return{data:(0,b.jA)(S)}}return(0,b.qC)(),{url:S}}if(S instanceof A)return{range:S};if((0,b.mw)(S))return{data:S};if(b.Bd&&(0,b.qf)(S)){return{data:yield(0,b.h1)(S)}}if((0,l.A)("object"===typeof S,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),(0,l.A)(E(S),"Invalid parameter object: need either .data, .range or .url"),"url"in S&&"string"===typeof S.url){if((0,b.zL)(S.url)){const{url:t}=S,e=w(S,["url"]),i=(0,b.jA)(t);return Object.assign({data:i},e)}(0,b.qC)()}return S}))),[S]);(0,s.useEffect)((()=>{const t=(0,r.A)(et());return t.promise.then((t=>{U({type:"RESOLVE",value:t})})).catch((t=>{U({type:"REJECT",error:t})})),()=>{(0,b.xL)(t)}}),[et,U]),(0,s.useEffect)((()=>{"undefined"!==typeof q&&(!1!==q?N&&N():V&&(c(!1,V.toString()),O&&O(V)))}),[q]),(0,s.useEffect)((function(){W({type:"RESET"})}),[W,q]),(0,s.useEffect)((function(){if(!q)return;const t=j?Object.assign(Object.assign({},q),j):q,e=u.YE(t);L&&(e.onProgress=L),F&&(e.onPassword=F);const i=e,n=i.promise.then((t=>{W({type:"RESOLVE",value:t})})).catch((t=>{i.destroyed||W({type:"REJECT",error:t})}));return()=>{n.finally((()=>i.destroy()))}}),[j,W,q]),(0,s.useEffect)((()=>{"undefined"!==typeof K&&(!1!==K?K&&(I&&I(K),Q.current=new Array(K.numPages),Y.current.setDocument(K)):X&&(c(!1,X.toString()),D&&D(X)))}),[K]),(0,s.useEffect)((function(){Y.current.setViewer(tt.current),Y.current.setExternalLinkRel(v),Y.current.setExternalLinkTarget(C)}),[v,C]);const it=(0,s.useCallback)(((t,e)=>{Q.current[t]=e}),[]),nt=(0,s.useCallback)((t=>{delete Q.current[t]}),[]),st=(0,s.useMemo)((()=>({imageResourcesPath:T,linkService:Y.current,onItemClick:R,pdf:K,registerPage:it,renderMode:z,rotate:B,unregisterPage:nt})),[T,R,K,it,z,B,nt]),at=(0,s.useMemo)((()=>(0,a.Ay)(H,(()=>K))),[H,K]);return(0,n.jsx)("div",Object.assign({className:(0,o.A)("react-pdf__Document",d),ref:k,style:{"--scale-factor":"1"}},at,{children:S?void 0===K||null===K?(0,n.jsx)(g.A,{type:"loading",children:"function"===typeof M?M():M}):!1===K?(0,n.jsx)(g.A,{type:"error",children:"function"===typeof h?h():h}):(0,n.jsx)(m.A.Provider,{value:st,children:i}):(0,n.jsx)(g.A,{type:"no-data",children:"function"===typeof P?P():P})}))}))},16512:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n=(0,i(65043).createContext)(null)},48599:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var n=i(70579);function s(t){let{children:e,type:i}=t;return(0,n.jsx)("div",{className:`react-pdf__message react-pdf__message--${i}`,children:e})}},6584:(t,e,i)=>{"use strict";i.d(e,{A:()=>I});var n=i(70579),s=i(65043),a=i(40645),r=i(77906),o=i(58387);function l(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=t.filter(Boolean);return i.length<=1?i[0]||null:function(t){i.forEach((function(e){"function"===typeof e?e(t):e&&(e.current=t)}))}}var c=i(3404),d=i(96440);const h=(0,s.createContext)(null);var p=i(48599),u=i(79355);const m={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},g=/^H(\d+)$/;function f(t){return"children"in t}function v(t){return!!f(t)&&(1===t.children.length&&0 in t.children&&"id"in t.children[0])}function b(t){const e={};if(f(t)){const{role:i}=t,n=i.match(g);if(n)e.role="heading",e["aria-level"]=Number(n[1]);else if(function(t){return t in m}(i)){const t=m[i];t&&(e.role=t)}}return e}function x(t){const e={};if(f(t)){if(void 0!==t.alt&&(e["aria-label"]=t.alt),void 0!==t.lang&&(e.lang=t.lang),v(t)){const[i]=t.children;if(i){const t=x(i);return Object.assign(Object.assign({},e),t)}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function y(t){return t?Object.assign(Object.assign({},b(t)),x(t)):null}function w(t){let{className:e,node:i}=t;const a=(0,s.useMemo)((()=>y(i)),[i]),r=(0,s.useMemo)((()=>f(i)?v(i)?null:i.children.map(((t,e)=>(0,n.jsx)(w,{node:t},e))):null),[i]);return(0,n.jsx)("span",Object.assign({className:e},a,{children:r}))}function A(){return(0,s.useContext)(h)}var _=i(28234),E=i(20665);function C(){const t=A();(0,c.A)(t,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[r,o]=(0,_.A)(),{value:l,error:h}=r,{customTextRenderer:p,page:u}=t;return(0,s.useEffect)((function(){o({type:"RESET"})}),[o,u]),(0,s.useEffect)((function(){if(p)return;if(!u)return;const t=(0,a.A)(u.getStructTree()),e=t;return t.promise.then((t=>{o({type:"RESOLVE",value:t})})).catch((t=>{o({type:"REJECT",error:t})})),()=>(0,E.xL)(e)}),[p,u,o]),(0,s.useEffect)((()=>{void 0!==l&&(!1!==l?l&&i&&i(l):h&&(d(!1,h.toString()),e&&e(h)))}),[l]),l?(0,n.jsx)(w,{className:"react-pdf__Page__structTree structTree",node:l}):null}const S=u.ng;function k(t){const e=A();(0,c.A)(e,"Unable to find Page context.");const i=Object.assign(Object.assign({},e),t),{_className:a,canvasBackground:r,devicePixelRatio:o=(0,E.mZ)(),onRenderError:h,onRenderSuccess:p,page:u,renderForms:m,renderTextLayer:g,rotate:f,scale:v}=i,{canvasRef:b}=t;(0,c.A)(u,"Attempted to render page canvas, but no page was specified.");const x=(0,s.useRef)(null);function y(t){(0,E.UT)(t)||(d(!1,t.toString()),h&&h(t))}const w=(0,s.useMemo)((()=>u.getViewport({scale:v*o,rotation:f})),[o,u,f,v]),_=(0,s.useMemo)((()=>u.getViewport({scale:v,rotation:f})),[u,f,v]);(0,s.useEffect)((function(){if(!u)return;u.cleanup();const{current:t}=x;if(!t)return;t.width=w.width,t.height=w.height,t.style.width=`${Math.floor(_.width)}px`,t.style.height=`${Math.floor(_.height)}px`,t.style.visibility="hidden";const e={annotationMode:m?S.ENABLE_FORMS:S.ENABLE,canvasContext:t.getContext("2d",{alpha:!1}),viewport:w};r&&(e.background=r);const i=u.render(e),n=i;return i.promise.then((()=>{t.style.visibility="",u&&p&&p((0,E.vS)(u,v))})).catch(y),()=>(0,E.xL)(n)}),[r,u,m,w,_]);const k=(0,s.useCallback)((()=>{const{current:t}=x;t&&(t.width=0,t.height=0)}),[]);return(0,s.useEffect)((()=>k),[k]),(0,n.jsx)("canvas",{className:`${a}__canvas`,dir:"ltr",ref:l(b,x),style:{display:"block",userSelect:"none"},children:g?(0,n.jsx)(C,{}):null})}function T(){const t=A();(0,c.A)(t,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:r,onRenderTextLayerError:l,onRenderTextLayerSuccess:h,page:p,pageIndex:m,pageNumber:g,rotate:f,scale:v}=t;(0,c.A)(p,"Attempted to load page text content, but no page was specified.");const[b,x]=(0,_.A)(),{value:y,error:w}=b,C=(0,s.useRef)(null),S=(0,s.useRef)(void 0);d(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),(0,s.useEffect)((function(){x({type:"RESET"})}),[p,x]),(0,s.useEffect)((function(){if(!p)return;const t=(0,a.A)(p.getTextContent()),e=t;return t.promise.then((t=>{x({type:"RESOLVE",value:t})})).catch((t=>{x({type:"REJECT",error:t})})),()=>(0,E.xL)(e)}),[p,x]),(0,s.useEffect)((()=>{void 0!==y&&(!1!==y?y&&r&&r(y):w&&(d(!1,w.toString()),i&&i(w)))}),[y]);const k=(0,s.useCallback)((()=>{h&&h()}),[h]),T=(0,s.useCallback)((t=>{d(!1,t.toString()),l&&l(t)}),[l]);const M=(0,s.useMemo)((()=>p.getViewport({scale:v,rotation:f})),[p,f,v]);return(0,s.useLayoutEffect)((function(){if(!p||!y)return;const{current:t}=C;if(!t)return;t.innerHTML="";const i=p.streamTextContent({includeMarkedContent:!0}),n={container:t,textContentSource:i,viewport:M},s=new u.D6(n),a=s;return s.render().then((()=>{const i=document.createElement("div");i.className="endOfContent",t.append(i),S.current=i;const n=t.querySelectorAll('[role="presentation"]');if(e){let t=0;y.items.forEach(((i,s)=>{if(!function(t){return"str"in t}(i))return;const a=n[t];if(!a)return;const r=e(Object.assign({pageIndex:m,pageNumber:g,itemIndex:s},i));a.innerHTML=r,t+=i.str&&i.hasEOL?2:1}))}k()})).catch(T),()=>(0,E.xL)(a)}),[e,T,k,p,m,g,y,M]),(0,n.jsx)("div",{className:(0,o.A)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=S.current;t&&t.classList.remove("active")},onMouseDown:function(){const t=S.current;t&&t.classList.add("active")},ref:C})}var M=i(16512);function P(){return(0,s.useContext)(M.A)}function R(){const t=P(),e=A();(0,c.A)(e,"Unable to find Page context.");const i=Object.assign(Object.assign({},t),e),{imageResourcesPath:r,linkService:l,onGetAnnotationsError:h,onGetAnnotationsSuccess:p,onRenderAnnotationLayerError:m,onRenderAnnotationLayerSuccess:g,page:f,pdf:v,renderForms:b,rotate:x,scale:y=1}=i;(0,c.A)(v,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),(0,c.A)(f,"Attempted to load page annotations, but no page was specified."),(0,c.A)(l,"Attempted to load page annotations, but no linkService was specified.");const[w,C]=(0,_.A)(),{value:S,error:k}=w,T=(0,s.useRef)(null);d(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,s.useEffect)((function(){C({type:"RESET"})}),[C,f]),(0,s.useEffect)((function(){if(!f)return;const t=(0,a.A)(f.getAnnotations()),e=t;return t.promise.then((t=>{C({type:"RESOLVE",value:t})})).catch((t=>{C({type:"REJECT",error:t})})),()=>{(0,E.xL)(e)}}),[C,f]),(0,s.useEffect)((()=>{void 0!==S&&(!1!==S?S&&p&&p(S):k&&(d(!1,k.toString()),h&&h(k)))}),[S]);const M=(0,s.useMemo)((()=>f.getViewport({scale:y,rotation:x})),[f,x,y]);return(0,s.useEffect)((function(){if(!v||!f||!l||!S)return;const{current:t}=T;if(!t)return;const e=M.clone({dontFlip:!0}),i={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:t,l10n:null,page:f,viewport:e},n={annotations:S,annotationStorage:v.annotationStorage,div:t,imageResourcesPath:r,linkService:l,page:f,renderForms:b,viewport:e};t.innerHTML="";try{new u.dU(i).render(n),g&&g()}catch(s){!function(t){d(!1,`${t}`),m&&m(t)}(s)}return()=>{}}),[S,r,l,f,v,b,M]),(0,n.jsx)("div",{className:(0,o.A)("react-pdf__Page__annotations","annotationLayer"),ref:T})}var D=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(i[n[s]]=t[n[s]])}return i};const L=1;function I(t){const e=P(),i=Object.assign(Object.assign({},e),t),{_className:u="react-pdf__Page",_enableRegisterUnregisterPage:m=!0,canvasBackground:g,canvasRef:f,children:v,className:b,customRenderer:x,customTextRenderer:y,devicePixelRatio:w,error:A="Failed to load the page.",height:C,inputRef:S,loading:M="Loading page\u2026",noData:I="No page specified.",onGetAnnotationsError:F,onGetAnnotationsSuccess:O,onGetStructTreeError:N,onGetStructTreeSuccess:j,onGetTextError:z,onGetTextSuccess:B,onLoadError:H,onLoadSuccess:$,onRenderAnnotationLayerError:U,onRenderAnnotationLayerSuccess:q,onRenderError:V,onRenderSuccess:G,onRenderTextLayerError:W,onRenderTextLayerSuccess:K,pageIndex:X,pageNumber:Y,pdf:Q,registerPage:J,renderAnnotationLayer:Z=!0,renderForms:tt=!1,renderMode:et="canvas",renderTextLayer:it=!0,rotate:nt,scale:st=L,unregisterPage:at,width:rt}=i,ot=D(i,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[lt,ct]=(0,_.A)(),{value:dt,error:ht}=lt,pt=(0,s.useRef)(null);(0,c.A)(Q,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const ut=(0,E.ci)(Y)?Y-1:null!==X&&void 0!==X?X:null,mt=null!==Y&&void 0!==Y?Y:(0,E.ci)(X)?X+1:null,gt=null!==nt&&void 0!==nt?nt:dt?dt.rotate:null,ft=(0,s.useMemo)((()=>{if(!dt)return null;let t=1;const e=null!==st&&void 0!==st?st:L;if(rt||C){const e=dt.getViewport({scale:1,rotation:gt});rt?t=rt/e.width:C&&(t=C/e.height)}return e*t}),[C,dt,gt,st,rt]);(0,s.useEffect)((function(){return()=>{(0,E.ci)(ut)&&m&&at&&at(ut)}}),[m,Q,ut,at]),(0,s.useEffect)((function(){ct({type:"RESET"})}),[ct,Q,ut]),(0,s.useEffect)((function(){if(!Q||!mt)return;const t=(0,a.A)(Q.getPage(mt)),e=t;return t.promise.then((t=>{ct({type:"RESOLVE",value:t})})).catch((t=>{ct({type:"REJECT",error:t})})),()=>(0,E.xL)(e)}),[ct,Q,mt]),(0,s.useEffect)((()=>{void 0!==dt&&(!1!==dt?function(){if($){if(!dt||!ft)return;$((0,E.vS)(dt,ft))}if(m&&J){if(!(0,E.ci)(ut)||!pt.current)return;J(ut,pt.current)}}():ht&&(d(!1,ht.toString()),H&&H(ht)))}),[dt,ft]);const vt=(0,s.useMemo)((()=>dt&&(0,E.ci)(ut)&&mt&&(0,E.ci)(gt)&&(0,E.ci)(ft)?{_className:u,canvasBackground:g,customTextRenderer:y,devicePixelRatio:w,onGetAnnotationsError:F,onGetAnnotationsSuccess:O,onGetStructTreeError:N,onGetStructTreeSuccess:j,onGetTextError:z,onGetTextSuccess:B,onRenderAnnotationLayerError:U,onRenderAnnotationLayerSuccess:q,onRenderError:V,onRenderSuccess:G,onRenderTextLayerError:W,onRenderTextLayerSuccess:K,page:dt,pageIndex:ut,pageNumber:mt,renderForms:tt,renderTextLayer:it,rotate:gt,scale:ft}:null),[u,g,y,w,F,O,N,j,z,B,U,q,V,G,W,K,dt,ut,mt,tt,it,gt,ft]),bt=(0,s.useMemo)((()=>(0,r.Ay)(ot,(()=>dt?ft?(0,E.vS)(dt,ft):void 0:dt))),[ot,dt,ft]),xt=`${ut}@${ft}/${gt}`;function yt(){switch(et){case"custom":return(0,c.A)(x,'renderMode was set to "custom", but no customRenderer was passed.'),(0,n.jsx)(x,{},`${xt}_custom`);case"none":return null;default:return(0,n.jsx)(k,{canvasRef:f},`${xt}_canvas`)}}return(0,n.jsx)("div",Object.assign({className:(0,o.A)(u,b),"data-page-number":mt,ref:l(S,pt),style:{"--scale-factor":`${ft}`,backgroundColor:g||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},bt,{children:mt?null===Q||void 0===dt||null===dt?(0,n.jsx)(p.A,{type:"loading",children:"function"===typeof M?M():M}):!1===Q||!1===dt?(0,n.jsx)(p.A,{type:"error",children:"function"===typeof A?A():A}):(0,n.jsxs)(h.Provider,{value:vt,children:[yt(),it?(0,n.jsx)(T,{},`${xt}_text`):null,Z?(0,n.jsx)(R,{},`${xt}_annotations`):null,v]}):(0,n.jsx)(p.A,{type:"no-data",children:"function"===typeof I?I():I})}))}},28234:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(65043);function s(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function a(){return(0,n.useReducer)(s,{value:void 0,error:void 0})}},20665:(t,e,i)=>{"use strict";i.d(e,{Bd:()=>a,UT:()=>v,ci:()=>o,h1:()=>b,jA:()=>h,mZ:()=>p,mw:()=>l,qC:()=>m,qf:()=>c,vS:()=>f,xL:()=>g,zL:()=>d});var n=i(3404),s=i(96440);const a="undefined"!==typeof window,r=a&&"file:"===window.location.protocol;function o(t){return function(t){return"undefined"!==typeof t}(t)&&null!==t}function l(t){return t instanceof ArrayBuffer}function c(t){return(0,n.A)(a,"isBlob can only be used in a browser environment"),t instanceof Blob}function d(t){return function(t){return"string"===typeof t}(t)&&/^data:/.test(t)}function h(t){(0,n.A)(d(t),"Invalid data URI.");const[e="",i=""]=t.split(",");return-1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}function p(){return a&&window.devicePixelRatio||1}const u="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function m(){s(!r,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${u}`)}function g(t){(null===t||void 0===t?void 0:t.cancel)&&t.cancel()}function f(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}function v(t){return"RenderingCancelledException"===t.name}function b(t){return new Promise(((e,i)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return i(new Error("Error while reading a file."));e(n.result)},n.onerror=t=>{if(!t.target)return i(new Error("Error while reading a file."));const{error:e}=t.target;if(!e)return i(new Error("Error while reading a file."));switch(e.code){case e.NOT_FOUND_ERR:return i(new Error("Error while reading a file: File not found."));case e.SECURITY_ERR:return i(new Error("Error while reading a file: Security error."));case e.ABORT_ERR:return i(new Error("Error while reading a file: Aborted."));default:return i(new Error("Error while reading a file."))}},n.readAsArrayBuffer(t)}))}}}]);
//# sourceMappingURL=5067.2702d94c.chunk.js.map