dascom-le-editor 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/editor.umd.cjs
CHANGED
|
@@ -933,7 +933,7 @@ This will fail in production.`);og=activePinia,og._s.has(tg)||(Ig?createSetupSto
|
|
|
933
933
|
* Vue-Lazyload.js v3.0.0
|
|
934
934
|
* (c) 2023 Awe <hilongjw@gmail.com>
|
|
935
935
|
* Released under the MIT License.
|
|
936
|
-
*/function createCommonjsModule(tg,eg){return eg={exports:{}},tg(eg,eg.exports),eg.exports}var assignSymbols$1=createCommonjsModule(function(tg){const eg=Object.prototype.toString,gg=Object.prototype.propertyIsEnumerable,ig=Object.getOwnPropertySymbols;tg.exports=(ng,...og)=>{if(!Ig(ng))throw new TypeError("expected the first argument to be an object");if(og.length===0||typeof Symbol!="function"||typeof ig!="function")return ng;for(let ag of og){let sg=ig(ag);for(let Cg of sg)gg.call(ag,Cg)&&(ng[Cg]=ag[Cg])}return ng};function Ig(ng){return typeof ng=="function"||eg.call(ng)==="[object Object]"||Array.isArray(ng)}}),assignSymbols$2=Object.freeze({__proto__:null,default:assignSymbols$1,__moduleExports:assignSymbols$1}),assignSymbols=assignSymbols$2&&assignSymbols$1||assignSymbols$2,assignDeep=createCommonjsModule(function(tg){const eg=Object.prototype.toString,gg=og=>og!=="__proto__"&&og!=="constructor"&&og!=="prototype",ig=tg.exports=(og,...ag)=>{let sg=0;for(ng(og)&&(og=ag[sg++]),og||(og={});sg<ag.length;sg++)if(Ig(ag[sg])){for(const Cg of Object.keys(ag[sg]))gg(Cg)&&(Ig(og[Cg])&&Ig(ag[sg][Cg])?ig(og[Cg],ag[sg][Cg]):og[Cg]=ag[sg][Cg]);assignSymbols(og,ag[sg])}return og};function Ig(og){return typeof og=="function"||eg.call(og)==="[object Object]"}function ng(og){return typeof og=="object"?og===null:typeof og!="function"}});const inBrowser=typeof window<"u"&&window!==null,hasIntersectionObserver=checkIntersectionObserver();function checkIntersectionObserver(){return inBrowser&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?("isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}}),!0):!1}const modeType={event:"event",observer:"observer"};function remove(tg,eg){if(!tg.length)return;const gg=tg.indexOf(eg);if(gg>-1)return tg.splice(gg,1)}function getBestSelectionFromSrcset(tg,eg){if(tg.tagName!=="IMG"||!tg.getAttribute("data-srcset"))return"";let gg=tg.getAttribute("data-srcset").trim().split(",");const ig=[],ng=tg.parentNode.offsetWidth*eg;let og,ag,sg;gg.forEach(Ag=>{Ag=Ag.trim(),og=Ag.lastIndexOf(" "),og===-1?(ag=Ag,sg=99999):(ag=Ag.substr(0,og),sg=parseInt(Ag.substr(og+1,Ag.length-og-2),10)),ig.push([sg,ag])}),ig.sort((Ag,cg)=>{if(Ag[0]<cg[0])return 1;if(Ag[0]>cg[0])return-1;if(Ag[0]===cg[0]){if(cg[1].indexOf(".webp",cg[1].length-5)!==-1)return 1;if(Ag[1].indexOf(".webp",Ag[1].length-5)!==-1)return-1}return 0});let Cg="",lg;for(let Ag=0;Ag<ig.length;Ag++){lg=ig[Ag],Cg=lg[1];const cg=ig[Ag+1];if(cg&&cg[0]<ng){Cg=lg[1];break}else if(!cg){Cg=lg[1];break}}return Cg}const getDPR=(tg=1)=>inBrowser&&window.devicePixelRatio||tg;function supportWebp(){if(!inBrowser)return!1;let tg=!0;function eg(gg,ig){const Ig={lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"},ng=new Image;ng.onload=function(){const og=ng.width>0&&ng.height>0;ig(og)},ng.onerror=function(){ig(!1)},ng.src="data:image/webp;base64,"+Ig[gg]}return eg("lossy",gg=>{tg=gg}),eg("lossless",gg=>{tg=gg}),eg("alpha",gg=>{tg=gg}),eg("animation",gg=>{tg=gg}),tg}function throttle(tg,eg){let gg=null,ig=0;return function(){if(gg)return;const Ig=Date.now()-ig,ng=this,og=arguments,ag=function(){ig=Date.now(),gg=!1,tg.apply(ng,og)};Ig>=eg?ag():gg=setTimeout(ag,eg)}}function testSupportsPassive(){if(!inBrowser)return!1;let tg=!1;try{const eg=Object.defineProperty({},"passive",{get:function(){tg=!0}});window.addEventListener("test",noop,eg)}catch{}return tg}const supportsPassive=testSupportsPassive(),_={on(tg,eg,gg,ig=!1){supportsPassive?tg.addEventListener(eg,gg,{capture:ig,passive:!0}):tg.addEventListener(eg,gg,ig)},off(tg,eg,gg,ig=!1){tg.removeEventListener(eg,gg,ig)}},loadImageAsync=(tg,eg,gg)=>{let ig=new Image;if(!tg||!tg.src){const Ig=new Error("image src is required");return gg(Ig)}tg.cors&&(ig.crossOrigin=tg.cors),ig.src=tg.src,ig.onload=function(){eg({naturalHeight:ig.naturalHeight,naturalWidth:ig.naturalWidth,src:ig.src}),ig=null},ig.onerror=function(Ig){gg(Ig)}},style=(tg,eg)=>typeof getComputedStyle<"u"?getComputedStyle(tg,null).getPropertyValue(eg):tg.style[eg],overflow=tg=>style(tg,"overflow")+style(tg,"overflowY")+style(tg,"overflowX"),scrollParent=tg=>{if(!inBrowser)return;if(!(tg instanceof Element))return window;let eg=tg;for(;eg&&!(eg===document.body||eg===document.documentElement||!eg.parentNode);){if(/(scroll|auto)/.test(overflow(eg)))return eg;eg=eg.parentNode}return window};function isObject(tg){return tg!==null&&typeof tg=="object"}function noop(){}class ImageCache{constructor(eg){this.max=eg||100,this._caches=[]}has(eg){return this._caches.indexOf(eg)>-1}add(eg){this.has(eg)||(this._caches.push(eg),this._caches.length>this.max&&this.free())}free(){this._caches.shift()}}class ReactiveListener{constructor(eg,gg,ig,Ig,ng,og,ag,sg,Cg,lg){this.el=eg,this.src=gg,this.error=ig,this.loading=Ig,this.bindType=ng,this.attempt=0,this.cors=sg,this.naturalHeight=0,this.naturalWidth=0,this.options=ag,this.rect={},this.$parent=og,this.elRenderer=Cg,this._imageCache=lg,this.performanceData={init:Date.now(),loadStart:0,loadEnd:0},this.filter(),this.initState(),this.render("loading",!1)}initState(){"dataset"in this.el?this.el.dataset.src=this.src:this.el.setAttribute("data-src",this.src),this.state={loading:!1,error:!1,loaded:!1,rendered:!1}}record(eg){this.performanceData[eg]=Date.now()}update(eg){const gg=this.src;this.src=eg.src,this.loading=eg.loading,this.error=eg.error,this.filter(),gg!==this.src&&(this.attempt=0,this.initState())}getRect(){this.rect=this.el.getBoundingClientRect()}checkInView(){return this.getRect(),this.rect.top<window.innerHeight*this.options.preLoad&&this.rect.bottom>this.options.preLoadTop&&this.rect.left<window.innerWidth*this.options.preLoad&&this.rect.right>0}filter(){for(const eg in this.options.filter)this.options.filter[eg](this,this.options)}renderLoading(eg){this.state.loading=!0,loadImageAsync({src:this.loading,cors:this.cors},()=>{this.render("loading",!1),this.state.loading=!1,eg()},()=>{eg(),this.state.loading=!1,this.options.silent||console.warn(`VueLazyload log: load failed with loading image(${this.loading})`)})}load(eg=noop){if(this.attempt>this.options.attempt-1&&this.state.error){this.options.silent||console.log(`VueLazyload log: ${this.src} tried too more than ${this.options.attempt} times`),eg();return}if(!(this.state.rendered&&this.state.loaded)){if(this._imageCache.has(this.src))return this.state.loaded=!0,this.render("loaded",!0),this.state.rendered=!0,eg();this.renderLoading(()=>{this.attempt++,this.options.adapter.beforeLoad&&this.options.adapter.beforeLoad(this,this.options),this.record("loadStart"),loadImageAsync({src:this.src,cors:this.cors},gg=>{this.naturalHeight=gg.naturalHeight,this.naturalWidth=gg.naturalWidth,this.state.loaded=!0,this.state.error=!1,this.record("loadEnd"),this.render("loaded",!1),this.state.rendered=!0,this._imageCache.add(this.src),eg()},gg=>{!this.options.silent&&console.error(gg),this.state.error=!0,this.state.loaded=!1,this.render("error",!1)})})}}render(eg,gg){this.elRenderer(this,eg,gg)}performance(){let eg="loading",gg=0;return this.state.loaded&&(eg="loaded",gg=(this.performanceData.loadEnd-this.performanceData.loadStart)/1e3),this.state.error&&(eg="error"),{src:this.src,state:eg,time:gg}}$destroy(){this.el=null,this.src="",this.error=null,this.loading="",this.bindType=null,this.attempt=0}}const DEFAULT_URL="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",DEFAULT_EVENTS=["scroll","wheel","mousewheel","resize","animationend","transitionend","touchmove"],DEFAULT_OBSERVER_OPTIONS={rootMargin:"0px",threshold:0};class Lazy{constructor({preLoad:eg,error:gg,throttleWait:ig,preLoadTop:Ig,dispatchEvent:ng,loading:og,attempt:ag,silent:sg=!0,scale:Cg,listenEvents:lg,filter:Ag,adapter:cg,observer:rg,observerOptions:ug}){this.version='"3.0.0"',this.lazyContainerMananger=null,this.mode=modeType.event,this.ListenerQueue=[],this.TargetIndex=0,this.TargetQueue=[],this.options={silent:sg,dispatchEvent:!!ng,throttleWait:ig||200,preLoad:eg||1.3,preLoadTop:Ig||0,error:gg||DEFAULT_URL,loading:og||DEFAULT_URL,attempt:ag||3,scale:Cg||getDPR(Cg),listenEvents:lg||DEFAULT_EVENTS,supportWebp:supportWebp(),filter:Ag||{},adapter:cg||{},observer:!!rg,observerOptions:ug||DEFAULT_OBSERVER_OPTIONS},this._initEvent(),this._imageCache=new ImageCache(200),this.lazyLoadHandler=throttle(this._lazyLoadHandler.bind(this),this.options.throttleWait),this.setMode(this.options.observer?modeType.observer:modeType.event)}performance(){const eg=[];return this.ListenerQueue.map(gg=>eg.push(gg.performance())),eg}addLazyBox(eg){this.ListenerQueue.push(eg),inBrowser&&(this._addListenerTarget(window),this._observer&&this._observer.observe(eg.el),eg.$el&&eg.$el.parentNode&&this._addListenerTarget(eg.$el.parentNode))}add(eg,gg,ig){if(this.ListenerQueue.some(sg=>sg.el===eg))return this.update(eg,gg),nextTick(this.lazyLoadHandler);let{src:Ig,loading:ng,error:og,cors:ag}=this._valueFormatter(gg.value);nextTick(()=>{Ig=getBestSelectionFromSrcset(eg,this.options.scale)||Ig,this._observer&&this._observer.observe(eg);const sg=Object.keys(gg.modifiers)[0];let Cg;sg&&(Cg=gg.instance.$refs[sg],Cg=Cg?Cg.el||Cg:document.getElementById(sg)),Cg||(Cg=scrollParent(eg));const lg=new ReactiveListener(eg,Ig,og,ng,gg.arg,Cg,this.options,ag,this._elRenderer.bind(this),this._imageCache);this.ListenerQueue.push(lg),inBrowser&&(this._addListenerTarget(window),this._addListenerTarget(Cg)),nextTick(this.lazyLoadHandler)})}update(eg,gg,ig){let{src:Ig,loading:ng,error:og}=this._valueFormatter(gg.value);Ig=getBestSelectionFromSrcset(eg,this.options.scale)||Ig;const ag=this.ListenerQueue.find(sg=>sg.el===eg);ag?ag.update({src:Ig,loading:ng,error:og}):(eg.getAttribute("lazy")!=="loaded"||eg.dataset.src!==Ig)&&this.add(eg,gg,ig),this._observer&&(this._observer.unobserve(eg),this._observer.observe(eg)),nextTick(this.lazyLoadHandler)}remove(eg){if(!eg)return;this._observer&&this._observer.unobserve(eg);const gg=this.ListenerQueue.find(ig=>ig.el===eg);gg&&(this._removeListenerTarget(gg.$parent),this._removeListenerTarget(window),remove(this.ListenerQueue,gg),gg.$destroy&&gg.$destroy())}removeComponent(eg){eg&&(remove(this.ListenerQueue,eg),this._observer&&this._observer.unobserve(eg.el),eg.$parent&&eg.$el.parentNode&&this._removeListenerTarget(eg.$el.parentNode),this._removeListenerTarget(window))}setMode(eg){!hasIntersectionObserver&&eg===modeType.observer&&(eg=modeType.event),this.mode=eg,eg===modeType.event?(this._observer&&(this.ListenerQueue.forEach(gg=>{this._observer.unobserve(gg.el)}),this._observer=null),this.TargetQueue.forEach(gg=>{this._initListen(gg.el,!0)})):(this.TargetQueue.forEach(gg=>{this._initListen(gg.el,!1)}),this._initIntersectionObserver())}_addListenerTarget(eg){if(!eg)return;let gg=this.TargetQueue.find(ig=>ig.el===eg);return gg?gg.childrenCount++:(gg={el:eg,id:++this.TargetIndex,childrenCount:1,listened:!0},this.mode===modeType.event&&this._initListen(gg.el,!0),this.TargetQueue.push(gg)),this.TargetIndex}_removeListenerTarget(eg){this.TargetQueue.forEach((gg,ig)=>{gg.el===eg&&(gg.childrenCount--,gg.childrenCount||(this._initListen(gg.el,!1),this.TargetQueue.splice(ig,1),gg=null))})}_initListen(eg,gg){this.options.listenEvents.forEach(ig=>_[gg?"on":"off"](eg,ig,this.lazyLoadHandler))}_initEvent(){this.Event={listeners:{loading:[],loaded:[],error:[]}},this.$on=(eg,gg)=>{this.Event.listeners[eg]||(this.Event.listeners[eg]=[]),this.Event.listeners[eg].push(gg)},this.$once=(eg,gg)=>{const ig=this;function Ig(){ig.$off(eg,Ig),gg.apply(ig,arguments)}this.$on(eg,Ig)},this.$off=(eg,gg)=>{if(!gg){if(!this.Event.listeners[eg])return;this.Event.listeners[eg].length=0;return}remove(this.Event.listeners[eg],gg)},this.$emit=(eg,gg,ig)=>{this.Event.listeners[eg]&&this.Event.listeners[eg].forEach(Ig=>Ig(gg,ig))}}_lazyLoadHandler(){const eg=[];this.ListenerQueue.forEach((gg,ig)=>{(!gg.el||!gg.el.parentNode||gg.state.loaded)&&eg.push(gg),gg.checkInView()&&(gg.state.loaded||gg.load())}),eg.forEach(gg=>{remove(this.ListenerQueue,gg),gg.$destroy&&gg.$destroy()})}_initIntersectionObserver(){hasIntersectionObserver&&(this._observer=new IntersectionObserver(this._observerHandler.bind(this),this.options.observerOptions),this.ListenerQueue.length&&this.ListenerQueue.forEach(eg=>{this._observer.observe(eg.el)}))}_observerHandler(eg){eg.forEach(gg=>{gg.isIntersecting&&this.ListenerQueue.forEach(ig=>{if(ig.el===gg.target){if(ig.state.loaded)return this._observer.unobserve(ig.el);ig.load()}})})}_elRenderer(eg,gg,ig){if(!eg.el)return;const{el:Ig,bindType:ng}=eg;let og;switch(gg){case"loading":og=eg.loading;break;case"error":og=eg.error;break;default:og=eg.src;break}if(ng?Ig.style[ng]='url("'+og+'")':Ig.getAttribute("src")!==og&&Ig.setAttribute("src",og),Ig.setAttribute("lazy",gg),this.$emit(gg,eg,ig),this.options.adapter[gg]&&this.options.adapter[gg](eg,this.options),this.options.dispatchEvent){const ag=new CustomEvent(gg,{detail:eg});Ig.dispatchEvent(ag)}}_valueFormatter(eg){return isObject(eg)?(!eg.src&&!this.options.silent&&console.error("Vue Lazyload warning: miss src with "+eg),{src:eg.src,loading:eg.loading||this.options.loading,error:eg.error||this.options.error,cors:this.options.cors}):{src:eg,loading:this.options.loading,error:this.options.error,cors:this.options.cors}}}const useCheckInView=(tg,eg)=>{let gg=reactive({});const ig=()=>{gg=tg.value.getBoundingClientRect()};return{rect:gg,checkInView:()=>(ig(),inBrowser&&gg.top<window.innerHeight*eg&&gg.bottom>0&&gg.left<window.innerWidth*eg&&gg.right>0)}};var LazyComponent=(tg=>defineComponent({props:{tag:{type:String,default:"div"}},emits:["show"],setup(eg,{emit:gg,slots:ig}){const Ig=ref(),ng=reactive({loaded:!1,error:!1,attempt:0}),og=ref(!1),{rect:ag,checkInView:sg}=useCheckInView(Ig,tg.options.preLoad),Cg=()=>{og.value=!0,ng.loaded=!0,gg("show",og.value)},lg=computed(()=>({el:Ig.value,rect:ag,checkInView:sg,load:Cg,state:ng}));return onMounted(()=>{tg.addLazyBox(lg.value),tg.lazyLoadHandler()}),onUnmounted(()=>{tg.removeComponent(lg.value)}),()=>{var Ag;return createVNode(eg.tag,{ref:Ig},[og.value&&((Ag=ig.default)===null||Ag===void 0?void 0:Ag.call(ig))])}}}));class LazyContainerMananger{constructor(eg){this.lazy=eg,eg.lazyContainerMananger=this,this._queue=[]}bind(eg,gg,ig){const Ig=new LazyContainer(eg,gg,ig,this.lazy);this._queue.push(Ig)}update(eg,gg,ig){const Ig=this._queue.find(ng=>ng.el===eg);Ig&&Ig.update(eg,gg)}unbind(eg,gg,ig){const Ig=this._queue.find(ng=>ng.el===eg);Ig&&(Ig.clear(),remove(this._queue,Ig))}}const defaultOptions={selector:"img",error:"",loading:""};class LazyContainer{constructor(eg,gg,ig,Ig){this.el=eg,this.vnode=ig,this.binding=gg,this.options={},this.lazy=Ig,this._queue=[],this.update(eg,gg)}update(eg,gg){this.el=eg,this.options=assignDeep({},defaultOptions,gg.value),this.getImgs().forEach(Ig=>{this.lazy.add(Ig,assignDeep({},this.binding,{value:{src:Ig.getAttribute("data-src")||Ig.dataset.src,error:Ig.getAttribute("data-error")||Ig.dataset.error||this.options.error,loading:Ig.getAttribute("data-loading")||Ig.dataset.loading||this.options.loading}}),this.vnode)})}getImgs(){return Array.from(this.el.querySelectorAll(this.options.selector))}clear(){this.getImgs().forEach(gg=>this.lazy.remove(gg)),this.vnode=null,this.binding=null,this.lazy=null}}var LazyImage=(tg=>defineComponent({setup(eg,{slots:gg}){const ig=ref(),Ig=reactive({src:"",error:"",loading:"",attempt:tg.options.attempt}),ng=reactive({loaded:!1,error:!1,attempt:0}),{rect:og,checkInView:ag}=useCheckInView(ig,tg.options.preLoad),sg=ref(""),Cg=(cg=noop)=>{if(ng.attempt>Ig.attempt-1&&ng.error)return tg.options.silent||console.log(`VueLazyload log: ${Ig.src} tried too more than ${Ig.attempt} times`),cg();const rg=Ig.src;loadImageAsync({src:rg},({src:ug})=>{sg.value=ug,ng.loaded=!0},()=>{ng.attempt++,sg.value=Ig.error,ng.error=!0})},lg=computed(()=>({el:ig.value,rect:og,checkInView:ag,load:Cg,state:ng}));onMounted(()=>{tg.addLazyBox(lg.value),tg.lazyLoadHandler()}),onUnmounted(()=>{tg.removeComponent(lg.value)});const Ag=()=>{const{src:cg,loading:rg,error:ug}=tg._valueFormatter(eg.src);ng.loaded=!1,Ig.src=cg,Ig.error=ug,Ig.loading=rg,sg.value=Ig.loading};return watch(()=>eg.src,()=>{Ag(),tg.addLazyBox(lg.value),tg.lazyLoadHandler()},{immediate:!0}),()=>{var cg;return createVNode(eg.tag||"img",{src:sg.value,ref:ig},[(cg=gg.default)===null||cg===void 0?void 0:cg.call(gg)])}}})),index={install(tg,eg={}){const gg=new Lazy(eg),ig=new LazyContainerMananger(gg);if(Number(tg.version.split(".")[0])<3)return new Error("Vue version at least 3.0");tg.config.globalProperties.$Lazyload=gg,tg.provide("Lazyload",gg),eg.lazyComponent&&tg.component("lazy-component",LazyComponent(gg)),eg.lazyImage&&tg.component("lazy-image",LazyImage(gg)),tg.directive("lazy",{beforeMount:gg.add.bind(gg),beforeUpdate:gg.update.bind(gg),updated:gg.lazyLoadHandler.bind(gg),unmounted:gg.remove.bind(gg)}),tg.directive("lazy-container",{beforeMount:ig.bind.bind(ig),updated:ig.update.bind(ig),unmounted:ig.unbind.bind(ig)})}};function createPiniaInstance(){return createPinia()}createPiniaInstance();const CMD_LIST=["ReplaceContent","AddPositionOffset","RecoverOriginalHSpacings","RemoveIndexs","RemoveNames","OnlyNames"],DEFAULT_LABEL_CONFIG={pageWidth:85.6,pageHeight:54,DPI:203,backgroundColor:"white",pageShape:"Rectangle",rows:1,columns:1,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,horizontalSpacing:0,verticalSpacing:0,orderStartAngle:"LeftTop",orderDirection:"Horizontal"};function parseJsonData(tg){return typeof tg=="string"?JSON.parse(tg):tg}function parseCanvasJson(tg){return typeof tg=="string"?JSON.parse(tg):tg}function normalizeCanvasJsonList(tg){const eg=parseCanvasJson(tg);return(Array.isArray(eg)?eg:[eg]).filter(Boolean).map(ig=>parseCanvasJson(ig))}function cloneJsonData(tg){return JSON.parse(JSON.stringify(tg))}function stringifyCanvasLikeSource(tg,eg){return typeof tg=="string"?JSON.stringify(eg):eg}function detectImageMimeFromBase64(tg){try{const eg=tg.replace(/^data:image\/\w+;base64,/,""),gg=atob(eg.slice(0,24)),ig=Array.from(gg).map(ng=>ng.charCodeAt(0)),Ig=ng=>ng.every((og,ag)=>ig[ag]===og);if(Ig([137,80,78,71]))return"png";if(Ig([255,216,255]))return"jpeg";if(Ig([71,73,70,56]))return"gif";if(Ig([82,73,70,70])&&ig[8]===87&&ig[9]===69&&ig[10]===66&&ig[11]===80)return"webp";if(Ig([66,77]))return"bmp"}catch{}return""}function getCmdObjectKey(tg){return tg!=null&&tg.fromJson?tg.jsonFieldKey||tg.name:tg==null?void 0:tg.name}function isCmdMatchObject(tg,eg,gg){const ig=String((tg==null?void 0:tg.type)||"").toLowerCase(),Ig=getCmdObjectKey(tg);return gg.name!=null?Ig===gg.name:gg.index!=null?eg===Number(gg.index):gg.type!=null?ig===String(gg.type).toLowerCase():!1}function setImageReplaceContent(tg,eg,gg){const ig=eg.content;if(tg.imgScaleType="1",eg.scale||eg.scale===0)switch(Number(eg.scale)){case 0:tg.imgScaleType="1";break;case 1:tg.imgScaleType="3";break;case 2:tg.imgScaleType="2";break}else eg.isScaleToPreviousWidth&&eg.isScaleToPreviousHeight?tg.imgScaleType="1":eg.isScaleToPreviousWidth?tg.imgScaleType="3":eg.isScaleToPreviousHeight&&(tg.imgScaleType="2");if(!ig||typeof ig!="string")return;const Ig=ig.match(/url:/i),ng=ig.match(/data:image/);if(Ig&&Ig.index===0){const og=ig.replace(/url:/i,"");tg.src=gg?gg(og):og}else if(ng&&ng.index===0)tg.src=ig;else{const og=detectImageMimeFromBase64(ig);og&&(tg.src=`data:image/${og};base64,${ig}`)}}function replaceCmdData(tg=[],eg=[],gg="",ig){const Ig=[];let ng=0;for(const og of tg){const ag=String((og==null?void 0:og.type)||"").toLowerCase(),sg=(og==null?void 0:og.objects)||(og==null?void 0:og._objects);if(ag==="group"&&Array.isArray(sg)){const Ag=replaceCmdData(sg,eg,"inGroup",ig);og.objects&&(og.objects=Ag),og._objects&&(og._objects=Ag)}let Cg=!1;const lg=getCmdObjectKey(og);for(const Ag of eg){if(!Ag||!CMD_LIST.includes(Ag.cmd))continue;const cg=Ag.content;switch(Ag.cmd){case"ReplaceContent":if(!isCmdMatchObject(og,ng,Ag))break;switch(ag){case"text":case"textname":og.text=cg;break;case"barcode":og.barcodeOptions&&(og.barcodeOptions.text=cg);break;case"barcode2d":og.barcode2dOptions&&(og.barcode2dOptions.text=cg);break;case"image":setImageReplaceContent(og,Ag,ig);break}break;case"AddPositionOffset":Number(Ag.x)&&(og.left+=Number(Ag.x)),Number(Ag.y)&&(og.top+=Number(Ag.y));break;case"RecoverOriginalHSpacings":break;case"RemoveIndexs":gg!=="inGroup"&&(Ag.indexs||[]).map(ug=>Number(ug)).includes(ng)&&(Cg=!0);break;case"RemoveNames":{(Ag.names||[]).includes(lg)&&(Cg=!0),ag==="group"&&Array.isArray(og.objects)&&og.objects.length===0&&(Cg=!0);break}case"OnlyNames":{const rg=Ag.names;Array.isArray(rg)&&!rg.includes(lg)&&(Cg=!0),ag==="group"&&Array.isArray(og.objects)&&og.objects.length>0&&(Cg=!1);break}}}ng++,Cg||Ig.push(og)}return Ig}function replaceCanvasCmdData(tg,eg=[],gg){if(!eg.length)return tg;const ig=cloneJsonData(tg),Ig=ng=>{if(!ng)return ng;const ag=(Array.isArray(ng)?ng:[ng]).map(sg=>{const Cg=parseCanvasJson(sg);return Cg.objects=replaceCmdData(Cg.objects||[],eg,"",gg),stringifyCanvasLikeSource(sg,Cg)});return Array.isArray(ng)?ag:ag[0]};return ig.canvas=Ig(ig.canvas),Array.isArray(ig.layers)&&(ig.layers=ig.layers.map(ng=>({...ng,canvas:Ig(ng==null?void 0:ng.canvas)}))),ig}function loadImage(tg){return tg?new Promise(eg=>{const gg=new Image;gg.onload=()=>eg(gg),gg.onerror=()=>eg(null),gg.src=tg}):Promise.resolve(null)}function getAllCanvasObjects(tg){const eg=[],gg=ig=>{ig.type==="group"&&ig._objects?ig._objects.forEach(Ig=>gg(Ig)):ig.id!=="workspace"&&eg.push(ig)};return tg.getObjects().forEach(ig=>gg(ig)),eg}async function createExportWorkspace({labelConfig:tg,width:eg,height:gg}){const ig=(tg==null?void 0:tg.backgroundColor)||"white",Ig=(tg==null?void 0:tg.backgroundImage)||"",ng=(tg==null?void 0:tg.backgroundImageCover)!==!1,og=(tg==null?void 0:tg.ribbonBorder)||null,ag=(tg==null?void 0:tg.pageShape)||"Rectangle",sg=Ig?await loadImage(Ig):null;let Cg=null,lg=null;og!=null&&og.pattern&&og.pattern!=="none"&&([Cg,lg]=await Promise.all([loadImage(og.left||""),loadImage(og.right||"")]));const Ag=ag==="Ellipse"?new _o({fill:ig,width:eg,height:gg,rx:eg/2,ry:gg/2,strokeWidth:0}):new Er({fill:ig,width:eg,height:gg,rx:ag==="RoundedRectangle"&&(tg==null?void 0:tg.rx)||0,ry:ag==="RoundedRectangle"&&(tg==null?void 0:tg.ry)||0,strokeWidth:0});if(Ag.set("id","workspace"),Ag.set("selectable",!1),Ag.set("hasControls",!1),Ag.excludeFromExport=!1,sg||Cg&&lg){const cg=Ag._render.bind(Ag);Ag._render=rg=>{if(cg(rg),sg){const ug=sg.naturalWidth||sg.width,dg=sg.naturalHeight||sg.height;if(ug&&dg){const bg=ng?eg:ug,mg=ng?gg:dg;rg.save(),rg.beginPath(),rg.rect(-eg/2,-gg/2,eg,gg),rg.clip(),rg.drawImage(sg,-bg/2,-mg/2,bg,mg),rg.restore()}}og!=null&&og.pattern&&og.pattern!=="none"&&Cg&&lg&&drawRibbonBorder(rg,og.pattern,{left:-eg/2,top:-gg/2,width:eg,height:gg},{left:Cg,right:lg})}}return Ag}async function renderCanvasLayer({canvasJson:tg,includeWorkspace:eg,includeFullDataUrl:gg=!1,width:ig,height:Ig,labelDPI:ng,multiplier:og,scaleList:ag=[],resTarget:sg="img",labelConfig:Cg}){let lg=document.createElement("canvas"),Ag=new se(lg,{width:ig,height:Ig,imageSmoothingEnabled:!1,fireMiddleClick:!0,fireRightClick:!0,stopContextMenu:!1,controlsAboveOverlay:!0,preserveObjectStacking:!0,selectionKey:"ctrlKey"});try{Ag.leRenderEnv="transform";const cg=await Ag.loadFromJSON(tg);if(eg){const mg=await createExportWorkspace({labelConfig:Cg,width:ig,height:Ig});cg.insertAt(0,mg)}const rg=getAllCanvasObjects(cg),ug=[];let dg=!1;rg.forEach(mg=>{if(mg.type==="text"&&(mg.set({left:Math.trunc(mg.left),top:Math.trunc(mg.top)}),mg.width=Math.trunc(mg.width),mg.height=Math.trunc(mg.height),mg.fontFamily&&mg.fontFamily.indexOf("宋体")>-1&&!mg.strokeWidth&&mg.set({strokeWidth:.3})),mg.type==="image"){let hg=!1;if(ag&&ag.length){for(const Zg of ag)if(Zg.name===mg.name){hg=!0;break}}hg||(mg.imgScaleType=mg.imgScaleType||"1"),Number(mg.imgScaleType)>1&&(mg.isScaleOtherSidedys=!0),mg.imageAlign&&mg.imageAlign!=="leftTop"&&ug.push(mg),mg.isSetSharpen&&(dg=!0)}}),cg.renderAll(),ug.forEach(mg=>{typeof mg.refreshAlignCoords=="function"&&mg.refreshAlignCoords(ng)}),cg.renderAll();const bg={};if(sg==="img"||sg==="all"){if(gg)return{fullDataUrl:Ag.toDataURL({format:"png",quality:1,multiplier:og})};const mg=["text","counter","textname","group","table"];bg.textDataUrl=Ag.toDataURL({multiplier:og,filter:Zg=>mg.includes(Zg.type)&&Zg.id!=="workspace"});const hg=["image","barcode","barcode2d","rect","circle","line","triangle"];bg.imgDataUrl=Ag.toDataURL({multiplier:og,filter:Zg=>(hg.includes(Zg.type)||Zg.id==="workspace")&&!Zg.isSetSharpen}),bg.sharpenDataUrl="",dg&&(bg.sharpenDataUrl=Ag.toDataURL({multiplier:og,filter:Zg=>Zg.type==="image"&&Zg.isSetSharpen}))}return(sg==="json"||sg==="all")&&(bg.dataJson=Ag.toJSON()),bg}finally{Ag==null||Ag.dispose(),Ag=null,lg=null}}async function composeDataUrlsToPng(tg,eg,gg){const ig=tg.filter(Boolean);if(!ig.length)return"";if(ig.length===1)return ig[0];const Ig=document.createElement("canvas");Ig.width=Math.max(1,Math.round(eg)),Ig.height=Math.max(1,Math.round(gg));const ng=Ig.getContext("2d");if(!ng)return ig[0];for(const og of ig){const ag=await loadImage(og);ag&&ng.drawImage(ag,0,0,Ig.width,Ig.height)}return Ig.toDataURL("image/png",1)}async function composeDataUrlsHorizontally(tg,eg,gg,ig=50){const Ig=tg.filter(Boolean);if(!Ig.length)return"";if(Ig.length===1)return Ig[0];const ng=document.createElement("canvas");ng.width=Math.max(1,Math.round(Ig.length*eg+(Ig.length-1)*ig)),ng.height=Math.max(1,Math.round(gg));const og=ng.getContext("2d");if(!og)return Ig[0];og.imageSmoothingEnabled=!1;for(let ag=0;ag<Ig.length;ag++){const sg=await loadImage(Ig[ag]);sg&&og.drawImage(sg,ag*(eg+ig),0,eg,gg)}return ng.toDataURL("image/png",1)}function getRenderMetrics(tg,eg={}){const gg={...DEFAULT_LABEL_CONFIG,...tg.labelConfig||{}},ig=Number(gg.DPI||eg.dpi)||203,Ig=Number(eg.width||gg.pageWidth)||85.6,ng=Number(eg.height||gg.pageHeight)||54,og=Ig*ig/25.4,ag=ng*ig/25.4;return{labelConfig:gg,labelDPI:ig,width:og,height:ag}}async function withTimeout(tg,eg=5e3,gg="加载 json 图片超时"){return new Promise((ig,Ig)=>{const ng=window.setTimeout(()=>{Ig(new Error(gg))},eg);tg.then(og=>ig(og)).catch(og=>Ig(og)).finally(()=>window.clearTimeout(ng))})}function hasCounterInCanvas(tg){var ig,Ig;if(!tg)return!1;const eg=typeof tg=="string"?JSON.parse(tg):tg,gg=(eg==null?void 0:eg.objects)||[];for(const ng of gg){if(String((ng==null?void 0:ng.type)||"").toLowerCase()==="counter"&&((ig=ng==null?void 0:ng._props)==null?void 0:ig.mode)==="1"||ng!=null&&ng.counterProps&&(ng.counterProps.value||ng.counterProps.value===0))return!0;const ag=(ng==null?void 0:ng.objects)||(ng==null?void 0:ng._objects);if(Array.isArray(ag)){for(const sg of ag)if(String((sg==null?void 0:sg.type)||"").toLowerCase()==="counter"&&((Ig=sg==null?void 0:sg._props)==null?void 0:Ig.mode)==="1"||sg!=null&&sg.counterProps&&(sg.counterProps.value||sg.counterProps.value===0))return!0}}return!1}function hasCounterObjects(tg){return tg.some(eg=>hasCounterInCanvas(eg))}function computeCounterValueAt(tg,eg){if(eg<=0)return tg.value;const gg=tg.valueType==="letter"?"letter":"number",Ig=(Math.trunc(Number(tg.incremental))||0)*eg;if(gg==="letter"){const og=Cg=>String(Cg??"").toUpperCase().replace(/[^A-Z]/g,"").split("").reduce((lg,Ag)=>lg*26+Ag.charCodeAt(0)-64,0)||1,ag=Cg=>{let lg=Math.max(1,Math.trunc(Cg)),Ag="";for(;lg>0;)lg--,Ag=String.fromCharCode(65+lg%26)+Ag,lg=Math.floor(lg/26);return Ag||"A"},sg=og(String(tg.value));return ag(sg+Ig)}const ng=Number(tg.value);return Number.isFinite(ng)?ng+Ig:tg.value}function applyCounterOffsetToObjects(tg,eg){var gg,ig;for(const Ig of tg){const ng=String((Ig==null?void 0:Ig.type)||"").toLowerCase(),og=(Ig==null?void 0:Ig.objects)||(Ig==null?void 0:Ig._objects);if(ng==="group"&&Array.isArray(og)&&applyCounterOffsetToObjects(og,eg),ng==="counter"&&((gg=Ig==null?void 0:Ig._props)==null?void 0:gg.mode)==="1"&&((ig=Ig==null?void 0:Ig._props)!=null&&ig.args)){const ag=Ig._props.args;if(ag.value||ag.value===0){const sg={value:ag.value,incremental:ag.incremental,length:ag.length,zeroPadding:ag.zeroPadding,valueType:ag.valueType},Cg=computeCounterValueAt(sg,eg);ag.value=Cg}}if(Ig!=null&&Ig.counterProps&&(Ig.counterProps.value||Ig.counterProps.value===0)){const ag={value:Ig.counterProps.value,incremental:Ig.counterProps.incremental,length:Ig.counterProps.length,zeroPadding:Ig.counterProps.zeroPadding,valueType:Ig.counterProps.valueType},sg=computeCounterValueAt(ag,eg);Ig.counterProps.value=sg}}}function cloneCanvasWithCounterOffset(tg,eg){return eg<=0?tg:tg.map(gg=>{const ig=typeof gg=="string"?JSON.parse(gg):gg,Ig=JSON.parse(JSON.stringify(ig));return Ig!=null&&Ig.objects&&applyCounterOffsetToObjects(Ig.objects,eg),typeof gg=="string"?JSON.stringify(Ig):Ig})}async function composeMultiTagsImageWithCounters(tg,eg,gg,ig,Ig,ng,og,ag){const{rows:sg,columns:Cg,count:lg}=getMultiTagCount(eg);if(lg<=1)return"";const Ag=og/25.4,cg=Math.round(Ig),rg=Math.round(ng),ug=Math.round((Number(eg.paddingLeft)||0)*Ag),dg=Math.round((Number(eg.paddingTop)||0)*Ag),bg=Math.round((Number(eg.horizontalSpacing)||0)*Ag),mg=Math.round((Number(eg.verticalSpacing)||0)*Ag),hg=getOrderTable(sg,Cg,eg.orderStartAngle||"LeftTop",eg.orderDirection||"Horizontal"),Zg=document.createElement("canvas");Zg.width=Math.max(1,Math.round(gg)),Zg.height=Math.max(1,Math.round(ig));const wg=Zg.getContext("2d");if(!wg)return"";wg.imageSmoothingEnabled=!1;const pg=o.DPI;try{o.DPI=og;for(let fg=0;fg<lg;fg++){const Gg=cloneCanvasWithCounterOffset(tg,fg),yg=[];for(let vg=0;vg<Gg.length;vg++){const Mg=await renderCanvasLayer({canvasJson:Gg[vg],includeWorkspace:vg===0,includeFullDataUrl:!0,width:Ig,height:ng,labelDPI:og,multiplier:1,scaleList:[],resTarget:"img",labelConfig:ag});yg.push(Mg.fullDataUrl||"")}const Bg=await composeDataUrlsToPng(yg,Ig,ng),Wg=await loadImage(Bg);if(!Wg)continue;const[$g,Ng]=hg[fg]||[Math.floor(fg/Cg),fg%Cg],Vg=ug+Ng*(cg+bg),Rg=dg+$g*(rg+mg);wg.drawImage(Wg,Vg,Rg,cg,rg)}}finally{o.DPI=pg}return Zg.toDataURL("image/png",1)}function getMultiTagCount(tg){const eg=Math.max(1,Math.floor(Number(tg==null?void 0:tg.rows)||1)),gg=Math.max(1,Math.floor(Number(tg==null?void 0:tg.columns)||1));return{rows:eg,columns:gg,count:eg*gg}}function getTagSizeMM(tg){const eg=Number(tg==null?void 0:tg.pageWidth)||0,gg=Number(tg==null?void 0:tg.pageHeight)||0;let ig=Number(tg==null?void 0:tg.tagWidth)||0,Ig=Number(tg==null?void 0:tg.tagHeight)||0;if(!ig||!Ig||ig===eg&&Ig===gg){const ng=Number(tg==null?void 0:tg.columns)||1,og=Number(tg==null?void 0:tg.rows)||1;ig=Math.floor((eg-Number((tg==null?void 0:tg.paddingLeft)||0)-Number((tg==null?void 0:tg.paddingRight)||0)-Number((tg==null?void 0:tg.horizontalSpacing)||0)*(ng-1))/ng*100)/100,Ig=Math.floor((gg-Number((tg==null?void 0:tg.paddingTop)||0)-Number((tg==null?void 0:tg.paddingBottom)||0)-Number((tg==null?void 0:tg.verticalSpacing)||0)*(og-1))/og*100)/100}return{width:ig,height:Ig}}function getOrderTable(tg,eg,gg="LeftTop",ig="Horizontal"){const Ig=[];if(ig==="Horizontal"){const ng=gg==="LeftTop"||gg==="RightTop"?[...Array(tg).keys()]:[...Array(tg).keys()].reverse(),og=gg==="LeftTop"||gg==="LeftBottom"?[...Array(eg).keys()]:[...Array(eg).keys()].reverse();for(const ag of ng)for(const sg of og)Ig.push([ag,sg])}else{const ng=gg==="LeftTop"||gg==="LeftBottom"?[...Array(eg).keys()]:[...Array(eg).keys()].reverse(),og=gg==="LeftTop"||gg==="RightTop"?[...Array(tg).keys()]:[...Array(tg).keys()].reverse();for(const ag of ng)for(const sg of og)Ig.push([sg,ag])}return Ig}async function composeMultiTagsImage(tg,eg,gg,ig,Ig,ng,og){if(!tg)return"";const{rows:ag,columns:sg,count:Cg}=getMultiTagCount(eg);if(Cg<=1)return tg;const lg=await loadImage(tg);if(!lg)return tg;const Ag=og/25.4,cg=Math.round(Ig),rg=Math.round(ng),ug=Math.round((Number(eg.paddingLeft)||0)*Ag),dg=Math.round((Number(eg.paddingTop)||0)*Ag),bg=Math.round((Number(eg.horizontalSpacing)||0)*Ag),mg=Math.round((Number(eg.verticalSpacing)||0)*Ag),hg=getOrderTable(ag,sg,eg.orderStartAngle||"LeftTop",eg.orderDirection||"Horizontal"),Zg=document.createElement("canvas");Zg.width=Math.max(1,Math.round(gg)),Zg.height=Math.max(1,Math.round(ig));const wg=Zg.getContext("2d");if(!wg)return tg;wg.imageSmoothingEnabled=!1;for(let pg=0;pg<Cg;pg++){const[fg,Gg]=hg[pg]||[Math.floor(pg/sg),pg%sg],yg=ug+Gg*(cg+bg),Bg=dg+fg*(rg+mg);wg.drawImage(lg,yg,Bg,cg,rg)}return Zg.toDataURL("image/png",1)}async function loadJsonToImageBase64(tg,eg={}){const{cmds:gg=[],timeout:ig=5e3,returnDataUrl:Ig=!0,imageUrlResolver:ng,mode:og="merged",gap:ag=50}=eg,sg=replaceCanvasCmdData(parseJsonData(tg),gg,ng),{labelConfig:Cg,labelDPI:lg,width:Ag,height:cg}=getRenderMetrics(sg,{dpi:eg.dpi,width:eg.width,height:eg.height}),{count:rg}=getMultiTagCount(Cg),ug=rg>1;let dg=Ag,bg=cg;if(ug){const Bg=getTagSizeMM(Cg);dg=Bg.width*lg/25.4,bg=Bg.height*lg/25.4}const mg=o.DPI,hg=normalizeCanvasJsonList(sg.canvas),Zg=[],wg=ug&&hasCounterObjects(hg),pg=(async()=>{try{if(o.DPI=lg,wg)return composeMultiTagsImageWithCounters(hg,Cg,Ag,cg,dg,bg,lg,Cg);for(let Wg=0;Wg<hg.length;Wg++){const $g=await renderCanvasLayer({canvasJson:hg[Wg],includeWorkspace:og==="separate"||Wg===0,includeFullDataUrl:!0,width:dg,height:bg,labelDPI:lg,multiplier:1,scaleList:[],resTarget:"img",labelConfig:Cg});Zg.push($g.fullDataUrl||"")}if(og==="separate"){const Wg=await composeDataUrlsHorizontally(Zg,dg,bg,ag);return{images:Zg,composedImage:Wg}}const Bg=await composeDataUrlsToPng(Zg,dg,bg);return ug?composeMultiTagsImage(Bg,Cg,Ag,cg,dg,bg,lg):Bg}finally{o.DPI=mg}})(),fg=wg?Math.max(ig,ig*rg):ig,Gg=await withTimeout(pg,fg),yg=Bg=>Ig?Bg:Bg.replace(/^data:image\/\w+;base64,/,"");return typeof Gg=="string"?yg(Gg):{images:Gg.images.map(yg),composedImage:yg(Gg.composedImage)}}let _activeInstance=null;function normalizeFileFieldJson(tg){if(typeof tg=="string"){const gg=tg.trim();return gg?(JSON.parse(gg),gg):""}const eg=JSON.stringify(tg,null,2);if(eg===void 0)throw new Error("Invalid fileFieldJson");return JSON.parse(eg),eg}class LabelEditor{constructor(eg,gg){el(this,"_autoSaveTimer",null);el(this,"_insertFileFieldJsonTimer",null);el(this,"_pendingFileFieldJson",null);el(this,"_app",null);el(this,"_el",null);el(this,"_destroyed",!1);el(this,"_isReplaceFont",!1);const Ig=!!(gg||{}).__offscreenRender;if(!Ig&&_activeInstance&&!_activeInstance._destroyed&&_activeInstance._el===eg)return console.warn("[LabelEditor] 同一容器已有活跃实例,复用现有实例"),_activeInstance;if(!Ig&&_activeInstance&&!_activeInstance._destroyed&&(console.warn("[LabelEditor] 检测到其他容器上的活跃实例,先销毁旧实例"),_activeInstance.destroy()),gg&&!Ig){const ag={...gg};delete ag.__offscreenRender,ag.separateLayerMode=ag.separateLayerMode===!0,Object.keys(ag).length&&setEditorConfig(ag),this.setSeparateLayerMode(!!getEditorConfig().separateLayerMode),getEditorConfig().separateLayerMode?this.setLayerMaxCount(getEditorConfig().separateLayerCount):this.setLayerMaxCount(ag.layerMaxCount??1)}resetFontState();const ng=Ig?LabelEditor._pauseVueDevtoolsForOffscreenRender():()=>{},og=createApp(_sfc_main);Ig&&(og.config.devtools=!1),og.config.errorHandler=(ag,sg,Cg)=>{console.error("全局错误:",ag,sg,Cg)};try{const ag=createPiniaInstance();og.use(ag).use(index,{}).use(modalInstall).use(loadingInstall),og.mount(eg)}finally{ng()}this._app=og,this._el=eg,Ig||(_activeInstance=this)}static _pauseVueDevtoolsForOffscreenRender(){const eg=window,gg="__VUE_DEVTOOLS_GLOBAL_HOOK__",ig=Object.prototype.hasOwnProperty.call(eg,gg),Ig=eg[gg];if(!Ig)return()=>{};try{return eg[gg]=void 0,()=>{ig?eg[gg]=Ig:delete eg[gg]}}catch{const ng=Ig.enabled;return Ig.enabled=!1,()=>{Ig.enabled=ng}}}static async loadJsonToImageBase64(eg,gg={}){return LabelEditor.exportImage({...gg,data:eg})}static async exportImage(eg){const{data:gg,...ig}=eg;return loadJsonToImageBase64(gg,ig)}get loadedFonts(){return loadedFonts}destroy(){this._destroyed||(this._destroyed=!0,clearInterval(this._autoSaveTimer),this._autoSaveTimer=null,clearTimeout(this._insertFileFieldJsonTimer),this._insertFileFieldJsonTimer=null,this._pendingFileFieldJson=null,this._app&&(this._app.unmount(),this._app=null),emitter.all.clear(),canvasEventBus.all.clear(),this._el&&(this._el.innerHTML="",this._el=null),_activeInstance===this&&(_activeInstance=null))}filterLoadFontByName(eg){let gg=Array.from(this.loadedFonts);return eg.filter(Ig=>{let ng=!0;if(ng=!gg.includes(Ig),!this._isReplaceFont){for(let og of fontListDefault)if(og.label===Ig){ng=!1;break}}return ng})}loadJson(eg,{newFile:gg=!1}={}){const ig=new Set(extractFontNames(eg.canvas));if(Array.isArray(eg.layers)&&eg.layers.forEach(Ig=>{Ig!=null&&Ig.canvas&&extractFontNames(Ig.canvas).forEach(ng=>ig.add(ng))}),ig.size){let Ig=Array.from(ig);emitter.emit("selectFontCallback",Ig)}eg.laserConfigList&&Array.isArray(eg.laserConfigList)&&setLaserPresets(eg.laserConfigList),emitter.emit("label-config",{labelConfig:eg.labelConfig||getTempLabelConfig(),canvas:eg.canvas,layers:eg.layers,activeLayerId:eg.activeLayerId,newFile:gg}),syncExternalPresets()}exportJson(){return new Promise(eg=>{emitter.emit("toTemplateJson",gg=>{try{const ig=JSON.parse(gg||"{}"),Ig=extractFontNames(ig.canvas),ng=getCustomFonts(Ig);ng.length&&(ig.labelConfig.customFonts=ng);const og=new Set,ag=Cg=>{try{(JSON.parse(Cg).objects||[]).forEach(Ag=>{var rg;const cg=(rg=Ag.customExportFields)==null?void 0:rg.laserConfigId;cg&&og.add(cg)})}catch{}};typeof ig.canvas=="string"?ag(ig.canvas):Array.isArray(ig.canvas)&&ig.canvas.forEach(Cg=>ag(Cg));const sg=getLaserPresets();sg.value.length>0&&(ig.laserConfigList=sg.value.filter(Cg=>og.has(Cg.configId)),ig.laserConfigList.length===0&&delete ig.laserConfigList),eg(JSON.stringify(ig))}catch{eg(gg)}})})}addCustomFontList(eg){emitter.emit("addCustomFontList",eg)}replaceFontList(eg){this._isReplaceFont=!0,emitter.emit("replaceFontList",eg)}setLaserConfigList(eg){setLaserConfigList(eg)}selectFontCallback(eg){emitter.off("selectFontCallback"),emitter.on("selectFontCallback",gg=>{let ig=this.filterLoadFontByName(gg)||[];eg&&ig.length&&eg(ig)})}async loadFontFile(eg){const{fontName:gg,blob:ig}=eg;return!gg||!ig?!1:loadFontFromBlob(gg,ig)}exportImage(eg={}){return new Promise(gg=>{emitter.emit("exportImage",{options:eg,callback:ig=>{gg(ig)}})})}getImage(eg={}){return this.exportImage(eg)}toggleMultiLayer(eg=!0){state$1.isMultiLayerEnabled=!!eg}setMultiLayerEnabled(eg=!0){this.toggleMultiLayer(eg)}setLayerMaxCount(eg=1){setSysConfigState({...getSysConfigState(),layerMaxCount:state$1.isSeparateLayerMode?state$1.separateLayerCount:getLayerMaxCount(eg)})}_applyFileFieldJson(eg){const gg=useTabsStore(),ig=gg.getActiveTab();return ig!=null&&ig.config?(ig.config.fileFieldJson=eg,gg.storeTabs(gg.tabs),setFileDirty(ig.id),!0):!1}insertFileFieldJson(eg){try{const gg=normalizeFileFieldJson(eg);return gg?(setTimeout(()=>{if(this._applyFileFieldJson(gg))return!0},150),!0):!1}catch(gg){return console.error("[LabelEditor] insertFileFieldJson failed:",gg),!1}}setSeparateLayerMode(eg=!0){state$1.isSeparateLayerMode=!!eg,state$1.isSeparateLayerMode&&(state$1.isMultiLayerEnabled=!0,state$1.separateLayerCount=getEditorConfig().separateLayerCount,state$1.separateLayerNames=[...getEditorConfig().separateLayerNames],this.setLayerMaxCount(state$1.separateLayerCount))}getDoubleRibbonsImage(eg={}){return new Promise(gg=>{this.exportImage({...eg,mode:"separate",layout:"doubleRibbons"}).then(ig=>{gg((ig==null?void 0:ig.composedImage)||ig)})})}enterDoubleRibbons(){state$1.isSeparateLayerMode=!0,state$1.isMultiLayerEnabled=!0,state$1.separateLayerCount=2,state$1.separateLayerNames=["上联","下联"],this.setLayerMaxCount(state$1.separateLayerCount),emitter.emit("separate-layer-config-change",{count:state$1.separateLayerCount,names:[...state$1.separateLayerNames]})}setSeparateLayerConfig(eg={}){eg.count!=null&&(state$1.separateLayerCount=getLayerMaxCount(eg.count)),eg.names!=null&&(state$1.separateLayerNames=Array.isArray(eg.names)?eg.names.map(gg=>String(gg||"").trim()).filter(Boolean):[]),state$1.isSeparateLayerMode&&(this.setLayerMaxCount(state$1.separateLayerCount),emitter.emit("separate-layer-config-change",{count:state$1.separateLayerCount,names:[...state$1.separateLayerNames]}))}toggleEditTabs(eg=!0){state$1.isShowEditTabs=!!eg}checkFileSave(){return new Promise(eg=>{emitter.emit("checkFileSave",gg=>{eg(gg)})})}openAutoSave(eg,gg=5e3){clearInterval(this._autoSaveTimer),this._autoSaveTimer=setInterval(async()=>{if(!await this.checkFileSave()){let Ig=await this.exportJson();eg&&eg(Ig)}},gg)}}function commonjsRequire(tg){throw new Error('Could not dynamically require "'+tg+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf$2={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$5=getAugmentedNamespace(__viteBrowserExternal$1);var hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports){(function(eg,gg){module.exports=eg.pdfjsLib=gg()})(globalThis,()=>(()=>{var __webpack_modules__=[,((tg,eg)=>{var kI;Object.defineProperty(eg,"__esModule",{value:!0}),eg.VerbosityLevel=eg.Util=eg.UnknownErrorException=eg.UnexpectedResponseException=eg.TextRenderingMode=eg.RenderingIntentFlag=eg.PromiseCapability=eg.PermissionFlag=eg.PasswordResponses=eg.PasswordException=eg.PageActionEventType=eg.OPS=eg.MissingPDFException=eg.MAX_IMAGE_SIZE_TO_CACHE=eg.LINE_FACTOR=eg.LINE_DESCENT_FACTOR=eg.InvalidPDFException=eg.ImageKind=eg.IDENTITY_MATRIX=eg.FormatError=eg.FeatureTest=eg.FONT_IDENTITY_MATRIX=eg.DocumentActionEventType=eg.CMapCompressionType=eg.BaseException=eg.BASELINE_FACTOR=eg.AnnotationType=eg.AnnotationReplyType=eg.AnnotationPrefix=eg.AnnotationMode=eg.AnnotationFlag=eg.AnnotationFieldFlag=eg.AnnotationEditorType=eg.AnnotationEditorPrefix=eg.AnnotationEditorParamsType=eg.AnnotationBorderStyleType=eg.AnnotationActionEventType=eg.AbortException=void 0,eg.assert=Yg,eg.bytesToString=dI,eg.createValidAbsoluteUrl=Tg,eg.getModificationDate=WI,eg.getUuid=wI,eg.getVerbosityLevel=vg,eg.info=Mg,eg.isArrayBuffer=uI,eg.isArrayEqual=fI,eg.isNodeJS=void 0,eg.normalizeUnicode=II,eg.objectFromMap=lI,eg.objectSize=Lg,eg.setVerbosityLevel=Rg,eg.shadow=xg,eg.string32=Og,eg.stringToBytes=ZI,eg.stringToPDFString=hI,eg.stringToUTF8String=BI,eg.unreachable=Sg,eg.utf8StringToString=YI,eg.warn=kg;const gg=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");eg.isNodeJS=gg;const ig=[1,0,0,1,0,0];eg.IDENTITY_MATRIX=ig;const Ig=[.001,0,0,.001,0,0];eg.FONT_IDENTITY_MATRIX=Ig;const ng=1e7;eg.MAX_IMAGE_SIZE_TO_CACHE=ng;const og=1.35;eg.LINE_FACTOR=og;const ag=.35;eg.LINE_DESCENT_FACTOR=ag;const sg=ag/og;eg.BASELINE_FACTOR=sg;const Cg={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};eg.RenderingIntentFlag=Cg;const lg={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};eg.AnnotationMode=lg;const Ag="pdfjs_internal_editor_";eg.AnnotationEditorPrefix=Ag;const cg={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};eg.AnnotationEditorType=cg;const rg={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};eg.AnnotationEditorParamsType=rg;const ug={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};eg.PermissionFlag=ug;const dg={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};eg.TextRenderingMode=dg;const bg={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};eg.ImageKind=bg;const mg={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};eg.AnnotationType=mg;const hg={GROUP:"Group",REPLY:"R"};eg.AnnotationReplyType=hg;const Zg={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};eg.AnnotationFlag=Zg;const wg={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};eg.AnnotationFieldFlag=wg;const pg={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};eg.AnnotationBorderStyleType=pg;const fg={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};eg.AnnotationActionEventType=fg;const Gg={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};eg.DocumentActionEventType=Gg;const yg={O:"PageOpen",C:"PageClose"};eg.PageActionEventType=yg;const Bg={ERRORS:0,WARNINGS:1,INFOS:5};eg.VerbosityLevel=Bg;const Wg={NONE:0,BINARY:1};eg.CMapCompressionType=Wg;const $g={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};eg.OPS=$g;const Ng={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};eg.PasswordResponses=Ng;let Vg=Bg.WARNINGS;function Rg(rI){Number.isInteger(rI)&&(Vg=rI)}function vg(){return Vg}function Mg(rI){Vg>=Bg.INFOS&&console.log(`Info: ${rI}`)}function kg(rI){Vg>=Bg.WARNINGS&&console.log(`Warning: ${rI}`)}function Sg(rI){throw new Error(rI)}function Yg(rI,Fg){rI||Sg(Fg)}function Kg(rI){switch(rI==null?void 0:rI.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Tg(rI,Fg=null,Dg=null){if(!rI)return null;try{if(Dg&&typeof rI=="string"){if(Dg.addDefaultProtocol&&rI.startsWith("www.")){const GI=rI.match(/\./g);(GI==null?void 0:GI.length)>=2&&(rI=`http://${rI}`)}if(Dg.tryConvertEncoding)try{rI=BI(rI)}catch{}}const sI=Fg?new URL(rI,Fg):new URL(rI);if(Kg(sI))return sI}catch{}return null}function xg(rI,Fg,Dg,sI=!1){return Object.defineProperty(rI,Fg,{value:Dg,enumerable:!sI,configurable:!0,writable:!1}),Dg}const Xg=(function(){function Fg(Dg,sI){this.constructor===Fg&&Sg("Cannot initialize BaseException."),this.message=Dg,this.name=sI}return Fg.prototype=new Error,Fg.constructor=Fg,Fg})();eg.BaseException=Xg;class jg extends Xg{constructor(Fg,Dg){super(Fg,"PasswordException"),this.code=Dg}}eg.PasswordException=jg;class zg extends Xg{constructor(Fg,Dg){super(Fg,"UnknownErrorException"),this.details=Dg}}eg.UnknownErrorException=zg;class Qg extends Xg{constructor(Fg){super(Fg,"InvalidPDFException")}}eg.InvalidPDFException=Qg;class _g extends Xg{constructor(Fg){super(Fg,"MissingPDFException")}}eg.MissingPDFException=_g;class gI extends Xg{constructor(Fg,Dg){super(Fg,"UnexpectedResponseException"),this.status=Dg}}eg.UnexpectedResponseException=gI;class AI extends Xg{constructor(Fg){super(Fg,"FormatError")}}eg.FormatError=AI;class CI extends Xg{constructor(Fg){super(Fg,"AbortException")}}eg.AbortException=CI;function dI(rI){(typeof rI!="object"||(rI==null?void 0:rI.length)===void 0)&&Sg("Invalid argument for bytesToString");const Fg=rI.length,Dg=8192;if(Fg<Dg)return String.fromCharCode.apply(null,rI);const sI=[];for(let GI=0;GI<Fg;GI+=Dg){const Hg=Math.min(GI+Dg,Fg),qg=rI.subarray(GI,Hg);sI.push(String.fromCharCode.apply(null,qg))}return sI.join("")}function ZI(rI){typeof rI!="string"&&Sg("Invalid argument for stringToBytes");const Fg=rI.length,Dg=new Uint8Array(Fg);for(let sI=0;sI<Fg;++sI)Dg[sI]=rI.charCodeAt(sI)&255;return Dg}function Og(rI){return String.fromCharCode(rI>>24&255,rI>>16&255,rI>>8&255,rI&255)}function Lg(rI){return Object.keys(rI).length}function lI(rI){const Fg=Object.create(null);for(const[Dg,sI]of rI)Fg[Dg]=sI;return Fg}function iI(){const rI=new Uint8Array(4);return rI[0]=1,new Uint32Array(rI.buffer,0,1)[0]===1}function eI(){try{return new Function(""),!0}catch{return!1}}class Jg{static get isLittleEndian(){return xg(this,"isLittleEndian",iI())}static get isEvalSupported(){return xg(this,"isEvalSupported",eI())}static get isOffscreenCanvasSupported(){return xg(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?xg(this,"platform",{isWin:!1,isMac:!1}):xg(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){var Fg,Dg;return xg(this,"isCSSRoundSupported",(Dg=(Fg=globalThis.CSS)==null?void 0:Fg.supports)==null?void 0:Dg.call(Fg,"width: round(1.5px, 1px)"))}}eg.FeatureTest=Jg;const Pg=[...Array(256).keys()].map(rI=>rI.toString(16).padStart(2,"0"));class cI{static makeHexColor(Fg,Dg,sI){return`#${Pg[Fg]}${Pg[Dg]}${Pg[sI]}`}static scaleMinMax(Fg,Dg){let sI;Fg[0]?(Fg[0]<0&&(sI=Dg[0],Dg[0]=Dg[1],Dg[1]=sI),Dg[0]*=Fg[0],Dg[1]*=Fg[0],Fg[3]<0&&(sI=Dg[2],Dg[2]=Dg[3],Dg[3]=sI),Dg[2]*=Fg[3],Dg[3]*=Fg[3]):(sI=Dg[0],Dg[0]=Dg[2],Dg[2]=sI,sI=Dg[1],Dg[1]=Dg[3],Dg[3]=sI,Fg[1]<0&&(sI=Dg[2],Dg[2]=Dg[3],Dg[3]=sI),Dg[2]*=Fg[1],Dg[3]*=Fg[1],Fg[2]<0&&(sI=Dg[0],Dg[0]=Dg[1],Dg[1]=sI),Dg[0]*=Fg[2],Dg[1]*=Fg[2]),Dg[0]+=Fg[4],Dg[1]+=Fg[4],Dg[2]+=Fg[5],Dg[3]+=Fg[5]}static transform(Fg,Dg){return[Fg[0]*Dg[0]+Fg[2]*Dg[1],Fg[1]*Dg[0]+Fg[3]*Dg[1],Fg[0]*Dg[2]+Fg[2]*Dg[3],Fg[1]*Dg[2]+Fg[3]*Dg[3],Fg[0]*Dg[4]+Fg[2]*Dg[5]+Fg[4],Fg[1]*Dg[4]+Fg[3]*Dg[5]+Fg[5]]}static applyTransform(Fg,Dg){const sI=Fg[0]*Dg[0]+Fg[1]*Dg[2]+Dg[4],GI=Fg[0]*Dg[1]+Fg[1]*Dg[3]+Dg[5];return[sI,GI]}static applyInverseTransform(Fg,Dg){const sI=Dg[0]*Dg[3]-Dg[1]*Dg[2],GI=(Fg[0]*Dg[3]-Fg[1]*Dg[2]+Dg[2]*Dg[5]-Dg[4]*Dg[3])/sI,Hg=(-Fg[0]*Dg[1]+Fg[1]*Dg[0]+Dg[4]*Dg[1]-Dg[5]*Dg[0])/sI;return[GI,Hg]}static getAxialAlignedBoundingBox(Fg,Dg){const sI=this.applyTransform(Fg,Dg),GI=this.applyTransform(Fg.slice(2,4),Dg),Hg=this.applyTransform([Fg[0],Fg[3]],Dg),qg=this.applyTransform([Fg[2],Fg[1]],Dg);return[Math.min(sI[0],GI[0],Hg[0],qg[0]),Math.min(sI[1],GI[1],Hg[1],qg[1]),Math.max(sI[0],GI[0],Hg[0],qg[0]),Math.max(sI[1],GI[1],Hg[1],qg[1])]}static inverseTransform(Fg){const Dg=Fg[0]*Fg[3]-Fg[1]*Fg[2];return[Fg[3]/Dg,-Fg[1]/Dg,-Fg[2]/Dg,Fg[0]/Dg,(Fg[2]*Fg[5]-Fg[4]*Fg[3])/Dg,(Fg[4]*Fg[1]-Fg[5]*Fg[0])/Dg]}static singularValueDecompose2dScale(Fg){const Dg=[Fg[0],Fg[2],Fg[1],Fg[3]],sI=Fg[0]*Dg[0]+Fg[1]*Dg[2],GI=Fg[0]*Dg[1]+Fg[1]*Dg[3],Hg=Fg[2]*Dg[0]+Fg[3]*Dg[2],qg=Fg[2]*Dg[1]+Fg[3]*Dg[3],nI=(sI+qg)/2,Ug=Math.sqrt((sI+qg)**2-4*(sI*qg-Hg*GI))/2,tI=nI+Ug||1,mI=nI-Ug||1;return[Math.sqrt(tI),Math.sqrt(mI)]}static normalizeRect(Fg){const Dg=Fg.slice(0);return Fg[0]>Fg[2]&&(Dg[0]=Fg[2],Dg[2]=Fg[0]),Fg[1]>Fg[3]&&(Dg[1]=Fg[3],Dg[3]=Fg[1]),Dg}static intersect(Fg,Dg){const sI=Math.max(Math.min(Fg[0],Fg[2]),Math.min(Dg[0],Dg[2])),GI=Math.min(Math.max(Fg[0],Fg[2]),Math.max(Dg[0],Dg[2]));if(sI>GI)return null;const Hg=Math.max(Math.min(Fg[1],Fg[3]),Math.min(Dg[1],Dg[3])),qg=Math.min(Math.max(Fg[1],Fg[3]),Math.max(Dg[1],Dg[3]));return Hg>qg?null:[sI,Hg,GI,qg]}static bezierBoundingBox(Fg,Dg,sI,GI,Hg,qg,nI,Ug){const tI=[],mI=[[],[]];let VI,oI,Eg,pI,vI,yI,NI,RI;for(let OI=0;OI<2;++OI){if(OI===0?(oI=6*Fg-12*sI+6*Hg,VI=-3*Fg+9*sI-9*Hg+3*nI,Eg=3*sI-3*Fg):(oI=6*Dg-12*GI+6*qg,VI=-3*Dg+9*GI-9*qg+3*Ug,Eg=3*GI-3*Dg),Math.abs(VI)<1e-12){if(Math.abs(oI)<1e-12)continue;pI=-Eg/oI,0<pI&&pI<1&&tI.push(pI);continue}NI=oI*oI-4*Eg*VI,RI=Math.sqrt(NI),!(NI<0)&&(vI=(-oI+RI)/(2*VI),0<vI&&vI<1&&tI.push(vI),yI=(-oI-RI)/(2*VI),0<yI&&yI<1&&tI.push(yI))}let XI=tI.length,xI;const FI=XI;for(;XI--;)pI=tI[XI],xI=1-pI,mI[0][XI]=xI*xI*xI*Fg+3*xI*xI*pI*sI+3*xI*pI*pI*Hg+pI*pI*pI*nI,mI[1][XI]=xI*xI*xI*Dg+3*xI*xI*pI*GI+3*xI*pI*pI*qg+pI*pI*pI*Ug;return mI[0][FI]=Fg,mI[1][FI]=Dg,mI[0][FI+1]=nI,mI[1][FI+1]=Ug,mI[0].length=mI[1].length=FI+2,[Math.min(...mI[0]),Math.min(...mI[1]),Math.max(...mI[0]),Math.max(...mI[1])]}}eg.Util=cI;const bI=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function hI(rI){if(rI[0]>="ï"){let Dg;if(rI[0]==="þ"&&rI[1]==="ÿ"?Dg="utf-16be":rI[0]==="ÿ"&&rI[1]==="þ"?Dg="utf-16le":rI[0]==="ï"&&rI[1]==="»"&&rI[2]==="¿"&&(Dg="utf-8"),Dg)try{const sI=new TextDecoder(Dg,{fatal:!0}),GI=ZI(rI);return sI.decode(GI)}catch(sI){kg(`stringToPDFString: "${sI}".`)}}const Fg=[];for(let Dg=0,sI=rI.length;Dg<sI;Dg++){const GI=bI[rI.charCodeAt(Dg)];Fg.push(GI?String.fromCharCode(GI):rI.charAt(Dg))}return Fg.join("")}function BI(rI){return decodeURIComponent(escape(rI))}function YI(rI){return unescape(encodeURIComponent(rI))}function uI(rI){return typeof rI=="object"&&(rI==null?void 0:rI.byteLength)!==void 0}function fI(rI,Fg){if(rI.length!==Fg.length)return!1;for(let Dg=0,sI=rI.length;Dg<sI;Dg++)if(rI[Dg]!==Fg[Dg])return!1;return!0}function WI(rI=new Date){return[rI.getUTCFullYear().toString(),(rI.getUTCMonth()+1).toString().padStart(2,"0"),rI.getUTCDate().toString().padStart(2,"0"),rI.getUTCHours().toString().padStart(2,"0"),rI.getUTCMinutes().toString().padStart(2,"0"),rI.getUTCSeconds().toString().padStart(2,"0")].join("")}class MI{constructor(){JI(this,kI,!1);this.promise=new Promise((Fg,Dg)=>{this.resolve=sI=>{EI(this,kI,!0),Fg(sI)},this.reject=sI=>{EI(this,kI,!0),Dg(sI)}})}get settled(){return aI(this,kI)}}kI=new WeakMap,eg.PromiseCapability=MI;let jI=null,HI=null;function II(rI){return jI||(jI=/([\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,HI=new Map([["ſt","ſt"]])),rI.replaceAll(jI,(Fg,Dg,sI)=>Dg?Dg.normalize("NFKC"):HI.get(sI))}function wI(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const rI=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(rI);else for(let Fg=0;Fg<32;Fg++)rI[Fg]=Math.floor(Math.random()*255);return dI(rI)}const $I="pdfjs_internal_id_";eg.AnnotationPrefix=$I}),((__unused_webpack_module,exports,__w_pdfjs_require__)=>{var tg,gg,ig,Ig,sd,Od,ag,sg,Cg,lg,Ag,cg,rg,ug,dg,Ed,mg,hg,cu,wg,pg;Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(Gg){if(typeof Gg=="string"||Gg instanceof URL?Gg={url:Gg}:(0,_util.isArrayBuffer)(Gg)&&(Gg={data:Gg}),typeof Gg!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!Gg.url&&!Gg.data&&!Gg.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const yg=new PDFDocumentLoadingTask,{docId:Bg}=yg,Wg=Gg.url?getUrlProp(Gg.url):null,$g=Gg.data?getDataProp(Gg.data):null,Ng=Gg.httpHeaders||null,Vg=Gg.withCredentials===!0,Rg=Gg.password??null,vg=Gg.range instanceof PDFDataRangeTransport?Gg.range:null,Mg=Number.isInteger(Gg.rangeChunkSize)&&Gg.rangeChunkSize>0?Gg.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let kg=Gg.worker instanceof PDFWorker?Gg.worker:null;const Sg=Gg.verbosity,Yg=typeof Gg.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(Gg.docBaseUrl)?Gg.docBaseUrl:null,Kg=typeof Gg.cMapUrl=="string"?Gg.cMapUrl:null,Tg=Gg.cMapPacked!==!1,xg=Gg.CMapReaderFactory||DefaultCMapReaderFactory,Xg=typeof Gg.standardFontDataUrl=="string"?Gg.standardFontDataUrl:null,jg=Gg.StandardFontDataFactory||DefaultStandardFontDataFactory,zg=Gg.stopAtErrors!==!0,Qg=Number.isInteger(Gg.maxImageSize)&&Gg.maxImageSize>-1?Gg.maxImageSize:-1,_g=Gg.isEvalSupported!==!1,gI=typeof Gg.isOffscreenCanvasSupported=="boolean"?Gg.isOffscreenCanvasSupported:!_util.isNodeJS,AI=Number.isInteger(Gg.canvasMaxAreaInBytes)?Gg.canvasMaxAreaInBytes:-1,CI=typeof Gg.disableFontFace=="boolean"?Gg.disableFontFace:_util.isNodeJS,dI=Gg.fontExtraProperties===!0,ZI=Gg.enableXfa===!0,Og=Gg.ownerDocument||globalThis.document,Lg=Gg.disableRange===!0,lI=Gg.disableStream===!0,iI=Gg.disableAutoFetch===!0,eI=Gg.pdfBug===!0,Jg=vg?vg.length:Gg.length??NaN,Pg=typeof Gg.useSystemFonts=="boolean"?Gg.useSystemFonts:!_util.isNodeJS&&!CI,cI=typeof Gg.useWorkerFetch=="boolean"?Gg.useWorkerFetch:xg===_display_utils.DOMCMapReaderFactory&&jg===_display_utils.DOMStandardFontDataFactory&&Kg&&Xg&&(0,_display_utils.isValidFetchUrl)(Kg,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(Xg,document.baseURI),bI=Gg.canvasFactory||new DefaultCanvasFactory({ownerDocument:Og}),hI=Gg.filterFactory||new DefaultFilterFactory({docId:Bg,ownerDocument:Og}),BI=null;(0,_util.setVerbosityLevel)(Sg);const YI={canvasFactory:bI,filterFactory:hI};if(cI||(YI.cMapReaderFactory=new xg({baseUrl:Kg,isCompressed:Tg}),YI.standardFontDataFactory=new jg({baseUrl:Xg})),!kg){const WI={verbosity:Sg,port:_worker_options.GlobalWorkerOptions.workerPort};kg=WI.port?PDFWorker.fromPort(WI):new PDFWorker(WI),yg._worker=kg}const uI={docId:Bg,apiVersion:"3.11.174",data:$g,password:Rg,disableAutoFetch:iI,rangeChunkSize:Mg,length:Jg,docBaseUrl:Yg,enableXfa:ZI,evaluatorOptions:{maxImageSize:Qg,disableFontFace:CI,ignoreErrors:zg,isEvalSupported:_g,isOffscreenCanvasSupported:gI,canvasMaxAreaInBytes:AI,fontExtraProperties:dI,useSystemFonts:Pg,cMapUrl:cI?Kg:null,standardFontDataUrl:cI?Xg:null}},fI={ignoreErrors:zg,isEvalSupported:_g,disableFontFace:CI,fontExtraProperties:dI,enableXfa:ZI,ownerDocument:Og,disableAutoFetch:iI,pdfBug:eI,styleElement:BI};return kg.promise.then(function(){if(yg.destroyed)throw new Error("Loading aborted");const WI=_fetchDocument(kg,uI),MI=new Promise(function(jI){let HI;vg?HI=new _transport_stream.PDFDataTransportStream({length:Jg,initialData:vg.initialData,progressiveDone:vg.progressiveDone,contentDispositionFilename:vg.contentDispositionFilename,disableRange:Lg,disableStream:lI},vg):$g||(HI=(wI=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(wI):(0,_display_utils.isValidFetchUrl)(wI.url)?new _displayFetch_stream.PDFFetchStream(wI):new _displayNetwork.PDFNetworkStream(wI))({url:Wg,length:Jg,httpHeaders:Ng,withCredentials:Vg,rangeChunkSize:Mg,disableRange:Lg,disableStream:lI})),jI(HI)});return Promise.all([WI,MI]).then(function([jI,HI]){if(yg.destroyed)throw new Error("Loading aborted");const II=new _message_handler.MessageHandler(Bg,jI,kg.port),wI=new WorkerTransport(II,yg,HI,fI,YI);yg._transport=wI,II.send("Ready",null)})}).catch(yg._capability.reject),yg}async function _fetchDocument(Gg,yg){if(Gg.destroyed)throw new Error("Worker was destroyed");const Bg=await Gg.messageHandler.sendWithPromise("GetDocRequest",yg,yg.data?[yg.data.buffer]:null);if(Gg.destroyed)throw new Error("Worker was destroyed");return Bg}function getUrlProp(Gg){if(Gg instanceof URL)return Gg.href;try{return new URL(Gg,window.location).href}catch{if(_util.isNodeJS&&typeof Gg=="string")return Gg}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(Gg){if(_util.isNodeJS&&typeof Buffer<"u"&&Gg instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(Gg instanceof Uint8Array&&Gg.byteLength===Gg.buffer.byteLength)return Gg;if(typeof Gg=="string")return(0,_util.stringToBytes)(Gg);if(typeof Gg=="object"&&!isNaN(Gg==null?void 0:Gg.length)||(0,_util.isArrayBuffer)(Gg))return new Uint8Array(Gg);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}const eg=class eg{constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${Wd(eg,tg)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var yg,Bg,Wg;this.destroyed=!0;try{(yg=this._worker)!=null&&yg.port&&(this._worker._pendingDestroy=!0),await((Bg=this._transport)==null?void 0:Bg.destroy())}catch($g){throw(Wg=this._worker)!=null&&Wg.port&&delete this._worker._pendingDestroy,$g}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};tg=new WeakMap,JI(eg,tg,0);let PDFDocumentLoadingTask=eg;exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(yg,Bg,Wg=!1,$g=null){this.length=yg,this.initialData=Bg,this.progressiveDone=Wg,this.contentDispositionFilename=$g,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(yg){this._rangeListeners.push(yg)}addProgressListener(yg){this._progressListeners.push(yg)}addProgressiveReadListener(yg){this._progressiveReadListeners.push(yg)}addProgressiveDoneListener(yg){this._progressiveDoneListeners.push(yg)}onDataRange(yg,Bg){for(const Wg of this._rangeListeners)Wg(yg,Bg)}onDataProgress(yg,Bg){this._readyCapability.promise.then(()=>{for(const Wg of this._progressListeners)Wg(yg,Bg)})}onDataProgressiveRead(yg){this._readyCapability.promise.then(()=>{for(const Bg of this._progressiveReadListeners)Bg(yg)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const yg of this._progressiveDoneListeners)yg()})}transportReady(){this._readyCapability.resolve()}requestDataRange(yg,Bg){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(yg,Bg){this._pdfInfo=yg,this._transport=Bg,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(Wg=>{if(!Wg)return Wg;const $g=[];for(const Ng in Wg)$g.push(...Wg[Ng]);return $g}))})}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(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(yg){return this._transport.getPage(yg)}getPageIndex(yg){return this._transport.getPageIndex(yg)}getDestinations(){return this._transport.getDestinations()}getDestination(yg){return this._transport.getDestination(yg)}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(){return this._transport.getOptionalContentConfig()}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(yg=!1){return this._transport.startCleanup(yg||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}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()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(yg,Bg,Wg,$g=!1){JI(this,Ig);JI(this,gg,null);JI(this,ig,!1);this._pageIndex=yg,this._pageInfo=Bg,this._transport=Wg,this._stats=$g?new _display_utils.StatTimer:null,this._pdfBug=$g,this.commonObjs=Wg.commonObjs,this.objs=new PDFObjects,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({scale:yg,rotation:Bg=this.rotate,offsetX:Wg=0,offsetY:$g=0,dontFlip:Ng=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:yg,rotation:Bg,offsetX:Wg,offsetY:$g,dontFlip:Ng})}getAnnotations({intent:yg="display"}={}){const Bg=this._transport.getRenderingIntent(yg);return this._transport.getAnnotations(this._pageIndex,Bg.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var yg;return((yg=this._transport._htmlForXfa)==null?void 0:yg.children[this._pageIndex])||null}render({canvasContext:yg,viewport:Bg,intent:Wg="display",annotationMode:$g=_util.AnnotationMode.ENABLE,transform:Ng=null,background:Vg=null,optionalContentConfigPromise:Rg=null,annotationCanvasMap:vg=null,pageColors:Mg=null,printAnnotationStorage:kg=null}){var jg,zg;(jg=this._stats)==null||jg.time("Overall");const Sg=this._transport.getRenderingIntent(Wg,$g,kg);EI(this,ig,!1),zI(this,Ig,Od).call(this),Rg||(Rg=this._transport.getOptionalContentConfig());let Yg=this._intentStates.get(Sg.cacheKey);Yg||(Yg=Object.create(null),this._intentStates.set(Sg.cacheKey,Yg)),Yg.streamReaderCancelTimeout&&(clearTimeout(Yg.streamReaderCancelTimeout),Yg.streamReaderCancelTimeout=null);const Kg=!!(Sg.renderingIntent&_util.RenderingIntentFlag.PRINT);Yg.displayReadyCapability||(Yg.displayReadyCapability=new _util.PromiseCapability,Yg.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(zg=this._stats)==null||zg.time("Page Request"),this._pumpOperatorList(Sg));const Tg=Qg=>{var _g,gI;Yg.renderTasks.delete(xg),(this._maybeCleanupAfterRender||Kg)&&EI(this,ig,!0),zI(this,Ig,sd).call(this,!Kg),Qg?(xg.capability.reject(Qg),this._abortOperatorList({intentState:Yg,reason:Qg instanceof Error?Qg:new Error(Qg)})):xg.capability.resolve(),(_g=this._stats)==null||_g.timeEnd("Rendering"),(gI=this._stats)==null||gI.timeEnd("Overall")},xg=new InternalRenderTask({callback:Tg,params:{canvasContext:yg,viewport:Bg,transform:Ng,background:Vg},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:vg,operatorList:Yg.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!Kg,pdfBug:this._pdfBug,pageColors:Mg});(Yg.renderTasks||(Yg.renderTasks=new Set)).add(xg);const Xg=xg.task;return Promise.all([Yg.displayReadyCapability.promise,Rg]).then(([Qg,_g])=>{var gI;if(this.destroyed){Tg();return}(gI=this._stats)==null||gI.time("Rendering"),xg.initializeGraphics({transparency:Qg,optionalContentConfig:_g}),xg.operatorListChanged()}).catch(Tg),Xg}getOperatorList({intent:yg="display",annotationMode:Bg=_util.AnnotationMode.ENABLE,printAnnotationStorage:Wg=null}={}){var vg;function $g(){Vg.operatorList.lastChunk&&(Vg.opListReadCapability.resolve(Vg.operatorList),Vg.renderTasks.delete(Rg))}const Ng=this._transport.getRenderingIntent(yg,Bg,Wg,!0);let Vg=this._intentStates.get(Ng.cacheKey);Vg||(Vg=Object.create(null),this._intentStates.set(Ng.cacheKey,Vg));let Rg;return Vg.opListReadCapability||(Rg=Object.create(null),Rg.operatorListChanged=$g,Vg.opListReadCapability=new _util.PromiseCapability,(Vg.renderTasks||(Vg.renderTasks=new Set)).add(Rg),Vg.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(vg=this._stats)==null||vg.time("Page Request"),this._pumpOperatorList(Ng)),Vg.opListReadCapability.promise}streamTextContent({includeMarkedContent:yg=!1,disableNormalization:Bg=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:yg===!0,disableNormalization:Bg===!0},{highWaterMark:100,size($g){return $g.items.length}})}getTextContent(yg={}){if(this._transport._htmlForXfa)return this.getXfa().then(Wg=>_xfa_text.XfaText.textContent(Wg));const Bg=this.streamTextContent(yg);return new Promise(function(Wg,$g){function Ng(){Vg.read().then(function({value:vg,done:Mg}){if(Mg){Wg(Rg);return}Object.assign(Rg.styles,vg.styles),Rg.items.push(...vg.items),Ng()},$g)}const Vg=Bg.getReader(),Rg={items:[],styles:Object.create(null)};Ng()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const yg=[];for(const Bg of this._intentStates.values())if(this._abortOperatorList({intentState:Bg,reason:new Error("Page was destroyed."),force:!0}),!Bg.opListReadCapability)for(const Wg of Bg.renderTasks)yg.push(Wg.completed),Wg.cancel();return this.objs.clear(),EI(this,ig,!1),zI(this,Ig,Od).call(this),Promise.all(yg)}cleanup(yg=!1){EI(this,ig,!0);const Bg=zI(this,Ig,sd).call(this,!1);return yg&&Bg&&this._stats&&(this._stats=new _display_utils.StatTimer),Bg}_startRenderPage(yg,Bg){var $g,Ng;const Wg=this._intentStates.get(Bg);Wg&&(($g=this._stats)==null||$g.timeEnd("Page Request"),(Ng=Wg.displayReadyCapability)==null||Ng.resolve(yg))}_renderPageChunk(yg,Bg){for(let Wg=0,$g=yg.length;Wg<$g;Wg++)Bg.operatorList.fnArray.push(yg.fnArray[Wg]),Bg.operatorList.argsArray.push(yg.argsArray[Wg]);Bg.operatorList.lastChunk=yg.lastChunk,Bg.operatorList.separateAnnots=yg.separateAnnots;for(const Wg of Bg.renderTasks)Wg.operatorListChanged();yg.lastChunk&&zI(this,Ig,sd).call(this,!0)}_pumpOperatorList({renderingIntent:yg,cacheKey:Bg,annotationStorageSerializable:Wg}){const{map:$g,transfers:Ng}=Wg,Rg=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:yg,cacheKey:Bg,annotationStorage:$g},Ng).getReader(),vg=this._intentStates.get(Bg);vg.streamReader=Rg;const Mg=()=>{Rg.read().then(({value:kg,done:Sg})=>{if(Sg){vg.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(kg,vg),Mg())},kg=>{if(vg.streamReader=null,!this._transport.destroyed){if(vg.operatorList){vg.operatorList.lastChunk=!0;for(const Sg of vg.renderTasks)Sg.operatorListChanged();zI(this,Ig,sd).call(this,!0)}if(vg.displayReadyCapability)vg.displayReadyCapability.reject(kg);else if(vg.opListReadCapability)vg.opListReadCapability.reject(kg);else throw kg}})};Mg()}_abortOperatorList({intentState:yg,reason:Bg,force:Wg=!1}){if(yg.streamReader){if(yg.streamReaderCancelTimeout&&(clearTimeout(yg.streamReaderCancelTimeout),yg.streamReaderCancelTimeout=null),!Wg){if(yg.renderTasks.size>0)return;if(Bg instanceof _display_utils.RenderingCancelledException){let $g=RENDERING_CANCELLED_TIMEOUT;Bg.extraDelay>0&&Bg.extraDelay<1e3&&($g+=Bg.extraDelay),yg.streamReaderCancelTimeout=setTimeout(()=>{yg.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:yg,reason:Bg,force:!0})},$g);return}}if(yg.streamReader.cancel(new _util.AbortException(Bg.message)).catch(()=>{}),yg.streamReader=null,!this._transport.destroyed){for(const[$g,Ng]of this._intentStates)if(Ng===yg){this._intentStates.delete($g);break}this.cleanup()}}}get stats(){return this._stats}}gg=new WeakMap,ig=new WeakMap,Ig=new WeakSet,sd=function(yg=!1){if(zI(this,Ig,Od).call(this),!aI(this,ig)||this.destroyed)return!1;if(yg)return EI(this,gg,setTimeout(()=>{EI(this,gg,null),zI(this,Ig,sd).call(this,!1)},DELAYED_CLEANUP_TIMEOUT)),!1;for(const{renderTasks:Bg,operatorList:Wg}of this._intentStates.values())if(Bg.size>0||!Wg.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),EI(this,ig,!1),!0},Od=function(){aI(this,gg)&&(clearTimeout(aI(this,gg)),EI(this,gg,null))},exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){JI(this,ag,new Set);JI(this,sg,Promise.resolve())}postMessage(yg,Bg){const Wg={data:structuredClone(yg,Bg?{transfer:Bg}:null)};aI(this,sg).then(()=>{for(const $g of aI(this,ag))$g.call(this,Wg)})}addEventListener(yg,Bg){aI(this,ag).add(Bg)}removeEventListener(yg,Bg){aI(this,ag).delete(Bg)}terminate(){aI(this,ag).clear()}}ag=new WeakMap,sg=new WeakMap,exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const Gg=(Cg=document==null?void 0:document.currentScript)==null?void 0:Cg.src;Gg&&(PDFWorkerUtil.fallbackWorkerSrc=Gg.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(Gg,yg){let Bg;try{if(Bg=new URL(Gg),!Bg.origin||Bg.origin==="null")return!1}catch{return!1}const Wg=new URL(yg,Bg);return Bg.origin===Wg.origin},PDFWorkerUtil.createCDNWrapper=function(Gg){const yg=`importScripts("${Gg}");`;return URL.createObjectURL(new Blob([yg]))}}const _PDFWorker=class _PDFWorker{constructor({name:Gg=null,port:yg=null,verbosity:Bg=(0,_util.getVerbosityLevel)()}={}){var Wg;if(this.name=Gg,this.destroyed=!1,this.verbosity=Bg,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,yg){if((Wg=aI(_PDFWorker,lg))!=null&&Wg.has(yg))throw new Error("Cannot use more than one PDFWorker per port.");(aI(_PDFWorker,lg)||EI(_PDFWorker,lg,new WeakMap)).set(yg,this),this._initializeFromPort(yg);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(Gg){this._port=Gg,this._messageHandler=new _message_handler.MessageHandler("main","worker",Gg),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!_PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:Gg}=_PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,Gg)||(Gg=PDFWorkerUtil.createCDNWrapper(new URL(Gg,window.location).href));const yg=new Worker(Gg),Bg=new _message_handler.MessageHandler("main","worker",yg),Wg=()=>{yg.removeEventListener("error",$g),Bg.destroy(),yg.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},$g=()=>{this._webWorker||Wg()};yg.addEventListener("error",$g),Bg.on("test",Vg=>{if(yg.removeEventListener("error",$g),this.destroyed){Wg();return}Vg?(this._messageHandler=Bg,this._port=yg,this._webWorker=yg,this._readyCapability.resolve(),Bg.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),Bg.destroy(),yg.terminate())}),Bg.on("ready",Vg=>{if(yg.removeEventListener("error",$g),this.destroyed){Wg();return}try{Ng()}catch{this._setupFakeWorker()}});const Ng=()=>{const Vg=new Uint8Array;Bg.send("test",Vg,[Vg.buffer])};Ng();return}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),_PDFWorker._setupFakeWorkerGlobal.then(Gg=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const yg=new LoopbackPort;this._port=yg;const Bg=`fake${PDFWorkerUtil.fakeWorkerId++}`,Wg=new _message_handler.MessageHandler(Bg+"_worker",Bg,yg);Gg.setup(Wg,yg);const $g=new _message_handler.MessageHandler(Bg,Bg+"_worker",yg);this._messageHandler=$g,this._readyCapability.resolve(),$g.send("configure",{verbosity:this.verbosity})}).catch(Gg=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${Gg.message}".`))})}destroy(){var Gg;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(Gg=aI(_PDFWorker,lg))==null||Gg.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(Gg){var Bg;if(!(Gg!=null&&Gg.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const yg=(Bg=aI(this,lg))==null?void 0:Bg.get(Gg.port);if(yg){if(yg._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return yg}return new _PDFWorker(Gg)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){var Gg;try{return((Gg=globalThis.pdfjsWorker)==null?void 0:Gg.WorkerMessageHandler)||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}};lg=new WeakMap,JI(_PDFWorker,lg);let PDFWorker=_PDFWorker;exports.PDFWorker=PDFWorker;class WorkerTransport{constructor(yg,Bg,Wg,$g,Ng){JI(this,dg);JI(this,Ag,new Map);JI(this,cg,new Map);JI(this,rg,new Map);JI(this,ug,null);this.messageHandler=yg,this.loadingTask=Bg,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:$g.ownerDocument,styleElement:$g.styleElement}),this._params=$g,this.canvasFactory=Ng.canvasFactory,this.filterFactory=Ng.filterFactory,this.cMapReaderFactory=Ng.cMapReaderFactory,this.standardFontDataFactory=Ng.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=Wg,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(yg,Bg=_util.AnnotationMode.ENABLE,Wg=null,$g=!1){let Ng=_util.RenderingIntentFlag.DISPLAY,Vg=_annotation_storage.SerializableEmpty;switch(yg){case"any":Ng=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":Ng=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${yg}`)}switch(Bg){case _util.AnnotationMode.DISABLE:Ng+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:Ng+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:Ng+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,Vg=(Ng&_util.RenderingIntentFlag.PRINT&&Wg instanceof _annotation_storage.PrintAnnotationStorage?Wg:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${Bg}`)}return $g&&(Ng+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:Ng,cacheKey:`${Ng}_${Vg.hash}`,annotationStorageSerializable:Vg}}destroy(){var Wg;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,(Wg=aI(this,ug))==null||Wg.reject(new Error("Worker was destroyed during onPassword callback"));const yg=[];for(const $g of aI(this,cg).values())yg.push($g._destroy());aI(this,cg).clear(),aI(this,rg).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const Bg=this.messageHandler.sendWithPromise("Terminate",null);return yg.push(Bg),Promise.all(yg).then(()=>{var $g;this.commonObjs.clear(),this.fontLoader.clear(),aI(this,Ag).clear(),this.filterFactory.destroy(),($g=this._networkStream)==null||$g.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:yg,loadingTask:Bg}=this;yg.on("GetReader",(Wg,$g)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=Ng=>{this._lastProgress={loaded:Ng.loaded,total:Ng.total}},$g.onPull=()=>{this._fullReader.read().then(function({value:Ng,done:Vg}){if(Vg){$g.close();return}(0,_util.assert)(Ng instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),$g.enqueue(new Uint8Array(Ng),1,[Ng])}).catch(Ng=>{$g.error(Ng)})},$g.onCancel=Ng=>{this._fullReader.cancel(Ng),$g.ready.catch(Vg=>{if(!this.destroyed)throw Vg})}}),yg.on("ReaderHeadersReady",Wg=>{const $g=new _util.PromiseCapability,Ng=this._fullReader;return Ng.headersReady.then(()=>{var Vg;(!Ng.isStreamingSupported||!Ng.isRangeSupported)&&(this._lastProgress&&((Vg=Bg.onProgress)==null||Vg.call(Bg,this._lastProgress)),Ng.onProgress=Rg=>{var vg;(vg=Bg.onProgress)==null||vg.call(Bg,{loaded:Rg.loaded,total:Rg.total})}),$g.resolve({isStreamingSupported:Ng.isStreamingSupported,isRangeSupported:Ng.isRangeSupported,contentLength:Ng.contentLength})},$g.reject),$g.promise}),yg.on("GetRangeReader",(Wg,$g)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const Ng=this._networkStream.getRangeReader(Wg.begin,Wg.end);if(!Ng){$g.close();return}$g.onPull=()=>{Ng.read().then(function({value:Vg,done:Rg}){if(Rg){$g.close();return}(0,_util.assert)(Vg instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),$g.enqueue(new Uint8Array(Vg),1,[Vg])}).catch(Vg=>{$g.error(Vg)})},$g.onCancel=Vg=>{Ng.cancel(Vg),$g.ready.catch(Rg=>{if(!this.destroyed)throw Rg})}}),yg.on("GetDoc",({pdfInfo:Wg})=>{this._numPages=Wg.numPages,this._htmlForXfa=Wg.htmlForXfa,delete Wg.htmlForXfa,Bg._capability.resolve(new PDFDocumentProxy(Wg,this))}),yg.on("DocException",function(Wg){let $g;switch(Wg.name){case"PasswordException":$g=new _util.PasswordException(Wg.message,Wg.code);break;case"InvalidPDFException":$g=new _util.InvalidPDFException(Wg.message);break;case"MissingPDFException":$g=new _util.MissingPDFException(Wg.message);break;case"UnexpectedResponseException":$g=new _util.UnexpectedResponseException(Wg.message,Wg.status);break;case"UnknownErrorException":$g=new _util.UnknownErrorException(Wg.message,Wg.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}Bg._capability.reject($g)}),yg.on("PasswordRequest",Wg=>{if(EI(this,ug,new _util.PromiseCapability),Bg.onPassword){const $g=Ng=>{Ng instanceof Error?aI(this,ug).reject(Ng):aI(this,ug).resolve({password:Ng})};try{Bg.onPassword($g,Wg.code)}catch(Ng){aI(this,ug).reject(Ng)}}else aI(this,ug).reject(new _util.PasswordException(Wg.message,Wg.code));return aI(this,ug).promise}),yg.on("DataLoaded",Wg=>{var $g;($g=Bg.onProgress)==null||$g.call(Bg,{loaded:Wg.length,total:Wg.length}),this.downloadInfoCapability.resolve(Wg)}),yg.on("StartRenderPage",Wg=>{if(this.destroyed)return;aI(this,cg).get(Wg.pageIndex)._startRenderPage(Wg.transparency,Wg.cacheKey)}),yg.on("commonobj",([Wg,$g,Ng])=>{var Vg;if(!this.destroyed&&!this.commonObjs.has(Wg))switch($g){case"Font":const Rg=this._params;if("error"in Ng){const kg=Ng.error;(0,_util.warn)(`Error during font loading: ${kg}`),this.commonObjs.resolve(Wg,kg);break}const vg=Rg.pdfBug&&((Vg=globalThis.FontInspector)!=null&&Vg.enabled)?(kg,Sg)=>globalThis.FontInspector.fontAdded(kg,Sg):null,Mg=new _font_loader.FontFaceObject(Ng,{isEvalSupported:Rg.isEvalSupported,disableFontFace:Rg.disableFontFace,ignoreErrors:Rg.ignoreErrors,inspectFont:vg});this.fontLoader.bind(Mg).catch(kg=>yg.sendWithPromise("FontFallback",{id:Wg})).finally(()=>{!Rg.fontExtraProperties&&Mg.data&&(Mg.data=null),this.commonObjs.resolve(Wg,Mg)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(Wg,Ng);break;default:throw new Error(`Got unknown common object type ${$g}`)}}),yg.on("obj",([Wg,$g,Ng,Vg])=>{var vg;if(this.destroyed)return;const Rg=aI(this,cg).get($g);if(!Rg.objs.has(Wg))switch(Ng){case"Image":if(Rg.objs.resolve(Wg,Vg),Vg){let Mg;if(Vg.bitmap){const{width:kg,height:Sg}=Vg;Mg=kg*Sg*4}else Mg=((vg=Vg.data)==null?void 0:vg.length)||0;Mg>_util.MAX_IMAGE_SIZE_TO_CACHE&&(Rg._maybeCleanupAfterRender=!0)}break;case"Pattern":Rg.objs.resolve(Wg,Vg);break;default:throw new Error(`Got unknown object type ${Ng}`)}}),yg.on("DocProgress",Wg=>{var $g;this.destroyed||($g=Bg.onProgress)==null||$g.call(Bg,{loaded:Wg.loaded,total:Wg.total})}),yg.on("FetchBuiltInCMap",Wg=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(Wg):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),yg.on("FetchStandardFontData",Wg=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(Wg):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var Wg;this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:yg,transfers:Bg}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:yg,filename:((Wg=this._fullReader)==null?void 0:Wg.filename)??null},Bg).finally(()=>{this.annotationStorage.resetModified()})}getPage(yg){if(!Number.isInteger(yg)||yg<=0||yg>this._numPages)return Promise.reject(new Error("Invalid page request."));const Bg=yg-1,Wg=aI(this,rg).get(Bg);if(Wg)return Wg;const $g=this.messageHandler.sendWithPromise("GetPage",{pageIndex:Bg}).then(Ng=>{if(this.destroyed)throw new Error("Transport destroyed");const Vg=new PDFPageProxy(Bg,Ng,this,this._params.pdfBug);return aI(this,cg).set(Bg,Vg),Vg});return aI(this,rg).set(Bg,$g),$g}getPageIndex(yg){return typeof yg!="object"||yg===null||!Number.isInteger(yg.num)||yg.num<0||!Number.isInteger(yg.gen)||yg.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:yg.num,gen:yg.gen})}getAnnotations(yg,Bg){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:yg,intent:Bg})}getFieldObjects(){return zI(this,dg,Ed).call(this,"GetFieldObjects")}hasJSActions(){return zI(this,dg,Ed).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(yg){return typeof yg!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:yg})}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 zI(this,dg,Ed).call(this,"GetDocJSActions")}getPageJSActions(yg){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:yg})}getStructTree(yg){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:yg})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(yg=>new _optional_content_config.OptionalContentConfig(yg))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const yg="GetMetadata",Bg=aI(this,Ag).get(yg);if(Bg)return Bg;const Wg=this.messageHandler.sendWithPromise(yg,null).then($g=>{var Ng,Vg;return{info:$g[0],metadata:$g[1]?new _metadata.Metadata($g[1]):null,contentDispositionFilename:((Ng=this._fullReader)==null?void 0:Ng.filename)??null,contentLength:((Vg=this._fullReader)==null?void 0:Vg.contentLength)??null}});return aI(this,Ag).set(yg,Wg),Wg}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(yg=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const Bg of aI(this,cg).values())if(!Bg.cleanup())throw new Error(`startCleanup: Page ${Bg.pageNumber} is currently rendering.`);this.commonObjs.clear(),yg||this.fontLoader.clear(),aI(this,Ag).clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:yg,enableXfa:Bg}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:yg,enableXfa:Bg})}}Ag=new WeakMap,cg=new WeakMap,rg=new WeakMap,ug=new WeakMap,dg=new WeakSet,Ed=function(yg,Bg=null){const Wg=aI(this,Ag).get(yg);if(Wg)return Wg;const $g=this.messageHandler.sendWithPromise(yg,Bg);return aI(this,Ag).set(yg,$g),$g};class PDFObjects{constructor(){JI(this,hg);JI(this,mg,Object.create(null))}get(yg,Bg=null){if(Bg){const $g=zI(this,hg,cu).call(this,yg);return $g.capability.promise.then(()=>Bg($g.data)),null}const Wg=aI(this,mg)[yg];if(!(Wg!=null&&Wg.capability.settled))throw new Error(`Requesting object that isn't resolved yet ${yg}.`);return Wg.data}has(yg){const Bg=aI(this,mg)[yg];return(Bg==null?void 0:Bg.capability.settled)||!1}resolve(yg,Bg=null){const Wg=zI(this,hg,cu).call(this,yg);Wg.data=Bg,Wg.capability.resolve()}clear(){var yg;for(const Bg in aI(this,mg)){const{data:Wg}=aI(this,mg)[Bg];(yg=Wg==null?void 0:Wg.bitmap)==null||yg.close()}EI(this,mg,Object.create(null))}}mg=new WeakMap,hg=new WeakSet,cu=function(yg){var Bg;return(Bg=aI(this,mg))[yg]||(Bg[yg]={capability:new _util.PromiseCapability,data:null})};class RenderTask{constructor(yg){JI(this,wg,null);EI(this,wg,yg),this.onContinue=null}get promise(){return aI(this,wg).capability.promise}cancel(yg=0){aI(this,wg).cancel(null,yg)}get separateAnnots(){const{separateAnnots:yg}=aI(this,wg).operatorList;if(!yg)return!1;const{annotationCanvasMap:Bg}=aI(this,wg);return yg.form||yg.canvas&&(Bg==null?void 0:Bg.size)>0}}wg=new WeakMap,exports.RenderTask=RenderTask;const fg=class fg{constructor({callback:yg,params:Bg,objs:Wg,commonObjs:$g,annotationCanvasMap:Ng,operatorList:Vg,pageIndex:Rg,canvasFactory:vg,filterFactory:Mg,useRequestAnimationFrame:kg=!1,pdfBug:Sg=!1,pageColors:Yg=null}){this.callback=yg,this.params=Bg,this.objs=Wg,this.commonObjs=$g,this.annotationCanvasMap=Ng,this.operatorListIdx=null,this.operatorList=Vg,this._pageIndex=Rg,this.canvasFactory=vg,this.filterFactory=Mg,this._pdfBug=Sg,this.pageColors=Yg,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=kg===!0&&typeof window<"u",this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=Bg.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:yg=!1,optionalContentConfig:Bg}){var Rg,vg;if(this.cancelled)return;if(this._canvas){if(aI(fg,pg).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.");aI(fg,pg).add(this._canvas)}this._pdfBug&&((Rg=globalThis.StepperManager)!=null&&Rg.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:Wg,viewport:$g,transform:Ng,background:Vg}=this.params;this.gfx=new _canvas.CanvasGraphics(Wg,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:Bg},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:Ng,viewport:$g,transparency:yg,background:Vg}),this.operatorListIdx=0,this.graphicsReady=!0,(vg=this.graphicsReadyCallback)==null||vg.call(this)}cancel(yg=null,Bg=0){var Wg;this.running=!1,this.cancelled=!0,(Wg=this.gfx)==null||Wg.endDrawing(),aI(fg,pg).delete(this._canvas),this.callback(yg||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,Bg))}operatorListChanged(){var yg;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(yg=this.stepper)==null||yg.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),aI(fg,pg).delete(this._canvas),this.callback())))}};pg=new WeakMap,JI(fg,pg,new WeakSet);let InternalRenderTask=fg;const version="3.11.174";exports.version=version;const build="ce8716743";exports.build=build}),((tg,eg,gg)=>{var Cg,lg,Ag,Sb,rg;Object.defineProperty(eg,"__esModule",{value:!0}),eg.SerializableEmpty=eg.PrintAnnotationStorage=eg.AnnotationStorage=void 0;var ig=gg(1),Ig=gg(4),ng=gg(8);const og=Object.freeze({map:null,hash:"",transfers:void 0});eg.SerializableEmpty=og;class ag{constructor(){JI(this,Ag);JI(this,Cg,!1);JI(this,lg,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(dg,bg){const mg=aI(this,lg).get(dg);return mg===void 0?bg:Object.assign(bg,mg)}getRawValue(dg){return aI(this,lg).get(dg)}remove(dg){if(aI(this,lg).delete(dg),aI(this,lg).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const bg of aI(this,lg).values())if(bg instanceof Ig.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(dg,bg){const mg=aI(this,lg).get(dg);let hg=!1;if(mg!==void 0)for(const[Zg,wg]of Object.entries(bg))mg[Zg]!==wg&&(hg=!0,mg[Zg]=wg);else hg=!0,aI(this,lg).set(dg,bg);hg&&zI(this,Ag,Sb).call(this),bg instanceof Ig.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(bg.constructor._type)}has(dg){return aI(this,lg).has(dg)}getAll(){return aI(this,lg).size>0?(0,ig.objectFromMap)(aI(this,lg)):null}setAll(dg){for(const[bg,mg]of Object.entries(dg))this.setValue(bg,mg)}get size(){return aI(this,lg).size}resetModified(){aI(this,Cg)&&(EI(this,Cg,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new sg(this)}get serializable(){if(aI(this,lg).size===0)return og;const dg=new Map,bg=new ng.MurmurHash3_64,mg=[],hg=Object.create(null);let Zg=!1;for(const[wg,pg]of aI(this,lg)){const fg=pg instanceof Ig.AnnotationEditor?pg.serialize(!1,hg):pg;fg&&(dg.set(wg,fg),bg.update(`${wg}:${JSON.stringify(fg)}`),Zg||(Zg=!!fg.bitmap))}if(Zg)for(const wg of dg.values())wg.bitmap&&mg.push(wg.bitmap);return dg.size>0?{map:dg,hash:bg.hexdigest(),transfers:mg}:og}}Cg=new WeakMap,lg=new WeakMap,Ag=new WeakSet,Sb=function(){aI(this,Cg)||(EI(this,Cg,!0),typeof this.onSetModified=="function"&&this.onSetModified())},eg.AnnotationStorage=ag;class sg extends ag{constructor(bg){super();JI(this,rg);const{map:mg,hash:hg,transfers:Zg}=bg.serializable,wg=structuredClone(mg,Zg?{transfer:Zg}:null);EI(this,rg,{map:wg,hash:hg,transfers:Zg})}get print(){(0,ig.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return aI(this,rg)}}rg=new WeakMap,eg.PrintAnnotationStorage=sg}),((tg,eg,gg)=>{var sg,Cg,lg,Ag,cg,rg,ug,dg,bg,mg,hg,Zg,wg,pg,fg,ru,du,Bg,uu,mu,Mb,Xb,Db,bu,Hb;Object.defineProperty(eg,"__esModule",{value:!0}),eg.AnnotationEditor=void 0;var ig=gg(5),Ig=gg(1),ng=gg(6);const kg=class kg{constructor(Yg){JI(this,fg);JI(this,sg,"");JI(this,Cg,!1);JI(this,lg,null);JI(this,Ag,null);JI(this,cg,null);JI(this,rg,!1);JI(this,ug,null);JI(this,dg,this.focusin.bind(this));JI(this,bg,this.focusout.bind(this));JI(this,mg,!1);JI(this,hg,!1);JI(this,Zg,!1);el(this,"_initialOptions",Object.create(null));el(this,"_uiManager",null);el(this,"_focusEventsAllowed",!0);el(this,"_l10nPromise",null);JI(this,wg,!1);JI(this,pg,kg._zIndex++);this.constructor===kg&&(0,Ig.unreachable)("Cannot initialize AnnotationEditor."),this.parent=Yg.parent,this.id=Yg.id,this.width=this.height=null,this.pageIndex=Yg.parent.pageIndex,this.name=Yg.name,this.div=null,this._uiManager=Yg.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=Yg.isCentered,this._structTreeParentId=null;const{rotation:Kg,rawDims:{pageWidth:Tg,pageHeight:xg,pageX:Xg,pageY:jg}}=this.parent.viewport;this.rotation=Kg,this.pageRotation=(360+Kg-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[Tg,xg],this.pageTranslation=[Xg,jg];const[zg,Qg]=this.parentDimensions;this.x=Yg.x/zg,this.y=Yg.y/Qg,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,Ig.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(Yg){const Kg=new ag({id:Yg.parent.getNextId(),parent:Yg.parent,uiManager:Yg._uiManager});Kg.annotationElementId=Yg.annotationElementId,Kg.deleted=!0,Kg._uiManager.addToAnnotationStorage(Kg)}static initialize(Yg,Kg=null){if(kg._l10nPromise||(kg._l10nPromise=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(xg=>[xg,Yg.get(xg)]))),Kg!=null&&Kg.strings)for(const xg of Kg.strings)kg._l10nPromise.set(xg,Yg.get(xg));if(kg._borderLineWidth!==-1)return;const Tg=getComputedStyle(document.documentElement);kg._borderLineWidth=parseFloat(Tg.getPropertyValue("--outline-width"))||0}static updateDefaultParams(Yg,Kg){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(Yg){return!1}static paste(Yg,Kg){(0,Ig.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return aI(this,wg)}set _isDraggable(Yg){var Kg;EI(this,wg,Yg),(Kg=this.div)==null||Kg.classList.toggle("draggable",Yg)}center(){const[Yg,Kg]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*Kg/(Yg*2),this.y+=this.width*Yg/(Kg*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*Kg/(Yg*2),this.y-=this.width*Yg/(Kg*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(Yg){this._uiManager.addCommands(Yg)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=aI(this,pg)}setParent(Yg){Yg!==null&&(this.pageIndex=Yg.pageIndex,this.pageDimensions=Yg.pageDimensions),this.parent=Yg}focusin(Yg){this._focusEventsAllowed&&(aI(this,mg)?EI(this,mg,!1):this.parent.setSelected(this))}focusout(Yg){var Tg;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const Kg=Yg.relatedTarget;Kg!=null&&Kg.closest(`#${this.id}`)||(Yg.preventDefault(),(Tg=this.parent)!=null&&Tg.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(Yg,Kg,Tg,xg){const[Xg,jg]=this.parentDimensions;[Tg,xg]=this.screenToPageTranslation(Tg,xg),this.x=(Yg+Tg)/Xg,this.y=(Kg+xg)/jg,this.fixAndSetPosition()}translate(Yg,Kg){zI(this,fg,ru).call(this,this.parentDimensions,Yg,Kg)}translateInPage(Yg,Kg){zI(this,fg,ru).call(this,this.pageDimensions,Yg,Kg),this.div.scrollIntoView({block:"nearest"})}drag(Yg,Kg){const[Tg,xg]=this.parentDimensions;if(this.x+=Yg/Tg,this.y+=Kg/xg,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:_g,y:gI}=this.div.getBoundingClientRect();this.parent.findNewParent(this,_g,gI)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:Xg,y:jg}=this;const[zg,Qg]=zI(this,fg,du).call(this);Xg+=zg,jg+=Qg,this.div.style.left=`${(100*Xg).toFixed(2)}%`,this.div.style.top=`${(100*jg).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}fixAndSetPosition(){const[Yg,Kg]=this.pageDimensions;let{x:Tg,y:xg,width:Xg,height:jg}=this;switch(Xg*=Yg,jg*=Kg,Tg*=Yg,xg*=Kg,this.rotation){case 0:Tg=Math.max(0,Math.min(Yg-Xg,Tg)),xg=Math.max(0,Math.min(Kg-jg,xg));break;case 90:Tg=Math.max(0,Math.min(Yg-jg,Tg)),xg=Math.min(Kg,Math.max(Xg,xg));break;case 180:Tg=Math.min(Yg,Math.max(Xg,Tg)),xg=Math.min(Kg,Math.max(jg,xg));break;case 270:Tg=Math.min(Yg,Math.max(jg,Tg)),xg=Math.max(0,Math.min(Kg-Xg,xg));break}this.x=Tg/=Yg,this.y=xg/=Kg;const[zg,Qg]=zI(this,fg,du).call(this);Tg+=zg,xg+=Qg;const{style:_g}=this.div;_g.left=`${(100*Tg).toFixed(2)}%`,_g.top=`${(100*xg).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(Yg,Kg){var Tg;return zI(Tg=kg,Bg,uu).call(Tg,Yg,Kg,this.parentRotation)}pageTranslationToScreen(Yg,Kg){var Tg;return zI(Tg=kg,Bg,uu).call(Tg,Yg,Kg,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:Yg,pageDimensions:[Kg,Tg]}=this,xg=Kg*Yg,Xg=Tg*Yg;return Ig.FeatureTest.isCSSRoundSupported?[Math.round(xg),Math.round(Xg)]:[xg,Xg]}setDims(Yg,Kg){var Xg;const[Tg,xg]=this.parentDimensions;this.div.style.width=`${(100*Yg/Tg).toFixed(2)}%`,aI(this,rg)||(this.div.style.height=`${(100*Kg/xg).toFixed(2)}%`),(Xg=aI(this,lg))==null||Xg.classList.toggle("small",Yg<kg.SMALL_EDITOR_SIZE||Kg<kg.SMALL_EDITOR_SIZE)}fixDims(){const{style:Yg}=this.div,{height:Kg,width:Tg}=Yg,xg=Tg.endsWith("%"),Xg=!aI(this,rg)&&Kg.endsWith("%");if(xg&&Xg)return;const[jg,zg]=this.parentDimensions;xg||(Yg.width=`${(100*parseFloat(Tg)/jg).toFixed(2)}%`),!aI(this,rg)&&!Xg&&(Yg.height=`${(100*parseFloat(Kg)/zg).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}async addAltTextButton(){if(aI(this,lg))return;const Yg=EI(this,lg,document.createElement("button"));Yg.className="altText";const Kg=await kg._l10nPromise.get("editor_alt_text_button_label");Yg.textContent=Kg,Yg.setAttribute("aria-label",Kg),Yg.tabIndex="0",Yg.addEventListener("contextmenu",ng.noContextMenu),Yg.addEventListener("pointerdown",Tg=>Tg.stopPropagation()),Yg.addEventListener("click",Tg=>{Tg.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),Yg.addEventListener("keydown",Tg=>{Tg.target===Yg&&Tg.key==="Enter"&&(Tg.preventDefault(),this._uiManager.editAltText(this))}),zI(this,fg,bu).call(this),this.div.append(Yg),kg.SMALL_EDITOR_SIZE||(kg.SMALL_EDITOR_SIZE=Math.min(128,Math.round(Yg.getBoundingClientRect().width*1.4)))}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:aI(this,sg),decorative:aI(this,Cg)}}set altTextData({altText:Yg,decorative:Kg}){aI(this,sg)===Yg&&aI(this,Cg)===Kg||(EI(this,sg,Yg),EI(this,Cg,Kg),zI(this,fg,bu).call(this))}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",aI(this,dg)),this.div.addEventListener("focusout",aI(this,bg));const[Yg,Kg]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*Kg/Yg).toFixed(2)}%`,this.div.style.maxHeight=`${(100*Yg/Kg).toFixed(2)}%`);const[Tg,xg]=this.getInitialTranslation();return this.translate(Tg,xg),(0,ig.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(Yg){const{isMac:Kg}=Ig.FeatureTest.platform;if(Yg.button!==0||Yg.ctrlKey&&Kg){Yg.preventDefault();return}EI(this,mg,!0),zI(this,fg,Hb).call(this,Yg)}moveInDOM(){var Yg;(Yg=this.parent)==null||Yg.moveEditorInDOM(this)}_setParentAndPosition(Yg,Kg,Tg){Yg.changeParent(this),this.x=Kg,this.y=Tg,this.fixAndSetPosition()}getRect(Yg,Kg){const Tg=this.parentScale,[xg,Xg]=this.pageDimensions,[jg,zg]=this.pageTranslation,Qg=Yg/Tg,_g=Kg/Tg,gI=this.x*xg,AI=this.y*Xg,CI=this.width*xg,dI=this.height*Xg;switch(this.rotation){case 0:return[gI+Qg+jg,Xg-AI-_g-dI+zg,gI+Qg+CI+jg,Xg-AI-_g+zg];case 90:return[gI+_g+jg,Xg-AI+Qg+zg,gI+_g+dI+jg,Xg-AI+Qg+CI+zg];case 180:return[gI-Qg-CI+jg,Xg-AI+_g+zg,gI-Qg+jg,Xg-AI+_g+dI+zg];case 270:return[gI-_g-dI+jg,Xg-AI-Qg-CI+zg,gI-_g+jg,Xg-AI-Qg+zg];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(Yg,Kg){const[Tg,xg,Xg,jg]=Yg,zg=Xg-Tg,Qg=jg-xg;switch(this.rotation){case 0:return[Tg,Kg-jg,zg,Qg];case 90:return[Tg,Kg-xg,Qg,zg];case 180:return[Xg,Kg-xg,zg,Qg];case 270:return[Xg,Kg-jg,Qg,zg];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){EI(this,Zg,!0)}disableEditMode(){EI(this,Zg,!1)}isInEditMode(){return aI(this,Zg)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var Yg,Kg;(Yg=this.div)==null||Yg.addEventListener("focusin",aI(this,dg)),(Kg=this.div)==null||Kg.addEventListener("focusout",aI(this,bg))}serialize(Yg=!1,Kg=null){(0,Ig.unreachable)("An editor must be serializable")}static deserialize(Yg,Kg,Tg){const xg=new this.prototype.constructor({parent:Kg,id:Kg.getNextId(),uiManager:Tg});xg.rotation=Yg.rotation;const[Xg,jg]=xg.pageDimensions,[zg,Qg,_g,gI]=xg.getRectInCurrentCoords(Yg.rect,jg);return xg.x=zg/Xg,xg.y=Qg/jg,xg.width=_g/Xg,xg.height=gI/jg,xg}remove(){var Yg;this.div.removeEventListener("focusin",aI(this,dg)),this.div.removeEventListener("focusout",aI(this,bg)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(Yg=aI(this,lg))==null||Yg.remove(),EI(this,lg,null),EI(this,Ag,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(zI(this,fg,Mb).call(this),aI(this,ug).classList.remove("hidden"))}select(){var Yg;this.makeResizable(),(Yg=this.div)==null||Yg.classList.add("selectedEditor")}unselect(){var Yg,Kg,Tg;(Yg=aI(this,ug))==null||Yg.classList.add("hidden"),(Kg=this.div)==null||Kg.classList.remove("selectedEditor"),(Tg=this.div)!=null&&Tg.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(Yg,Kg){}disableEditing(){aI(this,lg)&&(aI(this,lg).hidden=!0)}enableEditing(){aI(this,lg)&&(aI(this,lg).hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return aI(this,hg)}set isEditing(Yg){EI(this,hg,Yg),this.parent&&(Yg?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(Yg,Kg){EI(this,rg,!0);const Tg=Yg/Kg,{style:xg}=this.div;xg.aspectRatio=Tg,xg.height="auto"}static get MIN_SIZE(){return 16}};sg=new WeakMap,Cg=new WeakMap,lg=new WeakMap,Ag=new WeakMap,cg=new WeakMap,rg=new WeakMap,ug=new WeakMap,dg=new WeakMap,bg=new WeakMap,mg=new WeakMap,hg=new WeakMap,Zg=new WeakMap,wg=new WeakMap,pg=new WeakMap,fg=new WeakSet,ru=function([Yg,Kg],Tg,xg){[Tg,xg]=this.screenToPageTranslation(Tg,xg),this.x+=Tg/Yg,this.y+=xg/Kg,this.fixAndSetPosition()},du=function(){const[Yg,Kg]=this.parentDimensions,{_borderLineWidth:Tg}=kg,xg=Tg/Yg,Xg=Tg/Kg;switch(this.rotation){case 90:return[-xg,Xg];case 180:return[xg,Xg];case 270:return[xg,-Xg];default:return[-xg,-Xg]}},Bg=new WeakSet,uu=function(Yg,Kg,Tg){switch(Tg){case 90:return[Kg,-Yg];case 180:return[-Yg,-Kg];case 270:return[-Kg,Yg];default:return[Yg,Kg]}},mu=function(Yg){switch(Yg){case 90:{const[Kg,Tg]=this.pageDimensions;return[0,-Kg/Tg,Tg/Kg,0]}case 180:return[-1,0,0,-1];case 270:{const[Kg,Tg]=this.pageDimensions;return[0,Kg/Tg,-Tg/Kg,0]}default:return[1,0,0,1]}},Mb=function(){if(aI(this,ug))return;EI(this,ug,document.createElement("div")),aI(this,ug).classList.add("resizers");const Yg=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||Yg.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const Kg of Yg){const Tg=document.createElement("div");aI(this,ug).append(Tg),Tg.classList.add("resizer",Kg),Tg.addEventListener("pointerdown",zI(this,fg,Xb).bind(this,Kg)),Tg.addEventListener("contextmenu",ng.noContextMenu)}this.div.prepend(aI(this,ug))},Xb=function(Yg,Kg){Kg.preventDefault();const{isMac:Tg}=Ig.FeatureTest.platform;if(Kg.button!==0||Kg.ctrlKey&&Tg)return;const xg=zI(this,fg,Db).bind(this,Yg),Xg=this._isDraggable;this._isDraggable=!1;const jg={passive:!0,capture:!0};window.addEventListener("pointermove",xg,jg);const zg=this.x,Qg=this.y,_g=this.width,gI=this.height,AI=this.parent.div.style.cursor,CI=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(Kg.target).cursor;const dI=()=>{this._isDraggable=Xg,window.removeEventListener("pointerup",dI),window.removeEventListener("blur",dI),window.removeEventListener("pointermove",xg,jg),this.parent.div.style.cursor=AI,this.div.style.cursor=CI;const ZI=this.x,Og=this.y,Lg=this.width,lI=this.height;ZI===zg&&Og===Qg&&Lg===_g&&lI===gI||this.addCommands({cmd:()=>{this.width=Lg,this.height=lI,this.x=ZI,this.y=Og;const[iI,eI]=this.parentDimensions;this.setDims(iI*Lg,eI*lI),this.fixAndSetPosition()},undo:()=>{this.width=_g,this.height=gI,this.x=zg,this.y=Qg;const[iI,eI]=this.parentDimensions;this.setDims(iI*_g,eI*gI),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",dI),window.addEventListener("blur",dI)},Db=function(Yg,Kg){const[Tg,xg]=this.parentDimensions,Xg=this.x,jg=this.y,zg=this.width,Qg=this.height,_g=kg.MIN_SIZE/Tg,gI=kg.MIN_SIZE/xg,AI=II=>Math.round(II*1e4)/1e4,CI=zI(this,fg,mu).call(this,this.rotation),dI=(II,wI)=>[CI[0]*II+CI[2]*wI,CI[1]*II+CI[3]*wI],ZI=zI(this,fg,mu).call(this,360-this.rotation),Og=(II,wI)=>[ZI[0]*II+ZI[2]*wI,ZI[1]*II+ZI[3]*wI];let Lg,lI,iI=!1,eI=!1;switch(Yg){case"topLeft":iI=!0,Lg=(II,wI)=>[0,0],lI=(II,wI)=>[II,wI];break;case"topMiddle":Lg=(II,wI)=>[II/2,0],lI=(II,wI)=>[II/2,wI];break;case"topRight":iI=!0,Lg=(II,wI)=>[II,0],lI=(II,wI)=>[0,wI];break;case"middleRight":eI=!0,Lg=(II,wI)=>[II,wI/2],lI=(II,wI)=>[0,wI/2];break;case"bottomRight":iI=!0,Lg=(II,wI)=>[II,wI],lI=(II,wI)=>[0,0];break;case"bottomMiddle":Lg=(II,wI)=>[II/2,wI],lI=(II,wI)=>[II/2,0];break;case"bottomLeft":iI=!0,Lg=(II,wI)=>[0,wI],lI=(II,wI)=>[II,0];break;case"middleLeft":eI=!0,Lg=(II,wI)=>[0,wI/2],lI=(II,wI)=>[II,wI/2];break}const Jg=Lg(zg,Qg),Pg=lI(zg,Qg);let cI=dI(...Pg);const bI=AI(Xg+cI[0]),hI=AI(jg+cI[1]);let BI=1,YI=1,[uI,fI]=this.screenToPageTranslation(Kg.movementX,Kg.movementY);if([uI,fI]=Og(uI/Tg,fI/xg),iI){const II=Math.hypot(zg,Qg);BI=YI=Math.max(Math.min(Math.hypot(Pg[0]-Jg[0]-uI,Pg[1]-Jg[1]-fI)/II,1/zg,1/Qg),_g/zg,gI/Qg)}else eI?BI=Math.max(_g,Math.min(1,Math.abs(Pg[0]-Jg[0]-uI)))/zg:YI=Math.max(gI,Math.min(1,Math.abs(Pg[1]-Jg[1]-fI)))/Qg;const WI=AI(zg*BI),MI=AI(Qg*YI);cI=dI(...lI(WI,MI));const jI=bI-cI[0],HI=hI-cI[1];this.width=WI,this.height=MI,this.x=jI,this.y=HI,this.setDims(Tg*WI,xg*MI),this.fixAndSetPosition()},bu=async function(){var Tg;const Yg=aI(this,lg);if(!Yg)return;if(!aI(this,sg)&&!aI(this,Cg)){Yg.classList.remove("done"),(Tg=aI(this,Ag))==null||Tg.remove();return}kg._l10nPromise.get("editor_alt_text_edit_button_label").then(xg=>{Yg.setAttribute("aria-label",xg)});let Kg=aI(this,Ag);if(!Kg){EI(this,Ag,Kg=document.createElement("span")),Kg.className="tooltip",Kg.setAttribute("role","tooltip");const xg=Kg.id=`alt-text-tooltip-${this.id}`;Yg.setAttribute("aria-describedby",xg);const Xg=100;Yg.addEventListener("mouseenter",()=>{EI(this,cg,setTimeout(()=>{EI(this,cg,null),aI(this,Ag).classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},Xg))}),Yg.addEventListener("mouseleave",()=>{var jg;clearTimeout(aI(this,cg)),EI(this,cg,null),(jg=aI(this,Ag))==null||jg.classList.remove("show")})}Yg.classList.add("done"),Kg.innerText=aI(this,Cg)?await kg._l10nPromise.get("editor_alt_text_decorative_tooltip"):aI(this,sg),Kg.parentNode||Yg.append(Kg)},Hb=function(Yg){if(!this._isDraggable)return;const Kg=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let Tg,xg;Kg&&(Tg={passive:!0,capture:!0},xg=jg=>{const[zg,Qg]=this.screenToPageTranslation(jg.movementX,jg.movementY);this._uiManager.dragSelectedEditors(zg,Qg)},window.addEventListener("pointermove",xg,Tg));const Xg=()=>{if(window.removeEventListener("pointerup",Xg),window.removeEventListener("blur",Xg),Kg&&window.removeEventListener("pointermove",xg,Tg),EI(this,mg,!1),!this._uiManager.endDragSession()){const{isMac:jg}=Ig.FeatureTest.platform;Yg.ctrlKey&&!jg||Yg.shiftKey||Yg.metaKey&&jg?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",Xg),window.addEventListener("blur",Xg)},JI(kg,Bg),el(kg,"_borderLineWidth",-1),el(kg,"_colorManager",new ig.ColorManager),el(kg,"_zIndex",1),el(kg,"SMALL_EDITOR_SIZE",0);let og=kg;eg.AnnotationEditor=og;class ag extends og{constructor(Yg){super(Yg),this.annotationElementId=Yg.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((tg,eg,gg)=>{var rg,ug,dg,bg,mg,hu,wg,pg,fg,Gg,yg,jb,$g,Ng,Vg,Rg,vg,Mg,kg,Sg,Yg,Kg,Tg,xg,Xg,jg,zg,Qg,_g,gI,AI,CI,dI,ZI,Og,Lg,lI,iI,eI,Jg,Pg,cI,bI,hI,BI,YI,uI,xb,pu,Zu,Qd,wu,Gu,uc,Nd,Fb,Kb,fu,Vd,yu;Object.defineProperty(eg,"__esModule",{value:!0}),eg.KeyboardManager=eg.CommandManager=eg.ColorManager=eg.AnnotationEditorUIManager=void 0,eg.bindEvents=ng,eg.opacityToHex=og;var ig=gg(1),Ig=gg(6);function ng(Hg,qg,nI){for(const Ug of nI)qg.addEventListener(Ug,Hg[Ug].bind(Hg))}function og(Hg){return Math.round(Math.min(255,Math.max(1,255*Hg))).toString(16).padStart(2,"0")}class ag{constructor(){JI(this,rg,0)}getId(){return`${ig.AnnotationEditorPrefix}${Wd(this,rg)._++}`}}rg=new WeakMap;const Zg=class Zg{constructor(){JI(this,mg);JI(this,ug,(0,ig.getUuid)());JI(this,dg,0);JI(this,bg,null)}static get _isSVGFittingCanvas(){const qg='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>',Ug=new OffscreenCanvas(1,3).getContext("2d"),tI=new Image;tI.src=qg;const mI=tI.decode().then(()=>(Ug.drawImage(tI,0,0,1,1,0,0,1,3),new Uint32Array(Ug.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,ig.shadow)(this,"_isSVGFittingCanvas",mI)}async getFromFile(qg){const{lastModified:nI,name:Ug,size:tI,type:mI}=qg;return zI(this,mg,hu).call(this,`${nI}_${Ug}_${tI}_${mI}`,qg)}async getFromUrl(qg){return zI(this,mg,hu).call(this,qg,qg)}async getFromId(qg){aI(this,bg)||EI(this,bg,new Map);const nI=aI(this,bg).get(qg);return nI?nI.bitmap?(nI.refCounter+=1,nI):nI.file?this.getFromFile(nI.file):this.getFromUrl(nI.url):null}getSvgUrl(qg){const nI=aI(this,bg).get(qg);return nI!=null&&nI.isSvg?nI.svgUrl:null}deleteId(qg){aI(this,bg)||EI(this,bg,new Map);const nI=aI(this,bg).get(qg);nI&&(nI.refCounter-=1,nI.refCounter===0&&(nI.bitmap=null))}isValidId(qg){return qg.startsWith(`image_${aI(this,ug)}_`)}};ug=new WeakMap,dg=new WeakMap,bg=new WeakMap,mg=new WeakSet,hu=async function(qg,nI){aI(this,bg)||EI(this,bg,new Map);let Ug=aI(this,bg).get(qg);if(Ug===null)return null;if(Ug!=null&&Ug.bitmap)return Ug.refCounter+=1,Ug;try{Ug||(Ug={bitmap:null,id:`image_${aI(this,ug)}_${Wd(this,dg)._++}`,refCounter:0,isSvg:!1});let tI;if(typeof nI=="string"){Ug.url=nI;const mI=await fetch(nI);if(!mI.ok)throw new Error(mI.statusText);tI=await mI.blob()}else tI=Ug.file=nI;if(tI.type==="image/svg+xml"){const mI=Zg._isSVGFittingCanvas,VI=new FileReader,oI=new Image,Eg=new Promise((pI,vI)=>{oI.onload=()=>{Ug.bitmap=oI,Ug.isSvg=!0,pI()},VI.onload=async()=>{const yI=Ug.svgUrl=VI.result;oI.src=await mI?`${yI}#svgView(preserveAspectRatio(none))`:yI},oI.onerror=VI.onerror=vI});VI.readAsDataURL(tI),await Eg}else Ug.bitmap=await createImageBitmap(tI);Ug.refCounter=1}catch(tI){console.error(tI),Ug=null}return aI(this,bg).set(qg,Ug),Ug&&aI(this,bg).set(Ug.id,Ug),Ug};let sg=Zg;class Cg{constructor(qg=128){JI(this,wg,[]);JI(this,pg,!1);JI(this,fg);JI(this,Gg,-1);EI(this,fg,qg)}add({cmd:qg,undo:nI,mustExec:Ug,type:tI=NaN,overwriteIfSameType:mI=!1,keepUndo:VI=!1}){if(Ug&&qg(),aI(this,pg))return;const oI={cmd:qg,undo:nI,type:tI};if(aI(this,Gg)===-1){aI(this,wg).length>0&&(aI(this,wg).length=0),EI(this,Gg,0),aI(this,wg).push(oI);return}if(mI&&aI(this,wg)[aI(this,Gg)].type===tI){VI&&(oI.undo=aI(this,wg)[aI(this,Gg)].undo),aI(this,wg)[aI(this,Gg)]=oI;return}const Eg=aI(this,Gg)+1;Eg===aI(this,fg)?aI(this,wg).splice(0,1):(EI(this,Gg,Eg),Eg<aI(this,wg).length&&aI(this,wg).splice(Eg)),aI(this,wg).push(oI)}undo(){aI(this,Gg)!==-1&&(EI(this,pg,!0),aI(this,wg)[aI(this,Gg)].undo(),EI(this,pg,!1),EI(this,Gg,aI(this,Gg)-1))}redo(){aI(this,Gg)<aI(this,wg).length-1&&(EI(this,Gg,aI(this,Gg)+1),EI(this,pg,!0),aI(this,wg)[aI(this,Gg)].cmd(),EI(this,pg,!1))}hasSomethingToUndo(){return aI(this,Gg)!==-1}hasSomethingToRedo(){return aI(this,Gg)<aI(this,wg).length-1}destroy(){EI(this,wg,null)}}wg=new WeakMap,pg=new WeakMap,fg=new WeakMap,Gg=new WeakMap,eg.CommandManager=Cg;class lg{constructor(qg){JI(this,yg);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:nI}=ig.FeatureTest.platform;for(const[Ug,tI,mI={}]of qg)for(const VI of Ug){const oI=VI.startsWith("mac+");nI&&oI?(this.callbacks.set(VI.slice(4),{callback:tI,options:mI}),this.allKeys.add(VI.split("+").at(-1))):!nI&&!oI&&(this.callbacks.set(VI,{callback:tI,options:mI}),this.allKeys.add(VI.split("+").at(-1)))}}exec(qg,nI){if(!this.allKeys.has(nI.key))return;const Ug=this.callbacks.get(zI(this,yg,jb).call(this,nI));if(!Ug)return;const{callback:tI,options:{bubbles:mI=!1,args:VI=[],checker:oI=null}}=Ug;oI&&!oI(qg,nI)||(tI.bind(qg,...VI)(),mI||(nI.stopPropagation(),nI.preventDefault()))}}yg=new WeakSet,jb=function(qg){qg.altKey&&this.buffer.push("alt"),qg.ctrlKey&&this.buffer.push("ctrl"),qg.metaKey&&this.buffer.push("meta"),qg.shiftKey&&this.buffer.push("shift"),this.buffer.push(qg.key);const nI=this.buffer.join("+");return this.buffer.length=0,nI},eg.KeyboardManager=lg;const Wg=class Wg{get _colors(){const qg=new Map([["CanvasText",null],["Canvas",null]]);return(0,Ig.getColorValues)(qg),(0,ig.shadow)(this,"_colors",qg)}convert(qg){const nI=(0,Ig.getRGB)(qg);if(!window.matchMedia("(forced-colors: active)").matches)return nI;for(const[Ug,tI]of this._colors)if(tI.every((mI,VI)=>mI===nI[VI]))return Wg._colorsMapping.get(Ug);return nI}getHexCode(qg){const nI=this._colors.get(qg);return nI?ig.Util.makeHexColor(...nI):qg}};el(Wg,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Ag=Wg;eg.ColorManager=Ag;const GI=class GI{constructor(qg,nI,Ug,tI,mI,VI){JI(this,uI);JI(this,$g,null);JI(this,Ng,new Map);JI(this,Vg,new Map);JI(this,Rg,null);JI(this,vg,null);JI(this,Mg,new Cg);JI(this,kg,0);JI(this,Sg,new Set);JI(this,Yg,null);JI(this,Kg,null);JI(this,Tg,new Set);JI(this,xg,null);JI(this,Xg,new ag);JI(this,jg,!1);JI(this,zg,!1);JI(this,Qg,null);JI(this,_g,ig.AnnotationEditorType.NONE);JI(this,gI,new Set);JI(this,AI,null);JI(this,CI,this.blur.bind(this));JI(this,dI,this.focus.bind(this));JI(this,ZI,this.copy.bind(this));JI(this,Og,this.cut.bind(this));JI(this,Lg,this.paste.bind(this));JI(this,lI,this.keydown.bind(this));JI(this,iI,this.onEditingAction.bind(this));JI(this,eI,this.onPageChanging.bind(this));JI(this,Jg,this.onScaleChanging.bind(this));JI(this,Pg,this.onRotationChanging.bind(this));JI(this,cI,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1});JI(this,bI,[0,0]);JI(this,hI,null);JI(this,BI,null);JI(this,YI,null);EI(this,BI,qg),EI(this,YI,nI),EI(this,Rg,Ug),this._eventBus=tI,this._eventBus._on("editingaction",aI(this,iI)),this._eventBus._on("pagechanging",aI(this,eI)),this._eventBus._on("scalechanging",aI(this,Jg)),this._eventBus._on("rotationchanging",aI(this,Pg)),EI(this,vg,mI.annotationStorage),EI(this,xg,mI.filterFactory),EI(this,AI,VI),this.viewParameters={realScale:Ig.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}static get _keyboardManager(){const qg=GI.prototype,nI=mI=>{const{activeElement:VI}=document;return VI&&aI(mI,BI).contains(VI)&&mI.hasSomethingToControl()},Ug=this.TRANSLATE_SMALL,tI=this.TRANSLATE_BIG;return(0,ig.shadow)(this,"_keyboardManager",new lg([[["ctrl+a","mac+meta+a"],qg.selectAll],[["ctrl+z","mac+meta+z"],qg.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],qg.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],qg.delete],[["Escape","mac+Escape"],qg.unselectAll],[["ArrowLeft","mac+ArrowLeft"],qg.translateSelectedEditors,{args:[-Ug,0],checker:nI}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],qg.translateSelectedEditors,{args:[-tI,0],checker:nI}],[["ArrowRight","mac+ArrowRight"],qg.translateSelectedEditors,{args:[Ug,0],checker:nI}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],qg.translateSelectedEditors,{args:[tI,0],checker:nI}],[["ArrowUp","mac+ArrowUp"],qg.translateSelectedEditors,{args:[0,-Ug],checker:nI}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],qg.translateSelectedEditors,{args:[0,-tI],checker:nI}],[["ArrowDown","mac+ArrowDown"],qg.translateSelectedEditors,{args:[0,Ug],checker:nI}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],qg.translateSelectedEditors,{args:[0,tI],checker:nI}]]))}destroy(){zI(this,uI,Qd).call(this),zI(this,uI,pu).call(this),this._eventBus._off("editingaction",aI(this,iI)),this._eventBus._off("pagechanging",aI(this,eI)),this._eventBus._off("scalechanging",aI(this,Jg)),this._eventBus._off("rotationchanging",aI(this,Pg));for(const qg of aI(this,Vg).values())qg.destroy();aI(this,Vg).clear(),aI(this,Ng).clear(),aI(this,Tg).clear(),EI(this,$g,null),aI(this,gI).clear(),aI(this,Mg).destroy(),aI(this,Rg).destroy()}get hcmFilter(){return(0,ig.shadow)(this,"hcmFilter",aI(this,AI)?aI(this,xg).addHCMFilter(aI(this,AI).foreground,aI(this,AI).background):"none")}get direction(){return(0,ig.shadow)(this,"direction",getComputedStyle(aI(this,BI)).direction)}editAltText(qg){var nI;(nI=aI(this,Rg))==null||nI.editAltText(this,qg)}onPageChanging({pageNumber:qg}){EI(this,kg,qg-1)}focusMainContainer(){aI(this,BI).focus()}findParent(qg,nI){for(const Ug of aI(this,Vg).values()){const{x:tI,y:mI,width:VI,height:oI}=Ug.div.getBoundingClientRect();if(qg>=tI&&qg<=tI+VI&&nI>=mI&&nI<=mI+oI)return Ug}return null}disableUserSelect(qg=!1){aI(this,YI).classList.toggle("noUserSelect",qg)}addShouldRescale(qg){aI(this,Tg).add(qg)}removeShouldRescale(qg){aI(this,Tg).delete(qg)}onScaleChanging({scale:qg}){this.commitOrRemove(),this.viewParameters.realScale=qg*Ig.PixelsPerInch.PDF_TO_CSS_UNITS;for(const nI of aI(this,Tg))nI.onScaleChanging()}onRotationChanging({pagesRotation:qg}){this.commitOrRemove(),this.viewParameters.rotation=qg}addToAnnotationStorage(qg){!qg.isEmpty()&&aI(this,vg)&&!aI(this,vg).has(qg.id)&&aI(this,vg).setValue(qg.id,qg)}blur(){if(!this.hasSelection)return;const{activeElement:qg}=document;for(const nI of aI(this,gI))if(nI.div.contains(qg)){EI(this,Qg,[nI,qg]),nI._focusEventsAllowed=!1;break}}focus(){if(!aI(this,Qg))return;const[qg,nI]=aI(this,Qg);EI(this,Qg,null),nI.addEventListener("focusin",()=>{qg._focusEventsAllowed=!0},{once:!0}),nI.focus()}addEditListeners(){zI(this,uI,Zu).call(this),zI(this,uI,wu).call(this)}removeEditListeners(){zI(this,uI,Qd).call(this),zI(this,uI,Gu).call(this)}copy(qg){var Ug;if(qg.preventDefault(),(Ug=aI(this,$g))==null||Ug.commitOrRemove(),!this.hasSelection)return;const nI=[];for(const tI of aI(this,gI)){const mI=tI.serialize(!0);mI&&nI.push(mI)}nI.length!==0&&qg.clipboardData.setData("application/pdfjs",JSON.stringify(nI))}cut(qg){this.copy(qg),this.delete()}paste(qg){qg.preventDefault();const{clipboardData:nI}=qg;for(const mI of nI.items)for(const VI of aI(this,Kg))if(VI.isHandlingMimeForPasting(mI.type)){VI.paste(mI,this.currentLayer);return}let Ug=nI.getData("application/pdfjs");if(!Ug)return;try{Ug=JSON.parse(Ug)}catch(mI){(0,ig.warn)(`paste: "${mI.message}".`);return}if(!Array.isArray(Ug))return;this.unselectAll();const tI=this.currentLayer;try{const mI=[];for(const Eg of Ug){const pI=tI.deserialize(Eg);if(!pI)return;mI.push(pI)}const VI=()=>{for(const Eg of mI)zI(this,uI,fu).call(this,Eg);zI(this,uI,yu).call(this,mI)},oI=()=>{for(const Eg of mI)Eg.remove()};this.addCommands({cmd:VI,undo:oI,mustExec:!0})}catch(mI){(0,ig.warn)(`paste: "${mI.message}".`)}}keydown(qg){var nI;(nI=this.getActive())!=null&&nI.shouldGetKeyboardEvents()||GI._keyboardManager.exec(this,qg)}onEditingAction(qg){["undo","redo","delete","selectAll"].includes(qg.name)&&this[qg.name]()}setEditingState(qg){qg?(zI(this,uI,xb).call(this),zI(this,uI,Zu).call(this),zI(this,uI,wu).call(this),zI(this,uI,uc).call(this,{isEditing:aI(this,_g)!==ig.AnnotationEditorType.NONE,isEmpty:zI(this,uI,Vd).call(this),hasSomethingToUndo:aI(this,Mg).hasSomethingToUndo(),hasSomethingToRedo:aI(this,Mg).hasSomethingToRedo(),hasSelectedEditor:!1})):(zI(this,uI,pu).call(this),zI(this,uI,Qd).call(this),zI(this,uI,Gu).call(this),zI(this,uI,uc).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(qg){if(!aI(this,Kg)){EI(this,Kg,qg);for(const nI of aI(this,Kg))zI(this,uI,Nd).call(this,nI.defaultPropertiesToUpdate)}}getId(){return aI(this,Xg).getId()}get currentLayer(){return aI(this,Vg).get(aI(this,kg))}getLayer(qg){return aI(this,Vg).get(qg)}get currentPageIndex(){return aI(this,kg)}addLayer(qg){aI(this,Vg).set(qg.pageIndex,qg),aI(this,jg)?qg.enable():qg.disable()}removeLayer(qg){aI(this,Vg).delete(qg.pageIndex)}updateMode(qg,nI=null){if(aI(this,_g)!==qg){if(EI(this,_g,qg),qg===ig.AnnotationEditorType.NONE){this.setEditingState(!1),zI(this,uI,Kb).call(this);return}this.setEditingState(!0),zI(this,uI,Fb).call(this),this.unselectAll();for(const Ug of aI(this,Vg).values())Ug.updateMode(qg);if(nI){for(const Ug of aI(this,Ng).values())if(Ug.annotationElementId===nI){this.setSelected(Ug),Ug.enterInEditMode();break}}}}updateToolbar(qg){qg!==aI(this,_g)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:qg})}updateParams(qg,nI){if(aI(this,Kg)){if(qg===ig.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(qg);return}for(const Ug of aI(this,gI))Ug.updateParams(qg,nI);for(const Ug of aI(this,Kg))Ug.updateDefaultParams(qg,nI)}}enableWaiting(qg=!1){if(aI(this,zg)!==qg){EI(this,zg,qg);for(const nI of aI(this,Vg).values())qg?nI.disableClick():nI.enableClick(),nI.div.classList.toggle("waiting",qg)}}getEditors(qg){const nI=[];for(const Ug of aI(this,Ng).values())Ug.pageIndex===qg&&nI.push(Ug);return nI}getEditor(qg){return aI(this,Ng).get(qg)}addEditor(qg){aI(this,Ng).set(qg.id,qg)}removeEditor(qg){var nI;aI(this,Ng).delete(qg.id),this.unselect(qg),(!qg.annotationElementId||!aI(this,Sg).has(qg.annotationElementId))&&((nI=aI(this,vg))==null||nI.remove(qg.id))}addDeletedAnnotationElement(qg){aI(this,Sg).add(qg.annotationElementId),qg.deleted=!0}isDeletedAnnotationElement(qg){return aI(this,Sg).has(qg)}removeDeletedAnnotationElement(qg){aI(this,Sg).delete(qg.annotationElementId),qg.deleted=!1}setActiveEditor(qg){aI(this,$g)!==qg&&(EI(this,$g,qg),qg&&zI(this,uI,Nd).call(this,qg.propertiesToUpdate))}toggleSelected(qg){if(aI(this,gI).has(qg)){aI(this,gI).delete(qg),qg.unselect(),zI(this,uI,uc).call(this,{hasSelectedEditor:this.hasSelection});return}aI(this,gI).add(qg),qg.select(),zI(this,uI,Nd).call(this,qg.propertiesToUpdate),zI(this,uI,uc).call(this,{hasSelectedEditor:!0})}setSelected(qg){for(const nI of aI(this,gI))nI!==qg&&nI.unselect();aI(this,gI).clear(),aI(this,gI).add(qg),qg.select(),zI(this,uI,Nd).call(this,qg.propertiesToUpdate),zI(this,uI,uc).call(this,{hasSelectedEditor:!0})}isSelected(qg){return aI(this,gI).has(qg)}unselect(qg){qg.unselect(),aI(this,gI).delete(qg),zI(this,uI,uc).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return aI(this,gI).size!==0}undo(){aI(this,Mg).undo(),zI(this,uI,uc).call(this,{hasSomethingToUndo:aI(this,Mg).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:zI(this,uI,Vd).call(this)})}redo(){aI(this,Mg).redo(),zI(this,uI,uc).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:aI(this,Mg).hasSomethingToRedo(),isEmpty:zI(this,uI,Vd).call(this)})}addCommands(qg){aI(this,Mg).add(qg),zI(this,uI,uc).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:zI(this,uI,Vd).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const qg=[...aI(this,gI)],nI=()=>{for(const tI of qg)tI.remove()},Ug=()=>{for(const tI of qg)zI(this,uI,fu).call(this,tI)};this.addCommands({cmd:nI,undo:Ug,mustExec:!0})}commitOrRemove(){var qg;(qg=aI(this,$g))==null||qg.commitOrRemove()}hasSomethingToControl(){return aI(this,$g)||this.hasSelection}selectAll(){for(const qg of aI(this,gI))qg.commit();zI(this,uI,yu).call(this,aI(this,Ng).values())}unselectAll(){if(aI(this,$g)){aI(this,$g).commitOrRemove();return}if(this.hasSelection){for(const qg of aI(this,gI))qg.unselect();aI(this,gI).clear(),zI(this,uI,uc).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(qg,nI,Ug=!1){if(Ug||this.commitOrRemove(),!this.hasSelection)return;aI(this,bI)[0]+=qg,aI(this,bI)[1]+=nI;const[tI,mI]=aI(this,bI),VI=[...aI(this,gI)],oI=1e3;aI(this,hI)&&clearTimeout(aI(this,hI)),EI(this,hI,setTimeout(()=>{EI(this,hI,null),aI(this,bI)[0]=aI(this,bI)[1]=0,this.addCommands({cmd:()=>{for(const Eg of VI)aI(this,Ng).has(Eg.id)&&Eg.translateInPage(tI,mI)},undo:()=>{for(const Eg of VI)aI(this,Ng).has(Eg.id)&&Eg.translateInPage(-tI,-mI)},mustExec:!1})},oI));for(const Eg of VI)Eg.translateInPage(qg,nI)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),EI(this,Yg,new Map);for(const qg of aI(this,gI))aI(this,Yg).set(qg,{savedX:qg.x,savedY:qg.y,savedPageIndex:qg.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!aI(this,Yg))return!1;this.disableUserSelect(!1);const qg=aI(this,Yg);EI(this,Yg,null);let nI=!1;for(const[{x:tI,y:mI,pageIndex:VI},oI]of qg)oI.newX=tI,oI.newY=mI,oI.newPageIndex=VI,nI||(nI=tI!==oI.savedX||mI!==oI.savedY||VI!==oI.savedPageIndex);if(!nI)return!1;const Ug=(tI,mI,VI,oI)=>{if(aI(this,Ng).has(tI.id)){const Eg=aI(this,Vg).get(oI);Eg?tI._setParentAndPosition(Eg,mI,VI):(tI.pageIndex=oI,tI.x=mI,tI.y=VI)}};return this.addCommands({cmd:()=>{for(const[tI,{newX:mI,newY:VI,newPageIndex:oI}]of qg)Ug(tI,mI,VI,oI)},undo:()=>{for(const[tI,{savedX:mI,savedY:VI,savedPageIndex:oI}]of qg)Ug(tI,mI,VI,oI)},mustExec:!0}),!0}dragSelectedEditors(qg,nI){if(aI(this,Yg))for(const Ug of aI(this,Yg).keys())Ug.drag(qg,nI)}rebuild(qg){if(qg.parent===null){const nI=this.getLayer(qg.pageIndex);nI?(nI.changeParent(qg),nI.addOrRebuild(qg)):(this.addEditor(qg),this.addToAnnotationStorage(qg),qg.rebuild())}else qg.parent.addOrRebuild(qg)}isActive(qg){return aI(this,$g)===qg}getActive(){return aI(this,$g)}getMode(){return aI(this,_g)}get imageManager(){return(0,ig.shadow)(this,"imageManager",new sg)}};$g=new WeakMap,Ng=new WeakMap,Vg=new WeakMap,Rg=new WeakMap,vg=new WeakMap,Mg=new WeakMap,kg=new WeakMap,Sg=new WeakMap,Yg=new WeakMap,Kg=new WeakMap,Tg=new WeakMap,xg=new WeakMap,Xg=new WeakMap,jg=new WeakMap,zg=new WeakMap,Qg=new WeakMap,_g=new WeakMap,gI=new WeakMap,AI=new WeakMap,CI=new WeakMap,dI=new WeakMap,ZI=new WeakMap,Og=new WeakMap,Lg=new WeakMap,lI=new WeakMap,iI=new WeakMap,eI=new WeakMap,Jg=new WeakMap,Pg=new WeakMap,cI=new WeakMap,bI=new WeakMap,hI=new WeakMap,BI=new WeakMap,YI=new WeakMap,uI=new WeakSet,xb=function(){window.addEventListener("focus",aI(this,dI)),window.addEventListener("blur",aI(this,CI))},pu=function(){window.removeEventListener("focus",aI(this,dI)),window.removeEventListener("blur",aI(this,CI))},Zu=function(){window.addEventListener("keydown",aI(this,lI),{capture:!0})},Qd=function(){window.removeEventListener("keydown",aI(this,lI),{capture:!0})},wu=function(){document.addEventListener("copy",aI(this,ZI)),document.addEventListener("cut",aI(this,Og)),document.addEventListener("paste",aI(this,Lg))},Gu=function(){document.removeEventListener("copy",aI(this,ZI)),document.removeEventListener("cut",aI(this,Og)),document.removeEventListener("paste",aI(this,Lg))},uc=function(qg){Object.entries(qg).some(([Ug,tI])=>aI(this,cI)[Ug]!==tI)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(aI(this,cI),qg)})},Nd=function(qg){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:qg})},Fb=function(){if(!aI(this,jg)){EI(this,jg,!0);for(const qg of aI(this,Vg).values())qg.enable()}},Kb=function(){if(this.unselectAll(),aI(this,jg)){EI(this,jg,!1);for(const qg of aI(this,Vg).values())qg.disable()}},fu=function(qg){const nI=aI(this,Vg).get(qg.pageIndex);nI?nI.addOrRebuild(qg):this.addEditor(qg)},Vd=function(){if(aI(this,Ng).size===0)return!0;if(aI(this,Ng).size===1)for(const qg of aI(this,Ng).values())return qg.isEmpty();return!1},yu=function(qg){aI(this,gI).clear();for(const nI of qg)nI.isEmpty()||(aI(this,gI).add(nI),nI.select());zI(this,uI,uc).call(this,{hasSelectedEditor:!0})},el(GI,"TRANSLATE_SMALL",1),el(GI,"TRANSLATE_BIG",10);let cg=GI;eg.AnnotationEditorUIManager=cg}),((tg,eg,gg)=>{var kg,Sg,Yg,Kg,Tg,xg,Xg,jg,zg,Qg,_g,gI,ld,Cd,Bu,_d,Ud,vd,Yd;Object.defineProperty(eg,"__esModule",{value:!0}),eg.StatTimer=eg.RenderingCancelledException=eg.PixelsPerInch=eg.PageViewport=eg.PDFDateString=eg.DOMStandardFontDataFactory=eg.DOMSVGFactory=eg.DOMFilterFactory=eg.DOMCanvasFactory=eg.DOMCMapReaderFactory=void 0,eg.deprecated=Gg,eg.getColorValues=Ng,eg.getCurrentTransform=Vg,eg.getCurrentTransformInverse=Rg,eg.getFilenameFromUrl=mg,eg.getPdfFilenameFromUrl=hg,eg.getRGB=$g,eg.getXfaPageViewport=Wg,eg.isDataScheme=dg,eg.isPdfFile=bg,eg.isValidFetchUrl=wg,eg.loadScript=fg,eg.noContextMenu=pg,eg.setLayerDimensions=vg;var ig=gg(7),Ig=gg(1);const ng="http://www.w3.org/2000/svg",Mg=class Mg{};el(Mg,"CSS",96),el(Mg,"PDF",72),el(Mg,"PDF_TO_CSS_UNITS",Mg.CSS/Mg.PDF);let og=Mg;eg.PixelsPerInch=og;class ag extends ig.BaseFilterFactory{constructor({docId:Jg,ownerDocument:Pg=globalThis.document}={}){super();JI(this,gI);JI(this,kg);JI(this,Sg);JI(this,Yg);JI(this,Kg);JI(this,Tg);JI(this,xg);JI(this,Xg);JI(this,jg);JI(this,zg);JI(this,Qg);JI(this,_g,0);EI(this,Yg,Jg),EI(this,Kg,Pg)}addFilter(Jg){if(!Jg)return"none";let Pg=aI(this,gI,ld).get(Jg);if(Pg)return Pg;let cI,bI,hI,BI;if(Jg.length===1){const WI=Jg[0],MI=new Array(256);for(let jI=0;jI<256;jI++)MI[jI]=WI[jI]/255;BI=cI=bI=hI=MI.join(",")}else{const[WI,MI,jI]=Jg,HI=new Array(256),II=new Array(256),wI=new Array(256);for(let $I=0;$I<256;$I++)HI[$I]=WI[$I]/255,II[$I]=MI[$I]/255,wI[$I]=jI[$I]/255;cI=HI.join(","),bI=II.join(","),hI=wI.join(","),BI=`${cI}${bI}${hI}`}if(Pg=aI(this,gI,ld).get(BI),Pg)return aI(this,gI,ld).set(Jg,Pg),Pg;const YI=`g_${aI(this,Yg)}_transfer_map_${Wd(this,_g)._++}`,uI=`url(#${YI})`;aI(this,gI,ld).set(Jg,uI),aI(this,gI,ld).set(BI,uI);const fI=zI(this,gI,_d).call(this,YI);return zI(this,gI,vd).call(this,cI,bI,hI,fI),uI}addHCMFilter(Jg,Pg){var MI;const cI=`${Jg}-${Pg}`;if(aI(this,xg)===cI)return aI(this,Xg);if(EI(this,xg,cI),EI(this,Xg,"none"),(MI=aI(this,Tg))==null||MI.remove(),!Jg||!Pg)return aI(this,Xg);const bI=zI(this,gI,Yd).call(this,Jg);Jg=Ig.Util.makeHexColor(...bI);const hI=zI(this,gI,Yd).call(this,Pg);if(Pg=Ig.Util.makeHexColor(...hI),aI(this,gI,Cd).style.color="",Jg==="#000000"&&Pg==="#ffffff"||Jg===Pg)return aI(this,Xg);const BI=new Array(256);for(let jI=0;jI<=255;jI++){const HI=jI/255;BI[jI]=HI<=.03928?HI/12.92:((HI+.055)/1.055)**2.4}const YI=BI.join(","),uI=`g_${aI(this,Yg)}_hcm_filter`,fI=EI(this,jg,zI(this,gI,_d).call(this,uI));zI(this,gI,vd).call(this,YI,YI,YI,fI),zI(this,gI,Bu).call(this,fI);const WI=(jI,HI)=>{const II=bI[jI]/255,wI=hI[jI]/255,$I=new Array(HI+1);for(let kI=0;kI<=HI;kI++)$I[kI]=II+kI/HI*(wI-II);return $I.join(",")};return zI(this,gI,vd).call(this,WI(0,5),WI(1,5),WI(2,5),fI),EI(this,Xg,`url(#${uI})`),aI(this,Xg)}addHighlightHCMFilter(Jg,Pg,cI,bI){var wI;const hI=`${Jg}-${Pg}-${cI}-${bI}`;if(aI(this,zg)===hI)return aI(this,Qg);if(EI(this,zg,hI),EI(this,Qg,"none"),(wI=aI(this,jg))==null||wI.remove(),!Jg||!Pg)return aI(this,Qg);const[BI,YI]=[Jg,Pg].map(zI(this,gI,Yd).bind(this));let uI=Math.round(.2126*BI[0]+.7152*BI[1]+.0722*BI[2]),fI=Math.round(.2126*YI[0]+.7152*YI[1]+.0722*YI[2]),[WI,MI]=[cI,bI].map(zI(this,gI,Yd).bind(this));fI<uI&&([uI,fI,WI,MI]=[fI,uI,MI,WI]),aI(this,gI,Cd).style.color="";const jI=($I,kI,rI)=>{const Fg=new Array(256),Dg=(fI-uI)/rI,sI=$I/255,GI=(kI-$I)/(255*rI);let Hg=0;for(let qg=0;qg<=rI;qg++){const nI=Math.round(uI+qg*Dg),Ug=sI+qg*GI;for(let tI=Hg;tI<=nI;tI++)Fg[tI]=Ug;Hg=nI+1}for(let qg=Hg;qg<256;qg++)Fg[qg]=Fg[Hg-1];return Fg.join(",")},HI=`g_${aI(this,Yg)}_hcm_highlight_filter`,II=EI(this,jg,zI(this,gI,_d).call(this,HI));return zI(this,gI,Bu).call(this,II),zI(this,gI,vd).call(this,jI(WI[0],MI[0],5),jI(WI[1],MI[1],5),jI(WI[2],MI[2],5),II),EI(this,Qg,`url(#${HI})`),aI(this,Qg)}destroy(Jg=!1){Jg&&(aI(this,Xg)||aI(this,Qg))||(aI(this,Sg)&&(aI(this,Sg).parentNode.parentNode.remove(),EI(this,Sg,null)),aI(this,kg)&&(aI(this,kg).clear(),EI(this,kg,null)),EI(this,_g,0))}}kg=new WeakMap,Sg=new WeakMap,Yg=new WeakMap,Kg=new WeakMap,Tg=new WeakMap,xg=new WeakMap,Xg=new WeakMap,jg=new WeakMap,zg=new WeakMap,Qg=new WeakMap,_g=new WeakMap,gI=new WeakSet,ld=function(){return aI(this,kg)||EI(this,kg,new Map)},Cd=function(){if(!aI(this,Sg)){const Jg=aI(this,Kg).createElement("div"),{style:Pg}=Jg;Pg.visibility="hidden",Pg.contain="strict",Pg.width=Pg.height=0,Pg.position="absolute",Pg.top=Pg.left=0,Pg.zIndex=-1;const cI=aI(this,Kg).createElementNS(ng,"svg");cI.setAttribute("width",0),cI.setAttribute("height",0),EI(this,Sg,aI(this,Kg).createElementNS(ng,"defs")),Jg.append(cI),cI.append(aI(this,Sg)),aI(this,Kg).body.append(Jg)}return aI(this,Sg)},Bu=function(Jg){const Pg=aI(this,Kg).createElementNS(ng,"feColorMatrix");Pg.setAttribute("type","matrix"),Pg.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"),Jg.append(Pg)},_d=function(Jg){const Pg=aI(this,Kg).createElementNS(ng,"filter");return Pg.setAttribute("color-interpolation-filters","sRGB"),Pg.setAttribute("id",Jg),aI(this,gI,Cd).append(Pg),Pg},Ud=function(Jg,Pg,cI){const bI=aI(this,Kg).createElementNS(ng,Pg);bI.setAttribute("type","discrete"),bI.setAttribute("tableValues",cI),Jg.append(bI)},vd=function(Jg,Pg,cI,bI){const hI=aI(this,Kg).createElementNS(ng,"feComponentTransfer");bI.append(hI),zI(this,gI,Ud).call(this,hI,"feFuncR",Jg),zI(this,gI,Ud).call(this,hI,"feFuncG",Pg),zI(this,gI,Ud).call(this,hI,"feFuncB",cI)},Yd=function(Jg){return aI(this,gI,Cd).style.color=Jg,$g(getComputedStyle(aI(this,gI,Cd)).getPropertyValue("color"))},eg.DOMFilterFactory=ag;class sg extends ig.BaseCanvasFactory{constructor({ownerDocument:eI=globalThis.document}={}){super(),this._document=eI}_createCanvas(eI,Jg){const Pg=this._document.createElement("canvas");return Pg.width=eI,Pg.height=Jg,Pg}}eg.DOMCanvasFactory=sg;async function Cg(iI,eI=!1){if(wg(iI,document.baseURI)){const Jg=await fetch(iI);if(!Jg.ok)throw new Error(Jg.statusText);return eI?new Uint8Array(await Jg.arrayBuffer()):(0,Ig.stringToBytes)(await Jg.text())}return new Promise((Jg,Pg)=>{const cI=new XMLHttpRequest;cI.open("GET",iI,!0),eI&&(cI.responseType="arraybuffer"),cI.onreadystatechange=()=>{if(cI.readyState===XMLHttpRequest.DONE){if(cI.status===200||cI.status===0){let bI;if(eI&&cI.response?bI=new Uint8Array(cI.response):!eI&&cI.responseText&&(bI=(0,Ig.stringToBytes)(cI.responseText)),bI){Jg(bI);return}}Pg(new Error(cI.statusText))}},cI.send(null)})}class lg extends ig.BaseCMapReaderFactory{_fetchData(eI,Jg){return Cg(eI,this.isCompressed).then(Pg=>({cMapData:Pg,compressionType:Jg}))}}eg.DOMCMapReaderFactory=lg;class Ag extends ig.BaseStandardFontDataFactory{_fetchData(eI){return Cg(eI,!0)}}eg.DOMStandardFontDataFactory=Ag;class cg extends ig.BaseSVGFactory{_createSVG(eI){return document.createElementNS(ng,eI)}}eg.DOMSVGFactory=cg;class rg{constructor({viewBox:eI,scale:Jg,rotation:Pg,offsetX:cI=0,offsetY:bI=0,dontFlip:hI=!1}){this.viewBox=eI,this.scale=Jg,this.rotation=Pg,this.offsetX=cI,this.offsetY=bI;const BI=(eI[2]+eI[0])/2,YI=(eI[3]+eI[1])/2;let uI,fI,WI,MI;switch(Pg%=360,Pg<0&&(Pg+=360),Pg){case 180:uI=-1,fI=0,WI=0,MI=1;break;case 90:uI=0,fI=1,WI=1,MI=0;break;case 270:uI=0,fI=-1,WI=-1,MI=0;break;case 0:uI=1,fI=0,WI=0,MI=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}hI&&(WI=-WI,MI=-MI);let jI,HI,II,wI;uI===0?(jI=Math.abs(YI-eI[1])*Jg+cI,HI=Math.abs(BI-eI[0])*Jg+bI,II=(eI[3]-eI[1])*Jg,wI=(eI[2]-eI[0])*Jg):(jI=Math.abs(BI-eI[0])*Jg+cI,HI=Math.abs(YI-eI[1])*Jg+bI,II=(eI[2]-eI[0])*Jg,wI=(eI[3]-eI[1])*Jg),this.transform=[uI*Jg,fI*Jg,WI*Jg,MI*Jg,jI-uI*Jg*BI-WI*Jg*YI,HI-fI*Jg*BI-MI*Jg*YI],this.width=II,this.height=wI}get rawDims(){const{viewBox:eI}=this;return(0,Ig.shadow)(this,"rawDims",{pageWidth:eI[2]-eI[0],pageHeight:eI[3]-eI[1],pageX:eI[0],pageY:eI[1]})}clone({scale:eI=this.scale,rotation:Jg=this.rotation,offsetX:Pg=this.offsetX,offsetY:cI=this.offsetY,dontFlip:bI=!1}={}){return new rg({viewBox:this.viewBox.slice(),scale:eI,rotation:Jg,offsetX:Pg,offsetY:cI,dontFlip:bI})}convertToViewportPoint(eI,Jg){return Ig.Util.applyTransform([eI,Jg],this.transform)}convertToViewportRectangle(eI){const Jg=Ig.Util.applyTransform([eI[0],eI[1]],this.transform),Pg=Ig.Util.applyTransform([eI[2],eI[3]],this.transform);return[Jg[0],Jg[1],Pg[0],Pg[1]]}convertToPdfPoint(eI,Jg){return Ig.Util.applyInverseTransform([eI,Jg],this.transform)}}eg.PageViewport=rg;class ug extends Ig.BaseException{constructor(eI,Jg=0){super(eI,"RenderingCancelledException"),this.extraDelay=Jg}}eg.RenderingCancelledException=ug;function dg(iI){const eI=iI.length;let Jg=0;for(;Jg<eI&&iI[Jg].trim()==="";)Jg++;return iI.substring(Jg,Jg+5).toLowerCase()==="data:"}function bg(iI){return typeof iI=="string"&&/\.pdf$/i.test(iI)}function mg(iI,eI=!1){return eI||([iI]=iI.split(/[#?]/,1)),iI.substring(iI.lastIndexOf("/")+1)}function hg(iI,eI="document.pdf"){if(typeof iI!="string")return eI;if(dg(iI))return(0,Ig.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),eI;const Jg=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,Pg=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,cI=Jg.exec(iI);let bI=Pg.exec(cI[1])||Pg.exec(cI[2])||Pg.exec(cI[3]);if(bI&&(bI=bI[0],bI.includes("%")))try{bI=Pg.exec(decodeURIComponent(bI))[0]}catch{}return bI||eI}class Zg{constructor(){el(this,"started",Object.create(null));el(this,"times",[])}time(eI){eI in this.started&&(0,Ig.warn)(`Timer is already running for ${eI}`),this.started[eI]=Date.now()}timeEnd(eI){eI in this.started||(0,Ig.warn)(`Timer has not been started for ${eI}`),this.times.push({name:eI,start:this.started[eI],end:Date.now()}),delete this.started[eI]}toString(){const eI=[];let Jg=0;for(const{name:Pg}of this.times)Jg=Math.max(Pg.length,Jg);for(const{name:Pg,start:cI,end:bI}of this.times)eI.push(`${Pg.padEnd(Jg)} ${bI-cI}ms
|
|
936
|
+
*/function createCommonjsModule(tg,eg){return eg={exports:{}},tg(eg,eg.exports),eg.exports}var assignSymbols$1=createCommonjsModule(function(tg){const eg=Object.prototype.toString,gg=Object.prototype.propertyIsEnumerable,ig=Object.getOwnPropertySymbols;tg.exports=(ng,...og)=>{if(!Ig(ng))throw new TypeError("expected the first argument to be an object");if(og.length===0||typeof Symbol!="function"||typeof ig!="function")return ng;for(let ag of og){let sg=ig(ag);for(let Cg of sg)gg.call(ag,Cg)&&(ng[Cg]=ag[Cg])}return ng};function Ig(ng){return typeof ng=="function"||eg.call(ng)==="[object Object]"||Array.isArray(ng)}}),assignSymbols$2=Object.freeze({__proto__:null,default:assignSymbols$1,__moduleExports:assignSymbols$1}),assignSymbols=assignSymbols$2&&assignSymbols$1||assignSymbols$2,assignDeep=createCommonjsModule(function(tg){const eg=Object.prototype.toString,gg=og=>og!=="__proto__"&&og!=="constructor"&&og!=="prototype",ig=tg.exports=(og,...ag)=>{let sg=0;for(ng(og)&&(og=ag[sg++]),og||(og={});sg<ag.length;sg++)if(Ig(ag[sg])){for(const Cg of Object.keys(ag[sg]))gg(Cg)&&(Ig(og[Cg])&&Ig(ag[sg][Cg])?ig(og[Cg],ag[sg][Cg]):og[Cg]=ag[sg][Cg]);assignSymbols(og,ag[sg])}return og};function Ig(og){return typeof og=="function"||eg.call(og)==="[object Object]"}function ng(og){return typeof og=="object"?og===null:typeof og!="function"}});const inBrowser=typeof window<"u"&&window!==null,hasIntersectionObserver=checkIntersectionObserver();function checkIntersectionObserver(){return inBrowser&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?("isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}}),!0):!1}const modeType={event:"event",observer:"observer"};function remove(tg,eg){if(!tg.length)return;const gg=tg.indexOf(eg);if(gg>-1)return tg.splice(gg,1)}function getBestSelectionFromSrcset(tg,eg){if(tg.tagName!=="IMG"||!tg.getAttribute("data-srcset"))return"";let gg=tg.getAttribute("data-srcset").trim().split(",");const ig=[],ng=tg.parentNode.offsetWidth*eg;let og,ag,sg;gg.forEach(Ag=>{Ag=Ag.trim(),og=Ag.lastIndexOf(" "),og===-1?(ag=Ag,sg=99999):(ag=Ag.substr(0,og),sg=parseInt(Ag.substr(og+1,Ag.length-og-2),10)),ig.push([sg,ag])}),ig.sort((Ag,cg)=>{if(Ag[0]<cg[0])return 1;if(Ag[0]>cg[0])return-1;if(Ag[0]===cg[0]){if(cg[1].indexOf(".webp",cg[1].length-5)!==-1)return 1;if(Ag[1].indexOf(".webp",Ag[1].length-5)!==-1)return-1}return 0});let Cg="",lg;for(let Ag=0;Ag<ig.length;Ag++){lg=ig[Ag],Cg=lg[1];const cg=ig[Ag+1];if(cg&&cg[0]<ng){Cg=lg[1];break}else if(!cg){Cg=lg[1];break}}return Cg}const getDPR=(tg=1)=>inBrowser&&window.devicePixelRatio||tg;function supportWebp(){if(!inBrowser)return!1;let tg=!0;function eg(gg,ig){const Ig={lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"},ng=new Image;ng.onload=function(){const og=ng.width>0&&ng.height>0;ig(og)},ng.onerror=function(){ig(!1)},ng.src="data:image/webp;base64,"+Ig[gg]}return eg("lossy",gg=>{tg=gg}),eg("lossless",gg=>{tg=gg}),eg("alpha",gg=>{tg=gg}),eg("animation",gg=>{tg=gg}),tg}function throttle(tg,eg){let gg=null,ig=0;return function(){if(gg)return;const Ig=Date.now()-ig,ng=this,og=arguments,ag=function(){ig=Date.now(),gg=!1,tg.apply(ng,og)};Ig>=eg?ag():gg=setTimeout(ag,eg)}}function testSupportsPassive(){if(!inBrowser)return!1;let tg=!1;try{const eg=Object.defineProperty({},"passive",{get:function(){tg=!0}});window.addEventListener("test",noop,eg)}catch{}return tg}const supportsPassive=testSupportsPassive(),_={on(tg,eg,gg,ig=!1){supportsPassive?tg.addEventListener(eg,gg,{capture:ig,passive:!0}):tg.addEventListener(eg,gg,ig)},off(tg,eg,gg,ig=!1){tg.removeEventListener(eg,gg,ig)}},loadImageAsync=(tg,eg,gg)=>{let ig=new Image;if(!tg||!tg.src){const Ig=new Error("image src is required");return gg(Ig)}tg.cors&&(ig.crossOrigin=tg.cors),ig.src=tg.src,ig.onload=function(){eg({naturalHeight:ig.naturalHeight,naturalWidth:ig.naturalWidth,src:ig.src}),ig=null},ig.onerror=function(Ig){gg(Ig)}},style=(tg,eg)=>typeof getComputedStyle<"u"?getComputedStyle(tg,null).getPropertyValue(eg):tg.style[eg],overflow=tg=>style(tg,"overflow")+style(tg,"overflowY")+style(tg,"overflowX"),scrollParent=tg=>{if(!inBrowser)return;if(!(tg instanceof Element))return window;let eg=tg;for(;eg&&!(eg===document.body||eg===document.documentElement||!eg.parentNode);){if(/(scroll|auto)/.test(overflow(eg)))return eg;eg=eg.parentNode}return window};function isObject(tg){return tg!==null&&typeof tg=="object"}function noop(){}class ImageCache{constructor(eg){this.max=eg||100,this._caches=[]}has(eg){return this._caches.indexOf(eg)>-1}add(eg){this.has(eg)||(this._caches.push(eg),this._caches.length>this.max&&this.free())}free(){this._caches.shift()}}class ReactiveListener{constructor(eg,gg,ig,Ig,ng,og,ag,sg,Cg,lg){this.el=eg,this.src=gg,this.error=ig,this.loading=Ig,this.bindType=ng,this.attempt=0,this.cors=sg,this.naturalHeight=0,this.naturalWidth=0,this.options=ag,this.rect={},this.$parent=og,this.elRenderer=Cg,this._imageCache=lg,this.performanceData={init:Date.now(),loadStart:0,loadEnd:0},this.filter(),this.initState(),this.render("loading",!1)}initState(){"dataset"in this.el?this.el.dataset.src=this.src:this.el.setAttribute("data-src",this.src),this.state={loading:!1,error:!1,loaded:!1,rendered:!1}}record(eg){this.performanceData[eg]=Date.now()}update(eg){const gg=this.src;this.src=eg.src,this.loading=eg.loading,this.error=eg.error,this.filter(),gg!==this.src&&(this.attempt=0,this.initState())}getRect(){this.rect=this.el.getBoundingClientRect()}checkInView(){return this.getRect(),this.rect.top<window.innerHeight*this.options.preLoad&&this.rect.bottom>this.options.preLoadTop&&this.rect.left<window.innerWidth*this.options.preLoad&&this.rect.right>0}filter(){for(const eg in this.options.filter)this.options.filter[eg](this,this.options)}renderLoading(eg){this.state.loading=!0,loadImageAsync({src:this.loading,cors:this.cors},()=>{this.render("loading",!1),this.state.loading=!1,eg()},()=>{eg(),this.state.loading=!1,this.options.silent||console.warn(`VueLazyload log: load failed with loading image(${this.loading})`)})}load(eg=noop){if(this.attempt>this.options.attempt-1&&this.state.error){this.options.silent||console.log(`VueLazyload log: ${this.src} tried too more than ${this.options.attempt} times`),eg();return}if(!(this.state.rendered&&this.state.loaded)){if(this._imageCache.has(this.src))return this.state.loaded=!0,this.render("loaded",!0),this.state.rendered=!0,eg();this.renderLoading(()=>{this.attempt++,this.options.adapter.beforeLoad&&this.options.adapter.beforeLoad(this,this.options),this.record("loadStart"),loadImageAsync({src:this.src,cors:this.cors},gg=>{this.naturalHeight=gg.naturalHeight,this.naturalWidth=gg.naturalWidth,this.state.loaded=!0,this.state.error=!1,this.record("loadEnd"),this.render("loaded",!1),this.state.rendered=!0,this._imageCache.add(this.src),eg()},gg=>{!this.options.silent&&console.error(gg),this.state.error=!0,this.state.loaded=!1,this.render("error",!1)})})}}render(eg,gg){this.elRenderer(this,eg,gg)}performance(){let eg="loading",gg=0;return this.state.loaded&&(eg="loaded",gg=(this.performanceData.loadEnd-this.performanceData.loadStart)/1e3),this.state.error&&(eg="error"),{src:this.src,state:eg,time:gg}}$destroy(){this.el=null,this.src="",this.error=null,this.loading="",this.bindType=null,this.attempt=0}}const DEFAULT_URL="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",DEFAULT_EVENTS=["scroll","wheel","mousewheel","resize","animationend","transitionend","touchmove"],DEFAULT_OBSERVER_OPTIONS={rootMargin:"0px",threshold:0};class Lazy{constructor({preLoad:eg,error:gg,throttleWait:ig,preLoadTop:Ig,dispatchEvent:ng,loading:og,attempt:ag,silent:sg=!0,scale:Cg,listenEvents:lg,filter:Ag,adapter:cg,observer:rg,observerOptions:ug}){this.version='"3.0.0"',this.lazyContainerMananger=null,this.mode=modeType.event,this.ListenerQueue=[],this.TargetIndex=0,this.TargetQueue=[],this.options={silent:sg,dispatchEvent:!!ng,throttleWait:ig||200,preLoad:eg||1.3,preLoadTop:Ig||0,error:gg||DEFAULT_URL,loading:og||DEFAULT_URL,attempt:ag||3,scale:Cg||getDPR(Cg),listenEvents:lg||DEFAULT_EVENTS,supportWebp:supportWebp(),filter:Ag||{},adapter:cg||{},observer:!!rg,observerOptions:ug||DEFAULT_OBSERVER_OPTIONS},this._initEvent(),this._imageCache=new ImageCache(200),this.lazyLoadHandler=throttle(this._lazyLoadHandler.bind(this),this.options.throttleWait),this.setMode(this.options.observer?modeType.observer:modeType.event)}performance(){const eg=[];return this.ListenerQueue.map(gg=>eg.push(gg.performance())),eg}addLazyBox(eg){this.ListenerQueue.push(eg),inBrowser&&(this._addListenerTarget(window),this._observer&&this._observer.observe(eg.el),eg.$el&&eg.$el.parentNode&&this._addListenerTarget(eg.$el.parentNode))}add(eg,gg,ig){if(this.ListenerQueue.some(sg=>sg.el===eg))return this.update(eg,gg),nextTick(this.lazyLoadHandler);let{src:Ig,loading:ng,error:og,cors:ag}=this._valueFormatter(gg.value);nextTick(()=>{Ig=getBestSelectionFromSrcset(eg,this.options.scale)||Ig,this._observer&&this._observer.observe(eg);const sg=Object.keys(gg.modifiers)[0];let Cg;sg&&(Cg=gg.instance.$refs[sg],Cg=Cg?Cg.el||Cg:document.getElementById(sg)),Cg||(Cg=scrollParent(eg));const lg=new ReactiveListener(eg,Ig,og,ng,gg.arg,Cg,this.options,ag,this._elRenderer.bind(this),this._imageCache);this.ListenerQueue.push(lg),inBrowser&&(this._addListenerTarget(window),this._addListenerTarget(Cg)),nextTick(this.lazyLoadHandler)})}update(eg,gg,ig){let{src:Ig,loading:ng,error:og}=this._valueFormatter(gg.value);Ig=getBestSelectionFromSrcset(eg,this.options.scale)||Ig;const ag=this.ListenerQueue.find(sg=>sg.el===eg);ag?ag.update({src:Ig,loading:ng,error:og}):(eg.getAttribute("lazy")!=="loaded"||eg.dataset.src!==Ig)&&this.add(eg,gg,ig),this._observer&&(this._observer.unobserve(eg),this._observer.observe(eg)),nextTick(this.lazyLoadHandler)}remove(eg){if(!eg)return;this._observer&&this._observer.unobserve(eg);const gg=this.ListenerQueue.find(ig=>ig.el===eg);gg&&(this._removeListenerTarget(gg.$parent),this._removeListenerTarget(window),remove(this.ListenerQueue,gg),gg.$destroy&&gg.$destroy())}removeComponent(eg){eg&&(remove(this.ListenerQueue,eg),this._observer&&this._observer.unobserve(eg.el),eg.$parent&&eg.$el.parentNode&&this._removeListenerTarget(eg.$el.parentNode),this._removeListenerTarget(window))}setMode(eg){!hasIntersectionObserver&&eg===modeType.observer&&(eg=modeType.event),this.mode=eg,eg===modeType.event?(this._observer&&(this.ListenerQueue.forEach(gg=>{this._observer.unobserve(gg.el)}),this._observer=null),this.TargetQueue.forEach(gg=>{this._initListen(gg.el,!0)})):(this.TargetQueue.forEach(gg=>{this._initListen(gg.el,!1)}),this._initIntersectionObserver())}_addListenerTarget(eg){if(!eg)return;let gg=this.TargetQueue.find(ig=>ig.el===eg);return gg?gg.childrenCount++:(gg={el:eg,id:++this.TargetIndex,childrenCount:1,listened:!0},this.mode===modeType.event&&this._initListen(gg.el,!0),this.TargetQueue.push(gg)),this.TargetIndex}_removeListenerTarget(eg){this.TargetQueue.forEach((gg,ig)=>{gg.el===eg&&(gg.childrenCount--,gg.childrenCount||(this._initListen(gg.el,!1),this.TargetQueue.splice(ig,1),gg=null))})}_initListen(eg,gg){this.options.listenEvents.forEach(ig=>_[gg?"on":"off"](eg,ig,this.lazyLoadHandler))}_initEvent(){this.Event={listeners:{loading:[],loaded:[],error:[]}},this.$on=(eg,gg)=>{this.Event.listeners[eg]||(this.Event.listeners[eg]=[]),this.Event.listeners[eg].push(gg)},this.$once=(eg,gg)=>{const ig=this;function Ig(){ig.$off(eg,Ig),gg.apply(ig,arguments)}this.$on(eg,Ig)},this.$off=(eg,gg)=>{if(!gg){if(!this.Event.listeners[eg])return;this.Event.listeners[eg].length=0;return}remove(this.Event.listeners[eg],gg)},this.$emit=(eg,gg,ig)=>{this.Event.listeners[eg]&&this.Event.listeners[eg].forEach(Ig=>Ig(gg,ig))}}_lazyLoadHandler(){const eg=[];this.ListenerQueue.forEach((gg,ig)=>{(!gg.el||!gg.el.parentNode||gg.state.loaded)&&eg.push(gg),gg.checkInView()&&(gg.state.loaded||gg.load())}),eg.forEach(gg=>{remove(this.ListenerQueue,gg),gg.$destroy&&gg.$destroy()})}_initIntersectionObserver(){hasIntersectionObserver&&(this._observer=new IntersectionObserver(this._observerHandler.bind(this),this.options.observerOptions),this.ListenerQueue.length&&this.ListenerQueue.forEach(eg=>{this._observer.observe(eg.el)}))}_observerHandler(eg){eg.forEach(gg=>{gg.isIntersecting&&this.ListenerQueue.forEach(ig=>{if(ig.el===gg.target){if(ig.state.loaded)return this._observer.unobserve(ig.el);ig.load()}})})}_elRenderer(eg,gg,ig){if(!eg.el)return;const{el:Ig,bindType:ng}=eg;let og;switch(gg){case"loading":og=eg.loading;break;case"error":og=eg.error;break;default:og=eg.src;break}if(ng?Ig.style[ng]='url("'+og+'")':Ig.getAttribute("src")!==og&&Ig.setAttribute("src",og),Ig.setAttribute("lazy",gg),this.$emit(gg,eg,ig),this.options.adapter[gg]&&this.options.adapter[gg](eg,this.options),this.options.dispatchEvent){const ag=new CustomEvent(gg,{detail:eg});Ig.dispatchEvent(ag)}}_valueFormatter(eg){return isObject(eg)?(!eg.src&&!this.options.silent&&console.error("Vue Lazyload warning: miss src with "+eg),{src:eg.src,loading:eg.loading||this.options.loading,error:eg.error||this.options.error,cors:this.options.cors}):{src:eg,loading:this.options.loading,error:this.options.error,cors:this.options.cors}}}const useCheckInView=(tg,eg)=>{let gg=reactive({});const ig=()=>{gg=tg.value.getBoundingClientRect()};return{rect:gg,checkInView:()=>(ig(),inBrowser&&gg.top<window.innerHeight*eg&&gg.bottom>0&&gg.left<window.innerWidth*eg&&gg.right>0)}};var LazyComponent=(tg=>defineComponent({props:{tag:{type:String,default:"div"}},emits:["show"],setup(eg,{emit:gg,slots:ig}){const Ig=ref(),ng=reactive({loaded:!1,error:!1,attempt:0}),og=ref(!1),{rect:ag,checkInView:sg}=useCheckInView(Ig,tg.options.preLoad),Cg=()=>{og.value=!0,ng.loaded=!0,gg("show",og.value)},lg=computed(()=>({el:Ig.value,rect:ag,checkInView:sg,load:Cg,state:ng}));return onMounted(()=>{tg.addLazyBox(lg.value),tg.lazyLoadHandler()}),onUnmounted(()=>{tg.removeComponent(lg.value)}),()=>{var Ag;return createVNode(eg.tag,{ref:Ig},[og.value&&((Ag=ig.default)===null||Ag===void 0?void 0:Ag.call(ig))])}}}));class LazyContainerMananger{constructor(eg){this.lazy=eg,eg.lazyContainerMananger=this,this._queue=[]}bind(eg,gg,ig){const Ig=new LazyContainer(eg,gg,ig,this.lazy);this._queue.push(Ig)}update(eg,gg,ig){const Ig=this._queue.find(ng=>ng.el===eg);Ig&&Ig.update(eg,gg)}unbind(eg,gg,ig){const Ig=this._queue.find(ng=>ng.el===eg);Ig&&(Ig.clear(),remove(this._queue,Ig))}}const defaultOptions={selector:"img",error:"",loading:""};class LazyContainer{constructor(eg,gg,ig,Ig){this.el=eg,this.vnode=ig,this.binding=gg,this.options={},this.lazy=Ig,this._queue=[],this.update(eg,gg)}update(eg,gg){this.el=eg,this.options=assignDeep({},defaultOptions,gg.value),this.getImgs().forEach(Ig=>{this.lazy.add(Ig,assignDeep({},this.binding,{value:{src:Ig.getAttribute("data-src")||Ig.dataset.src,error:Ig.getAttribute("data-error")||Ig.dataset.error||this.options.error,loading:Ig.getAttribute("data-loading")||Ig.dataset.loading||this.options.loading}}),this.vnode)})}getImgs(){return Array.from(this.el.querySelectorAll(this.options.selector))}clear(){this.getImgs().forEach(gg=>this.lazy.remove(gg)),this.vnode=null,this.binding=null,this.lazy=null}}var LazyImage=(tg=>defineComponent({setup(eg,{slots:gg}){const ig=ref(),Ig=reactive({src:"",error:"",loading:"",attempt:tg.options.attempt}),ng=reactive({loaded:!1,error:!1,attempt:0}),{rect:og,checkInView:ag}=useCheckInView(ig,tg.options.preLoad),sg=ref(""),Cg=(cg=noop)=>{if(ng.attempt>Ig.attempt-1&&ng.error)return tg.options.silent||console.log(`VueLazyload log: ${Ig.src} tried too more than ${Ig.attempt} times`),cg();const rg=Ig.src;loadImageAsync({src:rg},({src:ug})=>{sg.value=ug,ng.loaded=!0},()=>{ng.attempt++,sg.value=Ig.error,ng.error=!0})},lg=computed(()=>({el:ig.value,rect:og,checkInView:ag,load:Cg,state:ng}));onMounted(()=>{tg.addLazyBox(lg.value),tg.lazyLoadHandler()}),onUnmounted(()=>{tg.removeComponent(lg.value)});const Ag=()=>{const{src:cg,loading:rg,error:ug}=tg._valueFormatter(eg.src);ng.loaded=!1,Ig.src=cg,Ig.error=ug,Ig.loading=rg,sg.value=Ig.loading};return watch(()=>eg.src,()=>{Ag(),tg.addLazyBox(lg.value),tg.lazyLoadHandler()},{immediate:!0}),()=>{var cg;return createVNode(eg.tag||"img",{src:sg.value,ref:ig},[(cg=gg.default)===null||cg===void 0?void 0:cg.call(gg)])}}})),index={install(tg,eg={}){const gg=new Lazy(eg),ig=new LazyContainerMananger(gg);if(Number(tg.version.split(".")[0])<3)return new Error("Vue version at least 3.0");tg.config.globalProperties.$Lazyload=gg,tg.provide("Lazyload",gg),eg.lazyComponent&&tg.component("lazy-component",LazyComponent(gg)),eg.lazyImage&&tg.component("lazy-image",LazyImage(gg)),tg.directive("lazy",{beforeMount:gg.add.bind(gg),beforeUpdate:gg.update.bind(gg),updated:gg.lazyLoadHandler.bind(gg),unmounted:gg.remove.bind(gg)}),tg.directive("lazy-container",{beforeMount:ig.bind.bind(ig),updated:ig.update.bind(ig),unmounted:ig.unbind.bind(ig)})}};function createPiniaInstance(){return createPinia()}createPiniaInstance();const CMD_LIST=["ReplaceContent","AddPositionOffset","RecoverOriginalHSpacings","RemoveIndexs","RemoveNames","OnlyNames"],DEFAULT_LABEL_CONFIG={pageWidth:85.6,pageHeight:54,DPI:203,backgroundColor:"white",pageShape:"Rectangle",rows:1,columns:1,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,horizontalSpacing:0,verticalSpacing:0,orderStartAngle:"LeftTop",orderDirection:"Horizontal"};function parseJsonData(tg){return typeof tg=="string"?JSON.parse(tg):tg}function parseCanvasJson(tg){return typeof tg=="string"?JSON.parse(tg):tg}function normalizeCanvasJsonList(tg){const eg=parseCanvasJson(tg);return(Array.isArray(eg)?eg:[eg]).filter(Boolean).map(ig=>parseCanvasJson(ig))}function cloneJsonData(tg){return JSON.parse(JSON.stringify(tg))}function stringifyCanvasLikeSource(tg,eg){return typeof tg=="string"?JSON.stringify(eg):eg}function detectImageMimeFromBase64(tg){try{const eg=tg.replace(/^data:image\/\w+;base64,/,""),gg=atob(eg.slice(0,24)),ig=Array.from(gg).map(ng=>ng.charCodeAt(0)),Ig=ng=>ng.every((og,ag)=>ig[ag]===og);if(Ig([137,80,78,71]))return"png";if(Ig([255,216,255]))return"jpeg";if(Ig([71,73,70,56]))return"gif";if(Ig([82,73,70,70])&&ig[8]===87&&ig[9]===69&&ig[10]===66&&ig[11]===80)return"webp";if(Ig([66,77]))return"bmp"}catch{}return""}function getCmdObjectKey(tg){return tg!=null&&tg.fromJson?tg.jsonFieldKey||tg.name:tg==null?void 0:tg.name}function isCmdMatchObject(tg,eg,gg){const ig=String((tg==null?void 0:tg.type)||"").toLowerCase(),Ig=getCmdObjectKey(tg);return gg.name!=null?Ig===gg.name:gg.index!=null?eg===Number(gg.index):gg.type!=null?ig===String(gg.type).toLowerCase():!1}function setImageReplaceContent(tg,eg,gg){const ig=eg.content;if(tg.imgScaleType="1",eg.scale||eg.scale===0)switch(Number(eg.scale)){case 0:tg.imgScaleType="1";break;case 1:tg.imgScaleType="3";break;case 2:tg.imgScaleType="2";break}else eg.isScaleToPreviousWidth&&eg.isScaleToPreviousHeight?tg.imgScaleType="1":eg.isScaleToPreviousWidth?tg.imgScaleType="3":eg.isScaleToPreviousHeight&&(tg.imgScaleType="2");if(!ig||typeof ig!="string")return;const Ig=ig.match(/url:/i),ng=ig.match(/data:image/);if(Ig&&Ig.index===0){const og=ig.replace(/url:/i,"");tg.src=gg?gg(og):og}else if(ng&&ng.index===0)tg.src=ig;else{const og=detectImageMimeFromBase64(ig);og&&(tg.src=`data:image/${og};base64,${ig}`)}}function replaceCmdData(tg=[],eg=[],gg="",ig){const Ig=[];let ng=0;for(const og of tg){const ag=String((og==null?void 0:og.type)||"").toLowerCase(),sg=(og==null?void 0:og.objects)||(og==null?void 0:og._objects);if(ag==="group"&&Array.isArray(sg)){const Ag=replaceCmdData(sg,eg,"inGroup",ig);og.objects&&(og.objects=Ag),og._objects&&(og._objects=Ag)}let Cg=!1;const lg=getCmdObjectKey(og);for(const Ag of eg){if(!Ag||!CMD_LIST.includes(Ag.cmd))continue;const cg=Ag.content;switch(Ag.cmd){case"ReplaceContent":if(!isCmdMatchObject(og,ng,Ag))break;switch(ag){case"text":case"textname":og.text=cg;break;case"barcode":og.barcodeOptions&&(og.barcodeOptions.text=cg);break;case"barcode2d":og.barcode2dOptions&&(og.barcode2dOptions.text=cg);break;case"image":setImageReplaceContent(og,Ag,ig);break}break;case"AddPositionOffset":Number(Ag.x)&&(og.left+=Number(Ag.x)),Number(Ag.y)&&(og.top+=Number(Ag.y));break;case"RecoverOriginalHSpacings":break;case"RemoveIndexs":gg!=="inGroup"&&(Ag.indexs||[]).map(ug=>Number(ug)).includes(ng)&&(Cg=!0);break;case"RemoveNames":{(Ag.names||[]).includes(lg)&&(Cg=!0),ag==="group"&&Array.isArray(og.objects)&&og.objects.length===0&&(Cg=!0);break}case"OnlyNames":{const rg=Ag.names;Array.isArray(rg)&&!rg.includes(lg)&&(Cg=!0),ag==="group"&&Array.isArray(og.objects)&&og.objects.length>0&&(Cg=!1);break}}}ng++,Cg||Ig.push(og)}return Ig}function replaceCanvasCmdData(tg,eg=[],gg){if(!eg.length)return tg;const ig=cloneJsonData(tg),Ig=ng=>{if(!ng)return ng;const ag=(Array.isArray(ng)?ng:[ng]).map(sg=>{const Cg=parseCanvasJson(sg);return Cg.objects=replaceCmdData(Cg.objects||[],eg,"",gg),stringifyCanvasLikeSource(sg,Cg)});return Array.isArray(ng)?ag:ag[0]};return ig.canvas=Ig(ig.canvas),Array.isArray(ig.layers)&&(ig.layers=ig.layers.map(ng=>({...ng,canvas:Ig(ng==null?void 0:ng.canvas)}))),ig}function loadImage(tg){return tg?new Promise(eg=>{const gg=new Image;gg.onload=()=>eg(gg),gg.onerror=()=>eg(null),gg.src=tg}):Promise.resolve(null)}function getAllCanvasObjects(tg){const eg=[],gg=ig=>{ig.type==="group"&&ig._objects?ig._objects.forEach(Ig=>gg(Ig)):ig.id!=="workspace"&&eg.push(ig)};return tg.getObjects().forEach(ig=>gg(ig)),eg}async function createExportWorkspace({labelConfig:tg,width:eg,height:gg}){const ig=(tg==null?void 0:tg.backgroundColor)||"white",Ig=(tg==null?void 0:tg.backgroundImage)||"",ng=(tg==null?void 0:tg.backgroundImageCover)!==!1,og=(tg==null?void 0:tg.ribbonBorder)||null,ag=(tg==null?void 0:tg.pageShape)||"Rectangle",sg=Ig?await loadImage(Ig):null;let Cg=null,lg=null;og!=null&&og.pattern&&og.pattern!=="none"&&([Cg,lg]=await Promise.all([loadImage(og.left||""),loadImage(og.right||"")]));const Ag=ag==="Ellipse"?new _o({fill:ig,width:eg,height:gg,rx:eg/2,ry:gg/2,strokeWidth:0}):new Er({fill:ig,width:eg,height:gg,rx:ag==="RoundedRectangle"&&(tg==null?void 0:tg.rx)||0,ry:ag==="RoundedRectangle"&&(tg==null?void 0:tg.ry)||0,strokeWidth:0});if(Ag.set("id","workspace"),Ag.set("selectable",!1),Ag.set("hasControls",!1),Ag.excludeFromExport=!1,sg||Cg&&lg){const cg=Ag._render.bind(Ag);Ag._render=rg=>{if(cg(rg),sg){const ug=sg.naturalWidth||sg.width,dg=sg.naturalHeight||sg.height;if(ug&&dg){const bg=ng?eg:ug,mg=ng?gg:dg;rg.save(),rg.beginPath(),rg.rect(-eg/2,-gg/2,eg,gg),rg.clip(),rg.drawImage(sg,-bg/2,-mg/2,bg,mg),rg.restore()}}og!=null&&og.pattern&&og.pattern!=="none"&&Cg&&lg&&drawRibbonBorder(rg,og.pattern,{left:-eg/2,top:-gg/2,width:eg,height:gg},{left:Cg,right:lg})}}return Ag}async function renderCanvasLayer({canvasJson:tg,includeWorkspace:eg,includeFullDataUrl:gg=!1,width:ig,height:Ig,labelDPI:ng,multiplier:og,scaleList:ag=[],resTarget:sg="img",labelConfig:Cg}){let lg=document.createElement("canvas"),Ag=new se(lg,{width:ig,height:Ig,imageSmoothingEnabled:!1,fireMiddleClick:!0,fireRightClick:!0,stopContextMenu:!1,controlsAboveOverlay:!0,preserveObjectStacking:!0,selectionKey:"ctrlKey"});try{Ag.leRenderEnv="transform";const cg=await Ag.loadFromJSON(tg);if(eg){const mg=await createExportWorkspace({labelConfig:Cg,width:ig,height:Ig});cg.insertAt(0,mg)}const rg=getAllCanvasObjects(cg),ug=[];let dg=!1;rg.forEach(mg=>{if(mg.type==="text"&&(mg.set({left:Math.trunc(mg.left),top:Math.trunc(mg.top)}),mg.width=Math.trunc(mg.width),mg.height=Math.trunc(mg.height),mg.fontFamily&&mg.fontFamily.indexOf("宋体")>-1&&!mg.strokeWidth&&mg.set({strokeWidth:.3})),mg.type==="image"){let hg=!1;if(ag&&ag.length){for(const Zg of ag)if(Zg.name===mg.name){hg=!0;break}}hg||(mg.imgScaleType=mg.imgScaleType||"1"),Number(mg.imgScaleType)>1&&(mg.isScaleOtherSidedys=!0),mg.imageAlign&&mg.imageAlign!=="leftTop"&&ug.push(mg),mg.isSetSharpen&&(dg=!0)}}),cg.renderAll(),ug.forEach(mg=>{typeof mg.refreshAlignCoords=="function"&&mg.refreshAlignCoords(ng)}),cg.renderAll();const bg={};if(sg==="img"||sg==="all"){if(gg)return{fullDataUrl:Ag.toDataURL({format:"png",quality:1,multiplier:og})};const mg=["text","counter","textname","group","table"];bg.textDataUrl=Ag.toDataURL({multiplier:og,filter:Zg=>mg.includes(Zg.type)&&Zg.id!=="workspace"});const hg=["image","barcode","barcode2d","rect","circle","line","triangle"];bg.imgDataUrl=Ag.toDataURL({multiplier:og,filter:Zg=>(hg.includes(Zg.type)||Zg.id==="workspace")&&!Zg.isSetSharpen}),bg.sharpenDataUrl="",dg&&(bg.sharpenDataUrl=Ag.toDataURL({multiplier:og,filter:Zg=>Zg.type==="image"&&Zg.isSetSharpen}))}return(sg==="json"||sg==="all")&&(bg.dataJson=Ag.toJSON()),bg}finally{Ag==null||Ag.dispose(),Ag=null,lg=null}}async function composeDataUrlsToPng(tg,eg,gg){const ig=tg.filter(Boolean);if(!ig.length)return"";if(ig.length===1)return ig[0];const Ig=document.createElement("canvas");Ig.width=Math.max(1,Math.round(eg)),Ig.height=Math.max(1,Math.round(gg));const ng=Ig.getContext("2d");if(!ng)return ig[0];for(const og of ig){const ag=await loadImage(og);ag&&ng.drawImage(ag,0,0,Ig.width,Ig.height)}return Ig.toDataURL("image/png",1)}async function composeDataUrlsHorizontally(tg,eg,gg,ig=50){const Ig=tg.filter(Boolean);if(!Ig.length)return"";if(Ig.length===1)return Ig[0];const ng=document.createElement("canvas");ng.width=Math.max(1,Math.round(Ig.length*eg+(Ig.length-1)*ig)),ng.height=Math.max(1,Math.round(gg));const og=ng.getContext("2d");if(!og)return Ig[0];og.imageSmoothingEnabled=!1;for(let ag=0;ag<Ig.length;ag++){const sg=await loadImage(Ig[ag]);sg&&og.drawImage(sg,ag*(eg+ig),0,eg,gg)}return ng.toDataURL("image/png",1)}function getRenderMetrics(tg,eg={}){const gg={...DEFAULT_LABEL_CONFIG,...tg.labelConfig||{}},ig=Number(gg.DPI||eg.dpi)||203,Ig=Number(eg.width||gg.pageWidth)||85.6,ng=Number(eg.height||gg.pageHeight)||54,og=Ig*ig/25.4,ag=ng*ig/25.4;return{labelConfig:gg,labelDPI:ig,width:og,height:ag}}async function withTimeout(tg,eg=5e3,gg="加载 json 图片超时"){return new Promise((ig,Ig)=>{const ng=window.setTimeout(()=>{Ig(new Error(gg))},eg);tg.then(og=>ig(og)).catch(og=>Ig(og)).finally(()=>window.clearTimeout(ng))})}function hasCounterInCanvas(tg){var ig,Ig;if(!tg)return!1;const eg=typeof tg=="string"?JSON.parse(tg):tg,gg=(eg==null?void 0:eg.objects)||[];for(const ng of gg){if(String((ng==null?void 0:ng.type)||"").toLowerCase()==="counter"&&((ig=ng==null?void 0:ng._props)==null?void 0:ig.mode)==="1"||ng!=null&&ng.counterProps&&(ng.counterProps.value||ng.counterProps.value===0))return!0;const ag=(ng==null?void 0:ng.objects)||(ng==null?void 0:ng._objects);if(Array.isArray(ag)){for(const sg of ag)if(String((sg==null?void 0:sg.type)||"").toLowerCase()==="counter"&&((Ig=sg==null?void 0:sg._props)==null?void 0:Ig.mode)==="1"||sg!=null&&sg.counterProps&&(sg.counterProps.value||sg.counterProps.value===0))return!0}}return!1}function hasCounterObjects(tg){return tg.some(eg=>hasCounterInCanvas(eg))}function computeCounterValueAt(tg,eg){if(eg<=0)return tg.value;const gg=tg.valueType==="letter"?"letter":"number",Ig=(Math.trunc(Number(tg.incremental))||0)*eg;if(gg==="letter"){const og=Cg=>String(Cg??"").toUpperCase().replace(/[^A-Z]/g,"").split("").reduce((lg,Ag)=>lg*26+Ag.charCodeAt(0)-64,0)||1,ag=Cg=>{let lg=Math.max(1,Math.trunc(Cg)),Ag="";for(;lg>0;)lg--,Ag=String.fromCharCode(65+lg%26)+Ag,lg=Math.floor(lg/26);return Ag||"A"},sg=og(String(tg.value));return ag(sg+Ig)}const ng=Number(tg.value);return Number.isFinite(ng)?ng+Ig:tg.value}function applyCounterOffsetToObjects(tg,eg){var gg,ig;for(const Ig of tg){const ng=String((Ig==null?void 0:Ig.type)||"").toLowerCase(),og=(Ig==null?void 0:Ig.objects)||(Ig==null?void 0:Ig._objects);if(ng==="group"&&Array.isArray(og)&&applyCounterOffsetToObjects(og,eg),ng==="counter"&&((gg=Ig==null?void 0:Ig._props)==null?void 0:gg.mode)==="1"&&((ig=Ig==null?void 0:Ig._props)!=null&&ig.args)){const ag=Ig._props.args;if(ag.value||ag.value===0){const sg={value:ag.value,incremental:ag.incremental,length:ag.length,zeroPadding:ag.zeroPadding,valueType:ag.valueType},Cg=computeCounterValueAt(sg,eg);ag.value=Cg}}if(Ig!=null&&Ig.counterProps&&(Ig.counterProps.value||Ig.counterProps.value===0)){const ag={value:Ig.counterProps.value,incremental:Ig.counterProps.incremental,length:Ig.counterProps.length,zeroPadding:Ig.counterProps.zeroPadding,valueType:Ig.counterProps.valueType},sg=computeCounterValueAt(ag,eg);Ig.counterProps.value=sg}}}function cloneCanvasWithCounterOffset(tg,eg){return eg<=0?tg:tg.map(gg=>{const ig=typeof gg=="string"?JSON.parse(gg):gg,Ig=JSON.parse(JSON.stringify(ig));return Ig!=null&&Ig.objects&&applyCounterOffsetToObjects(Ig.objects,eg),typeof gg=="string"?JSON.stringify(Ig):Ig})}async function composeMultiTagsImageWithCounters(tg,eg,gg,ig,Ig,ng,og,ag){const{rows:sg,columns:Cg,count:lg}=getMultiTagCount(eg);if(lg<=1)return"";const Ag=og/25.4,cg=Math.round(Ig),rg=Math.round(ng),ug=Math.round((Number(eg.paddingLeft)||0)*Ag),dg=Math.round((Number(eg.paddingTop)||0)*Ag),bg=Math.round((Number(eg.horizontalSpacing)||0)*Ag),mg=Math.round((Number(eg.verticalSpacing)||0)*Ag),hg=getOrderTable(sg,Cg,eg.orderStartAngle||"LeftTop",eg.orderDirection||"Horizontal"),Zg=document.createElement("canvas");Zg.width=Math.max(1,Math.round(gg)),Zg.height=Math.max(1,Math.round(ig));const wg=Zg.getContext("2d");if(!wg)return"";wg.imageSmoothingEnabled=!1;const pg=o.DPI;try{o.DPI=og;for(let fg=0;fg<lg;fg++){const Gg=cloneCanvasWithCounterOffset(tg,fg),yg=[];for(let vg=0;vg<Gg.length;vg++){const Mg=await renderCanvasLayer({canvasJson:Gg[vg],includeWorkspace:vg===0,includeFullDataUrl:!0,width:Ig,height:ng,labelDPI:og,multiplier:1,scaleList:[],resTarget:"img",labelConfig:ag});yg.push(Mg.fullDataUrl||"")}const Bg=await composeDataUrlsToPng(yg,Ig,ng),Wg=await loadImage(Bg);if(!Wg)continue;const[$g,Ng]=hg[fg]||[Math.floor(fg/Cg),fg%Cg],Vg=ug+Ng*(cg+bg),Rg=dg+$g*(rg+mg);wg.drawImage(Wg,Vg,Rg,cg,rg)}}finally{o.DPI=pg}return Zg.toDataURL("image/png",1)}function getMultiTagCount(tg){const eg=Math.max(1,Math.floor(Number(tg==null?void 0:tg.rows)||1)),gg=Math.max(1,Math.floor(Number(tg==null?void 0:tg.columns)||1));return{rows:eg,columns:gg,count:eg*gg}}function getTagSizeMM(tg){const eg=Number(tg==null?void 0:tg.pageWidth)||0,gg=Number(tg==null?void 0:tg.pageHeight)||0;let ig=Number(tg==null?void 0:tg.tagWidth)||0,Ig=Number(tg==null?void 0:tg.tagHeight)||0;if(!ig||!Ig||ig===eg&&Ig===gg){const ng=Number(tg==null?void 0:tg.columns)||1,og=Number(tg==null?void 0:tg.rows)||1;ig=Math.floor((eg-Number((tg==null?void 0:tg.paddingLeft)||0)-Number((tg==null?void 0:tg.paddingRight)||0)-Number((tg==null?void 0:tg.horizontalSpacing)||0)*(ng-1))/ng*100)/100,Ig=Math.floor((gg-Number((tg==null?void 0:tg.paddingTop)||0)-Number((tg==null?void 0:tg.paddingBottom)||0)-Number((tg==null?void 0:tg.verticalSpacing)||0)*(og-1))/og*100)/100}return{width:ig,height:Ig}}function getOrderTable(tg,eg,gg="LeftTop",ig="Horizontal"){const Ig=[];if(ig==="Horizontal"){const ng=gg==="LeftTop"||gg==="RightTop"?[...Array(tg).keys()]:[...Array(tg).keys()].reverse(),og=gg==="LeftTop"||gg==="LeftBottom"?[...Array(eg).keys()]:[...Array(eg).keys()].reverse();for(const ag of ng)for(const sg of og)Ig.push([ag,sg])}else{const ng=gg==="LeftTop"||gg==="LeftBottom"?[...Array(eg).keys()]:[...Array(eg).keys()].reverse(),og=gg==="LeftTop"||gg==="RightTop"?[...Array(tg).keys()]:[...Array(tg).keys()].reverse();for(const ag of ng)for(const sg of og)Ig.push([sg,ag])}return Ig}async function composeMultiTagsImage(tg,eg,gg,ig,Ig,ng,og){if(!tg)return"";const{rows:ag,columns:sg,count:Cg}=getMultiTagCount(eg);if(Cg<=1)return tg;const lg=await loadImage(tg);if(!lg)return tg;const Ag=og/25.4,cg=Math.round(Ig),rg=Math.round(ng),ug=Math.round((Number(eg.paddingLeft)||0)*Ag),dg=Math.round((Number(eg.paddingTop)||0)*Ag),bg=Math.round((Number(eg.horizontalSpacing)||0)*Ag),mg=Math.round((Number(eg.verticalSpacing)||0)*Ag),hg=getOrderTable(ag,sg,eg.orderStartAngle||"LeftTop",eg.orderDirection||"Horizontal"),Zg=document.createElement("canvas");Zg.width=Math.max(1,Math.round(gg)),Zg.height=Math.max(1,Math.round(ig));const wg=Zg.getContext("2d");if(!wg)return tg;wg.imageSmoothingEnabled=!1;for(let pg=0;pg<Cg;pg++){const[fg,Gg]=hg[pg]||[Math.floor(pg/sg),pg%sg],yg=ug+Gg*(cg+bg),Bg=dg+fg*(rg+mg);wg.drawImage(lg,yg,Bg,cg,rg)}return Zg.toDataURL("image/png",1)}async function loadJsonToImageBase64(tg,eg={}){const{cmds:gg=[],timeout:ig=5e3,returnDataUrl:Ig=!0,imageUrlResolver:ng,mode:og="merged",gap:ag=50}=eg,sg=replaceCanvasCmdData(parseJsonData(tg),gg,ng),{labelConfig:Cg,labelDPI:lg,width:Ag,height:cg}=getRenderMetrics(sg,{dpi:eg.dpi,width:eg.width,height:eg.height}),{count:rg}=getMultiTagCount(Cg),ug=rg>1;let dg=Ag,bg=cg;if(ug){const Bg=getTagSizeMM(Cg);dg=Bg.width*lg/25.4,bg=Bg.height*lg/25.4}const mg=o.DPI,hg=normalizeCanvasJsonList(sg.canvas),Zg=[],wg=ug&&hasCounterObjects(hg),pg=(async()=>{try{if(o.DPI=lg,wg)return composeMultiTagsImageWithCounters(hg,Cg,Ag,cg,dg,bg,lg,Cg);for(let Wg=0;Wg<hg.length;Wg++){const $g=await renderCanvasLayer({canvasJson:hg[Wg],includeWorkspace:og==="separate"||Wg===0,includeFullDataUrl:!0,width:dg,height:bg,labelDPI:lg,multiplier:1,scaleList:[],resTarget:"img",labelConfig:Cg});Zg.push($g.fullDataUrl||"")}if(og==="separate"){const Wg=await composeDataUrlsHorizontally(Zg,dg,bg,ag);return{images:Zg,composedImage:Wg}}const Bg=await composeDataUrlsToPng(Zg,dg,bg);return ug?composeMultiTagsImage(Bg,Cg,Ag,cg,dg,bg,lg):Bg}finally{o.DPI=mg}})(),fg=wg?Math.max(ig,ig*rg):ig,Gg=await withTimeout(pg,fg),yg=Bg=>Ig?Bg:Bg.replace(/^data:image\/\w+;base64,/,"");return typeof Gg=="string"?yg(Gg):{images:Gg.images.map(yg),composedImage:yg(Gg.composedImage)}}let _activeInstance=null;function normalizeFileFieldJson(tg){if(typeof tg=="string"){const gg=tg.trim();return gg?(JSON.parse(gg),gg):""}const eg=JSON.stringify(tg,null,2);if(eg===void 0)throw new Error("Invalid fileFieldJson");return JSON.parse(eg),eg}class LabelEditor{constructor(eg,gg){el(this,"_autoSaveTimer",null);el(this,"_insertFileFieldJsonTimer",null);el(this,"_pendingFileFieldJson",null);el(this,"_app",null);el(this,"_el",null);el(this,"_destroyed",!1);el(this,"_isReplaceFont",!1);const Ig=!!(gg||{}).__offscreenRender;if(!Ig&&_activeInstance&&!_activeInstance._destroyed&&_activeInstance._el===eg)return console.warn("[LabelEditor] 同一容器已有活跃实例,复用现有实例"),_activeInstance;if(!Ig&&_activeInstance&&!_activeInstance._destroyed&&(console.warn("[LabelEditor] 检测到其他容器上的活跃实例,先销毁旧实例"),_activeInstance.destroy()),gg&&!Ig){const ag={...gg};delete ag.__offscreenRender,ag.separateLayerMode=ag.separateLayerMode===!0,Object.keys(ag).length&&setEditorConfig(ag),this.setSeparateLayerMode(!!getEditorConfig().separateLayerMode),getEditorConfig().separateLayerMode?this.setLayerMaxCount(getEditorConfig().separateLayerCount):this.setLayerMaxCount(ag.layerMaxCount??1)}resetFontState();const ng=Ig?LabelEditor._pauseVueDevtoolsForOffscreenRender():()=>{},og=createApp(_sfc_main);Ig&&(og.config.devtools=!1),og.config.errorHandler=(ag,sg,Cg)=>{console.error("全局错误:",ag,sg,Cg)};try{const ag=createPiniaInstance();og.use(ag).use(index,{}).use(modalInstall).use(loadingInstall),og.mount(eg)}finally{ng()}this._app=og,this._el=eg,Ig||(_activeInstance=this)}static _pauseVueDevtoolsForOffscreenRender(){const eg=window,gg="__VUE_DEVTOOLS_GLOBAL_HOOK__",ig=Object.prototype.hasOwnProperty.call(eg,gg),Ig=eg[gg];if(!Ig)return()=>{};try{return eg[gg]=void 0,()=>{ig?eg[gg]=Ig:delete eg[gg]}}catch{const ng=Ig.enabled;return Ig.enabled=!1,()=>{Ig.enabled=ng}}}static async loadJsonToImageBase64(eg,gg={}){return LabelEditor.exportImage({...gg,data:eg})}static async exportImage(eg){const{data:gg,...ig}=eg;return loadJsonToImageBase64(gg,ig)}get loadedFonts(){return loadedFonts}destroy(){this._destroyed||(this._destroyed=!0,clearInterval(this._autoSaveTimer),this._autoSaveTimer=null,clearTimeout(this._insertFileFieldJsonTimer),this._insertFileFieldJsonTimer=null,this._pendingFileFieldJson=null,this._app&&(this._app.unmount(),this._app=null),emitter.all.clear(),canvasEventBus.all.clear(),this._el&&(this._el.innerHTML="",this._el=null),_activeInstance===this&&(_activeInstance=null))}filterLoadFontByName(eg){let gg=Array.from(this.loadedFonts);return eg.filter(Ig=>{let ng=!0;if(ng=!gg.includes(Ig),!this._isReplaceFont){for(let og of fontListDefault)if(og.label===Ig){ng=!1;break}}return ng})}loadJson(eg,{newFile:gg=!1}={}){const ig=new Set(extractFontNames(eg.canvas));if(Array.isArray(eg.layers)&&eg.layers.forEach(Ig=>{Ig!=null&&Ig.canvas&&extractFontNames(Ig.canvas).forEach(ng=>ig.add(ng))}),ig.size){let Ig=Array.from(ig);emitter.emit("selectFontCallback",Ig)}eg.laserConfigList&&Array.isArray(eg.laserConfigList)&&setLaserPresets(eg.laserConfigList),emitter.emit("label-config",{labelConfig:eg.labelConfig||getTempLabelConfig(),canvas:eg.canvas,layers:eg.layers,activeLayerId:eg.activeLayerId,newFile:gg}),syncExternalPresets()}exportJson(){return new Promise(eg=>{emitter.emit("toTemplateJson",gg=>{try{const ig=JSON.parse(gg||"{}"),Ig=extractFontNames(ig.canvas),ng=getCustomFonts(Ig);ng.length&&(ig.labelConfig.customFonts=ng);const og=new Set,ag=Cg=>{try{(JSON.parse(Cg).objects||[]).forEach(Ag=>{var rg;const cg=(rg=Ag.customExportFields)==null?void 0:rg.laserConfigId;cg&&og.add(cg)})}catch{}};typeof ig.canvas=="string"?ag(ig.canvas):Array.isArray(ig.canvas)&&ig.canvas.forEach(Cg=>ag(Cg));const sg=getLaserPresets();sg.value.length>0&&(ig.laserConfigList=sg.value.filter(Cg=>og.has(Cg.configId)),ig.laserConfigList.length===0&&delete ig.laserConfigList),eg(JSON.stringify(ig))}catch{eg(gg)}})})}addCustomFontList(eg){emitter.emit("addCustomFontList",eg)}replaceFontList(eg){this._isReplaceFont=!0,emitter.emit("replaceFontList",eg)}setLaserConfigList(eg){setLaserConfigList(eg)}selectFontCallback(eg){emitter.off("selectFontCallback"),emitter.on("selectFontCallback",gg=>{let ig=this.filterLoadFontByName(gg)||[];eg&&ig.length&&eg(ig)})}async loadFontFile(eg){const{fontName:gg,blob:ig}=eg;return!gg||!ig?!1:loadFontFromBlob(gg,ig)}exportImage(eg={}){return new Promise(gg=>{emitter.emit("exportImage",{options:eg,callback:ig=>{gg(ig)}})})}toggleMultiLayer(eg=!0){state$1.isMultiLayerEnabled=!!eg}setMultiLayerEnabled(eg=!0){this.toggleMultiLayer(eg)}setLayerMaxCount(eg=1){setSysConfigState({...getSysConfigState(),layerMaxCount:state$1.isSeparateLayerMode?state$1.separateLayerCount:getLayerMaxCount(eg)})}_applyFileFieldJson(eg){const gg=useTabsStore(),ig=gg.getActiveTab();return ig!=null&&ig.config?(ig.config.fileFieldJson=eg,gg.storeTabs(gg.tabs),setFileDirty(ig.id),!0):!1}insertFileFieldJson(eg){try{const gg=normalizeFileFieldJson(eg);return gg?(setTimeout(()=>{if(this._applyFileFieldJson(gg))return!0},150),!0):!1}catch(gg){return console.error("[LabelEditor] insertFileFieldJson failed:",gg),!1}}setSeparateLayerMode(eg=!0){state$1.isSeparateLayerMode=!!eg,state$1.isSeparateLayerMode&&(state$1.isMultiLayerEnabled=!0,state$1.separateLayerCount=getEditorConfig().separateLayerCount,state$1.separateLayerNames=[...getEditorConfig().separateLayerNames],this.setLayerMaxCount(state$1.separateLayerCount))}async getThumbnailImage(eg={}){const ig=useTabsStore().getActiveTab();if(!(ig!=null&&ig.config))return"";let ng=ig==null?void 0:ig.config,og="";ng.separateLayerMode?og=await this.getDoubleRibbonsImage(eg):og=await this.getImage(eg);let ag=document.createElement("canvas"),sg=ag.getContext("2d"),Cg=ng.pageWidth,Ag=ng.pageHeight/Cg,cg=266,rg=cg*Ag;ag.width=cg,ag.height=rg;let ug=await this.loadImage(og);return sg==null||sg.drawImage(ug,0,0,cg,rg),ag.toDataURL()}loadImage(eg){return new Promise((gg,ig)=>{const Ig=new Image;Ig.onload=()=>gg(Ig),Ig.onerror=ig,Ig.src=eg,Ig.complete&&gg(Ig)})}getImage(eg={}){return this.exportImage(eg)}getDoubleRibbonsImage(eg={}){return new Promise(gg=>{this.exportImage({...eg,mode:"separate",layout:"doubleRibbons"}).then(ig=>{gg((ig==null?void 0:ig.composedImage)||ig)})})}enterDoubleRibbons(){state$1.isSeparateLayerMode=!0,state$1.isMultiLayerEnabled=!0,state$1.separateLayerCount=2,state$1.separateLayerNames=["上联","下联"],this.setLayerMaxCount(state$1.separateLayerCount),emitter.emit("separate-layer-config-change",{count:state$1.separateLayerCount,names:[...state$1.separateLayerNames]})}setSeparateLayerConfig(eg={}){eg.count!=null&&(state$1.separateLayerCount=getLayerMaxCount(eg.count)),eg.names!=null&&(state$1.separateLayerNames=Array.isArray(eg.names)?eg.names.map(gg=>String(gg||"").trim()).filter(Boolean):[]),state$1.isSeparateLayerMode&&(this.setLayerMaxCount(state$1.separateLayerCount),emitter.emit("separate-layer-config-change",{count:state$1.separateLayerCount,names:[...state$1.separateLayerNames]}))}toggleEditTabs(eg=!0){state$1.isShowEditTabs=!!eg}checkFileSave(){return new Promise(eg=>{emitter.emit("checkFileSave",gg=>{eg(gg)})})}openAutoSave(eg,gg=5e3){clearInterval(this._autoSaveTimer),this._autoSaveTimer=setInterval(async()=>{if(!await this.checkFileSave()){let Ig=await this.exportJson();eg&&eg(Ig)}},gg)}}function commonjsRequire(tg){throw new Error('Could not dynamically require "'+tg+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf$2={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$5=getAugmentedNamespace(__viteBrowserExternal$1);var hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports){(function(eg,gg){module.exports=eg.pdfjsLib=gg()})(globalThis,()=>(()=>{var __webpack_modules__=[,((tg,eg)=>{var kI;Object.defineProperty(eg,"__esModule",{value:!0}),eg.VerbosityLevel=eg.Util=eg.UnknownErrorException=eg.UnexpectedResponseException=eg.TextRenderingMode=eg.RenderingIntentFlag=eg.PromiseCapability=eg.PermissionFlag=eg.PasswordResponses=eg.PasswordException=eg.PageActionEventType=eg.OPS=eg.MissingPDFException=eg.MAX_IMAGE_SIZE_TO_CACHE=eg.LINE_FACTOR=eg.LINE_DESCENT_FACTOR=eg.InvalidPDFException=eg.ImageKind=eg.IDENTITY_MATRIX=eg.FormatError=eg.FeatureTest=eg.FONT_IDENTITY_MATRIX=eg.DocumentActionEventType=eg.CMapCompressionType=eg.BaseException=eg.BASELINE_FACTOR=eg.AnnotationType=eg.AnnotationReplyType=eg.AnnotationPrefix=eg.AnnotationMode=eg.AnnotationFlag=eg.AnnotationFieldFlag=eg.AnnotationEditorType=eg.AnnotationEditorPrefix=eg.AnnotationEditorParamsType=eg.AnnotationBorderStyleType=eg.AnnotationActionEventType=eg.AbortException=void 0,eg.assert=Yg,eg.bytesToString=dI,eg.createValidAbsoluteUrl=Tg,eg.getModificationDate=WI,eg.getUuid=wI,eg.getVerbosityLevel=vg,eg.info=Mg,eg.isArrayBuffer=uI,eg.isArrayEqual=fI,eg.isNodeJS=void 0,eg.normalizeUnicode=II,eg.objectFromMap=lI,eg.objectSize=Lg,eg.setVerbosityLevel=Rg,eg.shadow=xg,eg.string32=Og,eg.stringToBytes=ZI,eg.stringToPDFString=hI,eg.stringToUTF8String=BI,eg.unreachable=Sg,eg.utf8StringToString=YI,eg.warn=kg;const gg=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");eg.isNodeJS=gg;const ig=[1,0,0,1,0,0];eg.IDENTITY_MATRIX=ig;const Ig=[.001,0,0,.001,0,0];eg.FONT_IDENTITY_MATRIX=Ig;const ng=1e7;eg.MAX_IMAGE_SIZE_TO_CACHE=ng;const og=1.35;eg.LINE_FACTOR=og;const ag=.35;eg.LINE_DESCENT_FACTOR=ag;const sg=ag/og;eg.BASELINE_FACTOR=sg;const Cg={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};eg.RenderingIntentFlag=Cg;const lg={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};eg.AnnotationMode=lg;const Ag="pdfjs_internal_editor_";eg.AnnotationEditorPrefix=Ag;const cg={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};eg.AnnotationEditorType=cg;const rg={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};eg.AnnotationEditorParamsType=rg;const ug={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};eg.PermissionFlag=ug;const dg={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};eg.TextRenderingMode=dg;const bg={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};eg.ImageKind=bg;const mg={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};eg.AnnotationType=mg;const hg={GROUP:"Group",REPLY:"R"};eg.AnnotationReplyType=hg;const Zg={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};eg.AnnotationFlag=Zg;const wg={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};eg.AnnotationFieldFlag=wg;const pg={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};eg.AnnotationBorderStyleType=pg;const fg={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};eg.AnnotationActionEventType=fg;const Gg={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};eg.DocumentActionEventType=Gg;const yg={O:"PageOpen",C:"PageClose"};eg.PageActionEventType=yg;const Bg={ERRORS:0,WARNINGS:1,INFOS:5};eg.VerbosityLevel=Bg;const Wg={NONE:0,BINARY:1};eg.CMapCompressionType=Wg;const $g={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};eg.OPS=$g;const Ng={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};eg.PasswordResponses=Ng;let Vg=Bg.WARNINGS;function Rg(rI){Number.isInteger(rI)&&(Vg=rI)}function vg(){return Vg}function Mg(rI){Vg>=Bg.INFOS&&console.log(`Info: ${rI}`)}function kg(rI){Vg>=Bg.WARNINGS&&console.log(`Warning: ${rI}`)}function Sg(rI){throw new Error(rI)}function Yg(rI,Fg){rI||Sg(Fg)}function Kg(rI){switch(rI==null?void 0:rI.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Tg(rI,Fg=null,Dg=null){if(!rI)return null;try{if(Dg&&typeof rI=="string"){if(Dg.addDefaultProtocol&&rI.startsWith("www.")){const GI=rI.match(/\./g);(GI==null?void 0:GI.length)>=2&&(rI=`http://${rI}`)}if(Dg.tryConvertEncoding)try{rI=BI(rI)}catch{}}const sI=Fg?new URL(rI,Fg):new URL(rI);if(Kg(sI))return sI}catch{}return null}function xg(rI,Fg,Dg,sI=!1){return Object.defineProperty(rI,Fg,{value:Dg,enumerable:!sI,configurable:!0,writable:!1}),Dg}const Xg=(function(){function Fg(Dg,sI){this.constructor===Fg&&Sg("Cannot initialize BaseException."),this.message=Dg,this.name=sI}return Fg.prototype=new Error,Fg.constructor=Fg,Fg})();eg.BaseException=Xg;class jg extends Xg{constructor(Fg,Dg){super(Fg,"PasswordException"),this.code=Dg}}eg.PasswordException=jg;class zg extends Xg{constructor(Fg,Dg){super(Fg,"UnknownErrorException"),this.details=Dg}}eg.UnknownErrorException=zg;class Qg extends Xg{constructor(Fg){super(Fg,"InvalidPDFException")}}eg.InvalidPDFException=Qg;class _g extends Xg{constructor(Fg){super(Fg,"MissingPDFException")}}eg.MissingPDFException=_g;class gI extends Xg{constructor(Fg,Dg){super(Fg,"UnexpectedResponseException"),this.status=Dg}}eg.UnexpectedResponseException=gI;class AI extends Xg{constructor(Fg){super(Fg,"FormatError")}}eg.FormatError=AI;class CI extends Xg{constructor(Fg){super(Fg,"AbortException")}}eg.AbortException=CI;function dI(rI){(typeof rI!="object"||(rI==null?void 0:rI.length)===void 0)&&Sg("Invalid argument for bytesToString");const Fg=rI.length,Dg=8192;if(Fg<Dg)return String.fromCharCode.apply(null,rI);const sI=[];for(let GI=0;GI<Fg;GI+=Dg){const Hg=Math.min(GI+Dg,Fg),qg=rI.subarray(GI,Hg);sI.push(String.fromCharCode.apply(null,qg))}return sI.join("")}function ZI(rI){typeof rI!="string"&&Sg("Invalid argument for stringToBytes");const Fg=rI.length,Dg=new Uint8Array(Fg);for(let sI=0;sI<Fg;++sI)Dg[sI]=rI.charCodeAt(sI)&255;return Dg}function Og(rI){return String.fromCharCode(rI>>24&255,rI>>16&255,rI>>8&255,rI&255)}function Lg(rI){return Object.keys(rI).length}function lI(rI){const Fg=Object.create(null);for(const[Dg,sI]of rI)Fg[Dg]=sI;return Fg}function iI(){const rI=new Uint8Array(4);return rI[0]=1,new Uint32Array(rI.buffer,0,1)[0]===1}function eI(){try{return new Function(""),!0}catch{return!1}}class Jg{static get isLittleEndian(){return xg(this,"isLittleEndian",iI())}static get isEvalSupported(){return xg(this,"isEvalSupported",eI())}static get isOffscreenCanvasSupported(){return xg(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?xg(this,"platform",{isWin:!1,isMac:!1}):xg(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){var Fg,Dg;return xg(this,"isCSSRoundSupported",(Dg=(Fg=globalThis.CSS)==null?void 0:Fg.supports)==null?void 0:Dg.call(Fg,"width: round(1.5px, 1px)"))}}eg.FeatureTest=Jg;const Pg=[...Array(256).keys()].map(rI=>rI.toString(16).padStart(2,"0"));class cI{static makeHexColor(Fg,Dg,sI){return`#${Pg[Fg]}${Pg[Dg]}${Pg[sI]}`}static scaleMinMax(Fg,Dg){let sI;Fg[0]?(Fg[0]<0&&(sI=Dg[0],Dg[0]=Dg[1],Dg[1]=sI),Dg[0]*=Fg[0],Dg[1]*=Fg[0],Fg[3]<0&&(sI=Dg[2],Dg[2]=Dg[3],Dg[3]=sI),Dg[2]*=Fg[3],Dg[3]*=Fg[3]):(sI=Dg[0],Dg[0]=Dg[2],Dg[2]=sI,sI=Dg[1],Dg[1]=Dg[3],Dg[3]=sI,Fg[1]<0&&(sI=Dg[2],Dg[2]=Dg[3],Dg[3]=sI),Dg[2]*=Fg[1],Dg[3]*=Fg[1],Fg[2]<0&&(sI=Dg[0],Dg[0]=Dg[1],Dg[1]=sI),Dg[0]*=Fg[2],Dg[1]*=Fg[2]),Dg[0]+=Fg[4],Dg[1]+=Fg[4],Dg[2]+=Fg[5],Dg[3]+=Fg[5]}static transform(Fg,Dg){return[Fg[0]*Dg[0]+Fg[2]*Dg[1],Fg[1]*Dg[0]+Fg[3]*Dg[1],Fg[0]*Dg[2]+Fg[2]*Dg[3],Fg[1]*Dg[2]+Fg[3]*Dg[3],Fg[0]*Dg[4]+Fg[2]*Dg[5]+Fg[4],Fg[1]*Dg[4]+Fg[3]*Dg[5]+Fg[5]]}static applyTransform(Fg,Dg){const sI=Fg[0]*Dg[0]+Fg[1]*Dg[2]+Dg[4],GI=Fg[0]*Dg[1]+Fg[1]*Dg[3]+Dg[5];return[sI,GI]}static applyInverseTransform(Fg,Dg){const sI=Dg[0]*Dg[3]-Dg[1]*Dg[2],GI=(Fg[0]*Dg[3]-Fg[1]*Dg[2]+Dg[2]*Dg[5]-Dg[4]*Dg[3])/sI,Hg=(-Fg[0]*Dg[1]+Fg[1]*Dg[0]+Dg[4]*Dg[1]-Dg[5]*Dg[0])/sI;return[GI,Hg]}static getAxialAlignedBoundingBox(Fg,Dg){const sI=this.applyTransform(Fg,Dg),GI=this.applyTransform(Fg.slice(2,4),Dg),Hg=this.applyTransform([Fg[0],Fg[3]],Dg),qg=this.applyTransform([Fg[2],Fg[1]],Dg);return[Math.min(sI[0],GI[0],Hg[0],qg[0]),Math.min(sI[1],GI[1],Hg[1],qg[1]),Math.max(sI[0],GI[0],Hg[0],qg[0]),Math.max(sI[1],GI[1],Hg[1],qg[1])]}static inverseTransform(Fg){const Dg=Fg[0]*Fg[3]-Fg[1]*Fg[2];return[Fg[3]/Dg,-Fg[1]/Dg,-Fg[2]/Dg,Fg[0]/Dg,(Fg[2]*Fg[5]-Fg[4]*Fg[3])/Dg,(Fg[4]*Fg[1]-Fg[5]*Fg[0])/Dg]}static singularValueDecompose2dScale(Fg){const Dg=[Fg[0],Fg[2],Fg[1],Fg[3]],sI=Fg[0]*Dg[0]+Fg[1]*Dg[2],GI=Fg[0]*Dg[1]+Fg[1]*Dg[3],Hg=Fg[2]*Dg[0]+Fg[3]*Dg[2],qg=Fg[2]*Dg[1]+Fg[3]*Dg[3],nI=(sI+qg)/2,Ug=Math.sqrt((sI+qg)**2-4*(sI*qg-Hg*GI))/2,tI=nI+Ug||1,mI=nI-Ug||1;return[Math.sqrt(tI),Math.sqrt(mI)]}static normalizeRect(Fg){const Dg=Fg.slice(0);return Fg[0]>Fg[2]&&(Dg[0]=Fg[2],Dg[2]=Fg[0]),Fg[1]>Fg[3]&&(Dg[1]=Fg[3],Dg[3]=Fg[1]),Dg}static intersect(Fg,Dg){const sI=Math.max(Math.min(Fg[0],Fg[2]),Math.min(Dg[0],Dg[2])),GI=Math.min(Math.max(Fg[0],Fg[2]),Math.max(Dg[0],Dg[2]));if(sI>GI)return null;const Hg=Math.max(Math.min(Fg[1],Fg[3]),Math.min(Dg[1],Dg[3])),qg=Math.min(Math.max(Fg[1],Fg[3]),Math.max(Dg[1],Dg[3]));return Hg>qg?null:[sI,Hg,GI,qg]}static bezierBoundingBox(Fg,Dg,sI,GI,Hg,qg,nI,Ug){const tI=[],mI=[[],[]];let VI,oI,Eg,pI,vI,yI,NI,RI;for(let OI=0;OI<2;++OI){if(OI===0?(oI=6*Fg-12*sI+6*Hg,VI=-3*Fg+9*sI-9*Hg+3*nI,Eg=3*sI-3*Fg):(oI=6*Dg-12*GI+6*qg,VI=-3*Dg+9*GI-9*qg+3*Ug,Eg=3*GI-3*Dg),Math.abs(VI)<1e-12){if(Math.abs(oI)<1e-12)continue;pI=-Eg/oI,0<pI&&pI<1&&tI.push(pI);continue}NI=oI*oI-4*Eg*VI,RI=Math.sqrt(NI),!(NI<0)&&(vI=(-oI+RI)/(2*VI),0<vI&&vI<1&&tI.push(vI),yI=(-oI-RI)/(2*VI),0<yI&&yI<1&&tI.push(yI))}let XI=tI.length,xI;const FI=XI;for(;XI--;)pI=tI[XI],xI=1-pI,mI[0][XI]=xI*xI*xI*Fg+3*xI*xI*pI*sI+3*xI*pI*pI*Hg+pI*pI*pI*nI,mI[1][XI]=xI*xI*xI*Dg+3*xI*xI*pI*GI+3*xI*pI*pI*qg+pI*pI*pI*Ug;return mI[0][FI]=Fg,mI[1][FI]=Dg,mI[0][FI+1]=nI,mI[1][FI+1]=Ug,mI[0].length=mI[1].length=FI+2,[Math.min(...mI[0]),Math.min(...mI[1]),Math.max(...mI[0]),Math.max(...mI[1])]}}eg.Util=cI;const bI=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function hI(rI){if(rI[0]>="ï"){let Dg;if(rI[0]==="þ"&&rI[1]==="ÿ"?Dg="utf-16be":rI[0]==="ÿ"&&rI[1]==="þ"?Dg="utf-16le":rI[0]==="ï"&&rI[1]==="»"&&rI[2]==="¿"&&(Dg="utf-8"),Dg)try{const sI=new TextDecoder(Dg,{fatal:!0}),GI=ZI(rI);return sI.decode(GI)}catch(sI){kg(`stringToPDFString: "${sI}".`)}}const Fg=[];for(let Dg=0,sI=rI.length;Dg<sI;Dg++){const GI=bI[rI.charCodeAt(Dg)];Fg.push(GI?String.fromCharCode(GI):rI.charAt(Dg))}return Fg.join("")}function BI(rI){return decodeURIComponent(escape(rI))}function YI(rI){return unescape(encodeURIComponent(rI))}function uI(rI){return typeof rI=="object"&&(rI==null?void 0:rI.byteLength)!==void 0}function fI(rI,Fg){if(rI.length!==Fg.length)return!1;for(let Dg=0,sI=rI.length;Dg<sI;Dg++)if(rI[Dg]!==Fg[Dg])return!1;return!0}function WI(rI=new Date){return[rI.getUTCFullYear().toString(),(rI.getUTCMonth()+1).toString().padStart(2,"0"),rI.getUTCDate().toString().padStart(2,"0"),rI.getUTCHours().toString().padStart(2,"0"),rI.getUTCMinutes().toString().padStart(2,"0"),rI.getUTCSeconds().toString().padStart(2,"0")].join("")}class MI{constructor(){JI(this,kI,!1);this.promise=new Promise((Fg,Dg)=>{this.resolve=sI=>{EI(this,kI,!0),Fg(sI)},this.reject=sI=>{EI(this,kI,!0),Dg(sI)}})}get settled(){return aI(this,kI)}}kI=new WeakMap,eg.PromiseCapability=MI;let jI=null,HI=null;function II(rI){return jI||(jI=/([\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,HI=new Map([["ſt","ſt"]])),rI.replaceAll(jI,(Fg,Dg,sI)=>Dg?Dg.normalize("NFKC"):HI.get(sI))}function wI(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const rI=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(rI);else for(let Fg=0;Fg<32;Fg++)rI[Fg]=Math.floor(Math.random()*255);return dI(rI)}const $I="pdfjs_internal_id_";eg.AnnotationPrefix=$I}),((__unused_webpack_module,exports,__w_pdfjs_require__)=>{var tg,gg,ig,Ig,sd,Od,ag,sg,Cg,lg,Ag,cg,rg,ug,dg,Ed,mg,hg,cu,wg,pg;Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(Gg){if(typeof Gg=="string"||Gg instanceof URL?Gg={url:Gg}:(0,_util.isArrayBuffer)(Gg)&&(Gg={data:Gg}),typeof Gg!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!Gg.url&&!Gg.data&&!Gg.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const yg=new PDFDocumentLoadingTask,{docId:Bg}=yg,Wg=Gg.url?getUrlProp(Gg.url):null,$g=Gg.data?getDataProp(Gg.data):null,Ng=Gg.httpHeaders||null,Vg=Gg.withCredentials===!0,Rg=Gg.password??null,vg=Gg.range instanceof PDFDataRangeTransport?Gg.range:null,Mg=Number.isInteger(Gg.rangeChunkSize)&&Gg.rangeChunkSize>0?Gg.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let kg=Gg.worker instanceof PDFWorker?Gg.worker:null;const Sg=Gg.verbosity,Yg=typeof Gg.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(Gg.docBaseUrl)?Gg.docBaseUrl:null,Kg=typeof Gg.cMapUrl=="string"?Gg.cMapUrl:null,Tg=Gg.cMapPacked!==!1,xg=Gg.CMapReaderFactory||DefaultCMapReaderFactory,Xg=typeof Gg.standardFontDataUrl=="string"?Gg.standardFontDataUrl:null,jg=Gg.StandardFontDataFactory||DefaultStandardFontDataFactory,zg=Gg.stopAtErrors!==!0,Qg=Number.isInteger(Gg.maxImageSize)&&Gg.maxImageSize>-1?Gg.maxImageSize:-1,_g=Gg.isEvalSupported!==!1,gI=typeof Gg.isOffscreenCanvasSupported=="boolean"?Gg.isOffscreenCanvasSupported:!_util.isNodeJS,AI=Number.isInteger(Gg.canvasMaxAreaInBytes)?Gg.canvasMaxAreaInBytes:-1,CI=typeof Gg.disableFontFace=="boolean"?Gg.disableFontFace:_util.isNodeJS,dI=Gg.fontExtraProperties===!0,ZI=Gg.enableXfa===!0,Og=Gg.ownerDocument||globalThis.document,Lg=Gg.disableRange===!0,lI=Gg.disableStream===!0,iI=Gg.disableAutoFetch===!0,eI=Gg.pdfBug===!0,Jg=vg?vg.length:Gg.length??NaN,Pg=typeof Gg.useSystemFonts=="boolean"?Gg.useSystemFonts:!_util.isNodeJS&&!CI,cI=typeof Gg.useWorkerFetch=="boolean"?Gg.useWorkerFetch:xg===_display_utils.DOMCMapReaderFactory&&jg===_display_utils.DOMStandardFontDataFactory&&Kg&&Xg&&(0,_display_utils.isValidFetchUrl)(Kg,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(Xg,document.baseURI),bI=Gg.canvasFactory||new DefaultCanvasFactory({ownerDocument:Og}),hI=Gg.filterFactory||new DefaultFilterFactory({docId:Bg,ownerDocument:Og}),BI=null;(0,_util.setVerbosityLevel)(Sg);const YI={canvasFactory:bI,filterFactory:hI};if(cI||(YI.cMapReaderFactory=new xg({baseUrl:Kg,isCompressed:Tg}),YI.standardFontDataFactory=new jg({baseUrl:Xg})),!kg){const WI={verbosity:Sg,port:_worker_options.GlobalWorkerOptions.workerPort};kg=WI.port?PDFWorker.fromPort(WI):new PDFWorker(WI),yg._worker=kg}const uI={docId:Bg,apiVersion:"3.11.174",data:$g,password:Rg,disableAutoFetch:iI,rangeChunkSize:Mg,length:Jg,docBaseUrl:Yg,enableXfa:ZI,evaluatorOptions:{maxImageSize:Qg,disableFontFace:CI,ignoreErrors:zg,isEvalSupported:_g,isOffscreenCanvasSupported:gI,canvasMaxAreaInBytes:AI,fontExtraProperties:dI,useSystemFonts:Pg,cMapUrl:cI?Kg:null,standardFontDataUrl:cI?Xg:null}},fI={ignoreErrors:zg,isEvalSupported:_g,disableFontFace:CI,fontExtraProperties:dI,enableXfa:ZI,ownerDocument:Og,disableAutoFetch:iI,pdfBug:eI,styleElement:BI};return kg.promise.then(function(){if(yg.destroyed)throw new Error("Loading aborted");const WI=_fetchDocument(kg,uI),MI=new Promise(function(jI){let HI;vg?HI=new _transport_stream.PDFDataTransportStream({length:Jg,initialData:vg.initialData,progressiveDone:vg.progressiveDone,contentDispositionFilename:vg.contentDispositionFilename,disableRange:Lg,disableStream:lI},vg):$g||(HI=(wI=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(wI):(0,_display_utils.isValidFetchUrl)(wI.url)?new _displayFetch_stream.PDFFetchStream(wI):new _displayNetwork.PDFNetworkStream(wI))({url:Wg,length:Jg,httpHeaders:Ng,withCredentials:Vg,rangeChunkSize:Mg,disableRange:Lg,disableStream:lI})),jI(HI)});return Promise.all([WI,MI]).then(function([jI,HI]){if(yg.destroyed)throw new Error("Loading aborted");const II=new _message_handler.MessageHandler(Bg,jI,kg.port),wI=new WorkerTransport(II,yg,HI,fI,YI);yg._transport=wI,II.send("Ready",null)})}).catch(yg._capability.reject),yg}async function _fetchDocument(Gg,yg){if(Gg.destroyed)throw new Error("Worker was destroyed");const Bg=await Gg.messageHandler.sendWithPromise("GetDocRequest",yg,yg.data?[yg.data.buffer]:null);if(Gg.destroyed)throw new Error("Worker was destroyed");return Bg}function getUrlProp(Gg){if(Gg instanceof URL)return Gg.href;try{return new URL(Gg,window.location).href}catch{if(_util.isNodeJS&&typeof Gg=="string")return Gg}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(Gg){if(_util.isNodeJS&&typeof Buffer<"u"&&Gg instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(Gg instanceof Uint8Array&&Gg.byteLength===Gg.buffer.byteLength)return Gg;if(typeof Gg=="string")return(0,_util.stringToBytes)(Gg);if(typeof Gg=="object"&&!isNaN(Gg==null?void 0:Gg.length)||(0,_util.isArrayBuffer)(Gg))return new Uint8Array(Gg);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}const eg=class eg{constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${Wd(eg,tg)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var yg,Bg,Wg;this.destroyed=!0;try{(yg=this._worker)!=null&&yg.port&&(this._worker._pendingDestroy=!0),await((Bg=this._transport)==null?void 0:Bg.destroy())}catch($g){throw(Wg=this._worker)!=null&&Wg.port&&delete this._worker._pendingDestroy,$g}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};tg=new WeakMap,JI(eg,tg,0);let PDFDocumentLoadingTask=eg;exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(yg,Bg,Wg=!1,$g=null){this.length=yg,this.initialData=Bg,this.progressiveDone=Wg,this.contentDispositionFilename=$g,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(yg){this._rangeListeners.push(yg)}addProgressListener(yg){this._progressListeners.push(yg)}addProgressiveReadListener(yg){this._progressiveReadListeners.push(yg)}addProgressiveDoneListener(yg){this._progressiveDoneListeners.push(yg)}onDataRange(yg,Bg){for(const Wg of this._rangeListeners)Wg(yg,Bg)}onDataProgress(yg,Bg){this._readyCapability.promise.then(()=>{for(const Wg of this._progressListeners)Wg(yg,Bg)})}onDataProgressiveRead(yg){this._readyCapability.promise.then(()=>{for(const Bg of this._progressiveReadListeners)Bg(yg)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const yg of this._progressiveDoneListeners)yg()})}transportReady(){this._readyCapability.resolve()}requestDataRange(yg,Bg){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(yg,Bg){this._pdfInfo=yg,this._transport=Bg,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(Wg=>{if(!Wg)return Wg;const $g=[];for(const Ng in Wg)$g.push(...Wg[Ng]);return $g}))})}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(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(yg){return this._transport.getPage(yg)}getPageIndex(yg){return this._transport.getPageIndex(yg)}getDestinations(){return this._transport.getDestinations()}getDestination(yg){return this._transport.getDestination(yg)}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(){return this._transport.getOptionalContentConfig()}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(yg=!1){return this._transport.startCleanup(yg||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}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()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(yg,Bg,Wg,$g=!1){JI(this,Ig);JI(this,gg,null);JI(this,ig,!1);this._pageIndex=yg,this._pageInfo=Bg,this._transport=Wg,this._stats=$g?new _display_utils.StatTimer:null,this._pdfBug=$g,this.commonObjs=Wg.commonObjs,this.objs=new PDFObjects,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({scale:yg,rotation:Bg=this.rotate,offsetX:Wg=0,offsetY:$g=0,dontFlip:Ng=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:yg,rotation:Bg,offsetX:Wg,offsetY:$g,dontFlip:Ng})}getAnnotations({intent:yg="display"}={}){const Bg=this._transport.getRenderingIntent(yg);return this._transport.getAnnotations(this._pageIndex,Bg.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var yg;return((yg=this._transport._htmlForXfa)==null?void 0:yg.children[this._pageIndex])||null}render({canvasContext:yg,viewport:Bg,intent:Wg="display",annotationMode:$g=_util.AnnotationMode.ENABLE,transform:Ng=null,background:Vg=null,optionalContentConfigPromise:Rg=null,annotationCanvasMap:vg=null,pageColors:Mg=null,printAnnotationStorage:kg=null}){var jg,zg;(jg=this._stats)==null||jg.time("Overall");const Sg=this._transport.getRenderingIntent(Wg,$g,kg);EI(this,ig,!1),zI(this,Ig,Od).call(this),Rg||(Rg=this._transport.getOptionalContentConfig());let Yg=this._intentStates.get(Sg.cacheKey);Yg||(Yg=Object.create(null),this._intentStates.set(Sg.cacheKey,Yg)),Yg.streamReaderCancelTimeout&&(clearTimeout(Yg.streamReaderCancelTimeout),Yg.streamReaderCancelTimeout=null);const Kg=!!(Sg.renderingIntent&_util.RenderingIntentFlag.PRINT);Yg.displayReadyCapability||(Yg.displayReadyCapability=new _util.PromiseCapability,Yg.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(zg=this._stats)==null||zg.time("Page Request"),this._pumpOperatorList(Sg));const Tg=Qg=>{var _g,gI;Yg.renderTasks.delete(xg),(this._maybeCleanupAfterRender||Kg)&&EI(this,ig,!0),zI(this,Ig,sd).call(this,!Kg),Qg?(xg.capability.reject(Qg),this._abortOperatorList({intentState:Yg,reason:Qg instanceof Error?Qg:new Error(Qg)})):xg.capability.resolve(),(_g=this._stats)==null||_g.timeEnd("Rendering"),(gI=this._stats)==null||gI.timeEnd("Overall")},xg=new InternalRenderTask({callback:Tg,params:{canvasContext:yg,viewport:Bg,transform:Ng,background:Vg},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:vg,operatorList:Yg.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!Kg,pdfBug:this._pdfBug,pageColors:Mg});(Yg.renderTasks||(Yg.renderTasks=new Set)).add(xg);const Xg=xg.task;return Promise.all([Yg.displayReadyCapability.promise,Rg]).then(([Qg,_g])=>{var gI;if(this.destroyed){Tg();return}(gI=this._stats)==null||gI.time("Rendering"),xg.initializeGraphics({transparency:Qg,optionalContentConfig:_g}),xg.operatorListChanged()}).catch(Tg),Xg}getOperatorList({intent:yg="display",annotationMode:Bg=_util.AnnotationMode.ENABLE,printAnnotationStorage:Wg=null}={}){var vg;function $g(){Vg.operatorList.lastChunk&&(Vg.opListReadCapability.resolve(Vg.operatorList),Vg.renderTasks.delete(Rg))}const Ng=this._transport.getRenderingIntent(yg,Bg,Wg,!0);let Vg=this._intentStates.get(Ng.cacheKey);Vg||(Vg=Object.create(null),this._intentStates.set(Ng.cacheKey,Vg));let Rg;return Vg.opListReadCapability||(Rg=Object.create(null),Rg.operatorListChanged=$g,Vg.opListReadCapability=new _util.PromiseCapability,(Vg.renderTasks||(Vg.renderTasks=new Set)).add(Rg),Vg.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(vg=this._stats)==null||vg.time("Page Request"),this._pumpOperatorList(Ng)),Vg.opListReadCapability.promise}streamTextContent({includeMarkedContent:yg=!1,disableNormalization:Bg=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:yg===!0,disableNormalization:Bg===!0},{highWaterMark:100,size($g){return $g.items.length}})}getTextContent(yg={}){if(this._transport._htmlForXfa)return this.getXfa().then(Wg=>_xfa_text.XfaText.textContent(Wg));const Bg=this.streamTextContent(yg);return new Promise(function(Wg,$g){function Ng(){Vg.read().then(function({value:vg,done:Mg}){if(Mg){Wg(Rg);return}Object.assign(Rg.styles,vg.styles),Rg.items.push(...vg.items),Ng()},$g)}const Vg=Bg.getReader(),Rg={items:[],styles:Object.create(null)};Ng()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const yg=[];for(const Bg of this._intentStates.values())if(this._abortOperatorList({intentState:Bg,reason:new Error("Page was destroyed."),force:!0}),!Bg.opListReadCapability)for(const Wg of Bg.renderTasks)yg.push(Wg.completed),Wg.cancel();return this.objs.clear(),EI(this,ig,!1),zI(this,Ig,Od).call(this),Promise.all(yg)}cleanup(yg=!1){EI(this,ig,!0);const Bg=zI(this,Ig,sd).call(this,!1);return yg&&Bg&&this._stats&&(this._stats=new _display_utils.StatTimer),Bg}_startRenderPage(yg,Bg){var $g,Ng;const Wg=this._intentStates.get(Bg);Wg&&(($g=this._stats)==null||$g.timeEnd("Page Request"),(Ng=Wg.displayReadyCapability)==null||Ng.resolve(yg))}_renderPageChunk(yg,Bg){for(let Wg=0,$g=yg.length;Wg<$g;Wg++)Bg.operatorList.fnArray.push(yg.fnArray[Wg]),Bg.operatorList.argsArray.push(yg.argsArray[Wg]);Bg.operatorList.lastChunk=yg.lastChunk,Bg.operatorList.separateAnnots=yg.separateAnnots;for(const Wg of Bg.renderTasks)Wg.operatorListChanged();yg.lastChunk&&zI(this,Ig,sd).call(this,!0)}_pumpOperatorList({renderingIntent:yg,cacheKey:Bg,annotationStorageSerializable:Wg}){const{map:$g,transfers:Ng}=Wg,Rg=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:yg,cacheKey:Bg,annotationStorage:$g},Ng).getReader(),vg=this._intentStates.get(Bg);vg.streamReader=Rg;const Mg=()=>{Rg.read().then(({value:kg,done:Sg})=>{if(Sg){vg.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(kg,vg),Mg())},kg=>{if(vg.streamReader=null,!this._transport.destroyed){if(vg.operatorList){vg.operatorList.lastChunk=!0;for(const Sg of vg.renderTasks)Sg.operatorListChanged();zI(this,Ig,sd).call(this,!0)}if(vg.displayReadyCapability)vg.displayReadyCapability.reject(kg);else if(vg.opListReadCapability)vg.opListReadCapability.reject(kg);else throw kg}})};Mg()}_abortOperatorList({intentState:yg,reason:Bg,force:Wg=!1}){if(yg.streamReader){if(yg.streamReaderCancelTimeout&&(clearTimeout(yg.streamReaderCancelTimeout),yg.streamReaderCancelTimeout=null),!Wg){if(yg.renderTasks.size>0)return;if(Bg instanceof _display_utils.RenderingCancelledException){let $g=RENDERING_CANCELLED_TIMEOUT;Bg.extraDelay>0&&Bg.extraDelay<1e3&&($g+=Bg.extraDelay),yg.streamReaderCancelTimeout=setTimeout(()=>{yg.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:yg,reason:Bg,force:!0})},$g);return}}if(yg.streamReader.cancel(new _util.AbortException(Bg.message)).catch(()=>{}),yg.streamReader=null,!this._transport.destroyed){for(const[$g,Ng]of this._intentStates)if(Ng===yg){this._intentStates.delete($g);break}this.cleanup()}}}get stats(){return this._stats}}gg=new WeakMap,ig=new WeakMap,Ig=new WeakSet,sd=function(yg=!1){if(zI(this,Ig,Od).call(this),!aI(this,ig)||this.destroyed)return!1;if(yg)return EI(this,gg,setTimeout(()=>{EI(this,gg,null),zI(this,Ig,sd).call(this,!1)},DELAYED_CLEANUP_TIMEOUT)),!1;for(const{renderTasks:Bg,operatorList:Wg}of this._intentStates.values())if(Bg.size>0||!Wg.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),EI(this,ig,!1),!0},Od=function(){aI(this,gg)&&(clearTimeout(aI(this,gg)),EI(this,gg,null))},exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){JI(this,ag,new Set);JI(this,sg,Promise.resolve())}postMessage(yg,Bg){const Wg={data:structuredClone(yg,Bg?{transfer:Bg}:null)};aI(this,sg).then(()=>{for(const $g of aI(this,ag))$g.call(this,Wg)})}addEventListener(yg,Bg){aI(this,ag).add(Bg)}removeEventListener(yg,Bg){aI(this,ag).delete(Bg)}terminate(){aI(this,ag).clear()}}ag=new WeakMap,sg=new WeakMap,exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const Gg=(Cg=document==null?void 0:document.currentScript)==null?void 0:Cg.src;Gg&&(PDFWorkerUtil.fallbackWorkerSrc=Gg.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(Gg,yg){let Bg;try{if(Bg=new URL(Gg),!Bg.origin||Bg.origin==="null")return!1}catch{return!1}const Wg=new URL(yg,Bg);return Bg.origin===Wg.origin},PDFWorkerUtil.createCDNWrapper=function(Gg){const yg=`importScripts("${Gg}");`;return URL.createObjectURL(new Blob([yg]))}}const _PDFWorker=class _PDFWorker{constructor({name:Gg=null,port:yg=null,verbosity:Bg=(0,_util.getVerbosityLevel)()}={}){var Wg;if(this.name=Gg,this.destroyed=!1,this.verbosity=Bg,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,yg){if((Wg=aI(_PDFWorker,lg))!=null&&Wg.has(yg))throw new Error("Cannot use more than one PDFWorker per port.");(aI(_PDFWorker,lg)||EI(_PDFWorker,lg,new WeakMap)).set(yg,this),this._initializeFromPort(yg);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(Gg){this._port=Gg,this._messageHandler=new _message_handler.MessageHandler("main","worker",Gg),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!_PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:Gg}=_PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,Gg)||(Gg=PDFWorkerUtil.createCDNWrapper(new URL(Gg,window.location).href));const yg=new Worker(Gg),Bg=new _message_handler.MessageHandler("main","worker",yg),Wg=()=>{yg.removeEventListener("error",$g),Bg.destroy(),yg.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},$g=()=>{this._webWorker||Wg()};yg.addEventListener("error",$g),Bg.on("test",Vg=>{if(yg.removeEventListener("error",$g),this.destroyed){Wg();return}Vg?(this._messageHandler=Bg,this._port=yg,this._webWorker=yg,this._readyCapability.resolve(),Bg.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),Bg.destroy(),yg.terminate())}),Bg.on("ready",Vg=>{if(yg.removeEventListener("error",$g),this.destroyed){Wg();return}try{Ng()}catch{this._setupFakeWorker()}});const Ng=()=>{const Vg=new Uint8Array;Bg.send("test",Vg,[Vg.buffer])};Ng();return}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),_PDFWorker._setupFakeWorkerGlobal.then(Gg=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const yg=new LoopbackPort;this._port=yg;const Bg=`fake${PDFWorkerUtil.fakeWorkerId++}`,Wg=new _message_handler.MessageHandler(Bg+"_worker",Bg,yg);Gg.setup(Wg,yg);const $g=new _message_handler.MessageHandler(Bg,Bg+"_worker",yg);this._messageHandler=$g,this._readyCapability.resolve(),$g.send("configure",{verbosity:this.verbosity})}).catch(Gg=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${Gg.message}".`))})}destroy(){var Gg;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(Gg=aI(_PDFWorker,lg))==null||Gg.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(Gg){var Bg;if(!(Gg!=null&&Gg.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const yg=(Bg=aI(this,lg))==null?void 0:Bg.get(Gg.port);if(yg){if(yg._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return yg}return new _PDFWorker(Gg)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){var Gg;try{return((Gg=globalThis.pdfjsWorker)==null?void 0:Gg.WorkerMessageHandler)||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}};lg=new WeakMap,JI(_PDFWorker,lg);let PDFWorker=_PDFWorker;exports.PDFWorker=PDFWorker;class WorkerTransport{constructor(yg,Bg,Wg,$g,Ng){JI(this,dg);JI(this,Ag,new Map);JI(this,cg,new Map);JI(this,rg,new Map);JI(this,ug,null);this.messageHandler=yg,this.loadingTask=Bg,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:$g.ownerDocument,styleElement:$g.styleElement}),this._params=$g,this.canvasFactory=Ng.canvasFactory,this.filterFactory=Ng.filterFactory,this.cMapReaderFactory=Ng.cMapReaderFactory,this.standardFontDataFactory=Ng.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=Wg,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(yg,Bg=_util.AnnotationMode.ENABLE,Wg=null,$g=!1){let Ng=_util.RenderingIntentFlag.DISPLAY,Vg=_annotation_storage.SerializableEmpty;switch(yg){case"any":Ng=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":Ng=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${yg}`)}switch(Bg){case _util.AnnotationMode.DISABLE:Ng+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:Ng+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:Ng+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,Vg=(Ng&_util.RenderingIntentFlag.PRINT&&Wg instanceof _annotation_storage.PrintAnnotationStorage?Wg:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${Bg}`)}return $g&&(Ng+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:Ng,cacheKey:`${Ng}_${Vg.hash}`,annotationStorageSerializable:Vg}}destroy(){var Wg;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,(Wg=aI(this,ug))==null||Wg.reject(new Error("Worker was destroyed during onPassword callback"));const yg=[];for(const $g of aI(this,cg).values())yg.push($g._destroy());aI(this,cg).clear(),aI(this,rg).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const Bg=this.messageHandler.sendWithPromise("Terminate",null);return yg.push(Bg),Promise.all(yg).then(()=>{var $g;this.commonObjs.clear(),this.fontLoader.clear(),aI(this,Ag).clear(),this.filterFactory.destroy(),($g=this._networkStream)==null||$g.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:yg,loadingTask:Bg}=this;yg.on("GetReader",(Wg,$g)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=Ng=>{this._lastProgress={loaded:Ng.loaded,total:Ng.total}},$g.onPull=()=>{this._fullReader.read().then(function({value:Ng,done:Vg}){if(Vg){$g.close();return}(0,_util.assert)(Ng instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),$g.enqueue(new Uint8Array(Ng),1,[Ng])}).catch(Ng=>{$g.error(Ng)})},$g.onCancel=Ng=>{this._fullReader.cancel(Ng),$g.ready.catch(Vg=>{if(!this.destroyed)throw Vg})}}),yg.on("ReaderHeadersReady",Wg=>{const $g=new _util.PromiseCapability,Ng=this._fullReader;return Ng.headersReady.then(()=>{var Vg;(!Ng.isStreamingSupported||!Ng.isRangeSupported)&&(this._lastProgress&&((Vg=Bg.onProgress)==null||Vg.call(Bg,this._lastProgress)),Ng.onProgress=Rg=>{var vg;(vg=Bg.onProgress)==null||vg.call(Bg,{loaded:Rg.loaded,total:Rg.total})}),$g.resolve({isStreamingSupported:Ng.isStreamingSupported,isRangeSupported:Ng.isRangeSupported,contentLength:Ng.contentLength})},$g.reject),$g.promise}),yg.on("GetRangeReader",(Wg,$g)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const Ng=this._networkStream.getRangeReader(Wg.begin,Wg.end);if(!Ng){$g.close();return}$g.onPull=()=>{Ng.read().then(function({value:Vg,done:Rg}){if(Rg){$g.close();return}(0,_util.assert)(Vg instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),$g.enqueue(new Uint8Array(Vg),1,[Vg])}).catch(Vg=>{$g.error(Vg)})},$g.onCancel=Vg=>{Ng.cancel(Vg),$g.ready.catch(Rg=>{if(!this.destroyed)throw Rg})}}),yg.on("GetDoc",({pdfInfo:Wg})=>{this._numPages=Wg.numPages,this._htmlForXfa=Wg.htmlForXfa,delete Wg.htmlForXfa,Bg._capability.resolve(new PDFDocumentProxy(Wg,this))}),yg.on("DocException",function(Wg){let $g;switch(Wg.name){case"PasswordException":$g=new _util.PasswordException(Wg.message,Wg.code);break;case"InvalidPDFException":$g=new _util.InvalidPDFException(Wg.message);break;case"MissingPDFException":$g=new _util.MissingPDFException(Wg.message);break;case"UnexpectedResponseException":$g=new _util.UnexpectedResponseException(Wg.message,Wg.status);break;case"UnknownErrorException":$g=new _util.UnknownErrorException(Wg.message,Wg.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}Bg._capability.reject($g)}),yg.on("PasswordRequest",Wg=>{if(EI(this,ug,new _util.PromiseCapability),Bg.onPassword){const $g=Ng=>{Ng instanceof Error?aI(this,ug).reject(Ng):aI(this,ug).resolve({password:Ng})};try{Bg.onPassword($g,Wg.code)}catch(Ng){aI(this,ug).reject(Ng)}}else aI(this,ug).reject(new _util.PasswordException(Wg.message,Wg.code));return aI(this,ug).promise}),yg.on("DataLoaded",Wg=>{var $g;($g=Bg.onProgress)==null||$g.call(Bg,{loaded:Wg.length,total:Wg.length}),this.downloadInfoCapability.resolve(Wg)}),yg.on("StartRenderPage",Wg=>{if(this.destroyed)return;aI(this,cg).get(Wg.pageIndex)._startRenderPage(Wg.transparency,Wg.cacheKey)}),yg.on("commonobj",([Wg,$g,Ng])=>{var Vg;if(!this.destroyed&&!this.commonObjs.has(Wg))switch($g){case"Font":const Rg=this._params;if("error"in Ng){const kg=Ng.error;(0,_util.warn)(`Error during font loading: ${kg}`),this.commonObjs.resolve(Wg,kg);break}const vg=Rg.pdfBug&&((Vg=globalThis.FontInspector)!=null&&Vg.enabled)?(kg,Sg)=>globalThis.FontInspector.fontAdded(kg,Sg):null,Mg=new _font_loader.FontFaceObject(Ng,{isEvalSupported:Rg.isEvalSupported,disableFontFace:Rg.disableFontFace,ignoreErrors:Rg.ignoreErrors,inspectFont:vg});this.fontLoader.bind(Mg).catch(kg=>yg.sendWithPromise("FontFallback",{id:Wg})).finally(()=>{!Rg.fontExtraProperties&&Mg.data&&(Mg.data=null),this.commonObjs.resolve(Wg,Mg)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(Wg,Ng);break;default:throw new Error(`Got unknown common object type ${$g}`)}}),yg.on("obj",([Wg,$g,Ng,Vg])=>{var vg;if(this.destroyed)return;const Rg=aI(this,cg).get($g);if(!Rg.objs.has(Wg))switch(Ng){case"Image":if(Rg.objs.resolve(Wg,Vg),Vg){let Mg;if(Vg.bitmap){const{width:kg,height:Sg}=Vg;Mg=kg*Sg*4}else Mg=((vg=Vg.data)==null?void 0:vg.length)||0;Mg>_util.MAX_IMAGE_SIZE_TO_CACHE&&(Rg._maybeCleanupAfterRender=!0)}break;case"Pattern":Rg.objs.resolve(Wg,Vg);break;default:throw new Error(`Got unknown object type ${Ng}`)}}),yg.on("DocProgress",Wg=>{var $g;this.destroyed||($g=Bg.onProgress)==null||$g.call(Bg,{loaded:Wg.loaded,total:Wg.total})}),yg.on("FetchBuiltInCMap",Wg=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(Wg):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),yg.on("FetchStandardFontData",Wg=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(Wg):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var Wg;this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:yg,transfers:Bg}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:yg,filename:((Wg=this._fullReader)==null?void 0:Wg.filename)??null},Bg).finally(()=>{this.annotationStorage.resetModified()})}getPage(yg){if(!Number.isInteger(yg)||yg<=0||yg>this._numPages)return Promise.reject(new Error("Invalid page request."));const Bg=yg-1,Wg=aI(this,rg).get(Bg);if(Wg)return Wg;const $g=this.messageHandler.sendWithPromise("GetPage",{pageIndex:Bg}).then(Ng=>{if(this.destroyed)throw new Error("Transport destroyed");const Vg=new PDFPageProxy(Bg,Ng,this,this._params.pdfBug);return aI(this,cg).set(Bg,Vg),Vg});return aI(this,rg).set(Bg,$g),$g}getPageIndex(yg){return typeof yg!="object"||yg===null||!Number.isInteger(yg.num)||yg.num<0||!Number.isInteger(yg.gen)||yg.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:yg.num,gen:yg.gen})}getAnnotations(yg,Bg){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:yg,intent:Bg})}getFieldObjects(){return zI(this,dg,Ed).call(this,"GetFieldObjects")}hasJSActions(){return zI(this,dg,Ed).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(yg){return typeof yg!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:yg})}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 zI(this,dg,Ed).call(this,"GetDocJSActions")}getPageJSActions(yg){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:yg})}getStructTree(yg){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:yg})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(yg=>new _optional_content_config.OptionalContentConfig(yg))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const yg="GetMetadata",Bg=aI(this,Ag).get(yg);if(Bg)return Bg;const Wg=this.messageHandler.sendWithPromise(yg,null).then($g=>{var Ng,Vg;return{info:$g[0],metadata:$g[1]?new _metadata.Metadata($g[1]):null,contentDispositionFilename:((Ng=this._fullReader)==null?void 0:Ng.filename)??null,contentLength:((Vg=this._fullReader)==null?void 0:Vg.contentLength)??null}});return aI(this,Ag).set(yg,Wg),Wg}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(yg=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const Bg of aI(this,cg).values())if(!Bg.cleanup())throw new Error(`startCleanup: Page ${Bg.pageNumber} is currently rendering.`);this.commonObjs.clear(),yg||this.fontLoader.clear(),aI(this,Ag).clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:yg,enableXfa:Bg}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:yg,enableXfa:Bg})}}Ag=new WeakMap,cg=new WeakMap,rg=new WeakMap,ug=new WeakMap,dg=new WeakSet,Ed=function(yg,Bg=null){const Wg=aI(this,Ag).get(yg);if(Wg)return Wg;const $g=this.messageHandler.sendWithPromise(yg,Bg);return aI(this,Ag).set(yg,$g),$g};class PDFObjects{constructor(){JI(this,hg);JI(this,mg,Object.create(null))}get(yg,Bg=null){if(Bg){const $g=zI(this,hg,cu).call(this,yg);return $g.capability.promise.then(()=>Bg($g.data)),null}const Wg=aI(this,mg)[yg];if(!(Wg!=null&&Wg.capability.settled))throw new Error(`Requesting object that isn't resolved yet ${yg}.`);return Wg.data}has(yg){const Bg=aI(this,mg)[yg];return(Bg==null?void 0:Bg.capability.settled)||!1}resolve(yg,Bg=null){const Wg=zI(this,hg,cu).call(this,yg);Wg.data=Bg,Wg.capability.resolve()}clear(){var yg;for(const Bg in aI(this,mg)){const{data:Wg}=aI(this,mg)[Bg];(yg=Wg==null?void 0:Wg.bitmap)==null||yg.close()}EI(this,mg,Object.create(null))}}mg=new WeakMap,hg=new WeakSet,cu=function(yg){var Bg;return(Bg=aI(this,mg))[yg]||(Bg[yg]={capability:new _util.PromiseCapability,data:null})};class RenderTask{constructor(yg){JI(this,wg,null);EI(this,wg,yg),this.onContinue=null}get promise(){return aI(this,wg).capability.promise}cancel(yg=0){aI(this,wg).cancel(null,yg)}get separateAnnots(){const{separateAnnots:yg}=aI(this,wg).operatorList;if(!yg)return!1;const{annotationCanvasMap:Bg}=aI(this,wg);return yg.form||yg.canvas&&(Bg==null?void 0:Bg.size)>0}}wg=new WeakMap,exports.RenderTask=RenderTask;const fg=class fg{constructor({callback:yg,params:Bg,objs:Wg,commonObjs:$g,annotationCanvasMap:Ng,operatorList:Vg,pageIndex:Rg,canvasFactory:vg,filterFactory:Mg,useRequestAnimationFrame:kg=!1,pdfBug:Sg=!1,pageColors:Yg=null}){this.callback=yg,this.params=Bg,this.objs=Wg,this.commonObjs=$g,this.annotationCanvasMap=Ng,this.operatorListIdx=null,this.operatorList=Vg,this._pageIndex=Rg,this.canvasFactory=vg,this.filterFactory=Mg,this._pdfBug=Sg,this.pageColors=Yg,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=kg===!0&&typeof window<"u",this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=Bg.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:yg=!1,optionalContentConfig:Bg}){var Rg,vg;if(this.cancelled)return;if(this._canvas){if(aI(fg,pg).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.");aI(fg,pg).add(this._canvas)}this._pdfBug&&((Rg=globalThis.StepperManager)!=null&&Rg.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:Wg,viewport:$g,transform:Ng,background:Vg}=this.params;this.gfx=new _canvas.CanvasGraphics(Wg,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:Bg},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:Ng,viewport:$g,transparency:yg,background:Vg}),this.operatorListIdx=0,this.graphicsReady=!0,(vg=this.graphicsReadyCallback)==null||vg.call(this)}cancel(yg=null,Bg=0){var Wg;this.running=!1,this.cancelled=!0,(Wg=this.gfx)==null||Wg.endDrawing(),aI(fg,pg).delete(this._canvas),this.callback(yg||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,Bg))}operatorListChanged(){var yg;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(yg=this.stepper)==null||yg.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),aI(fg,pg).delete(this._canvas),this.callback())))}};pg=new WeakMap,JI(fg,pg,new WeakSet);let InternalRenderTask=fg;const version="3.11.174";exports.version=version;const build="ce8716743";exports.build=build}),((tg,eg,gg)=>{var Cg,lg,Ag,Sb,rg;Object.defineProperty(eg,"__esModule",{value:!0}),eg.SerializableEmpty=eg.PrintAnnotationStorage=eg.AnnotationStorage=void 0;var ig=gg(1),Ig=gg(4),ng=gg(8);const og=Object.freeze({map:null,hash:"",transfers:void 0});eg.SerializableEmpty=og;class ag{constructor(){JI(this,Ag);JI(this,Cg,!1);JI(this,lg,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(dg,bg){const mg=aI(this,lg).get(dg);return mg===void 0?bg:Object.assign(bg,mg)}getRawValue(dg){return aI(this,lg).get(dg)}remove(dg){if(aI(this,lg).delete(dg),aI(this,lg).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const bg of aI(this,lg).values())if(bg instanceof Ig.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(dg,bg){const mg=aI(this,lg).get(dg);let hg=!1;if(mg!==void 0)for(const[Zg,wg]of Object.entries(bg))mg[Zg]!==wg&&(hg=!0,mg[Zg]=wg);else hg=!0,aI(this,lg).set(dg,bg);hg&&zI(this,Ag,Sb).call(this),bg instanceof Ig.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(bg.constructor._type)}has(dg){return aI(this,lg).has(dg)}getAll(){return aI(this,lg).size>0?(0,ig.objectFromMap)(aI(this,lg)):null}setAll(dg){for(const[bg,mg]of Object.entries(dg))this.setValue(bg,mg)}get size(){return aI(this,lg).size}resetModified(){aI(this,Cg)&&(EI(this,Cg,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new sg(this)}get serializable(){if(aI(this,lg).size===0)return og;const dg=new Map,bg=new ng.MurmurHash3_64,mg=[],hg=Object.create(null);let Zg=!1;for(const[wg,pg]of aI(this,lg)){const fg=pg instanceof Ig.AnnotationEditor?pg.serialize(!1,hg):pg;fg&&(dg.set(wg,fg),bg.update(`${wg}:${JSON.stringify(fg)}`),Zg||(Zg=!!fg.bitmap))}if(Zg)for(const wg of dg.values())wg.bitmap&&mg.push(wg.bitmap);return dg.size>0?{map:dg,hash:bg.hexdigest(),transfers:mg}:og}}Cg=new WeakMap,lg=new WeakMap,Ag=new WeakSet,Sb=function(){aI(this,Cg)||(EI(this,Cg,!0),typeof this.onSetModified=="function"&&this.onSetModified())},eg.AnnotationStorage=ag;class sg extends ag{constructor(bg){super();JI(this,rg);const{map:mg,hash:hg,transfers:Zg}=bg.serializable,wg=structuredClone(mg,Zg?{transfer:Zg}:null);EI(this,rg,{map:wg,hash:hg,transfers:Zg})}get print(){(0,ig.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return aI(this,rg)}}rg=new WeakMap,eg.PrintAnnotationStorage=sg}),((tg,eg,gg)=>{var sg,Cg,lg,Ag,cg,rg,ug,dg,bg,mg,hg,Zg,wg,pg,fg,ru,du,Bg,uu,mu,Mb,Xb,Db,bu,Hb;Object.defineProperty(eg,"__esModule",{value:!0}),eg.AnnotationEditor=void 0;var ig=gg(5),Ig=gg(1),ng=gg(6);const kg=class kg{constructor(Yg){JI(this,fg);JI(this,sg,"");JI(this,Cg,!1);JI(this,lg,null);JI(this,Ag,null);JI(this,cg,null);JI(this,rg,!1);JI(this,ug,null);JI(this,dg,this.focusin.bind(this));JI(this,bg,this.focusout.bind(this));JI(this,mg,!1);JI(this,hg,!1);JI(this,Zg,!1);el(this,"_initialOptions",Object.create(null));el(this,"_uiManager",null);el(this,"_focusEventsAllowed",!0);el(this,"_l10nPromise",null);JI(this,wg,!1);JI(this,pg,kg._zIndex++);this.constructor===kg&&(0,Ig.unreachable)("Cannot initialize AnnotationEditor."),this.parent=Yg.parent,this.id=Yg.id,this.width=this.height=null,this.pageIndex=Yg.parent.pageIndex,this.name=Yg.name,this.div=null,this._uiManager=Yg.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=Yg.isCentered,this._structTreeParentId=null;const{rotation:Kg,rawDims:{pageWidth:Tg,pageHeight:xg,pageX:Xg,pageY:jg}}=this.parent.viewport;this.rotation=Kg,this.pageRotation=(360+Kg-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[Tg,xg],this.pageTranslation=[Xg,jg];const[zg,Qg]=this.parentDimensions;this.x=Yg.x/zg,this.y=Yg.y/Qg,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,Ig.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(Yg){const Kg=new ag({id:Yg.parent.getNextId(),parent:Yg.parent,uiManager:Yg._uiManager});Kg.annotationElementId=Yg.annotationElementId,Kg.deleted=!0,Kg._uiManager.addToAnnotationStorage(Kg)}static initialize(Yg,Kg=null){if(kg._l10nPromise||(kg._l10nPromise=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(xg=>[xg,Yg.get(xg)]))),Kg!=null&&Kg.strings)for(const xg of Kg.strings)kg._l10nPromise.set(xg,Yg.get(xg));if(kg._borderLineWidth!==-1)return;const Tg=getComputedStyle(document.documentElement);kg._borderLineWidth=parseFloat(Tg.getPropertyValue("--outline-width"))||0}static updateDefaultParams(Yg,Kg){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(Yg){return!1}static paste(Yg,Kg){(0,Ig.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return aI(this,wg)}set _isDraggable(Yg){var Kg;EI(this,wg,Yg),(Kg=this.div)==null||Kg.classList.toggle("draggable",Yg)}center(){const[Yg,Kg]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*Kg/(Yg*2),this.y+=this.width*Yg/(Kg*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*Kg/(Yg*2),this.y-=this.width*Yg/(Kg*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(Yg){this._uiManager.addCommands(Yg)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=aI(this,pg)}setParent(Yg){Yg!==null&&(this.pageIndex=Yg.pageIndex,this.pageDimensions=Yg.pageDimensions),this.parent=Yg}focusin(Yg){this._focusEventsAllowed&&(aI(this,mg)?EI(this,mg,!1):this.parent.setSelected(this))}focusout(Yg){var Tg;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const Kg=Yg.relatedTarget;Kg!=null&&Kg.closest(`#${this.id}`)||(Yg.preventDefault(),(Tg=this.parent)!=null&&Tg.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(Yg,Kg,Tg,xg){const[Xg,jg]=this.parentDimensions;[Tg,xg]=this.screenToPageTranslation(Tg,xg),this.x=(Yg+Tg)/Xg,this.y=(Kg+xg)/jg,this.fixAndSetPosition()}translate(Yg,Kg){zI(this,fg,ru).call(this,this.parentDimensions,Yg,Kg)}translateInPage(Yg,Kg){zI(this,fg,ru).call(this,this.pageDimensions,Yg,Kg),this.div.scrollIntoView({block:"nearest"})}drag(Yg,Kg){const[Tg,xg]=this.parentDimensions;if(this.x+=Yg/Tg,this.y+=Kg/xg,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:_g,y:gI}=this.div.getBoundingClientRect();this.parent.findNewParent(this,_g,gI)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:Xg,y:jg}=this;const[zg,Qg]=zI(this,fg,du).call(this);Xg+=zg,jg+=Qg,this.div.style.left=`${(100*Xg).toFixed(2)}%`,this.div.style.top=`${(100*jg).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}fixAndSetPosition(){const[Yg,Kg]=this.pageDimensions;let{x:Tg,y:xg,width:Xg,height:jg}=this;switch(Xg*=Yg,jg*=Kg,Tg*=Yg,xg*=Kg,this.rotation){case 0:Tg=Math.max(0,Math.min(Yg-Xg,Tg)),xg=Math.max(0,Math.min(Kg-jg,xg));break;case 90:Tg=Math.max(0,Math.min(Yg-jg,Tg)),xg=Math.min(Kg,Math.max(Xg,xg));break;case 180:Tg=Math.min(Yg,Math.max(Xg,Tg)),xg=Math.min(Kg,Math.max(jg,xg));break;case 270:Tg=Math.min(Yg,Math.max(jg,Tg)),xg=Math.max(0,Math.min(Kg-Xg,xg));break}this.x=Tg/=Yg,this.y=xg/=Kg;const[zg,Qg]=zI(this,fg,du).call(this);Tg+=zg,xg+=Qg;const{style:_g}=this.div;_g.left=`${(100*Tg).toFixed(2)}%`,_g.top=`${(100*xg).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(Yg,Kg){var Tg;return zI(Tg=kg,Bg,uu).call(Tg,Yg,Kg,this.parentRotation)}pageTranslationToScreen(Yg,Kg){var Tg;return zI(Tg=kg,Bg,uu).call(Tg,Yg,Kg,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:Yg,pageDimensions:[Kg,Tg]}=this,xg=Kg*Yg,Xg=Tg*Yg;return Ig.FeatureTest.isCSSRoundSupported?[Math.round(xg),Math.round(Xg)]:[xg,Xg]}setDims(Yg,Kg){var Xg;const[Tg,xg]=this.parentDimensions;this.div.style.width=`${(100*Yg/Tg).toFixed(2)}%`,aI(this,rg)||(this.div.style.height=`${(100*Kg/xg).toFixed(2)}%`),(Xg=aI(this,lg))==null||Xg.classList.toggle("small",Yg<kg.SMALL_EDITOR_SIZE||Kg<kg.SMALL_EDITOR_SIZE)}fixDims(){const{style:Yg}=this.div,{height:Kg,width:Tg}=Yg,xg=Tg.endsWith("%"),Xg=!aI(this,rg)&&Kg.endsWith("%");if(xg&&Xg)return;const[jg,zg]=this.parentDimensions;xg||(Yg.width=`${(100*parseFloat(Tg)/jg).toFixed(2)}%`),!aI(this,rg)&&!Xg&&(Yg.height=`${(100*parseFloat(Kg)/zg).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}async addAltTextButton(){if(aI(this,lg))return;const Yg=EI(this,lg,document.createElement("button"));Yg.className="altText";const Kg=await kg._l10nPromise.get("editor_alt_text_button_label");Yg.textContent=Kg,Yg.setAttribute("aria-label",Kg),Yg.tabIndex="0",Yg.addEventListener("contextmenu",ng.noContextMenu),Yg.addEventListener("pointerdown",Tg=>Tg.stopPropagation()),Yg.addEventListener("click",Tg=>{Tg.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),Yg.addEventListener("keydown",Tg=>{Tg.target===Yg&&Tg.key==="Enter"&&(Tg.preventDefault(),this._uiManager.editAltText(this))}),zI(this,fg,bu).call(this),this.div.append(Yg),kg.SMALL_EDITOR_SIZE||(kg.SMALL_EDITOR_SIZE=Math.min(128,Math.round(Yg.getBoundingClientRect().width*1.4)))}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:aI(this,sg),decorative:aI(this,Cg)}}set altTextData({altText:Yg,decorative:Kg}){aI(this,sg)===Yg&&aI(this,Cg)===Kg||(EI(this,sg,Yg),EI(this,Cg,Kg),zI(this,fg,bu).call(this))}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",aI(this,dg)),this.div.addEventListener("focusout",aI(this,bg));const[Yg,Kg]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*Kg/Yg).toFixed(2)}%`,this.div.style.maxHeight=`${(100*Yg/Kg).toFixed(2)}%`);const[Tg,xg]=this.getInitialTranslation();return this.translate(Tg,xg),(0,ig.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(Yg){const{isMac:Kg}=Ig.FeatureTest.platform;if(Yg.button!==0||Yg.ctrlKey&&Kg){Yg.preventDefault();return}EI(this,mg,!0),zI(this,fg,Hb).call(this,Yg)}moveInDOM(){var Yg;(Yg=this.parent)==null||Yg.moveEditorInDOM(this)}_setParentAndPosition(Yg,Kg,Tg){Yg.changeParent(this),this.x=Kg,this.y=Tg,this.fixAndSetPosition()}getRect(Yg,Kg){const Tg=this.parentScale,[xg,Xg]=this.pageDimensions,[jg,zg]=this.pageTranslation,Qg=Yg/Tg,_g=Kg/Tg,gI=this.x*xg,AI=this.y*Xg,CI=this.width*xg,dI=this.height*Xg;switch(this.rotation){case 0:return[gI+Qg+jg,Xg-AI-_g-dI+zg,gI+Qg+CI+jg,Xg-AI-_g+zg];case 90:return[gI+_g+jg,Xg-AI+Qg+zg,gI+_g+dI+jg,Xg-AI+Qg+CI+zg];case 180:return[gI-Qg-CI+jg,Xg-AI+_g+zg,gI-Qg+jg,Xg-AI+_g+dI+zg];case 270:return[gI-_g-dI+jg,Xg-AI-Qg-CI+zg,gI-_g+jg,Xg-AI-Qg+zg];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(Yg,Kg){const[Tg,xg,Xg,jg]=Yg,zg=Xg-Tg,Qg=jg-xg;switch(this.rotation){case 0:return[Tg,Kg-jg,zg,Qg];case 90:return[Tg,Kg-xg,Qg,zg];case 180:return[Xg,Kg-xg,zg,Qg];case 270:return[Xg,Kg-jg,Qg,zg];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){EI(this,Zg,!0)}disableEditMode(){EI(this,Zg,!1)}isInEditMode(){return aI(this,Zg)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var Yg,Kg;(Yg=this.div)==null||Yg.addEventListener("focusin",aI(this,dg)),(Kg=this.div)==null||Kg.addEventListener("focusout",aI(this,bg))}serialize(Yg=!1,Kg=null){(0,Ig.unreachable)("An editor must be serializable")}static deserialize(Yg,Kg,Tg){const xg=new this.prototype.constructor({parent:Kg,id:Kg.getNextId(),uiManager:Tg});xg.rotation=Yg.rotation;const[Xg,jg]=xg.pageDimensions,[zg,Qg,_g,gI]=xg.getRectInCurrentCoords(Yg.rect,jg);return xg.x=zg/Xg,xg.y=Qg/jg,xg.width=_g/Xg,xg.height=gI/jg,xg}remove(){var Yg;this.div.removeEventListener("focusin",aI(this,dg)),this.div.removeEventListener("focusout",aI(this,bg)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(Yg=aI(this,lg))==null||Yg.remove(),EI(this,lg,null),EI(this,Ag,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(zI(this,fg,Mb).call(this),aI(this,ug).classList.remove("hidden"))}select(){var Yg;this.makeResizable(),(Yg=this.div)==null||Yg.classList.add("selectedEditor")}unselect(){var Yg,Kg,Tg;(Yg=aI(this,ug))==null||Yg.classList.add("hidden"),(Kg=this.div)==null||Kg.classList.remove("selectedEditor"),(Tg=this.div)!=null&&Tg.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(Yg,Kg){}disableEditing(){aI(this,lg)&&(aI(this,lg).hidden=!0)}enableEditing(){aI(this,lg)&&(aI(this,lg).hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return aI(this,hg)}set isEditing(Yg){EI(this,hg,Yg),this.parent&&(Yg?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(Yg,Kg){EI(this,rg,!0);const Tg=Yg/Kg,{style:xg}=this.div;xg.aspectRatio=Tg,xg.height="auto"}static get MIN_SIZE(){return 16}};sg=new WeakMap,Cg=new WeakMap,lg=new WeakMap,Ag=new WeakMap,cg=new WeakMap,rg=new WeakMap,ug=new WeakMap,dg=new WeakMap,bg=new WeakMap,mg=new WeakMap,hg=new WeakMap,Zg=new WeakMap,wg=new WeakMap,pg=new WeakMap,fg=new WeakSet,ru=function([Yg,Kg],Tg,xg){[Tg,xg]=this.screenToPageTranslation(Tg,xg),this.x+=Tg/Yg,this.y+=xg/Kg,this.fixAndSetPosition()},du=function(){const[Yg,Kg]=this.parentDimensions,{_borderLineWidth:Tg}=kg,xg=Tg/Yg,Xg=Tg/Kg;switch(this.rotation){case 90:return[-xg,Xg];case 180:return[xg,Xg];case 270:return[xg,-Xg];default:return[-xg,-Xg]}},Bg=new WeakSet,uu=function(Yg,Kg,Tg){switch(Tg){case 90:return[Kg,-Yg];case 180:return[-Yg,-Kg];case 270:return[-Kg,Yg];default:return[Yg,Kg]}},mu=function(Yg){switch(Yg){case 90:{const[Kg,Tg]=this.pageDimensions;return[0,-Kg/Tg,Tg/Kg,0]}case 180:return[-1,0,0,-1];case 270:{const[Kg,Tg]=this.pageDimensions;return[0,Kg/Tg,-Tg/Kg,0]}default:return[1,0,0,1]}},Mb=function(){if(aI(this,ug))return;EI(this,ug,document.createElement("div")),aI(this,ug).classList.add("resizers");const Yg=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||Yg.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const Kg of Yg){const Tg=document.createElement("div");aI(this,ug).append(Tg),Tg.classList.add("resizer",Kg),Tg.addEventListener("pointerdown",zI(this,fg,Xb).bind(this,Kg)),Tg.addEventListener("contextmenu",ng.noContextMenu)}this.div.prepend(aI(this,ug))},Xb=function(Yg,Kg){Kg.preventDefault();const{isMac:Tg}=Ig.FeatureTest.platform;if(Kg.button!==0||Kg.ctrlKey&&Tg)return;const xg=zI(this,fg,Db).bind(this,Yg),Xg=this._isDraggable;this._isDraggable=!1;const jg={passive:!0,capture:!0};window.addEventListener("pointermove",xg,jg);const zg=this.x,Qg=this.y,_g=this.width,gI=this.height,AI=this.parent.div.style.cursor,CI=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(Kg.target).cursor;const dI=()=>{this._isDraggable=Xg,window.removeEventListener("pointerup",dI),window.removeEventListener("blur",dI),window.removeEventListener("pointermove",xg,jg),this.parent.div.style.cursor=AI,this.div.style.cursor=CI;const ZI=this.x,Og=this.y,Lg=this.width,lI=this.height;ZI===zg&&Og===Qg&&Lg===_g&&lI===gI||this.addCommands({cmd:()=>{this.width=Lg,this.height=lI,this.x=ZI,this.y=Og;const[iI,eI]=this.parentDimensions;this.setDims(iI*Lg,eI*lI),this.fixAndSetPosition()},undo:()=>{this.width=_g,this.height=gI,this.x=zg,this.y=Qg;const[iI,eI]=this.parentDimensions;this.setDims(iI*_g,eI*gI),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",dI),window.addEventListener("blur",dI)},Db=function(Yg,Kg){const[Tg,xg]=this.parentDimensions,Xg=this.x,jg=this.y,zg=this.width,Qg=this.height,_g=kg.MIN_SIZE/Tg,gI=kg.MIN_SIZE/xg,AI=II=>Math.round(II*1e4)/1e4,CI=zI(this,fg,mu).call(this,this.rotation),dI=(II,wI)=>[CI[0]*II+CI[2]*wI,CI[1]*II+CI[3]*wI],ZI=zI(this,fg,mu).call(this,360-this.rotation),Og=(II,wI)=>[ZI[0]*II+ZI[2]*wI,ZI[1]*II+ZI[3]*wI];let Lg,lI,iI=!1,eI=!1;switch(Yg){case"topLeft":iI=!0,Lg=(II,wI)=>[0,0],lI=(II,wI)=>[II,wI];break;case"topMiddle":Lg=(II,wI)=>[II/2,0],lI=(II,wI)=>[II/2,wI];break;case"topRight":iI=!0,Lg=(II,wI)=>[II,0],lI=(II,wI)=>[0,wI];break;case"middleRight":eI=!0,Lg=(II,wI)=>[II,wI/2],lI=(II,wI)=>[0,wI/2];break;case"bottomRight":iI=!0,Lg=(II,wI)=>[II,wI],lI=(II,wI)=>[0,0];break;case"bottomMiddle":Lg=(II,wI)=>[II/2,wI],lI=(II,wI)=>[II/2,0];break;case"bottomLeft":iI=!0,Lg=(II,wI)=>[0,wI],lI=(II,wI)=>[II,0];break;case"middleLeft":eI=!0,Lg=(II,wI)=>[0,wI/2],lI=(II,wI)=>[II,wI/2];break}const Jg=Lg(zg,Qg),Pg=lI(zg,Qg);let cI=dI(...Pg);const bI=AI(Xg+cI[0]),hI=AI(jg+cI[1]);let BI=1,YI=1,[uI,fI]=this.screenToPageTranslation(Kg.movementX,Kg.movementY);if([uI,fI]=Og(uI/Tg,fI/xg),iI){const II=Math.hypot(zg,Qg);BI=YI=Math.max(Math.min(Math.hypot(Pg[0]-Jg[0]-uI,Pg[1]-Jg[1]-fI)/II,1/zg,1/Qg),_g/zg,gI/Qg)}else eI?BI=Math.max(_g,Math.min(1,Math.abs(Pg[0]-Jg[0]-uI)))/zg:YI=Math.max(gI,Math.min(1,Math.abs(Pg[1]-Jg[1]-fI)))/Qg;const WI=AI(zg*BI),MI=AI(Qg*YI);cI=dI(...lI(WI,MI));const jI=bI-cI[0],HI=hI-cI[1];this.width=WI,this.height=MI,this.x=jI,this.y=HI,this.setDims(Tg*WI,xg*MI),this.fixAndSetPosition()},bu=async function(){var Tg;const Yg=aI(this,lg);if(!Yg)return;if(!aI(this,sg)&&!aI(this,Cg)){Yg.classList.remove("done"),(Tg=aI(this,Ag))==null||Tg.remove();return}kg._l10nPromise.get("editor_alt_text_edit_button_label").then(xg=>{Yg.setAttribute("aria-label",xg)});let Kg=aI(this,Ag);if(!Kg){EI(this,Ag,Kg=document.createElement("span")),Kg.className="tooltip",Kg.setAttribute("role","tooltip");const xg=Kg.id=`alt-text-tooltip-${this.id}`;Yg.setAttribute("aria-describedby",xg);const Xg=100;Yg.addEventListener("mouseenter",()=>{EI(this,cg,setTimeout(()=>{EI(this,cg,null),aI(this,Ag).classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},Xg))}),Yg.addEventListener("mouseleave",()=>{var jg;clearTimeout(aI(this,cg)),EI(this,cg,null),(jg=aI(this,Ag))==null||jg.classList.remove("show")})}Yg.classList.add("done"),Kg.innerText=aI(this,Cg)?await kg._l10nPromise.get("editor_alt_text_decorative_tooltip"):aI(this,sg),Kg.parentNode||Yg.append(Kg)},Hb=function(Yg){if(!this._isDraggable)return;const Kg=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let Tg,xg;Kg&&(Tg={passive:!0,capture:!0},xg=jg=>{const[zg,Qg]=this.screenToPageTranslation(jg.movementX,jg.movementY);this._uiManager.dragSelectedEditors(zg,Qg)},window.addEventListener("pointermove",xg,Tg));const Xg=()=>{if(window.removeEventListener("pointerup",Xg),window.removeEventListener("blur",Xg),Kg&&window.removeEventListener("pointermove",xg,Tg),EI(this,mg,!1),!this._uiManager.endDragSession()){const{isMac:jg}=Ig.FeatureTest.platform;Yg.ctrlKey&&!jg||Yg.shiftKey||Yg.metaKey&&jg?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",Xg),window.addEventListener("blur",Xg)},JI(kg,Bg),el(kg,"_borderLineWidth",-1),el(kg,"_colorManager",new ig.ColorManager),el(kg,"_zIndex",1),el(kg,"SMALL_EDITOR_SIZE",0);let og=kg;eg.AnnotationEditor=og;class ag extends og{constructor(Yg){super(Yg),this.annotationElementId=Yg.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((tg,eg,gg)=>{var rg,ug,dg,bg,mg,hu,wg,pg,fg,Gg,yg,jb,$g,Ng,Vg,Rg,vg,Mg,kg,Sg,Yg,Kg,Tg,xg,Xg,jg,zg,Qg,_g,gI,AI,CI,dI,ZI,Og,Lg,lI,iI,eI,Jg,Pg,cI,bI,hI,BI,YI,uI,xb,pu,Zu,Qd,wu,Gu,uc,Nd,Fb,Kb,fu,Vd,yu;Object.defineProperty(eg,"__esModule",{value:!0}),eg.KeyboardManager=eg.CommandManager=eg.ColorManager=eg.AnnotationEditorUIManager=void 0,eg.bindEvents=ng,eg.opacityToHex=og;var ig=gg(1),Ig=gg(6);function ng(Hg,qg,nI){for(const Ug of nI)qg.addEventListener(Ug,Hg[Ug].bind(Hg))}function og(Hg){return Math.round(Math.min(255,Math.max(1,255*Hg))).toString(16).padStart(2,"0")}class ag{constructor(){JI(this,rg,0)}getId(){return`${ig.AnnotationEditorPrefix}${Wd(this,rg)._++}`}}rg=new WeakMap;const Zg=class Zg{constructor(){JI(this,mg);JI(this,ug,(0,ig.getUuid)());JI(this,dg,0);JI(this,bg,null)}static get _isSVGFittingCanvas(){const qg='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>',Ug=new OffscreenCanvas(1,3).getContext("2d"),tI=new Image;tI.src=qg;const mI=tI.decode().then(()=>(Ug.drawImage(tI,0,0,1,1,0,0,1,3),new Uint32Array(Ug.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,ig.shadow)(this,"_isSVGFittingCanvas",mI)}async getFromFile(qg){const{lastModified:nI,name:Ug,size:tI,type:mI}=qg;return zI(this,mg,hu).call(this,`${nI}_${Ug}_${tI}_${mI}`,qg)}async getFromUrl(qg){return zI(this,mg,hu).call(this,qg,qg)}async getFromId(qg){aI(this,bg)||EI(this,bg,new Map);const nI=aI(this,bg).get(qg);return nI?nI.bitmap?(nI.refCounter+=1,nI):nI.file?this.getFromFile(nI.file):this.getFromUrl(nI.url):null}getSvgUrl(qg){const nI=aI(this,bg).get(qg);return nI!=null&&nI.isSvg?nI.svgUrl:null}deleteId(qg){aI(this,bg)||EI(this,bg,new Map);const nI=aI(this,bg).get(qg);nI&&(nI.refCounter-=1,nI.refCounter===0&&(nI.bitmap=null))}isValidId(qg){return qg.startsWith(`image_${aI(this,ug)}_`)}};ug=new WeakMap,dg=new WeakMap,bg=new WeakMap,mg=new WeakSet,hu=async function(qg,nI){aI(this,bg)||EI(this,bg,new Map);let Ug=aI(this,bg).get(qg);if(Ug===null)return null;if(Ug!=null&&Ug.bitmap)return Ug.refCounter+=1,Ug;try{Ug||(Ug={bitmap:null,id:`image_${aI(this,ug)}_${Wd(this,dg)._++}`,refCounter:0,isSvg:!1});let tI;if(typeof nI=="string"){Ug.url=nI;const mI=await fetch(nI);if(!mI.ok)throw new Error(mI.statusText);tI=await mI.blob()}else tI=Ug.file=nI;if(tI.type==="image/svg+xml"){const mI=Zg._isSVGFittingCanvas,VI=new FileReader,oI=new Image,Eg=new Promise((pI,vI)=>{oI.onload=()=>{Ug.bitmap=oI,Ug.isSvg=!0,pI()},VI.onload=async()=>{const yI=Ug.svgUrl=VI.result;oI.src=await mI?`${yI}#svgView(preserveAspectRatio(none))`:yI},oI.onerror=VI.onerror=vI});VI.readAsDataURL(tI),await Eg}else Ug.bitmap=await createImageBitmap(tI);Ug.refCounter=1}catch(tI){console.error(tI),Ug=null}return aI(this,bg).set(qg,Ug),Ug&&aI(this,bg).set(Ug.id,Ug),Ug};let sg=Zg;class Cg{constructor(qg=128){JI(this,wg,[]);JI(this,pg,!1);JI(this,fg);JI(this,Gg,-1);EI(this,fg,qg)}add({cmd:qg,undo:nI,mustExec:Ug,type:tI=NaN,overwriteIfSameType:mI=!1,keepUndo:VI=!1}){if(Ug&&qg(),aI(this,pg))return;const oI={cmd:qg,undo:nI,type:tI};if(aI(this,Gg)===-1){aI(this,wg).length>0&&(aI(this,wg).length=0),EI(this,Gg,0),aI(this,wg).push(oI);return}if(mI&&aI(this,wg)[aI(this,Gg)].type===tI){VI&&(oI.undo=aI(this,wg)[aI(this,Gg)].undo),aI(this,wg)[aI(this,Gg)]=oI;return}const Eg=aI(this,Gg)+1;Eg===aI(this,fg)?aI(this,wg).splice(0,1):(EI(this,Gg,Eg),Eg<aI(this,wg).length&&aI(this,wg).splice(Eg)),aI(this,wg).push(oI)}undo(){aI(this,Gg)!==-1&&(EI(this,pg,!0),aI(this,wg)[aI(this,Gg)].undo(),EI(this,pg,!1),EI(this,Gg,aI(this,Gg)-1))}redo(){aI(this,Gg)<aI(this,wg).length-1&&(EI(this,Gg,aI(this,Gg)+1),EI(this,pg,!0),aI(this,wg)[aI(this,Gg)].cmd(),EI(this,pg,!1))}hasSomethingToUndo(){return aI(this,Gg)!==-1}hasSomethingToRedo(){return aI(this,Gg)<aI(this,wg).length-1}destroy(){EI(this,wg,null)}}wg=new WeakMap,pg=new WeakMap,fg=new WeakMap,Gg=new WeakMap,eg.CommandManager=Cg;class lg{constructor(qg){JI(this,yg);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:nI}=ig.FeatureTest.platform;for(const[Ug,tI,mI={}]of qg)for(const VI of Ug){const oI=VI.startsWith("mac+");nI&&oI?(this.callbacks.set(VI.slice(4),{callback:tI,options:mI}),this.allKeys.add(VI.split("+").at(-1))):!nI&&!oI&&(this.callbacks.set(VI,{callback:tI,options:mI}),this.allKeys.add(VI.split("+").at(-1)))}}exec(qg,nI){if(!this.allKeys.has(nI.key))return;const Ug=this.callbacks.get(zI(this,yg,jb).call(this,nI));if(!Ug)return;const{callback:tI,options:{bubbles:mI=!1,args:VI=[],checker:oI=null}}=Ug;oI&&!oI(qg,nI)||(tI.bind(qg,...VI)(),mI||(nI.stopPropagation(),nI.preventDefault()))}}yg=new WeakSet,jb=function(qg){qg.altKey&&this.buffer.push("alt"),qg.ctrlKey&&this.buffer.push("ctrl"),qg.metaKey&&this.buffer.push("meta"),qg.shiftKey&&this.buffer.push("shift"),this.buffer.push(qg.key);const nI=this.buffer.join("+");return this.buffer.length=0,nI},eg.KeyboardManager=lg;const Wg=class Wg{get _colors(){const qg=new Map([["CanvasText",null],["Canvas",null]]);return(0,Ig.getColorValues)(qg),(0,ig.shadow)(this,"_colors",qg)}convert(qg){const nI=(0,Ig.getRGB)(qg);if(!window.matchMedia("(forced-colors: active)").matches)return nI;for(const[Ug,tI]of this._colors)if(tI.every((mI,VI)=>mI===nI[VI]))return Wg._colorsMapping.get(Ug);return nI}getHexCode(qg){const nI=this._colors.get(qg);return nI?ig.Util.makeHexColor(...nI):qg}};el(Wg,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Ag=Wg;eg.ColorManager=Ag;const GI=class GI{constructor(qg,nI,Ug,tI,mI,VI){JI(this,uI);JI(this,$g,null);JI(this,Ng,new Map);JI(this,Vg,new Map);JI(this,Rg,null);JI(this,vg,null);JI(this,Mg,new Cg);JI(this,kg,0);JI(this,Sg,new Set);JI(this,Yg,null);JI(this,Kg,null);JI(this,Tg,new Set);JI(this,xg,null);JI(this,Xg,new ag);JI(this,jg,!1);JI(this,zg,!1);JI(this,Qg,null);JI(this,_g,ig.AnnotationEditorType.NONE);JI(this,gI,new Set);JI(this,AI,null);JI(this,CI,this.blur.bind(this));JI(this,dI,this.focus.bind(this));JI(this,ZI,this.copy.bind(this));JI(this,Og,this.cut.bind(this));JI(this,Lg,this.paste.bind(this));JI(this,lI,this.keydown.bind(this));JI(this,iI,this.onEditingAction.bind(this));JI(this,eI,this.onPageChanging.bind(this));JI(this,Jg,this.onScaleChanging.bind(this));JI(this,Pg,this.onRotationChanging.bind(this));JI(this,cI,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1});JI(this,bI,[0,0]);JI(this,hI,null);JI(this,BI,null);JI(this,YI,null);EI(this,BI,qg),EI(this,YI,nI),EI(this,Rg,Ug),this._eventBus=tI,this._eventBus._on("editingaction",aI(this,iI)),this._eventBus._on("pagechanging",aI(this,eI)),this._eventBus._on("scalechanging",aI(this,Jg)),this._eventBus._on("rotationchanging",aI(this,Pg)),EI(this,vg,mI.annotationStorage),EI(this,xg,mI.filterFactory),EI(this,AI,VI),this.viewParameters={realScale:Ig.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}static get _keyboardManager(){const qg=GI.prototype,nI=mI=>{const{activeElement:VI}=document;return VI&&aI(mI,BI).contains(VI)&&mI.hasSomethingToControl()},Ug=this.TRANSLATE_SMALL,tI=this.TRANSLATE_BIG;return(0,ig.shadow)(this,"_keyboardManager",new lg([[["ctrl+a","mac+meta+a"],qg.selectAll],[["ctrl+z","mac+meta+z"],qg.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],qg.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],qg.delete],[["Escape","mac+Escape"],qg.unselectAll],[["ArrowLeft","mac+ArrowLeft"],qg.translateSelectedEditors,{args:[-Ug,0],checker:nI}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],qg.translateSelectedEditors,{args:[-tI,0],checker:nI}],[["ArrowRight","mac+ArrowRight"],qg.translateSelectedEditors,{args:[Ug,0],checker:nI}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],qg.translateSelectedEditors,{args:[tI,0],checker:nI}],[["ArrowUp","mac+ArrowUp"],qg.translateSelectedEditors,{args:[0,-Ug],checker:nI}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],qg.translateSelectedEditors,{args:[0,-tI],checker:nI}],[["ArrowDown","mac+ArrowDown"],qg.translateSelectedEditors,{args:[0,Ug],checker:nI}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],qg.translateSelectedEditors,{args:[0,tI],checker:nI}]]))}destroy(){zI(this,uI,Qd).call(this),zI(this,uI,pu).call(this),this._eventBus._off("editingaction",aI(this,iI)),this._eventBus._off("pagechanging",aI(this,eI)),this._eventBus._off("scalechanging",aI(this,Jg)),this._eventBus._off("rotationchanging",aI(this,Pg));for(const qg of aI(this,Vg).values())qg.destroy();aI(this,Vg).clear(),aI(this,Ng).clear(),aI(this,Tg).clear(),EI(this,$g,null),aI(this,gI).clear(),aI(this,Mg).destroy(),aI(this,Rg).destroy()}get hcmFilter(){return(0,ig.shadow)(this,"hcmFilter",aI(this,AI)?aI(this,xg).addHCMFilter(aI(this,AI).foreground,aI(this,AI).background):"none")}get direction(){return(0,ig.shadow)(this,"direction",getComputedStyle(aI(this,BI)).direction)}editAltText(qg){var nI;(nI=aI(this,Rg))==null||nI.editAltText(this,qg)}onPageChanging({pageNumber:qg}){EI(this,kg,qg-1)}focusMainContainer(){aI(this,BI).focus()}findParent(qg,nI){for(const Ug of aI(this,Vg).values()){const{x:tI,y:mI,width:VI,height:oI}=Ug.div.getBoundingClientRect();if(qg>=tI&&qg<=tI+VI&&nI>=mI&&nI<=mI+oI)return Ug}return null}disableUserSelect(qg=!1){aI(this,YI).classList.toggle("noUserSelect",qg)}addShouldRescale(qg){aI(this,Tg).add(qg)}removeShouldRescale(qg){aI(this,Tg).delete(qg)}onScaleChanging({scale:qg}){this.commitOrRemove(),this.viewParameters.realScale=qg*Ig.PixelsPerInch.PDF_TO_CSS_UNITS;for(const nI of aI(this,Tg))nI.onScaleChanging()}onRotationChanging({pagesRotation:qg}){this.commitOrRemove(),this.viewParameters.rotation=qg}addToAnnotationStorage(qg){!qg.isEmpty()&&aI(this,vg)&&!aI(this,vg).has(qg.id)&&aI(this,vg).setValue(qg.id,qg)}blur(){if(!this.hasSelection)return;const{activeElement:qg}=document;for(const nI of aI(this,gI))if(nI.div.contains(qg)){EI(this,Qg,[nI,qg]),nI._focusEventsAllowed=!1;break}}focus(){if(!aI(this,Qg))return;const[qg,nI]=aI(this,Qg);EI(this,Qg,null),nI.addEventListener("focusin",()=>{qg._focusEventsAllowed=!0},{once:!0}),nI.focus()}addEditListeners(){zI(this,uI,Zu).call(this),zI(this,uI,wu).call(this)}removeEditListeners(){zI(this,uI,Qd).call(this),zI(this,uI,Gu).call(this)}copy(qg){var Ug;if(qg.preventDefault(),(Ug=aI(this,$g))==null||Ug.commitOrRemove(),!this.hasSelection)return;const nI=[];for(const tI of aI(this,gI)){const mI=tI.serialize(!0);mI&&nI.push(mI)}nI.length!==0&&qg.clipboardData.setData("application/pdfjs",JSON.stringify(nI))}cut(qg){this.copy(qg),this.delete()}paste(qg){qg.preventDefault();const{clipboardData:nI}=qg;for(const mI of nI.items)for(const VI of aI(this,Kg))if(VI.isHandlingMimeForPasting(mI.type)){VI.paste(mI,this.currentLayer);return}let Ug=nI.getData("application/pdfjs");if(!Ug)return;try{Ug=JSON.parse(Ug)}catch(mI){(0,ig.warn)(`paste: "${mI.message}".`);return}if(!Array.isArray(Ug))return;this.unselectAll();const tI=this.currentLayer;try{const mI=[];for(const Eg of Ug){const pI=tI.deserialize(Eg);if(!pI)return;mI.push(pI)}const VI=()=>{for(const Eg of mI)zI(this,uI,fu).call(this,Eg);zI(this,uI,yu).call(this,mI)},oI=()=>{for(const Eg of mI)Eg.remove()};this.addCommands({cmd:VI,undo:oI,mustExec:!0})}catch(mI){(0,ig.warn)(`paste: "${mI.message}".`)}}keydown(qg){var nI;(nI=this.getActive())!=null&&nI.shouldGetKeyboardEvents()||GI._keyboardManager.exec(this,qg)}onEditingAction(qg){["undo","redo","delete","selectAll"].includes(qg.name)&&this[qg.name]()}setEditingState(qg){qg?(zI(this,uI,xb).call(this),zI(this,uI,Zu).call(this),zI(this,uI,wu).call(this),zI(this,uI,uc).call(this,{isEditing:aI(this,_g)!==ig.AnnotationEditorType.NONE,isEmpty:zI(this,uI,Vd).call(this),hasSomethingToUndo:aI(this,Mg).hasSomethingToUndo(),hasSomethingToRedo:aI(this,Mg).hasSomethingToRedo(),hasSelectedEditor:!1})):(zI(this,uI,pu).call(this),zI(this,uI,Qd).call(this),zI(this,uI,Gu).call(this),zI(this,uI,uc).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(qg){if(!aI(this,Kg)){EI(this,Kg,qg);for(const nI of aI(this,Kg))zI(this,uI,Nd).call(this,nI.defaultPropertiesToUpdate)}}getId(){return aI(this,Xg).getId()}get currentLayer(){return aI(this,Vg).get(aI(this,kg))}getLayer(qg){return aI(this,Vg).get(qg)}get currentPageIndex(){return aI(this,kg)}addLayer(qg){aI(this,Vg).set(qg.pageIndex,qg),aI(this,jg)?qg.enable():qg.disable()}removeLayer(qg){aI(this,Vg).delete(qg.pageIndex)}updateMode(qg,nI=null){if(aI(this,_g)!==qg){if(EI(this,_g,qg),qg===ig.AnnotationEditorType.NONE){this.setEditingState(!1),zI(this,uI,Kb).call(this);return}this.setEditingState(!0),zI(this,uI,Fb).call(this),this.unselectAll();for(const Ug of aI(this,Vg).values())Ug.updateMode(qg);if(nI){for(const Ug of aI(this,Ng).values())if(Ug.annotationElementId===nI){this.setSelected(Ug),Ug.enterInEditMode();break}}}}updateToolbar(qg){qg!==aI(this,_g)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:qg})}updateParams(qg,nI){if(aI(this,Kg)){if(qg===ig.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(qg);return}for(const Ug of aI(this,gI))Ug.updateParams(qg,nI);for(const Ug of aI(this,Kg))Ug.updateDefaultParams(qg,nI)}}enableWaiting(qg=!1){if(aI(this,zg)!==qg){EI(this,zg,qg);for(const nI of aI(this,Vg).values())qg?nI.disableClick():nI.enableClick(),nI.div.classList.toggle("waiting",qg)}}getEditors(qg){const nI=[];for(const Ug of aI(this,Ng).values())Ug.pageIndex===qg&&nI.push(Ug);return nI}getEditor(qg){return aI(this,Ng).get(qg)}addEditor(qg){aI(this,Ng).set(qg.id,qg)}removeEditor(qg){var nI;aI(this,Ng).delete(qg.id),this.unselect(qg),(!qg.annotationElementId||!aI(this,Sg).has(qg.annotationElementId))&&((nI=aI(this,vg))==null||nI.remove(qg.id))}addDeletedAnnotationElement(qg){aI(this,Sg).add(qg.annotationElementId),qg.deleted=!0}isDeletedAnnotationElement(qg){return aI(this,Sg).has(qg)}removeDeletedAnnotationElement(qg){aI(this,Sg).delete(qg.annotationElementId),qg.deleted=!1}setActiveEditor(qg){aI(this,$g)!==qg&&(EI(this,$g,qg),qg&&zI(this,uI,Nd).call(this,qg.propertiesToUpdate))}toggleSelected(qg){if(aI(this,gI).has(qg)){aI(this,gI).delete(qg),qg.unselect(),zI(this,uI,uc).call(this,{hasSelectedEditor:this.hasSelection});return}aI(this,gI).add(qg),qg.select(),zI(this,uI,Nd).call(this,qg.propertiesToUpdate),zI(this,uI,uc).call(this,{hasSelectedEditor:!0})}setSelected(qg){for(const nI of aI(this,gI))nI!==qg&&nI.unselect();aI(this,gI).clear(),aI(this,gI).add(qg),qg.select(),zI(this,uI,Nd).call(this,qg.propertiesToUpdate),zI(this,uI,uc).call(this,{hasSelectedEditor:!0})}isSelected(qg){return aI(this,gI).has(qg)}unselect(qg){qg.unselect(),aI(this,gI).delete(qg),zI(this,uI,uc).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return aI(this,gI).size!==0}undo(){aI(this,Mg).undo(),zI(this,uI,uc).call(this,{hasSomethingToUndo:aI(this,Mg).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:zI(this,uI,Vd).call(this)})}redo(){aI(this,Mg).redo(),zI(this,uI,uc).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:aI(this,Mg).hasSomethingToRedo(),isEmpty:zI(this,uI,Vd).call(this)})}addCommands(qg){aI(this,Mg).add(qg),zI(this,uI,uc).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:zI(this,uI,Vd).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const qg=[...aI(this,gI)],nI=()=>{for(const tI of qg)tI.remove()},Ug=()=>{for(const tI of qg)zI(this,uI,fu).call(this,tI)};this.addCommands({cmd:nI,undo:Ug,mustExec:!0})}commitOrRemove(){var qg;(qg=aI(this,$g))==null||qg.commitOrRemove()}hasSomethingToControl(){return aI(this,$g)||this.hasSelection}selectAll(){for(const qg of aI(this,gI))qg.commit();zI(this,uI,yu).call(this,aI(this,Ng).values())}unselectAll(){if(aI(this,$g)){aI(this,$g).commitOrRemove();return}if(this.hasSelection){for(const qg of aI(this,gI))qg.unselect();aI(this,gI).clear(),zI(this,uI,uc).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(qg,nI,Ug=!1){if(Ug||this.commitOrRemove(),!this.hasSelection)return;aI(this,bI)[0]+=qg,aI(this,bI)[1]+=nI;const[tI,mI]=aI(this,bI),VI=[...aI(this,gI)],oI=1e3;aI(this,hI)&&clearTimeout(aI(this,hI)),EI(this,hI,setTimeout(()=>{EI(this,hI,null),aI(this,bI)[0]=aI(this,bI)[1]=0,this.addCommands({cmd:()=>{for(const Eg of VI)aI(this,Ng).has(Eg.id)&&Eg.translateInPage(tI,mI)},undo:()=>{for(const Eg of VI)aI(this,Ng).has(Eg.id)&&Eg.translateInPage(-tI,-mI)},mustExec:!1})},oI));for(const Eg of VI)Eg.translateInPage(qg,nI)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),EI(this,Yg,new Map);for(const qg of aI(this,gI))aI(this,Yg).set(qg,{savedX:qg.x,savedY:qg.y,savedPageIndex:qg.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!aI(this,Yg))return!1;this.disableUserSelect(!1);const qg=aI(this,Yg);EI(this,Yg,null);let nI=!1;for(const[{x:tI,y:mI,pageIndex:VI},oI]of qg)oI.newX=tI,oI.newY=mI,oI.newPageIndex=VI,nI||(nI=tI!==oI.savedX||mI!==oI.savedY||VI!==oI.savedPageIndex);if(!nI)return!1;const Ug=(tI,mI,VI,oI)=>{if(aI(this,Ng).has(tI.id)){const Eg=aI(this,Vg).get(oI);Eg?tI._setParentAndPosition(Eg,mI,VI):(tI.pageIndex=oI,tI.x=mI,tI.y=VI)}};return this.addCommands({cmd:()=>{for(const[tI,{newX:mI,newY:VI,newPageIndex:oI}]of qg)Ug(tI,mI,VI,oI)},undo:()=>{for(const[tI,{savedX:mI,savedY:VI,savedPageIndex:oI}]of qg)Ug(tI,mI,VI,oI)},mustExec:!0}),!0}dragSelectedEditors(qg,nI){if(aI(this,Yg))for(const Ug of aI(this,Yg).keys())Ug.drag(qg,nI)}rebuild(qg){if(qg.parent===null){const nI=this.getLayer(qg.pageIndex);nI?(nI.changeParent(qg),nI.addOrRebuild(qg)):(this.addEditor(qg),this.addToAnnotationStorage(qg),qg.rebuild())}else qg.parent.addOrRebuild(qg)}isActive(qg){return aI(this,$g)===qg}getActive(){return aI(this,$g)}getMode(){return aI(this,_g)}get imageManager(){return(0,ig.shadow)(this,"imageManager",new sg)}};$g=new WeakMap,Ng=new WeakMap,Vg=new WeakMap,Rg=new WeakMap,vg=new WeakMap,Mg=new WeakMap,kg=new WeakMap,Sg=new WeakMap,Yg=new WeakMap,Kg=new WeakMap,Tg=new WeakMap,xg=new WeakMap,Xg=new WeakMap,jg=new WeakMap,zg=new WeakMap,Qg=new WeakMap,_g=new WeakMap,gI=new WeakMap,AI=new WeakMap,CI=new WeakMap,dI=new WeakMap,ZI=new WeakMap,Og=new WeakMap,Lg=new WeakMap,lI=new WeakMap,iI=new WeakMap,eI=new WeakMap,Jg=new WeakMap,Pg=new WeakMap,cI=new WeakMap,bI=new WeakMap,hI=new WeakMap,BI=new WeakMap,YI=new WeakMap,uI=new WeakSet,xb=function(){window.addEventListener("focus",aI(this,dI)),window.addEventListener("blur",aI(this,CI))},pu=function(){window.removeEventListener("focus",aI(this,dI)),window.removeEventListener("blur",aI(this,CI))},Zu=function(){window.addEventListener("keydown",aI(this,lI),{capture:!0})},Qd=function(){window.removeEventListener("keydown",aI(this,lI),{capture:!0})},wu=function(){document.addEventListener("copy",aI(this,ZI)),document.addEventListener("cut",aI(this,Og)),document.addEventListener("paste",aI(this,Lg))},Gu=function(){document.removeEventListener("copy",aI(this,ZI)),document.removeEventListener("cut",aI(this,Og)),document.removeEventListener("paste",aI(this,Lg))},uc=function(qg){Object.entries(qg).some(([Ug,tI])=>aI(this,cI)[Ug]!==tI)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(aI(this,cI),qg)})},Nd=function(qg){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:qg})},Fb=function(){if(!aI(this,jg)){EI(this,jg,!0);for(const qg of aI(this,Vg).values())qg.enable()}},Kb=function(){if(this.unselectAll(),aI(this,jg)){EI(this,jg,!1);for(const qg of aI(this,Vg).values())qg.disable()}},fu=function(qg){const nI=aI(this,Vg).get(qg.pageIndex);nI?nI.addOrRebuild(qg):this.addEditor(qg)},Vd=function(){if(aI(this,Ng).size===0)return!0;if(aI(this,Ng).size===1)for(const qg of aI(this,Ng).values())return qg.isEmpty();return!1},yu=function(qg){aI(this,gI).clear();for(const nI of qg)nI.isEmpty()||(aI(this,gI).add(nI),nI.select());zI(this,uI,uc).call(this,{hasSelectedEditor:!0})},el(GI,"TRANSLATE_SMALL",1),el(GI,"TRANSLATE_BIG",10);let cg=GI;eg.AnnotationEditorUIManager=cg}),((tg,eg,gg)=>{var kg,Sg,Yg,Kg,Tg,xg,Xg,jg,zg,Qg,_g,gI,ld,Cd,Bu,_d,Ud,vd,Yd;Object.defineProperty(eg,"__esModule",{value:!0}),eg.StatTimer=eg.RenderingCancelledException=eg.PixelsPerInch=eg.PageViewport=eg.PDFDateString=eg.DOMStandardFontDataFactory=eg.DOMSVGFactory=eg.DOMFilterFactory=eg.DOMCanvasFactory=eg.DOMCMapReaderFactory=void 0,eg.deprecated=Gg,eg.getColorValues=Ng,eg.getCurrentTransform=Vg,eg.getCurrentTransformInverse=Rg,eg.getFilenameFromUrl=mg,eg.getPdfFilenameFromUrl=hg,eg.getRGB=$g,eg.getXfaPageViewport=Wg,eg.isDataScheme=dg,eg.isPdfFile=bg,eg.isValidFetchUrl=wg,eg.loadScript=fg,eg.noContextMenu=pg,eg.setLayerDimensions=vg;var ig=gg(7),Ig=gg(1);const ng="http://www.w3.org/2000/svg",Mg=class Mg{};el(Mg,"CSS",96),el(Mg,"PDF",72),el(Mg,"PDF_TO_CSS_UNITS",Mg.CSS/Mg.PDF);let og=Mg;eg.PixelsPerInch=og;class ag extends ig.BaseFilterFactory{constructor({docId:Jg,ownerDocument:Pg=globalThis.document}={}){super();JI(this,gI);JI(this,kg);JI(this,Sg);JI(this,Yg);JI(this,Kg);JI(this,Tg);JI(this,xg);JI(this,Xg);JI(this,jg);JI(this,zg);JI(this,Qg);JI(this,_g,0);EI(this,Yg,Jg),EI(this,Kg,Pg)}addFilter(Jg){if(!Jg)return"none";let Pg=aI(this,gI,ld).get(Jg);if(Pg)return Pg;let cI,bI,hI,BI;if(Jg.length===1){const WI=Jg[0],MI=new Array(256);for(let jI=0;jI<256;jI++)MI[jI]=WI[jI]/255;BI=cI=bI=hI=MI.join(",")}else{const[WI,MI,jI]=Jg,HI=new Array(256),II=new Array(256),wI=new Array(256);for(let $I=0;$I<256;$I++)HI[$I]=WI[$I]/255,II[$I]=MI[$I]/255,wI[$I]=jI[$I]/255;cI=HI.join(","),bI=II.join(","),hI=wI.join(","),BI=`${cI}${bI}${hI}`}if(Pg=aI(this,gI,ld).get(BI),Pg)return aI(this,gI,ld).set(Jg,Pg),Pg;const YI=`g_${aI(this,Yg)}_transfer_map_${Wd(this,_g)._++}`,uI=`url(#${YI})`;aI(this,gI,ld).set(Jg,uI),aI(this,gI,ld).set(BI,uI);const fI=zI(this,gI,_d).call(this,YI);return zI(this,gI,vd).call(this,cI,bI,hI,fI),uI}addHCMFilter(Jg,Pg){var MI;const cI=`${Jg}-${Pg}`;if(aI(this,xg)===cI)return aI(this,Xg);if(EI(this,xg,cI),EI(this,Xg,"none"),(MI=aI(this,Tg))==null||MI.remove(),!Jg||!Pg)return aI(this,Xg);const bI=zI(this,gI,Yd).call(this,Jg);Jg=Ig.Util.makeHexColor(...bI);const hI=zI(this,gI,Yd).call(this,Pg);if(Pg=Ig.Util.makeHexColor(...hI),aI(this,gI,Cd).style.color="",Jg==="#000000"&&Pg==="#ffffff"||Jg===Pg)return aI(this,Xg);const BI=new Array(256);for(let jI=0;jI<=255;jI++){const HI=jI/255;BI[jI]=HI<=.03928?HI/12.92:((HI+.055)/1.055)**2.4}const YI=BI.join(","),uI=`g_${aI(this,Yg)}_hcm_filter`,fI=EI(this,jg,zI(this,gI,_d).call(this,uI));zI(this,gI,vd).call(this,YI,YI,YI,fI),zI(this,gI,Bu).call(this,fI);const WI=(jI,HI)=>{const II=bI[jI]/255,wI=hI[jI]/255,$I=new Array(HI+1);for(let kI=0;kI<=HI;kI++)$I[kI]=II+kI/HI*(wI-II);return $I.join(",")};return zI(this,gI,vd).call(this,WI(0,5),WI(1,5),WI(2,5),fI),EI(this,Xg,`url(#${uI})`),aI(this,Xg)}addHighlightHCMFilter(Jg,Pg,cI,bI){var wI;const hI=`${Jg}-${Pg}-${cI}-${bI}`;if(aI(this,zg)===hI)return aI(this,Qg);if(EI(this,zg,hI),EI(this,Qg,"none"),(wI=aI(this,jg))==null||wI.remove(),!Jg||!Pg)return aI(this,Qg);const[BI,YI]=[Jg,Pg].map(zI(this,gI,Yd).bind(this));let uI=Math.round(.2126*BI[0]+.7152*BI[1]+.0722*BI[2]),fI=Math.round(.2126*YI[0]+.7152*YI[1]+.0722*YI[2]),[WI,MI]=[cI,bI].map(zI(this,gI,Yd).bind(this));fI<uI&&([uI,fI,WI,MI]=[fI,uI,MI,WI]),aI(this,gI,Cd).style.color="";const jI=($I,kI,rI)=>{const Fg=new Array(256),Dg=(fI-uI)/rI,sI=$I/255,GI=(kI-$I)/(255*rI);let Hg=0;for(let qg=0;qg<=rI;qg++){const nI=Math.round(uI+qg*Dg),Ug=sI+qg*GI;for(let tI=Hg;tI<=nI;tI++)Fg[tI]=Ug;Hg=nI+1}for(let qg=Hg;qg<256;qg++)Fg[qg]=Fg[Hg-1];return Fg.join(",")},HI=`g_${aI(this,Yg)}_hcm_highlight_filter`,II=EI(this,jg,zI(this,gI,_d).call(this,HI));return zI(this,gI,Bu).call(this,II),zI(this,gI,vd).call(this,jI(WI[0],MI[0],5),jI(WI[1],MI[1],5),jI(WI[2],MI[2],5),II),EI(this,Qg,`url(#${HI})`),aI(this,Qg)}destroy(Jg=!1){Jg&&(aI(this,Xg)||aI(this,Qg))||(aI(this,Sg)&&(aI(this,Sg).parentNode.parentNode.remove(),EI(this,Sg,null)),aI(this,kg)&&(aI(this,kg).clear(),EI(this,kg,null)),EI(this,_g,0))}}kg=new WeakMap,Sg=new WeakMap,Yg=new WeakMap,Kg=new WeakMap,Tg=new WeakMap,xg=new WeakMap,Xg=new WeakMap,jg=new WeakMap,zg=new WeakMap,Qg=new WeakMap,_g=new WeakMap,gI=new WeakSet,ld=function(){return aI(this,kg)||EI(this,kg,new Map)},Cd=function(){if(!aI(this,Sg)){const Jg=aI(this,Kg).createElement("div"),{style:Pg}=Jg;Pg.visibility="hidden",Pg.contain="strict",Pg.width=Pg.height=0,Pg.position="absolute",Pg.top=Pg.left=0,Pg.zIndex=-1;const cI=aI(this,Kg).createElementNS(ng,"svg");cI.setAttribute("width",0),cI.setAttribute("height",0),EI(this,Sg,aI(this,Kg).createElementNS(ng,"defs")),Jg.append(cI),cI.append(aI(this,Sg)),aI(this,Kg).body.append(Jg)}return aI(this,Sg)},Bu=function(Jg){const Pg=aI(this,Kg).createElementNS(ng,"feColorMatrix");Pg.setAttribute("type","matrix"),Pg.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"),Jg.append(Pg)},_d=function(Jg){const Pg=aI(this,Kg).createElementNS(ng,"filter");return Pg.setAttribute("color-interpolation-filters","sRGB"),Pg.setAttribute("id",Jg),aI(this,gI,Cd).append(Pg),Pg},Ud=function(Jg,Pg,cI){const bI=aI(this,Kg).createElementNS(ng,Pg);bI.setAttribute("type","discrete"),bI.setAttribute("tableValues",cI),Jg.append(bI)},vd=function(Jg,Pg,cI,bI){const hI=aI(this,Kg).createElementNS(ng,"feComponentTransfer");bI.append(hI),zI(this,gI,Ud).call(this,hI,"feFuncR",Jg),zI(this,gI,Ud).call(this,hI,"feFuncG",Pg),zI(this,gI,Ud).call(this,hI,"feFuncB",cI)},Yd=function(Jg){return aI(this,gI,Cd).style.color=Jg,$g(getComputedStyle(aI(this,gI,Cd)).getPropertyValue("color"))},eg.DOMFilterFactory=ag;class sg extends ig.BaseCanvasFactory{constructor({ownerDocument:eI=globalThis.document}={}){super(),this._document=eI}_createCanvas(eI,Jg){const Pg=this._document.createElement("canvas");return Pg.width=eI,Pg.height=Jg,Pg}}eg.DOMCanvasFactory=sg;async function Cg(iI,eI=!1){if(wg(iI,document.baseURI)){const Jg=await fetch(iI);if(!Jg.ok)throw new Error(Jg.statusText);return eI?new Uint8Array(await Jg.arrayBuffer()):(0,Ig.stringToBytes)(await Jg.text())}return new Promise((Jg,Pg)=>{const cI=new XMLHttpRequest;cI.open("GET",iI,!0),eI&&(cI.responseType="arraybuffer"),cI.onreadystatechange=()=>{if(cI.readyState===XMLHttpRequest.DONE){if(cI.status===200||cI.status===0){let bI;if(eI&&cI.response?bI=new Uint8Array(cI.response):!eI&&cI.responseText&&(bI=(0,Ig.stringToBytes)(cI.responseText)),bI){Jg(bI);return}}Pg(new Error(cI.statusText))}},cI.send(null)})}class lg extends ig.BaseCMapReaderFactory{_fetchData(eI,Jg){return Cg(eI,this.isCompressed).then(Pg=>({cMapData:Pg,compressionType:Jg}))}}eg.DOMCMapReaderFactory=lg;class Ag extends ig.BaseStandardFontDataFactory{_fetchData(eI){return Cg(eI,!0)}}eg.DOMStandardFontDataFactory=Ag;class cg extends ig.BaseSVGFactory{_createSVG(eI){return document.createElementNS(ng,eI)}}eg.DOMSVGFactory=cg;class rg{constructor({viewBox:eI,scale:Jg,rotation:Pg,offsetX:cI=0,offsetY:bI=0,dontFlip:hI=!1}){this.viewBox=eI,this.scale=Jg,this.rotation=Pg,this.offsetX=cI,this.offsetY=bI;const BI=(eI[2]+eI[0])/2,YI=(eI[3]+eI[1])/2;let uI,fI,WI,MI;switch(Pg%=360,Pg<0&&(Pg+=360),Pg){case 180:uI=-1,fI=0,WI=0,MI=1;break;case 90:uI=0,fI=1,WI=1,MI=0;break;case 270:uI=0,fI=-1,WI=-1,MI=0;break;case 0:uI=1,fI=0,WI=0,MI=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}hI&&(WI=-WI,MI=-MI);let jI,HI,II,wI;uI===0?(jI=Math.abs(YI-eI[1])*Jg+cI,HI=Math.abs(BI-eI[0])*Jg+bI,II=(eI[3]-eI[1])*Jg,wI=(eI[2]-eI[0])*Jg):(jI=Math.abs(BI-eI[0])*Jg+cI,HI=Math.abs(YI-eI[1])*Jg+bI,II=(eI[2]-eI[0])*Jg,wI=(eI[3]-eI[1])*Jg),this.transform=[uI*Jg,fI*Jg,WI*Jg,MI*Jg,jI-uI*Jg*BI-WI*Jg*YI,HI-fI*Jg*BI-MI*Jg*YI],this.width=II,this.height=wI}get rawDims(){const{viewBox:eI}=this;return(0,Ig.shadow)(this,"rawDims",{pageWidth:eI[2]-eI[0],pageHeight:eI[3]-eI[1],pageX:eI[0],pageY:eI[1]})}clone({scale:eI=this.scale,rotation:Jg=this.rotation,offsetX:Pg=this.offsetX,offsetY:cI=this.offsetY,dontFlip:bI=!1}={}){return new rg({viewBox:this.viewBox.slice(),scale:eI,rotation:Jg,offsetX:Pg,offsetY:cI,dontFlip:bI})}convertToViewportPoint(eI,Jg){return Ig.Util.applyTransform([eI,Jg],this.transform)}convertToViewportRectangle(eI){const Jg=Ig.Util.applyTransform([eI[0],eI[1]],this.transform),Pg=Ig.Util.applyTransform([eI[2],eI[3]],this.transform);return[Jg[0],Jg[1],Pg[0],Pg[1]]}convertToPdfPoint(eI,Jg){return Ig.Util.applyInverseTransform([eI,Jg],this.transform)}}eg.PageViewport=rg;class ug extends Ig.BaseException{constructor(eI,Jg=0){super(eI,"RenderingCancelledException"),this.extraDelay=Jg}}eg.RenderingCancelledException=ug;function dg(iI){const eI=iI.length;let Jg=0;for(;Jg<eI&&iI[Jg].trim()==="";)Jg++;return iI.substring(Jg,Jg+5).toLowerCase()==="data:"}function bg(iI){return typeof iI=="string"&&/\.pdf$/i.test(iI)}function mg(iI,eI=!1){return eI||([iI]=iI.split(/[#?]/,1)),iI.substring(iI.lastIndexOf("/")+1)}function hg(iI,eI="document.pdf"){if(typeof iI!="string")return eI;if(dg(iI))return(0,Ig.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),eI;const Jg=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,Pg=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,cI=Jg.exec(iI);let bI=Pg.exec(cI[1])||Pg.exec(cI[2])||Pg.exec(cI[3]);if(bI&&(bI=bI[0],bI.includes("%")))try{bI=Pg.exec(decodeURIComponent(bI))[0]}catch{}return bI||eI}class Zg{constructor(){el(this,"started",Object.create(null));el(this,"times",[])}time(eI){eI in this.started&&(0,Ig.warn)(`Timer is already running for ${eI}`),this.started[eI]=Date.now()}timeEnd(eI){eI in this.started||(0,Ig.warn)(`Timer has not been started for ${eI}`),this.times.push({name:eI,start:this.started[eI],end:Date.now()}),delete this.started[eI]}toString(){const eI=[];let Jg=0;for(const{name:Pg}of this.times)Jg=Math.max(Pg.length,Jg);for(const{name:Pg,start:cI,end:bI}of this.times)eI.push(`${Pg.padEnd(Jg)} ${bI-cI}ms
|
|
937
937
|
`);return eI.join("")}}eg.StatTimer=Zg;function wg(iI,eI){try{const{protocol:Jg}=eI?new URL(iI,eI):new URL(iI);return Jg==="http:"||Jg==="https:"}catch{return!1}}function pg(iI){iI.preventDefault()}function fg(iI,eI=!1){return new Promise((Jg,Pg)=>{const cI=document.createElement("script");cI.src=iI,cI.onload=function(bI){eI&&cI.remove(),Jg(bI)},cI.onerror=function(){Pg(new Error(`Cannot load script at: ${cI.src}`))},(document.head||document.documentElement).append(cI)})}function Gg(iI){console.log("Deprecated API usage: "+iI)}let yg;class Bg{static toDateObject(eI){if(!eI||typeof eI!="string")return null;yg||(yg=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const Jg=yg.exec(eI);if(!Jg)return null;const Pg=parseInt(Jg[1],10);let cI=parseInt(Jg[2],10);cI=cI>=1&&cI<=12?cI-1:0;let bI=parseInt(Jg[3],10);bI=bI>=1&&bI<=31?bI:1;let hI=parseInt(Jg[4],10);hI=hI>=0&&hI<=23?hI:0;let BI=parseInt(Jg[5],10);BI=BI>=0&&BI<=59?BI:0;let YI=parseInt(Jg[6],10);YI=YI>=0&&YI<=59?YI:0;const uI=Jg[7]||"Z";let fI=parseInt(Jg[8],10);fI=fI>=0&&fI<=23?fI:0;let WI=parseInt(Jg[9],10)||0;return WI=WI>=0&&WI<=59?WI:0,uI==="-"?(hI+=fI,BI+=WI):uI==="+"&&(hI-=fI,BI-=WI),new Date(Date.UTC(Pg,cI,bI,hI,BI,YI))}}eg.PDFDateString=Bg;function Wg(iI,{scale:eI=1,rotation:Jg=0}){const{width:Pg,height:cI}=iI.attributes.style,bI=[0,0,parseInt(Pg),parseInt(cI)];return new rg({viewBox:bI,scale:eI,rotation:Jg})}function $g(iI){if(iI.startsWith("#")){const eI=parseInt(iI.slice(1),16);return[(eI&16711680)>>16,(eI&65280)>>8,eI&255]}return iI.startsWith("rgb(")?iI.slice(4,-1).split(",").map(eI=>parseInt(eI)):iI.startsWith("rgba(")?iI.slice(5,-1).split(",").map(eI=>parseInt(eI)).slice(0,3):((0,Ig.warn)(`Not a valid color format: "${iI}"`),[0,0,0])}function Ng(iI){const eI=document.createElement("span");eI.style.visibility="hidden",document.body.append(eI);for(const Jg of iI.keys()){eI.style.color=Jg;const Pg=window.getComputedStyle(eI).color;iI.set(Jg,$g(Pg))}eI.remove()}function Vg(iI){const{a:eI,b:Jg,c:Pg,d:cI,e:bI,f:hI}=iI.getTransform();return[eI,Jg,Pg,cI,bI,hI]}function Rg(iI){const{a:eI,b:Jg,c:Pg,d:cI,e:bI,f:hI}=iI.getTransform().invertSelf();return[eI,Jg,Pg,cI,bI,hI]}function vg(iI,eI,Jg=!1,Pg=!0){if(eI instanceof rg){const{pageWidth:cI,pageHeight:bI}=eI.rawDims,{style:hI}=iI,BI=Ig.FeatureTest.isCSSRoundSupported,YI=`var(--scale-factor) * ${cI}px`,uI=`var(--scale-factor) * ${bI}px`,fI=BI?`round(${YI}, 1px)`:`calc(${YI})`,WI=BI?`round(${uI}, 1px)`:`calc(${uI})`;!Jg||eI.rotation%180===0?(hI.width=fI,hI.height=WI):(hI.width=WI,hI.height=fI)}Pg&&iI.setAttribute("data-main-rotation",eI.rotation)}}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.BaseStandardFontDataFactory=eg.BaseSVGFactory=eg.BaseFilterFactory=eg.BaseCanvasFactory=eg.BaseCMapReaderFactory=void 0;var ig=gg(1);class Ig{constructor(){this.constructor===Ig&&(0,ig.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(lg){return"none"}addHCMFilter(lg,Ag){return"none"}addHighlightHCMFilter(lg,Ag,cg,rg){return"none"}destroy(lg=!1){}}eg.BaseFilterFactory=Ig;class ng{constructor(){this.constructor===ng&&(0,ig.unreachable)("Cannot initialize BaseCanvasFactory.")}create(lg,Ag){if(lg<=0||Ag<=0)throw new Error("Invalid canvas size");const cg=this._createCanvas(lg,Ag);return{canvas:cg,context:cg.getContext("2d")}}reset(lg,Ag,cg){if(!lg.canvas)throw new Error("Canvas is not specified");if(Ag<=0||cg<=0)throw new Error("Invalid canvas size");lg.canvas.width=Ag,lg.canvas.height=cg}destroy(lg){if(!lg.canvas)throw new Error("Canvas is not specified");lg.canvas.width=0,lg.canvas.height=0,lg.canvas=null,lg.context=null}_createCanvas(lg,Ag){(0,ig.unreachable)("Abstract method `_createCanvas` called.")}}eg.BaseCanvasFactory=ng;class og{constructor({baseUrl:lg=null,isCompressed:Ag=!0}){this.constructor===og&&(0,ig.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=lg,this.isCompressed=Ag}async fetch({name:lg}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!lg)throw new Error("CMap name must be specified.");const Ag=this.baseUrl+lg+(this.isCompressed?".bcmap":""),cg=this.isCompressed?ig.CMapCompressionType.BINARY:ig.CMapCompressionType.NONE;return this._fetchData(Ag,cg).catch(rg=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${Ag}`)})}_fetchData(lg,Ag){(0,ig.unreachable)("Abstract method `_fetchData` called.")}}eg.BaseCMapReaderFactory=og;class ag{constructor({baseUrl:lg=null}){this.constructor===ag&&(0,ig.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=lg}async fetch({filename:lg}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!lg)throw new Error("Font filename must be specified.");const Ag=`${this.baseUrl}${lg}`;return this._fetchData(Ag).catch(cg=>{throw new Error(`Unable to load font data at: ${Ag}`)})}_fetchData(lg){(0,ig.unreachable)("Abstract method `_fetchData` called.")}}eg.BaseStandardFontDataFactory=ag;class sg{constructor(){this.constructor===sg&&(0,ig.unreachable)("Cannot initialize BaseSVGFactory.")}create(lg,Ag,cg=!1){if(lg<=0||Ag<=0)throw new Error("Invalid SVG dimensions");const rg=this._createSVG("svg:svg");return rg.setAttribute("version","1.1"),cg||(rg.setAttribute("width",`${lg}px`),rg.setAttribute("height",`${Ag}px`)),rg.setAttribute("preserveAspectRatio","none"),rg.setAttribute("viewBox",`0 0 ${lg} ${Ag}`),rg}createElement(lg){if(typeof lg!="string")throw new Error("Invalid SVG element type");return this._createSVG(lg)}_createSVG(lg){(0,ig.unreachable)("Abstract method `_createSVG` called.")}}eg.BaseSVGFactory=sg}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.MurmurHash3_64=void 0;var ig=gg(1);const Ig=3285377520,ng=4294901760,og=65535;class ag{constructor(Cg){this.h1=Cg?Cg&4294967295:Ig,this.h2=Cg?Cg&4294967295:Ig}update(Cg){let lg,Ag;if(typeof Cg=="string"){lg=new Uint8Array(Cg.length*2),Ag=0;for(let Gg=0,yg=Cg.length;Gg<yg;Gg++){const Bg=Cg.charCodeAt(Gg);Bg<=255?lg[Ag++]=Bg:(lg[Ag++]=Bg>>>8,lg[Ag++]=Bg&255)}}else if((0,ig.isArrayBuffer)(Cg))lg=Cg.slice(),Ag=lg.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const cg=Ag>>2,rg=Ag-cg*4,ug=new Uint32Array(lg.buffer,0,cg);let dg=0,bg=0,mg=this.h1,hg=this.h2;const Zg=3432918353,wg=461845907,pg=Zg&og,fg=wg&og;for(let Gg=0;Gg<cg;Gg++)Gg&1?(dg=ug[Gg],dg=dg*Zg&ng|dg*pg&og,dg=dg<<15|dg>>>17,dg=dg*wg&ng|dg*fg&og,mg^=dg,mg=mg<<13|mg>>>19,mg=mg*5+3864292196):(bg=ug[Gg],bg=bg*Zg&ng|bg*pg&og,bg=bg<<15|bg>>>17,bg=bg*wg&ng|bg*fg&og,hg^=bg,hg=hg<<13|hg>>>19,hg=hg*5+3864292196);switch(dg=0,rg){case 3:dg^=lg[cg*4+2]<<16;case 2:dg^=lg[cg*4+1]<<8;case 1:dg^=lg[cg*4],dg=dg*Zg&ng|dg*pg&og,dg=dg<<15|dg>>>17,dg=dg*wg&ng|dg*fg&og,cg&1?mg^=dg:hg^=dg}this.h1=mg,this.h2=hg}hexdigest(){let Cg=this.h1,lg=this.h2;return Cg^=lg>>>1,Cg=Cg*3981806797&ng|Cg*36045&og,lg=lg*4283543511&ng|((lg<<16|Cg>>>16)*2950163797&ng)>>>16,Cg^=lg>>>1,Cg=Cg*444984403&ng|Cg*60499&og,lg=lg*3301882366&ng|((lg<<16|Cg>>>16)*3120437893&ng)>>>16,Cg^=lg>>>1,(Cg>>>0).toString(16).padStart(8,"0")+(lg>>>0).toString(16).padStart(8,"0")}}eg.MurmurHash3_64=ag}),((tg,eg,gg)=>{var og;Object.defineProperty(eg,"__esModule",{value:!0}),eg.FontLoader=eg.FontFaceObject=void 0;var ig=gg(1);class Ig{constructor({ownerDocument:sg=globalThis.document,styleElement:Cg=null}){JI(this,og,new Set);this._document=sg,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(sg){this.nativeFontFaces.add(sg),this._document.fonts.add(sg)}removeNativeFontFace(sg){this.nativeFontFaces.delete(sg),this._document.fonts.delete(sg)}insertRule(sg){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const Cg=this.styleElement.sheet;Cg.insertRule(sg,Cg.cssRules.length)}clear(){for(const sg of this.nativeFontFaces)this._document.fonts.delete(sg);this.nativeFontFaces.clear(),aI(this,og).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(sg){if(!(!sg||aI(this,og).has(sg.loadedName))){if((0,ig.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:Cg,src:lg,style:Ag}=sg,cg=new FontFace(Cg,lg,Ag);this.addNativeFontFace(cg);try{await cg.load(),aI(this,og).add(Cg)}catch{(0,ig.warn)(`Cannot load system font: ${sg.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(cg)}return}(0,ig.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(sg){if(sg.attached||sg.missingFile&&!sg.systemFontInfo)return;if(sg.attached=!0,sg.systemFontInfo){await this.loadSystemFont(sg.systemFontInfo);return}if(this.isFontLoadingAPISupported){const lg=sg.createNativeFontFace();if(lg){this.addNativeFontFace(lg);try{await lg.loaded}catch(Ag){throw(0,ig.warn)(`Failed to load font '${lg.family}': '${Ag}'.`),sg.disableFontFace=!0,Ag}}return}const Cg=sg.createFontFaceRule();if(Cg){if(this.insertRule(Cg),this.isSyncFontLoadingSupported)return;await new Promise(lg=>{const Ag=this._queueLoadingCallback(lg);this._prepareFontLoadEvent(sg,Ag)})}}get isFontLoadingAPISupported(){var Cg;const sg=!!((Cg=this._document)!=null&&Cg.fonts);return(0,ig.shadow)(this,"isFontLoadingAPISupported",sg)}get isSyncFontLoadingSupported(){let sg=!1;return(ig.isNodeJS||typeof navigator<"u"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(sg=!0),(0,ig.shadow)(this,"isSyncFontLoadingSupported",sg)}_queueLoadingCallback(sg){function Cg(){for((0,ig.assert)(!Ag.done,"completeRequest() cannot be called twice."),Ag.done=!0;lg.length>0&&lg[0].done;){const cg=lg.shift();setTimeout(cg.callback,0)}}const{loadingRequests:lg}=this,Ag={done:!1,complete:Cg,callback:sg};return lg.push(Ag),Ag}get _loadTestFont(){const sg=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,ig.shadow)(this,"_loadTestFont",sg)}_prepareFontLoadEvent(sg,Cg){function lg($g,Ng){return $g.charCodeAt(Ng)<<24|$g.charCodeAt(Ng+1)<<16|$g.charCodeAt(Ng+2)<<8|$g.charCodeAt(Ng+3)&255}function Ag($g,Ng,Vg,Rg){const vg=$g.substring(0,Ng),Mg=$g.substring(Ng+Vg);return vg+Rg+Mg}let cg,rg;const ug=this._document.createElement("canvas");ug.width=1,ug.height=1;const dg=ug.getContext("2d");let bg=0;function mg($g,Ng){if(++bg>30){(0,ig.warn)("Load test font never loaded."),Ng();return}if(dg.font="30px "+$g,dg.fillText(".",0,20),dg.getImageData(0,0,1,1).data[3]>0){Ng();return}setTimeout(mg.bind(null,$g,Ng))}const hg=`lt${Date.now()}${this.loadTestFontId++}`;let Zg=this._loadTestFont;Zg=Ag(Zg,976,hg.length,hg);const pg=16,fg=1482184792;let Gg=lg(Zg,pg);for(cg=0,rg=hg.length-3;cg<rg;cg+=4)Gg=Gg-fg+lg(hg,cg)|0;cg<hg.length&&(Gg=Gg-fg+lg(hg+"XXX",cg)|0),Zg=Ag(Zg,pg,4,(0,ig.string32)(Gg));const yg=`url(data:font/opentype;base64,${btoa(Zg)});`,Bg=`@font-face {font-family:"${hg}";src:${yg}}`;this.insertRule(Bg);const Wg=this._document.createElement("div");Wg.style.visibility="hidden",Wg.style.width=Wg.style.height="10px",Wg.style.position="absolute",Wg.style.top=Wg.style.left="0px";for(const $g of[sg.loadedName,hg]){const Ng=this._document.createElement("span");Ng.textContent="Hi",Ng.style.fontFamily=$g,Wg.append(Ng)}this._document.body.append(Wg),mg(hg,()=>{Wg.remove(),Cg.complete()})}}og=new WeakMap,eg.FontLoader=Ig;class ng{constructor(sg,{isEvalSupported:Cg=!0,disableFontFace:lg=!1,ignoreErrors:Ag=!1,inspectFont:cg=null}){this.compiledGlyphs=Object.create(null);for(const rg in sg)this[rg]=sg[rg];this.isEvalSupported=Cg!==!1,this.disableFontFace=lg===!0,this.ignoreErrors=Ag===!0,this._inspectFont=cg}createNativeFontFace(){var Cg;if(!this.data||this.disableFontFace)return null;let sg;if(!this.cssFontInfo)sg=new FontFace(this.loadedName,this.data,{});else{const lg={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(lg.style=`oblique ${this.cssFontInfo.italicAngle}deg`),sg=new FontFace(this.cssFontInfo.fontFamily,this.data,lg)}return(Cg=this._inspectFont)==null||Cg.call(this,this),sg}createFontFaceRule(){var Ag;if(!this.data||this.disableFontFace)return null;const sg=(0,ig.bytesToString)(this.data),Cg=`url(data:${this.mimetype};base64,${btoa(sg)});`;let lg;if(!this.cssFontInfo)lg=`@font-face {font-family:"${this.loadedName}";src:${Cg}}`;else{let cg=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(cg+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),lg=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${cg}src:${Cg}}`}return(Ag=this._inspectFont)==null||Ag.call(this,this,Cg),lg}getPathGenerator(sg,Cg){if(this.compiledGlyphs[Cg]!==void 0)return this.compiledGlyphs[Cg];let lg;try{lg=sg.get(this.loadedName+"_path_"+Cg)}catch(Ag){if(!this.ignoreErrors)throw Ag;return(0,ig.warn)(`getPathGenerator - ignoring character: "${Ag}".`),this.compiledGlyphs[Cg]=function(cg,rg){}}if(this.isEvalSupported&&ig.FeatureTest.isEvalSupported){const Ag=[];for(const cg of lg){const rg=cg.args!==void 0?cg.args.join(","):"";Ag.push("c.",cg.cmd,"(",rg,`);
|
|
938
938
|
`)}return this.compiledGlyphs[Cg]=new Function("c","size",Ag.join(""))}return this.compiledGlyphs[Cg]=function(Ag,cg){for(const rg of lg)rg.cmd==="scale"&&(rg.args=[cg,-cg]),Ag[rg.cmd].apply(Ag,rg.args)}}}eg.FontFaceObject=ng}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.NodeStandardFontDataFactory=eg.NodeFilterFactory=eg.NodeCanvasFactory=eg.NodeCMapReaderFactory=void 0;var ig=gg(7);gg(1);const Ig=function(Cg){return new Promise((lg,Ag)=>{require$$5.readFile(Cg,(rg,ug)=>{if(rg||!ug){Ag(new Error(rg));return}lg(new Uint8Array(ug))})})};class ng extends ig.BaseFilterFactory{}eg.NodeFilterFactory=ng;class og extends ig.BaseCanvasFactory{_createCanvas(lg,Ag){return require$$5.createCanvas(lg,Ag)}}eg.NodeCanvasFactory=og;class ag extends ig.BaseCMapReaderFactory{_fetchData(lg,Ag){return Ig(lg).then(cg=>({cMapData:cg,compressionType:Ag}))}}eg.NodeCMapReaderFactory=ag;class sg extends ig.BaseStandardFontDataFactory{_fetchData(lg){return Ig(lg)}}eg.NodeStandardFontDataFactory=sg}),((tg,eg,gg)=>{var Sg,$u,Wu;Object.defineProperty(eg,"__esModule",{value:!0}),eg.CanvasGraphics=void 0;var ig=gg(1),Ig=gg(6),ng=gg(12),og=gg(13);const ag=16,sg=100,Cg=4096,lg=15,Ag=10,cg=1e3,rg=16;function ug(xg,Xg){if(xg._removeMirroring)throw new Error("Context is already forwarding operations.");xg.__originalSave=xg.save,xg.__originalRestore=xg.restore,xg.__originalRotate=xg.rotate,xg.__originalScale=xg.scale,xg.__originalTranslate=xg.translate,xg.__originalTransform=xg.transform,xg.__originalSetTransform=xg.setTransform,xg.__originalResetTransform=xg.resetTransform,xg.__originalClip=xg.clip,xg.__originalMoveTo=xg.moveTo,xg.__originalLineTo=xg.lineTo,xg.__originalBezierCurveTo=xg.bezierCurveTo,xg.__originalRect=xg.rect,xg.__originalClosePath=xg.closePath,xg.__originalBeginPath=xg.beginPath,xg._removeMirroring=()=>{xg.save=xg.__originalSave,xg.restore=xg.__originalRestore,xg.rotate=xg.__originalRotate,xg.scale=xg.__originalScale,xg.translate=xg.__originalTranslate,xg.transform=xg.__originalTransform,xg.setTransform=xg.__originalSetTransform,xg.resetTransform=xg.__originalResetTransform,xg.clip=xg.__originalClip,xg.moveTo=xg.__originalMoveTo,xg.lineTo=xg.__originalLineTo,xg.bezierCurveTo=xg.__originalBezierCurveTo,xg.rect=xg.__originalRect,xg.closePath=xg.__originalClosePath,xg.beginPath=xg.__originalBeginPath,delete xg._removeMirroring},xg.save=function(){Xg.save(),this.__originalSave()},xg.restore=function(){Xg.restore(),this.__originalRestore()},xg.translate=function(zg,Qg){Xg.translate(zg,Qg),this.__originalTranslate(zg,Qg)},xg.scale=function(zg,Qg){Xg.scale(zg,Qg),this.__originalScale(zg,Qg)},xg.transform=function(zg,Qg,_g,gI,AI,CI){Xg.transform(zg,Qg,_g,gI,AI,CI),this.__originalTransform(zg,Qg,_g,gI,AI,CI)},xg.setTransform=function(zg,Qg,_g,gI,AI,CI){Xg.setTransform(zg,Qg,_g,gI,AI,CI),this.__originalSetTransform(zg,Qg,_g,gI,AI,CI)},xg.resetTransform=function(){Xg.resetTransform(),this.__originalResetTransform()},xg.rotate=function(zg){Xg.rotate(zg),this.__originalRotate(zg)},xg.clip=function(zg){Xg.clip(zg),this.__originalClip(zg)},xg.moveTo=function(jg,zg){Xg.moveTo(jg,zg),this.__originalMoveTo(jg,zg)},xg.lineTo=function(jg,zg){Xg.lineTo(jg,zg),this.__originalLineTo(jg,zg)},xg.bezierCurveTo=function(jg,zg,Qg,_g,gI,AI){Xg.bezierCurveTo(jg,zg,Qg,_g,gI,AI),this.__originalBezierCurveTo(jg,zg,Qg,_g,gI,AI)},xg.rect=function(jg,zg,Qg,_g){Xg.rect(jg,zg,Qg,_g),this.__originalRect(jg,zg,Qg,_g)},xg.closePath=function(){Xg.closePath(),this.__originalClosePath()},xg.beginPath=function(){Xg.beginPath(),this.__originalBeginPath()}}class dg{constructor(Xg){this.canvasFactory=Xg,this.cache=Object.create(null)}getCanvas(Xg,jg,zg){let Qg;return this.cache[Xg]!==void 0?(Qg=this.cache[Xg],this.canvasFactory.reset(Qg,jg,zg)):(Qg=this.canvasFactory.create(jg,zg),this.cache[Xg]=Qg),Qg}delete(Xg){delete this.cache[Xg]}clear(){for(const Xg in this.cache){const jg=this.cache[Xg];this.canvasFactory.destroy(jg),delete this.cache[Xg]}}}function bg(xg,Xg,jg,zg,Qg,_g,gI,AI,CI,dI){const[ZI,Og,Lg,lI,iI,eI]=(0,Ig.getCurrentTransform)(xg);if(Og===0&&Lg===0){const cI=gI*ZI+iI,bI=Math.round(cI),hI=AI*lI+eI,BI=Math.round(hI),YI=(gI+CI)*ZI+iI,uI=Math.abs(Math.round(YI)-bI)||1,fI=(AI+dI)*lI+eI,WI=Math.abs(Math.round(fI)-BI)||1;return xg.setTransform(Math.sign(ZI),0,0,Math.sign(lI),bI,BI),xg.drawImage(Xg,jg,zg,Qg,_g,0,0,uI,WI),xg.setTransform(ZI,Og,Lg,lI,iI,eI),[uI,WI]}if(ZI===0&&lI===0){const cI=AI*Lg+iI,bI=Math.round(cI),hI=gI*Og+eI,BI=Math.round(hI),YI=(AI+dI)*Lg+iI,uI=Math.abs(Math.round(YI)-bI)||1,fI=(gI+CI)*Og+eI,WI=Math.abs(Math.round(fI)-BI)||1;return xg.setTransform(0,Math.sign(Og),Math.sign(Lg),0,bI,BI),xg.drawImage(Xg,jg,zg,Qg,_g,0,0,WI,uI),xg.setTransform(ZI,Og,Lg,lI,iI,eI),[WI,uI]}xg.drawImage(Xg,jg,zg,Qg,_g,gI,AI,CI,dI);const Jg=Math.hypot(ZI,Og),Pg=Math.hypot(Lg,lI);return[Jg*CI,Pg*dI]}function mg(xg){const{width:Xg,height:jg}=xg;if(Xg>cg||jg>cg)return null;const zg=1e3,Qg=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),_g=Xg+1;let gI=new Uint8Array(_g*(jg+1)),AI,CI,dI;const ZI=Xg+7&-8;let Og=new Uint8Array(ZI*jg),Lg=0;for(const Pg of xg.data){let cI=128;for(;cI>0;)Og[Lg++]=Pg&cI?0:255,cI>>=1}let lI=0;for(Lg=0,Og[Lg]!==0&&(gI[0]=1,++lI),CI=1;CI<Xg;CI++)Og[Lg]!==Og[Lg+1]&&(gI[CI]=Og[Lg]?2:1,++lI),Lg++;for(Og[Lg]!==0&&(gI[CI]=2,++lI),AI=1;AI<jg;AI++){Lg=AI*ZI,dI=AI*_g,Og[Lg-ZI]!==Og[Lg]&&(gI[dI]=Og[Lg]?1:8,++lI);let Pg=(Og[Lg]?4:0)+(Og[Lg-ZI]?8:0);for(CI=1;CI<Xg;CI++)Pg=(Pg>>2)+(Og[Lg+1]?4:0)+(Og[Lg-ZI+1]?8:0),Qg[Pg]&&(gI[dI+CI]=Qg[Pg],++lI),Lg++;if(Og[Lg-ZI]!==Og[Lg]&&(gI[dI+CI]=Og[Lg]?2:4,++lI),lI>zg)return null}for(Lg=ZI*(jg-1),dI=AI*_g,Og[Lg]!==0&&(gI[dI]=8,++lI),CI=1;CI<Xg;CI++)Og[Lg]!==Og[Lg+1]&&(gI[dI+CI]=Og[Lg]?4:8,++lI),Lg++;if(Og[Lg]!==0&&(gI[dI+CI]=4,++lI),lI>zg)return null;const iI=new Int32Array([0,_g,-1,0,-_g,0,0,0,1]),eI=new Path2D;for(AI=0;lI&&AI<=jg;AI++){let Pg=AI*_g;const cI=Pg+Xg;for(;Pg<cI&&!gI[Pg];)Pg++;if(Pg===cI)continue;eI.moveTo(Pg%_g,AI);const bI=Pg;let hI=gI[Pg];do{const BI=iI[hI];do Pg+=BI;while(!gI[Pg]);const YI=gI[Pg];YI!==5&&YI!==10?(hI=YI,gI[Pg]=0):(hI=YI&51*hI>>4,gI[Pg]&=hI>>2|hI<<2),eI.lineTo(Pg%_g,Pg/_g|0),gI[Pg]||--lI}while(bI!==Pg);--AI}return Og=null,gI=null,function(Pg){Pg.save(),Pg.scale(1/Xg,-1/jg),Pg.translate(0,-jg),Pg.fill(eI),Pg.beginPath(),Pg.restore()}}class hg{constructor(Xg,jg){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=ig.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=ig.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=ig.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,Xg,jg])}clone(){const Xg=Object.create(this);return Xg.clipBox=this.clipBox.slice(),Xg}setCurrentPoint(Xg,jg){this.x=Xg,this.y=jg}updatePathMinMax(Xg,jg,zg){[jg,zg]=ig.Util.applyTransform([jg,zg],Xg),this.minX=Math.min(this.minX,jg),this.minY=Math.min(this.minY,zg),this.maxX=Math.max(this.maxX,jg),this.maxY=Math.max(this.maxY,zg)}updateRectMinMax(Xg,jg){const zg=ig.Util.applyTransform(jg,Xg),Qg=ig.Util.applyTransform(jg.slice(2),Xg);this.minX=Math.min(this.minX,zg[0],Qg[0]),this.minY=Math.min(this.minY,zg[1],Qg[1]),this.maxX=Math.max(this.maxX,zg[0],Qg[0]),this.maxY=Math.max(this.maxY,zg[1],Qg[1])}updateScalingPathMinMax(Xg,jg){ig.Util.scaleMinMax(Xg,jg),this.minX=Math.min(this.minX,jg[0]),this.maxX=Math.max(this.maxX,jg[1]),this.minY=Math.min(this.minY,jg[2]),this.maxY=Math.max(this.maxY,jg[3])}updateCurvePathMinMax(Xg,jg,zg,Qg,_g,gI,AI,CI,dI,ZI){const Og=ig.Util.bezierBoundingBox(jg,zg,Qg,_g,gI,AI,CI,dI);if(ZI){ZI[0]=Math.min(ZI[0],Og[0],Og[2]),ZI[1]=Math.max(ZI[1],Og[0],Og[2]),ZI[2]=Math.min(ZI[2],Og[1],Og[3]),ZI[3]=Math.max(ZI[3],Og[1],Og[3]);return}this.updateRectMinMax(Xg,Og)}getPathBoundingBox(Xg=ng.PathType.FILL,jg=null){const zg=[this.minX,this.minY,this.maxX,this.maxY];if(Xg===ng.PathType.STROKE){jg||(0,ig.unreachable)("Stroke bounding box must include transform.");const Qg=ig.Util.singularValueDecompose2dScale(jg),_g=Qg[0]*this.lineWidth/2,gI=Qg[1]*this.lineWidth/2;zg[0]-=_g,zg[1]-=gI,zg[2]+=_g,zg[3]+=gI}return zg}updateClipFromPath(){const Xg=ig.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(Xg||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(Xg){this.clipBox=Xg,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(Xg=ng.PathType.FILL,jg=null){return ig.Util.intersect(this.clipBox,this.getPathBoundingBox(Xg,jg))}}function Zg(xg,Xg){if(typeof ImageData<"u"&&Xg instanceof ImageData){xg.putImageData(Xg,0,0);return}const jg=Xg.height,zg=Xg.width,Qg=jg%rg,_g=(jg-Qg)/rg,gI=Qg===0?_g:_g+1,AI=xg.createImageData(zg,rg);let CI=0,dI;const ZI=Xg.data,Og=AI.data;let Lg,lI,iI,eI;if(Xg.kind===ig.ImageKind.GRAYSCALE_1BPP){const Jg=ZI.byteLength,Pg=new Uint32Array(Og.buffer,0,Og.byteLength>>2),cI=Pg.length,bI=zg+7>>3,hI=4294967295,BI=ig.FeatureTest.isLittleEndian?4278190080:255;for(Lg=0;Lg<gI;Lg++){for(iI=Lg<_g?rg:Qg,dI=0,lI=0;lI<iI;lI++){const YI=Jg-CI;let uI=0;const fI=YI>bI?zg:YI*8-7,WI=fI&-8;let MI=0,jI=0;for(;uI<WI;uI+=8)jI=ZI[CI++],Pg[dI++]=jI&128?hI:BI,Pg[dI++]=jI&64?hI:BI,Pg[dI++]=jI&32?hI:BI,Pg[dI++]=jI&16?hI:BI,Pg[dI++]=jI&8?hI:BI,Pg[dI++]=jI&4?hI:BI,Pg[dI++]=jI&2?hI:BI,Pg[dI++]=jI&1?hI:BI;for(;uI<fI;uI++)MI===0&&(jI=ZI[CI++],MI=128),Pg[dI++]=jI&MI?hI:BI,MI>>=1}for(;dI<cI;)Pg[dI++]=0;xg.putImageData(AI,0,Lg*rg)}}else if(Xg.kind===ig.ImageKind.RGBA_32BPP){for(lI=0,eI=zg*rg*4,Lg=0;Lg<_g;Lg++)Og.set(ZI.subarray(CI,CI+eI)),CI+=eI,xg.putImageData(AI,0,lI),lI+=rg;Lg<gI&&(eI=zg*Qg*4,Og.set(ZI.subarray(CI,CI+eI)),xg.putImageData(AI,0,lI))}else if(Xg.kind===ig.ImageKind.RGB_24BPP)for(iI=rg,eI=zg*iI,Lg=0;Lg<gI;Lg++){for(Lg>=_g&&(iI=Qg,eI=zg*iI),dI=0,lI=eI;lI--;)Og[dI++]=ZI[CI++],Og[dI++]=ZI[CI++],Og[dI++]=ZI[CI++],Og[dI++]=255;xg.putImageData(AI,0,Lg*rg)}else throw new Error(`bad image kind: ${Xg.kind}`)}function wg(xg,Xg){if(Xg.bitmap){xg.drawImage(Xg.bitmap,0,0);return}const jg=Xg.height,zg=Xg.width,Qg=jg%rg,_g=(jg-Qg)/rg,gI=Qg===0?_g:_g+1,AI=xg.createImageData(zg,rg);let CI=0;const dI=Xg.data,ZI=AI.data;for(let Og=0;Og<gI;Og++){const Lg=Og<_g?rg:Qg;({srcPos:CI}=(0,og.convertBlackAndWhiteToRGBA)({src:dI,srcPos:CI,dest:ZI,width:zg,height:Lg,nonBlackColor:0})),xg.putImageData(AI,0,Og*rg)}}function pg(xg,Xg){const jg=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const zg of jg)xg[zg]!==void 0&&(Xg[zg]=xg[zg]);xg.setLineDash!==void 0&&(Xg.setLineDash(xg.getLineDash()),Xg.lineDashOffset=xg.lineDashOffset)}function fg(xg){if(xg.strokeStyle=xg.fillStyle="#000000",xg.fillRule="nonzero",xg.globalAlpha=1,xg.lineWidth=1,xg.lineCap="butt",xg.lineJoin="miter",xg.miterLimit=10,xg.globalCompositeOperation="source-over",xg.font="10px sans-serif",xg.setLineDash!==void 0&&(xg.setLineDash([]),xg.lineDashOffset=0),!ig.isNodeJS){const{filter:Xg}=xg;Xg!=="none"&&Xg!==""&&(xg.filter="none")}}function Gg(xg,Xg,jg,zg){const Qg=xg.length;for(let _g=3;_g<Qg;_g+=4){const gI=xg[_g];if(gI===0)xg[_g-3]=Xg,xg[_g-2]=jg,xg[_g-1]=zg;else if(gI<255){const AI=255-gI;xg[_g-3]=xg[_g-3]*gI+Xg*AI>>8,xg[_g-2]=xg[_g-2]*gI+jg*AI>>8,xg[_g-1]=xg[_g-1]*gI+zg*AI>>8}}}function yg(xg,Xg,jg){const zg=xg.length,Qg=1/255;for(let _g=3;_g<zg;_g+=4){const gI=jg?jg[xg[_g]]:xg[_g];Xg[_g]=Xg[_g]*gI*Qg|0}}function Bg(xg,Xg,jg){const zg=xg.length;for(let Qg=3;Qg<zg;Qg+=4){const _g=xg[Qg-3]*77+xg[Qg-2]*152+xg[Qg-1]*28;Xg[Qg]=jg?Xg[Qg]*jg[_g>>8]>>8:Xg[Qg]*_g>>16}}function Wg(xg,Xg,jg,zg,Qg,_g,gI,AI,CI,dI,ZI){const Og=!!_g,Lg=Og?_g[0]:0,lI=Og?_g[1]:0,iI=Og?_g[2]:0,eI=Qg==="Luminosity"?Bg:yg,Pg=Math.min(zg,Math.ceil(1048576/jg));for(let cI=0;cI<zg;cI+=Pg){const bI=Math.min(Pg,zg-cI),hI=xg.getImageData(AI-dI,cI+(CI-ZI),jg,bI),BI=Xg.getImageData(AI,cI+CI,jg,bI);Og&&Gg(hI.data,Lg,lI,iI),eI(hI.data,BI.data,gI),Xg.putImageData(BI,AI,cI+CI)}}function $g(xg,Xg,jg,zg){const Qg=zg[0],_g=zg[1],gI=zg[2]-Qg,AI=zg[3]-_g;gI===0||AI===0||(Wg(Xg.context,jg,gI,AI,Xg.subtype,Xg.backdrop,Xg.transferMap,Qg,_g,Xg.offsetX,Xg.offsetY),xg.save(),xg.globalAlpha=1,xg.globalCompositeOperation="source-over",xg.setTransform(1,0,0,1,0,0),xg.drawImage(jg.canvas,0,0),xg.restore())}function Ng(xg,Xg){const jg=ig.Util.singularValueDecompose2dScale(xg);jg[0]=Math.fround(jg[0]),jg[1]=Math.fround(jg[1]);const zg=Math.fround((globalThis.devicePixelRatio||1)*Ig.PixelsPerInch.PDF_TO_CSS_UNITS);return Xg!==void 0?Xg:jg[0]<=zg||jg[1]<=zg}const Vg=["butt","round","square"],Rg=["miter","round","bevel"],vg={},Mg={},Tg=class Tg{constructor(Xg,jg,zg,Qg,_g,{optionalContentConfig:gI,markedContentStack:AI=null},CI,dI){JI(this,Sg);this.ctx=Xg,this.current=new hg(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=jg,this.objs=zg,this.canvasFactory=Qg,this.filterFactory=_g,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=AI||[],this.optionalContentConfig=gI,this.cachedCanvases=new dg(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=CI,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=dI,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(Xg,jg=null){return typeof Xg=="string"?Xg.startsWith("g_")?this.commonObjs.get(Xg):this.objs.get(Xg):jg}beginDrawing({transform:Xg,viewport:jg,transparency:zg=!1,background:Qg=null}){const _g=this.ctx.canvas.width,gI=this.ctx.canvas.height,AI=this.ctx.fillStyle;if(this.ctx.fillStyle=Qg||"#ffffff",this.ctx.fillRect(0,0,_g,gI),this.ctx.fillStyle=AI,zg){const CI=this.cachedCanvases.getCanvas("transparent",_g,gI);this.compositeCtx=this.ctx,this.transparentCanvas=CI.canvas,this.ctx=CI.context,this.ctx.save(),this.ctx.transform(...(0,Ig.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),fg(this.ctx),Xg&&(this.ctx.transform(...Xg),this.outputScaleX=Xg[0],this.outputScaleY=Xg[0]),this.ctx.transform(...jg.transform),this.viewportScale=jg.scale,this.baseTransform=(0,Ig.getCurrentTransform)(this.ctx)}executeOperatorList(Xg,jg,zg,Qg){const _g=Xg.argsArray,gI=Xg.fnArray;let AI=jg||0;const CI=_g.length;if(CI===AI)return AI;const dI=CI-AI>Ag&&typeof zg=="function",ZI=dI?Date.now()+lg:0;let Og=0;const Lg=this.commonObjs,lI=this.objs;let iI;for(;;){if(Qg!==void 0&&AI===Qg.nextBreakPoint)return Qg.breakIt(AI,zg),AI;if(iI=gI[AI],iI!==ig.OPS.dependency)this[iI].apply(this,_g[AI]);else for(const eI of _g[AI]){const Jg=eI.startsWith("g_")?Lg:lI;if(!Jg.has(eI))return Jg.get(eI,zg),AI}if(AI++,AI===CI)return AI;if(dI&&++Og>Ag){if(Date.now()>ZI)return zg(),AI;Og=0}}}endDrawing(){zI(this,Sg,$u).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const Xg of this._cachedBitmapsMap.values()){for(const jg of Xg.values())typeof HTMLCanvasElement<"u"&&jg instanceof HTMLCanvasElement&&(jg.width=jg.height=0);Xg.clear()}this._cachedBitmapsMap.clear(),zI(this,Sg,Wu).call(this)}_scaleImage(Xg,jg){const zg=Xg.width,Qg=Xg.height;let _g=Math.max(Math.hypot(jg[0],jg[1]),1),gI=Math.max(Math.hypot(jg[2],jg[3]),1),AI=zg,CI=Qg,dI="prescale1",ZI,Og;for(;_g>2&&AI>1||gI>2&&CI>1;){let Lg=AI,lI=CI;_g>2&&AI>1&&(Lg=AI>=16384?Math.floor(AI/2)-1||1:Math.ceil(AI/2),_g/=AI/Lg),gI>2&&CI>1&&(lI=CI>=16384?Math.floor(CI/2)-1||1:Math.ceil(CI)/2,gI/=CI/lI),ZI=this.cachedCanvases.getCanvas(dI,Lg,lI),Og=ZI.context,Og.clearRect(0,0,Lg,lI),Og.drawImage(Xg,0,0,AI,CI,0,0,Lg,lI),Xg=ZI.canvas,AI=Lg,CI=lI,dI=dI==="prescale1"?"prescale2":"prescale1"}return{img:Xg,paintWidth:AI,paintHeight:CI}}_createMaskCanvas(Xg){const jg=this.ctx,{width:zg,height:Qg}=Xg,_g=this.current.fillColor,gI=this.current.patternFill,AI=(0,Ig.getCurrentTransform)(jg);let CI,dI,ZI,Og;if((Xg.bitmap||Xg.data)&&Xg.count>1){const uI=Xg.bitmap||Xg.data.buffer;dI=JSON.stringify(gI?AI:[AI.slice(0,4),_g]),CI=this._cachedBitmapsMap.get(uI),CI||(CI=new Map,this._cachedBitmapsMap.set(uI,CI));const fI=CI.get(dI);if(fI&&!gI){const WI=Math.round(Math.min(AI[0],AI[2])+AI[4]),MI=Math.round(Math.min(AI[1],AI[3])+AI[5]);return{canvas:fI,offsetX:WI,offsetY:MI}}ZI=fI}ZI||(Og=this.cachedCanvases.getCanvas("maskCanvas",zg,Qg),wg(Og.context,Xg));let Lg=ig.Util.transform(AI,[1/zg,0,0,-1/Qg,0,0]);Lg=ig.Util.transform(Lg,[1,0,0,1,0,-Qg]);const lI=ig.Util.applyTransform([0,0],Lg),iI=ig.Util.applyTransform([zg,Qg],Lg),eI=ig.Util.normalizeRect([lI[0],lI[1],iI[0],iI[1]]),Jg=Math.round(eI[2]-eI[0])||1,Pg=Math.round(eI[3]-eI[1])||1,cI=this.cachedCanvases.getCanvas("fillCanvas",Jg,Pg),bI=cI.context,hI=Math.min(lI[0],iI[0]),BI=Math.min(lI[1],iI[1]);bI.translate(-hI,-BI),bI.transform(...Lg),ZI||(ZI=this._scaleImage(Og.canvas,(0,Ig.getCurrentTransformInverse)(bI)),ZI=ZI.img,CI&&gI&&CI.set(dI,ZI)),bI.imageSmoothingEnabled=Ng((0,Ig.getCurrentTransform)(bI),Xg.interpolate),bg(bI,ZI,0,0,ZI.width,ZI.height,0,0,zg,Qg),bI.globalCompositeOperation="source-in";const YI=ig.Util.transform((0,Ig.getCurrentTransformInverse)(bI),[1,0,0,1,-hI,-BI]);return bI.fillStyle=gI?_g.getPattern(jg,this,YI,ng.PathType.FILL):_g,bI.fillRect(0,0,zg,Qg),CI&&!gI&&(this.cachedCanvases.delete("fillCanvas"),CI.set(dI,cI.canvas)),{canvas:cI.canvas,offsetX:Math.round(hI),offsetY:Math.round(BI)}}setLineWidth(Xg){Xg!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=Xg,this.ctx.lineWidth=Xg}setLineCap(Xg){this.ctx.lineCap=Vg[Xg]}setLineJoin(Xg){this.ctx.lineJoin=Rg[Xg]}setMiterLimit(Xg){this.ctx.miterLimit=Xg}setDash(Xg,jg){const zg=this.ctx;zg.setLineDash!==void 0&&(zg.setLineDash(Xg),zg.lineDashOffset=jg)}setRenderingIntent(Xg){}setFlatness(Xg){}setGState(Xg){for(const[jg,zg]of Xg)switch(jg){case"LW":this.setLineWidth(zg);break;case"LC":this.setLineCap(zg);break;case"LJ":this.setLineJoin(zg);break;case"ML":this.setMiterLimit(zg);break;case"D":this.setDash(zg[0],zg[1]);break;case"RI":this.setRenderingIntent(zg);break;case"FL":this.setFlatness(zg);break;case"Font":this.setFont(zg[0],zg[1]);break;case"CA":this.current.strokeAlpha=zg;break;case"ca":this.current.fillAlpha=zg,this.ctx.globalAlpha=zg;break;case"BM":this.ctx.globalCompositeOperation=zg;break;case"SMask":this.current.activeSMask=zg?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(zg);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const Xg=this.inSMaskMode;this.current.activeSMask&&!Xg?this.beginSMaskMode():!this.current.activeSMask&&Xg&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const Xg=this.ctx.canvas.width,jg=this.ctx.canvas.height,zg="smaskGroupAt"+this.groupLevel,Qg=this.cachedCanvases.getCanvas(zg,Xg,jg);this.suspendedCtx=this.ctx,this.ctx=Qg.context;const _g=this.ctx;_g.setTransform(...(0,Ig.getCurrentTransform)(this.suspendedCtx)),pg(this.suspendedCtx,_g),ug(_g,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(),pg(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(Xg){if(!this.current.activeSMask)return;Xg?(Xg[0]=Math.floor(Xg[0]),Xg[1]=Math.floor(Xg[1]),Xg[2]=Math.ceil(Xg[2]),Xg[3]=Math.ceil(Xg[3])):Xg=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const jg=this.current.activeSMask,zg=this.suspendedCtx;$g(zg,jg,this.ctx,Xg),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}save(){this.inSMaskMode?(pg(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const Xg=this.current;this.stateStack.push(Xg),this.current=Xg.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),pg(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(Xg,jg,zg,Qg,_g,gI){this.ctx.transform(Xg,jg,zg,Qg,_g,gI),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(Xg,jg,zg){const Qg=this.ctx,_g=this.current;let gI=_g.x,AI=_g.y,CI,dI;const ZI=(0,Ig.getCurrentTransform)(Qg),Og=ZI[0]===0&&ZI[3]===0||ZI[1]===0&&ZI[2]===0,Lg=Og?zg.slice(0):null;for(let lI=0,iI=0,eI=Xg.length;lI<eI;lI++)switch(Xg[lI]|0){case ig.OPS.rectangle:gI=jg[iI++],AI=jg[iI++];const Jg=jg[iI++],Pg=jg[iI++],cI=gI+Jg,bI=AI+Pg;Qg.moveTo(gI,AI),Jg===0||Pg===0?Qg.lineTo(cI,bI):(Qg.lineTo(cI,AI),Qg.lineTo(cI,bI),Qg.lineTo(gI,bI)),Og||_g.updateRectMinMax(ZI,[gI,AI,cI,bI]),Qg.closePath();break;case ig.OPS.moveTo:gI=jg[iI++],AI=jg[iI++],Qg.moveTo(gI,AI),Og||_g.updatePathMinMax(ZI,gI,AI);break;case ig.OPS.lineTo:gI=jg[iI++],AI=jg[iI++],Qg.lineTo(gI,AI),Og||_g.updatePathMinMax(ZI,gI,AI);break;case ig.OPS.curveTo:CI=gI,dI=AI,gI=jg[iI+4],AI=jg[iI+5],Qg.bezierCurveTo(jg[iI],jg[iI+1],jg[iI+2],jg[iI+3],gI,AI),_g.updateCurvePathMinMax(ZI,CI,dI,jg[iI],jg[iI+1],jg[iI+2],jg[iI+3],gI,AI,Lg),iI+=6;break;case ig.OPS.curveTo2:CI=gI,dI=AI,Qg.bezierCurveTo(gI,AI,jg[iI],jg[iI+1],jg[iI+2],jg[iI+3]),_g.updateCurvePathMinMax(ZI,CI,dI,gI,AI,jg[iI],jg[iI+1],jg[iI+2],jg[iI+3],Lg),gI=jg[iI+2],AI=jg[iI+3],iI+=4;break;case ig.OPS.curveTo3:CI=gI,dI=AI,gI=jg[iI+2],AI=jg[iI+3],Qg.bezierCurveTo(jg[iI],jg[iI+1],gI,AI,gI,AI),_g.updateCurvePathMinMax(ZI,CI,dI,jg[iI],jg[iI+1],gI,AI,gI,AI,Lg),iI+=4;break;case ig.OPS.closePath:Qg.closePath();break}Og&&_g.updateScalingPathMinMax(ZI,Lg),_g.setCurrentPoint(gI,AI)}closePath(){this.ctx.closePath()}stroke(Xg=!0){const jg=this.ctx,zg=this.current.strokeColor;jg.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof zg=="object"&&(zg!=null&&zg.getPattern)?(jg.save(),jg.strokeStyle=zg.getPattern(jg,this,(0,Ig.getCurrentTransformInverse)(jg),ng.PathType.STROKE),this.rescaleAndStroke(!1),jg.restore()):this.rescaleAndStroke(!0)),Xg&&this.consumePath(this.current.getClippedPathBoundingBox()),jg.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(Xg=!0){const jg=this.ctx,zg=this.current.fillColor,Qg=this.current.patternFill;let _g=!1;Qg&&(jg.save(),jg.fillStyle=zg.getPattern(jg,this,(0,Ig.getCurrentTransformInverse)(jg),ng.PathType.FILL),_g=!0);const gI=this.current.getClippedPathBoundingBox();this.contentVisible&&gI!==null&&(this.pendingEOFill?(jg.fill("evenodd"),this.pendingEOFill=!1):jg.fill()),_g&&jg.restore(),Xg&&this.consumePath(gI)}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=vg}eoClip(){this.pendingClip=Mg}beginText(){this.current.textMatrix=ig.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const Xg=this.pendingTextPaths,jg=this.ctx;if(Xg===void 0){jg.beginPath();return}jg.save(),jg.beginPath();for(const zg of Xg)jg.setTransform(...zg.transform),jg.translate(zg.x,zg.y),zg.addToPath(jg,zg.fontSize);jg.restore(),jg.clip(),jg.beginPath(),delete this.pendingTextPaths}setCharSpacing(Xg){this.current.charSpacing=Xg}setWordSpacing(Xg){this.current.wordSpacing=Xg}setHScale(Xg){this.current.textHScale=Xg/100}setLeading(Xg){this.current.leading=-Xg}setFont(Xg,jg){var ZI;const zg=this.commonObjs.get(Xg),Qg=this.current;if(!zg)throw new Error(`Can't find font for ${Xg}`);if(Qg.fontMatrix=zg.fontMatrix||ig.FONT_IDENTITY_MATRIX,(Qg.fontMatrix[0]===0||Qg.fontMatrix[3]===0)&&(0,ig.warn)("Invalid font matrix for font "+Xg),jg<0?(jg=-jg,Qg.fontDirection=-1):Qg.fontDirection=1,this.current.font=zg,this.current.fontSize=jg,zg.isType3Font)return;const _g=zg.loadedName||"sans-serif",gI=((ZI=zg.systemFontInfo)==null?void 0:ZI.css)||`"${_g}", ${zg.fallbackName}`;let AI="normal";zg.black?AI="900":zg.bold&&(AI="bold");const CI=zg.italic?"italic":"normal";let dI=jg;jg<ag?dI=ag:jg>sg&&(dI=sg),this.current.fontSizeScale=jg/dI,this.ctx.font=`${CI} ${AI} ${dI}px ${gI}`}setTextRenderingMode(Xg){this.current.textRenderingMode=Xg}setTextRise(Xg){this.current.textRise=Xg}moveText(Xg,jg){this.current.x=this.current.lineX+=Xg,this.current.y=this.current.lineY+=jg}setLeadingMoveText(Xg,jg){this.setLeading(-jg),this.moveText(Xg,jg)}setTextMatrix(Xg,jg,zg,Qg,_g,gI){this.current.textMatrix=[Xg,jg,zg,Qg,_g,gI],this.current.textMatrixScale=Math.hypot(Xg,jg),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(Xg,jg,zg,Qg){const _g=this.ctx,gI=this.current,AI=gI.font,CI=gI.textRenderingMode,dI=gI.fontSize/gI.fontSizeScale,ZI=CI&ig.TextRenderingMode.FILL_STROKE_MASK,Og=!!(CI&ig.TextRenderingMode.ADD_TO_PATH_FLAG),Lg=gI.patternFill&&!AI.missingFile;let lI;(AI.disableFontFace||Og||Lg)&&(lI=AI.getPathGenerator(this.commonObjs,Xg)),AI.disableFontFace||Lg?(_g.save(),_g.translate(jg,zg),_g.beginPath(),lI(_g,dI),Qg&&_g.setTransform(...Qg),(ZI===ig.TextRenderingMode.FILL||ZI===ig.TextRenderingMode.FILL_STROKE)&&_g.fill(),(ZI===ig.TextRenderingMode.STROKE||ZI===ig.TextRenderingMode.FILL_STROKE)&&_g.stroke(),_g.restore()):((ZI===ig.TextRenderingMode.FILL||ZI===ig.TextRenderingMode.FILL_STROKE)&&_g.fillText(Xg,jg,zg),(ZI===ig.TextRenderingMode.STROKE||ZI===ig.TextRenderingMode.FILL_STROKE)&&_g.strokeText(Xg,jg,zg)),Og&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,Ig.getCurrentTransform)(_g),x:jg,y:zg,fontSize:dI,addToPath:lI})}get isFontSubpixelAAEnabled(){const{context:Xg}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);Xg.scale(1.5,1),Xg.fillText("I",0,10);const jg=Xg.getImageData(0,0,10,10).data;let zg=!1;for(let Qg=3;Qg<jg.length;Qg+=4)if(jg[Qg]>0&&jg[Qg]<255){zg=!0;break}return(0,ig.shadow)(this,"isFontSubpixelAAEnabled",zg)}showText(Xg){const jg=this.current,zg=jg.font;if(zg.isType3Font)return this.showType3Text(Xg);const Qg=jg.fontSize;if(Qg===0)return;const _g=this.ctx,gI=jg.fontSizeScale,AI=jg.charSpacing,CI=jg.wordSpacing,dI=jg.fontDirection,ZI=jg.textHScale*dI,Og=Xg.length,Lg=zg.vertical,lI=Lg?1:-1,iI=zg.defaultVMetrics,eI=Qg*jg.fontMatrix[0],Jg=jg.textRenderingMode===ig.TextRenderingMode.FILL&&!zg.disableFontFace&&!jg.patternFill;_g.save(),_g.transform(...jg.textMatrix),_g.translate(jg.x,jg.y+jg.textRise),dI>0?_g.scale(ZI,-1):_g.scale(ZI,1);let Pg;if(jg.patternFill){_g.save();const YI=jg.fillColor.getPattern(_g,this,(0,Ig.getCurrentTransformInverse)(_g),ng.PathType.FILL);Pg=(0,Ig.getCurrentTransform)(_g),_g.restore(),_g.fillStyle=YI}let cI=jg.lineWidth;const bI=jg.textMatrixScale;if(bI===0||cI===0){const YI=jg.textRenderingMode&ig.TextRenderingMode.FILL_STROKE_MASK;(YI===ig.TextRenderingMode.STROKE||YI===ig.TextRenderingMode.FILL_STROKE)&&(cI=this.getSinglePixelWidth())}else cI/=bI;if(gI!==1&&(_g.scale(gI,gI),cI/=gI),_g.lineWidth=cI,zg.isInvalidPDFjsFont){const YI=[];let uI=0;for(const fI of Xg)YI.push(fI.unicode),uI+=fI.width;_g.fillText(YI.join(""),0,0),jg.x+=uI*eI*ZI,_g.restore(),this.compose();return}let hI=0,BI;for(BI=0;BI<Og;++BI){const YI=Xg[BI];if(typeof YI=="number"){hI+=lI*YI*Qg/1e3;continue}let uI=!1;const fI=(YI.isSpace?CI:0)+AI,WI=YI.fontChar,MI=YI.accent;let jI,HI,II=YI.width;if(Lg){const $I=YI.vmetric||iI,kI=-(YI.vmetric?$I[1]:II*.5)*eI,rI=$I[2]*eI;II=$I?-$I[0]:II,jI=kI/gI,HI=(hI+rI)/gI}else jI=hI/gI,HI=0;if(zg.remeasure&&II>0){const $I=_g.measureText(WI).width*1e3/Qg*gI;if(II<$I&&this.isFontSubpixelAAEnabled){const kI=II/$I;uI=!0,_g.save(),_g.scale(kI,1),jI/=kI}else II!==$I&&(jI+=(II-$I)/2e3*Qg/gI)}if(this.contentVisible&&(YI.isInFont||zg.missingFile)){if(Jg&&!MI)_g.fillText(WI,jI,HI);else if(this.paintChar(WI,jI,HI,Pg),MI){const $I=jI+Qg*MI.offset.x/gI,kI=HI-Qg*MI.offset.y/gI;this.paintChar(MI.fontChar,$I,kI,Pg)}}const wI=Lg?II*eI-fI*dI:II*eI+fI*dI;hI+=wI,uI&&_g.restore()}Lg?jg.y-=hI:jg.x+=hI*ZI,_g.restore(),this.compose()}showType3Text(Xg){const jg=this.ctx,zg=this.current,Qg=zg.font,_g=zg.fontSize,gI=zg.fontDirection,AI=Qg.vertical?1:-1,CI=zg.charSpacing,dI=zg.wordSpacing,ZI=zg.textHScale*gI,Og=zg.fontMatrix||ig.FONT_IDENTITY_MATRIX,Lg=Xg.length,lI=zg.textRenderingMode===ig.TextRenderingMode.INVISIBLE;let iI,eI,Jg,Pg;if(!(lI||_g===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,jg.save(),jg.transform(...zg.textMatrix),jg.translate(zg.x,zg.y),jg.scale(ZI,gI),iI=0;iI<Lg;++iI){if(eI=Xg[iI],typeof eI=="number"){Pg=AI*eI*_g/1e3,this.ctx.translate(Pg,0),zg.x+=Pg*ZI;continue}const cI=(eI.isSpace?dI:0)+CI,bI=Qg.charProcOperatorList[eI.operatorListId];if(!bI){(0,ig.warn)(`Type3 character "${eI.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=eI,this.save(),jg.scale(_g,_g),jg.transform(...Og),this.executeOperatorList(bI),this.restore()),Jg=ig.Util.applyTransform([eI.width,0],Og)[0]*_g+cI,jg.translate(Jg,0),zg.x+=Jg*ZI}jg.restore(),this.processingType3=null}}setCharWidth(Xg,jg){}setCharWidthAndBounds(Xg,jg,zg,Qg,_g,gI){this.ctx.rect(zg,Qg,_g-zg,gI-Qg),this.ctx.clip(),this.endPath()}getColorN_Pattern(Xg){let jg;if(Xg[0]==="TilingPattern"){const zg=Xg[1],Qg=this.baseTransform||(0,Ig.getCurrentTransform)(this.ctx),_g={createCanvasGraphics:gI=>new Tg(gI,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};jg=new ng.TilingPattern(Xg,zg,this.ctx,_g,Qg)}else jg=this._getPattern(Xg[1],Xg[2]);return jg}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(Xg,jg,zg){const Qg=ig.Util.makeHexColor(Xg,jg,zg);this.ctx.strokeStyle=Qg,this.current.strokeColor=Qg}setFillRGBColor(Xg,jg,zg){const Qg=ig.Util.makeHexColor(Xg,jg,zg);this.ctx.fillStyle=Qg,this.current.fillColor=Qg,this.current.patternFill=!1}_getPattern(Xg,jg=null){let zg;return this.cachedPatterns.has(Xg)?zg=this.cachedPatterns.get(Xg):(zg=(0,ng.getShadingPattern)(this.getObject(Xg)),this.cachedPatterns.set(Xg,zg)),jg&&(zg.matrix=jg),zg}shadingFill(Xg){if(!this.contentVisible)return;const jg=this.ctx;this.save();const zg=this._getPattern(Xg);jg.fillStyle=zg.getPattern(jg,this,(0,Ig.getCurrentTransformInverse)(jg),ng.PathType.SHADING);const Qg=(0,Ig.getCurrentTransformInverse)(jg);if(Qg){const{width:_g,height:gI}=jg.canvas,[AI,CI,dI,ZI]=ig.Util.getAxialAlignedBoundingBox([0,0,_g,gI],Qg);this.ctx.fillRect(AI,CI,dI-AI,ZI-CI)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,ig.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,ig.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(Xg,jg){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(Xg)&&Xg.length===6&&this.transform(...Xg),this.baseTransform=(0,Ig.getCurrentTransform)(this.ctx),jg)){const zg=jg[2]-jg[0],Qg=jg[3]-jg[1];this.ctx.rect(jg[0],jg[1],zg,Qg),this.current.updateRectMinMax((0,Ig.getCurrentTransform)(this.ctx),jg),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(Xg){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const jg=this.ctx;Xg.isolated||(0,ig.info)("TODO: Support non-isolated groups."),Xg.knockout&&(0,ig.warn)("Knockout groups not supported.");const zg=(0,Ig.getCurrentTransform)(jg);if(Xg.matrix&&jg.transform(...Xg.matrix),!Xg.bbox)throw new Error("Bounding box is required.");let Qg=ig.Util.getAxialAlignedBoundingBox(Xg.bbox,(0,Ig.getCurrentTransform)(jg));const _g=[0,0,jg.canvas.width,jg.canvas.height];Qg=ig.Util.intersect(Qg,_g)||[0,0,0,0];const gI=Math.floor(Qg[0]),AI=Math.floor(Qg[1]);let CI=Math.max(Math.ceil(Qg[2])-gI,1),dI=Math.max(Math.ceil(Qg[3])-AI,1),ZI=1,Og=1;CI>Cg&&(ZI=CI/Cg,CI=Cg),dI>Cg&&(Og=dI/Cg,dI=Cg),this.current.startNewPathAndClipBox([0,0,CI,dI]);let Lg="groupAt"+this.groupLevel;Xg.smask&&(Lg+="_smask_"+this.smaskCounter++%2);const lI=this.cachedCanvases.getCanvas(Lg,CI,dI),iI=lI.context;iI.scale(1/ZI,1/Og),iI.translate(-gI,-AI),iI.transform(...zg),Xg.smask?this.smaskStack.push({canvas:lI.canvas,context:iI,offsetX:gI,offsetY:AI,scaleX:ZI,scaleY:Og,subtype:Xg.smask.subtype,backdrop:Xg.smask.backdrop,transferMap:Xg.smask.transferMap||null,startTransformInverse:null}):(jg.setTransform(1,0,0,1,0,0),jg.translate(gI,AI),jg.scale(ZI,Og),jg.save()),pg(jg,iI),this.ctx=iI,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(jg),this.groupLevel++}endGroup(Xg){if(!this.contentVisible)return;this.groupLevel--;const jg=this.ctx,zg=this.groupStack.pop();if(this.ctx=zg,this.ctx.imageSmoothingEnabled=!1,Xg.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const Qg=(0,Ig.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...Qg);const _g=ig.Util.getAxialAlignedBoundingBox([0,0,jg.canvas.width,jg.canvas.height],Qg);this.ctx.drawImage(jg.canvas,0,0),this.ctx.restore(),this.compose(_g)}}beginAnnotation(Xg,jg,zg,Qg,_g){if(zI(this,Sg,$u).call(this),fg(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(jg)&&jg.length===4){const gI=jg[2]-jg[0],AI=jg[3]-jg[1];if(_g&&this.annotationCanvasMap){zg=zg.slice(),zg[4]-=jg[0],zg[5]-=jg[1],jg=jg.slice(),jg[0]=jg[1]=0,jg[2]=gI,jg[3]=AI;const[CI,dI]=ig.Util.singularValueDecompose2dScale((0,Ig.getCurrentTransform)(this.ctx)),{viewportScale:ZI}=this,Og=Math.ceil(gI*this.outputScaleX*ZI),Lg=Math.ceil(AI*this.outputScaleY*ZI);this.annotationCanvas=this.canvasFactory.create(Og,Lg);const{canvas:lI,context:iI}=this.annotationCanvas;this.annotationCanvasMap.set(Xg,lI),this.annotationCanvas.savedCtx=this.ctx,this.ctx=iI,this.ctx.save(),this.ctx.setTransform(CI,0,0,-dI,0,AI*dI),fg(this.ctx)}else fg(this.ctx),this.ctx.rect(jg[0],jg[1],gI,AI),this.ctx.clip(),this.endPath()}this.current=new hg(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...zg),this.transform(...Qg)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),zI(this,Sg,Wu).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(Xg){if(!this.contentVisible)return;const jg=Xg.count;Xg=this.getObject(Xg.data,Xg),Xg.count=jg;const zg=this.ctx,Qg=this.processingType3;if(Qg&&(Qg.compiled===void 0&&(Qg.compiled=mg(Xg)),Qg.compiled)){Qg.compiled(zg);return}const _g=this._createMaskCanvas(Xg),gI=_g.canvas;zg.save(),zg.setTransform(1,0,0,1,0,0),zg.drawImage(gI,_g.offsetX,_g.offsetY),zg.restore(),this.compose()}paintImageMaskXObjectRepeat(Xg,jg,zg=0,Qg=0,_g,gI){if(!this.contentVisible)return;Xg=this.getObject(Xg.data,Xg);const AI=this.ctx;AI.save();const CI=(0,Ig.getCurrentTransform)(AI);AI.transform(jg,zg,Qg,_g,0,0);const dI=this._createMaskCanvas(Xg);AI.setTransform(1,0,0,1,dI.offsetX-CI[4],dI.offsetY-CI[5]);for(let ZI=0,Og=gI.length;ZI<Og;ZI+=2){const Lg=ig.Util.transform(CI,[jg,zg,Qg,_g,gI[ZI],gI[ZI+1]]),[lI,iI]=ig.Util.applyTransform([0,0],Lg);AI.drawImage(dI.canvas,lI,iI)}AI.restore(),this.compose()}paintImageMaskXObjectGroup(Xg){if(!this.contentVisible)return;const jg=this.ctx,zg=this.current.fillColor,Qg=this.current.patternFill;for(const _g of Xg){const{data:gI,width:AI,height:CI,transform:dI}=_g,ZI=this.cachedCanvases.getCanvas("maskCanvas",AI,CI),Og=ZI.context;Og.save();const Lg=this.getObject(gI,_g);wg(Og,Lg),Og.globalCompositeOperation="source-in",Og.fillStyle=Qg?zg.getPattern(Og,this,(0,Ig.getCurrentTransformInverse)(jg),ng.PathType.FILL):zg,Og.fillRect(0,0,AI,CI),Og.restore(),jg.save(),jg.transform(...dI),jg.scale(1,-1),bg(jg,ZI.canvas,0,0,AI,CI,0,-1,1,1),jg.restore()}this.compose()}paintImageXObject(Xg){if(!this.contentVisible)return;const jg=this.getObject(Xg);if(!jg){(0,ig.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(jg)}paintImageXObjectRepeat(Xg,jg,zg,Qg){if(!this.contentVisible)return;const _g=this.getObject(Xg);if(!_g){(0,ig.warn)("Dependent image isn't ready yet");return}const gI=_g.width,AI=_g.height,CI=[];for(let dI=0,ZI=Qg.length;dI<ZI;dI+=2)CI.push({transform:[jg,0,0,zg,Qg[dI],Qg[dI+1]],x:0,y:0,w:gI,h:AI});this.paintInlineImageXObjectGroup(_g,CI)}applyTransferMapsToCanvas(Xg){return this.current.transferMaps!=="none"&&(Xg.filter=this.current.transferMaps,Xg.drawImage(Xg.canvas,0,0),Xg.filter="none"),Xg.canvas}applyTransferMapsToBitmap(Xg){if(this.current.transferMaps==="none")return Xg.bitmap;const{bitmap:jg,width:zg,height:Qg}=Xg,_g=this.cachedCanvases.getCanvas("inlineImage",zg,Qg),gI=_g.context;return gI.filter=this.current.transferMaps,gI.drawImage(jg,0,0),gI.filter="none",_g.canvas}paintInlineImageXObject(Xg){if(!this.contentVisible)return;const jg=Xg.width,zg=Xg.height,Qg=this.ctx;if(this.save(),!ig.isNodeJS){const{filter:AI}=Qg;AI!=="none"&&AI!==""&&(Qg.filter="none")}Qg.scale(1/jg,-1/zg);let _g;if(Xg.bitmap)_g=this.applyTransferMapsToBitmap(Xg);else if(typeof HTMLElement=="function"&&Xg instanceof HTMLElement||!Xg.data)_g=Xg;else{const CI=this.cachedCanvases.getCanvas("inlineImage",jg,zg).context;Zg(CI,Xg),_g=this.applyTransferMapsToCanvas(CI)}const gI=this._scaleImage(_g,(0,Ig.getCurrentTransformInverse)(Qg));Qg.imageSmoothingEnabled=Ng((0,Ig.getCurrentTransform)(Qg),Xg.interpolate),bg(Qg,gI.img,0,0,gI.paintWidth,gI.paintHeight,0,-zg,jg,zg),this.compose(),this.restore()}paintInlineImageXObjectGroup(Xg,jg){if(!this.contentVisible)return;const zg=this.ctx;let Qg;if(Xg.bitmap)Qg=Xg.bitmap;else{const _g=Xg.width,gI=Xg.height,CI=this.cachedCanvases.getCanvas("inlineImage",_g,gI).context;Zg(CI,Xg),Qg=this.applyTransferMapsToCanvas(CI)}for(const _g of jg)zg.save(),zg.transform(..._g.transform),zg.scale(1,-1),bg(zg,Qg,_g.x,_g.y,_g.w,_g.h,0,-1,1,1),zg.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(Xg){}markPointProps(Xg,jg){}beginMarkedContent(Xg){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(Xg,jg){Xg==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(jg)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(Xg){const jg=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(Xg);const zg=this.ctx;this.pendingClip&&(jg||(this.pendingClip===Mg?zg.clip("evenodd"):zg.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),zg.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const Xg=(0,Ig.getCurrentTransform)(this.ctx);if(Xg[1]===0&&Xg[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(Xg[0]),Math.abs(Xg[3]));else{const jg=Math.abs(Xg[0]*Xg[3]-Xg[2]*Xg[1]),zg=Math.hypot(Xg[0],Xg[2]),Qg=Math.hypot(Xg[1],Xg[3]);this._cachedGetSinglePixelWidth=Math.max(zg,Qg)/jg}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:Xg}=this.current,{a:jg,b:zg,c:Qg,d:_g}=this.ctx.getTransform();let gI,AI;if(zg===0&&Qg===0){const CI=Math.abs(jg),dI=Math.abs(_g);if(CI===dI)if(Xg===0)gI=AI=1/CI;else{const ZI=CI*Xg;gI=AI=ZI<1?1/ZI:1}else if(Xg===0)gI=1/CI,AI=1/dI;else{const ZI=CI*Xg,Og=dI*Xg;gI=ZI<1?1/ZI:1,AI=Og<1?1/Og:1}}else{const CI=Math.abs(jg*_g-zg*Qg),dI=Math.hypot(jg,zg),ZI=Math.hypot(Qg,_g);if(Xg===0)gI=ZI/CI,AI=dI/CI;else{const Og=Xg*CI;gI=ZI>Og?ZI/Og:1,AI=dI>Og?dI/Og:1}}this._cachedScaleForStroking[0]=gI,this._cachedScaleForStroking[1]=AI}return this._cachedScaleForStroking}rescaleAndStroke(Xg){const{ctx:jg}=this,{lineWidth:zg}=this.current,[Qg,_g]=this.getScaleForStroking();if(jg.lineWidth=zg||1,Qg===1&&_g===1){jg.stroke();return}const gI=jg.getLineDash();if(Xg&&jg.save(),jg.scale(Qg,_g),gI.length>0){const AI=Math.max(Qg,_g);jg.setLineDash(gI.map(CI=>CI/AI)),jg.lineDashOffset/=AI}jg.stroke(),Xg&&jg.restore()}isContentVisible(){for(let Xg=this.markedContentStack.length-1;Xg>=0;Xg--)if(!this.markedContentStack[Xg].visible)return!1;return!0}};Sg=new WeakSet,$u=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},Wu=function(){if(this.pageColors){const Xg=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(Xg!=="none"){const jg=this.ctx.filter;this.ctx.filter=Xg,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=jg}}};let kg=Tg;eg.CanvasGraphics=kg;for(const xg in ig.OPS)kg.prototype[xg]!==void 0&&(kg.prototype[ig.OPS[xg]]=kg.prototype[xg])}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.TilingPattern=eg.PathType=void 0,eg.getShadingPattern=rg;var ig=gg(1),Ig=gg(6);const ng={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};eg.PathType=ng;function og(mg,hg){if(!hg)return;const Zg=hg[2]-hg[0],wg=hg[3]-hg[1],pg=new Path2D;pg.rect(hg[0],hg[1],Zg,wg),mg.clip(pg)}class ag{constructor(){this.constructor===ag&&(0,ig.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,ig.unreachable)("Abstract method `getPattern` called.")}}class sg extends ag{constructor(hg){super(),this._type=hg[1],this._bbox=hg[2],this._colorStops=hg[3],this._p0=hg[4],this._p1=hg[5],this._r0=hg[6],this._r1=hg[7],this.matrix=null}_createGradient(hg){let Zg;this._type==="axial"?Zg=hg.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(Zg=hg.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const wg of this._colorStops)Zg.addColorStop(wg[0],wg[1]);return Zg}getPattern(hg,Zg,wg,pg){let fg;if(pg===ng.STROKE||pg===ng.FILL){const Gg=Zg.current.getClippedPathBoundingBox(pg,(0,Ig.getCurrentTransform)(hg))||[0,0,0,0],yg=Math.ceil(Gg[2]-Gg[0])||1,Bg=Math.ceil(Gg[3]-Gg[1])||1,Wg=Zg.cachedCanvases.getCanvas("pattern",yg,Bg,!0),$g=Wg.context;$g.clearRect(0,0,$g.canvas.width,$g.canvas.height),$g.beginPath(),$g.rect(0,0,$g.canvas.width,$g.canvas.height),$g.translate(-Gg[0],-Gg[1]),wg=ig.Util.transform(wg,[1,0,0,1,Gg[0],Gg[1]]),$g.transform(...Zg.baseTransform),this.matrix&&$g.transform(...this.matrix),og($g,this._bbox),$g.fillStyle=this._createGradient($g),$g.fill(),fg=hg.createPattern(Wg.canvas,"no-repeat");const Ng=new DOMMatrix(wg);fg.setTransform(Ng)}else og(hg,this._bbox),fg=this._createGradient(hg);return fg}}function Cg(mg,hg,Zg,wg,pg,fg,Gg,yg){const Bg=hg.coords,Wg=hg.colors,$g=mg.data,Ng=mg.width*4;let Vg;Bg[Zg+1]>Bg[wg+1]&&(Vg=Zg,Zg=wg,wg=Vg,Vg=fg,fg=Gg,Gg=Vg),Bg[wg+1]>Bg[pg+1]&&(Vg=wg,wg=pg,pg=Vg,Vg=Gg,Gg=yg,yg=Vg),Bg[Zg+1]>Bg[wg+1]&&(Vg=Zg,Zg=wg,wg=Vg,Vg=fg,fg=Gg,Gg=Vg);const Rg=(Bg[Zg]+hg.offsetX)*hg.scaleX,vg=(Bg[Zg+1]+hg.offsetY)*hg.scaleY,Mg=(Bg[wg]+hg.offsetX)*hg.scaleX,kg=(Bg[wg+1]+hg.offsetY)*hg.scaleY,Sg=(Bg[pg]+hg.offsetX)*hg.scaleX,Yg=(Bg[pg+1]+hg.offsetY)*hg.scaleY;if(vg>=Yg)return;const Kg=Wg[fg],Tg=Wg[fg+1],xg=Wg[fg+2],Xg=Wg[Gg],jg=Wg[Gg+1],zg=Wg[Gg+2],Qg=Wg[yg],_g=Wg[yg+1],gI=Wg[yg+2],AI=Math.round(vg),CI=Math.round(Yg);let dI,ZI,Og,Lg,lI,iI,eI,Jg;for(let Pg=AI;Pg<=CI;Pg++){if(Pg<kg){const YI=Pg<vg?0:(vg-Pg)/(vg-kg);dI=Rg-(Rg-Mg)*YI,ZI=Kg-(Kg-Xg)*YI,Og=Tg-(Tg-jg)*YI,Lg=xg-(xg-zg)*YI}else{let YI;Pg>Yg?YI=1:kg===Yg?YI=0:YI=(kg-Pg)/(kg-Yg),dI=Mg-(Mg-Sg)*YI,ZI=Xg-(Xg-Qg)*YI,Og=jg-(jg-_g)*YI,Lg=zg-(zg-gI)*YI}let cI;Pg<vg?cI=0:Pg>Yg?cI=1:cI=(vg-Pg)/(vg-Yg),lI=Rg-(Rg-Sg)*cI,iI=Kg-(Kg-Qg)*cI,eI=Tg-(Tg-_g)*cI,Jg=xg-(xg-gI)*cI;const bI=Math.round(Math.min(dI,lI)),hI=Math.round(Math.max(dI,lI));let BI=Ng*Pg+bI*4;for(let YI=bI;YI<=hI;YI++)cI=(dI-YI)/(dI-lI),cI<0?cI=0:cI>1&&(cI=1),$g[BI++]=ZI-(ZI-iI)*cI|0,$g[BI++]=Og-(Og-eI)*cI|0,$g[BI++]=Lg-(Lg-Jg)*cI|0,$g[BI++]=255}}function lg(mg,hg,Zg){const wg=hg.coords,pg=hg.colors;let fg,Gg;switch(hg.type){case"lattice":const yg=hg.verticesPerRow,Bg=Math.floor(wg.length/yg)-1,Wg=yg-1;for(fg=0;fg<Bg;fg++){let $g=fg*yg;for(let Ng=0;Ng<Wg;Ng++,$g++)Cg(mg,Zg,wg[$g],wg[$g+1],wg[$g+yg],pg[$g],pg[$g+1],pg[$g+yg]),Cg(mg,Zg,wg[$g+yg+1],wg[$g+1],wg[$g+yg],pg[$g+yg+1],pg[$g+1],pg[$g+yg])}break;case"triangles":for(fg=0,Gg=wg.length;fg<Gg;fg+=3)Cg(mg,Zg,wg[fg],wg[fg+1],wg[fg+2],pg[fg],pg[fg+1],pg[fg+2]);break;default:throw new Error("illegal figure")}}class Ag extends ag{constructor(hg){super(),this._coords=hg[2],this._colors=hg[3],this._figures=hg[4],this._bounds=hg[5],this._bbox=hg[7],this._background=hg[8],this.matrix=null}_createMeshCanvas(hg,Zg,wg){const yg=Math.floor(this._bounds[0]),Bg=Math.floor(this._bounds[1]),Wg=Math.ceil(this._bounds[2])-yg,$g=Math.ceil(this._bounds[3])-Bg,Ng=Math.min(Math.ceil(Math.abs(Wg*hg[0]*1.1)),3e3),Vg=Math.min(Math.ceil(Math.abs($g*hg[1]*1.1)),3e3),Rg=Wg/Ng,vg=$g/Vg,Mg={coords:this._coords,colors:this._colors,offsetX:-yg,offsetY:-Bg,scaleX:1/Rg,scaleY:1/vg},kg=Ng+4,Sg=Vg+4,Yg=wg.getCanvas("mesh",kg,Sg,!1),Kg=Yg.context,Tg=Kg.createImageData(Ng,Vg);if(Zg){const Xg=Tg.data;for(let jg=0,zg=Xg.length;jg<zg;jg+=4)Xg[jg]=Zg[0],Xg[jg+1]=Zg[1],Xg[jg+2]=Zg[2],Xg[jg+3]=255}for(const Xg of this._figures)lg(Tg,Xg,Mg);return Kg.putImageData(Tg,2,2),{canvas:Yg.canvas,offsetX:yg-2*Rg,offsetY:Bg-2*vg,scaleX:Rg,scaleY:vg}}getPattern(hg,Zg,wg,pg){og(hg,this._bbox);let fg;if(pg===ng.SHADING)fg=ig.Util.singularValueDecompose2dScale((0,Ig.getCurrentTransform)(hg));else if(fg=ig.Util.singularValueDecompose2dScale(Zg.baseTransform),this.matrix){const yg=ig.Util.singularValueDecompose2dScale(this.matrix);fg=[fg[0]*yg[0],fg[1]*yg[1]]}const Gg=this._createMeshCanvas(fg,pg===ng.SHADING?null:this._background,Zg.cachedCanvases);return pg!==ng.SHADING&&(hg.setTransform(...Zg.baseTransform),this.matrix&&hg.transform(...this.matrix)),hg.translate(Gg.offsetX,Gg.offsetY),hg.scale(Gg.scaleX,Gg.scaleY),hg.createPattern(Gg.canvas,"no-repeat")}}class cg extends ag{getPattern(){return"hotpink"}}function rg(mg){switch(mg[0]){case"RadialAxial":return new sg(mg);case"Mesh":return new Ag(mg);case"Dummy":return new cg}throw new Error(`Unknown IR type: ${mg[0]}`)}const ug={COLORED:1,UNCOLORED:2},bg=class bg{constructor(hg,Zg,wg,pg,fg){this.operatorList=hg[2],this.matrix=hg[3]||[1,0,0,1,0,0],this.bbox=hg[4],this.xstep=hg[5],this.ystep=hg[6],this.paintType=hg[7],this.tilingType=hg[8],this.color=Zg,this.ctx=wg,this.canvasGraphicsFactory=pg,this.baseTransform=fg}createPatternCanvas(hg){const Zg=this.operatorList,wg=this.bbox,pg=this.xstep,fg=this.ystep,Gg=this.paintType,yg=this.tilingType,Bg=this.color,Wg=this.canvasGraphicsFactory;(0,ig.info)("TilingType: "+yg);const $g=wg[0],Ng=wg[1],Vg=wg[2],Rg=wg[3],vg=ig.Util.singularValueDecompose2dScale(this.matrix),Mg=ig.Util.singularValueDecompose2dScale(this.baseTransform),kg=[vg[0]*Mg[0],vg[1]*Mg[1]],Sg=this.getSizeAndScale(pg,this.ctx.canvas.width,kg[0]),Yg=this.getSizeAndScale(fg,this.ctx.canvas.height,kg[1]),Kg=hg.cachedCanvases.getCanvas("pattern",Sg.size,Yg.size,!0),Tg=Kg.context,xg=Wg.createCanvasGraphics(Tg);xg.groupLevel=hg.groupLevel,this.setFillAndStrokeStyleToContext(xg,Gg,Bg);let Xg=$g,jg=Ng,zg=Vg,Qg=Rg;return $g<0&&(Xg=0,zg+=Math.abs($g)),Ng<0&&(jg=0,Qg+=Math.abs(Ng)),Tg.translate(-(Sg.scale*Xg),-(Yg.scale*jg)),xg.transform(Sg.scale,0,0,Yg.scale,0,0),Tg.save(),this.clipBbox(xg,Xg,jg,zg,Qg),xg.baseTransform=(0,Ig.getCurrentTransform)(xg.ctx),xg.executeOperatorList(Zg),xg.endDrawing(),{canvas:Kg.canvas,scaleX:Sg.scale,scaleY:Yg.scale,offsetX:Xg,offsetY:jg}}getSizeAndScale(hg,Zg,wg){hg=Math.abs(hg);const pg=Math.max(bg.MAX_PATTERN_SIZE,Zg);let fg=Math.ceil(hg*wg);return fg>=pg?fg=pg:wg=fg/hg,{scale:wg,size:fg}}clipBbox(hg,Zg,wg,pg,fg){const Gg=pg-Zg,yg=fg-wg;hg.ctx.rect(Zg,wg,Gg,yg),hg.current.updateRectMinMax((0,Ig.getCurrentTransform)(hg.ctx),[Zg,wg,pg,fg]),hg.clip(),hg.endPath()}setFillAndStrokeStyleToContext(hg,Zg,wg){const pg=hg.ctx,fg=hg.current;switch(Zg){case ug.COLORED:const Gg=this.ctx;pg.fillStyle=Gg.fillStyle,pg.strokeStyle=Gg.strokeStyle,fg.fillColor=Gg.fillStyle,fg.strokeColor=Gg.strokeStyle;break;case ug.UNCOLORED:const yg=ig.Util.makeHexColor(wg[0],wg[1],wg[2]);pg.fillStyle=yg,pg.strokeStyle=yg,fg.fillColor=yg,fg.strokeColor=yg;break;default:throw new ig.FormatError(`Unsupported paint type: ${Zg}`)}}getPattern(hg,Zg,wg,pg){let fg=wg;pg!==ng.SHADING&&(fg=ig.Util.transform(fg,Zg.baseTransform),this.matrix&&(fg=ig.Util.transform(fg,this.matrix)));const Gg=this.createPatternCanvas(Zg);let yg=new DOMMatrix(fg);yg=yg.translate(Gg.offsetX,Gg.offsetY),yg=yg.scale(1/Gg.scaleX,1/Gg.scaleY);const Bg=hg.createPattern(Gg.canvas,"repeat");return Bg.setTransform(yg),Bg}};el(bg,"MAX_PATTERN_SIZE",3e3);let dg=bg;eg.TilingPattern=dg}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.convertBlackAndWhiteToRGBA=ng,eg.convertToRGBA=Ig,eg.grayToRGBA=ag;var ig=gg(1);function Ig(sg){switch(sg.kind){case ig.ImageKind.GRAYSCALE_1BPP:return ng(sg);case ig.ImageKind.RGB_24BPP:return og(sg)}return null}function ng({src:sg,srcPos:Cg=0,dest:lg,width:Ag,height:cg,nonBlackColor:rg=4294967295,inverseDecode:ug=!1}){const dg=ig.FeatureTest.isLittleEndian?4278190080:255,[bg,mg]=ug?[rg,dg]:[dg,rg],hg=Ag>>3,Zg=Ag&7,wg=sg.length;lg=new Uint32Array(lg.buffer);let pg=0;for(let fg=0;fg<cg;fg++){for(const yg=Cg+hg;Cg<yg;Cg++){const Bg=Cg<wg?sg[Cg]:255;lg[pg++]=Bg&128?mg:bg,lg[pg++]=Bg&64?mg:bg,lg[pg++]=Bg&32?mg:bg,lg[pg++]=Bg&16?mg:bg,lg[pg++]=Bg&8?mg:bg,lg[pg++]=Bg&4?mg:bg,lg[pg++]=Bg&2?mg:bg,lg[pg++]=Bg&1?mg:bg}if(Zg===0)continue;const Gg=Cg<wg?sg[Cg++]:255;for(let yg=0;yg<Zg;yg++)lg[pg++]=Gg&1<<7-yg?mg:bg}return{srcPos:Cg,destPos:pg}}function og({src:sg,srcPos:Cg=0,dest:lg,destPos:Ag=0,width:cg,height:rg}){let ug=0;const dg=sg.length>>2,bg=new Uint32Array(sg.buffer,Cg,dg);if(ig.FeatureTest.isLittleEndian){for(;ug<dg-2;ug+=3,Ag+=4){const mg=bg[ug],hg=bg[ug+1],Zg=bg[ug+2];lg[Ag]=mg|4278190080,lg[Ag+1]=mg>>>24|hg<<8|4278190080,lg[Ag+2]=hg>>>16|Zg<<16|4278190080,lg[Ag+3]=Zg>>>8|4278190080}for(let mg=ug*4,hg=sg.length;mg<hg;mg+=3)lg[Ag++]=sg[mg]|sg[mg+1]<<8|sg[mg+2]<<16|4278190080}else{for(;ug<dg-2;ug+=3,Ag+=4){const mg=bg[ug],hg=bg[ug+1],Zg=bg[ug+2];lg[Ag]=mg|255,lg[Ag+1]=mg<<24|hg>>>8|255,lg[Ag+2]=hg<<16|Zg>>>16|255,lg[Ag+3]=Zg<<8|255}for(let mg=ug*4,hg=sg.length;mg<hg;mg+=3)lg[Ag++]=sg[mg]<<24|sg[mg+1]<<16|sg[mg+2]<<8|255}return{srcPos:Cg,destPos:Ag}}function ag(sg,Cg){if(ig.FeatureTest.isLittleEndian)for(let lg=0,Ag=sg.length;lg<Ag;lg++)Cg[lg]=sg[lg]*65793|4278190080;else for(let lg=0,Ag=sg.length;lg<Ag;lg++)Cg[lg]=sg[lg]*16843008|255}}),((tg,eg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.GlobalWorkerOptions=void 0;const gg=Object.create(null);eg.GlobalWorkerOptions=gg,gg.workerPort=null,gg.workerSrc=""}),((tg,eg,gg)=>{var sg,zb,Tb,Pd;Object.defineProperty(eg,"__esModule",{value:!0}),eg.MessageHandler=void 0;var ig=gg(1);const Ig={DATA:1,ERROR:2},ng={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function og(cg){switch(cg instanceof Error||typeof cg=="object"&&cg!==null||(0,ig.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),cg.name){case"AbortException":return new ig.AbortException(cg.message);case"MissingPDFException":return new ig.MissingPDFException(cg.message);case"PasswordException":return new ig.PasswordException(cg.message,cg.code);case"UnexpectedResponseException":return new ig.UnexpectedResponseException(cg.message,cg.status);case"UnknownErrorException":return new ig.UnknownErrorException(cg.message,cg.details);default:return new ig.UnknownErrorException(cg.message,cg.toString())}}class ag{constructor(rg,ug,dg){JI(this,sg);this.sourceName=rg,this.targetName=ug,this.comObj=dg,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=bg=>{const mg=bg.data;if(mg.targetName!==this.sourceName)return;if(mg.stream){zI(this,sg,Tb).call(this,mg);return}if(mg.callback){const Zg=mg.callbackId,wg=this.callbackCapabilities[Zg];if(!wg)throw new Error(`Cannot resolve callback ${Zg}`);if(delete this.callbackCapabilities[Zg],mg.callback===Ig.DATA)wg.resolve(mg.data);else if(mg.callback===Ig.ERROR)wg.reject(og(mg.reason));else throw new Error("Unexpected callback case");return}const hg=this.actionHandler[mg.action];if(!hg)throw new Error(`Unknown action from worker: ${mg.action}`);if(mg.callbackId){const Zg=this.sourceName,wg=mg.sourceName;new Promise(function(pg){pg(hg(mg.data))}).then(function(pg){dg.postMessage({sourceName:Zg,targetName:wg,callback:Ig.DATA,callbackId:mg.callbackId,data:pg})},function(pg){dg.postMessage({sourceName:Zg,targetName:wg,callback:Ig.ERROR,callbackId:mg.callbackId,reason:og(pg)})});return}if(mg.streamId){zI(this,sg,zb).call(this,mg);return}hg(mg.data)},dg.addEventListener("message",this._onComObjOnMessage)}on(rg,ug){const dg=this.actionHandler;if(dg[rg])throw new Error(`There is already an actionName called "${rg}"`);dg[rg]=ug}send(rg,ug,dg){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:rg,data:ug},dg)}sendWithPromise(rg,ug,dg){const bg=this.callbackId++,mg=new ig.PromiseCapability;this.callbackCapabilities[bg]=mg;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:rg,callbackId:bg,data:ug},dg)}catch(hg){mg.reject(hg)}return mg.promise}sendWithStream(rg,ug,dg,bg){const mg=this.streamId++,hg=this.sourceName,Zg=this.targetName,wg=this.comObj;return new ReadableStream({start:pg=>{const fg=new ig.PromiseCapability;return this.streamControllers[mg]={controller:pg,startCall:fg,pullCall:null,cancelCall:null,isClosed:!1},wg.postMessage({sourceName:hg,targetName:Zg,action:rg,streamId:mg,data:ug,desiredSize:pg.desiredSize},bg),fg.promise},pull:pg=>{const fg=new ig.PromiseCapability;return this.streamControllers[mg].pullCall=fg,wg.postMessage({sourceName:hg,targetName:Zg,stream:ng.PULL,streamId:mg,desiredSize:pg.desiredSize}),fg.promise},cancel:pg=>{(0,ig.assert)(pg instanceof Error,"cancel must have a valid reason");const fg=new ig.PromiseCapability;return this.streamControllers[mg].cancelCall=fg,this.streamControllers[mg].isClosed=!0,wg.postMessage({sourceName:hg,targetName:Zg,stream:ng.CANCEL,streamId:mg,reason:og(pg)}),fg.promise}},dg)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}sg=new WeakSet,zb=function(rg){const ug=rg.streamId,dg=this.sourceName,bg=rg.sourceName,mg=this.comObj,hg=this,Zg=this.actionHandler[rg.action],wg={enqueue(pg,fg=1,Gg){if(this.isCancelled)return;const yg=this.desiredSize;this.desiredSize-=fg,yg>0&&this.desiredSize<=0&&(this.sinkCapability=new ig.PromiseCapability,this.ready=this.sinkCapability.promise),mg.postMessage({sourceName:dg,targetName:bg,stream:ng.ENQUEUE,streamId:ug,chunk:pg},Gg)},close(){this.isCancelled||(this.isCancelled=!0,mg.postMessage({sourceName:dg,targetName:bg,stream:ng.CLOSE,streamId:ug}),delete hg.streamSinks[ug])},error(pg){(0,ig.assert)(pg instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,mg.postMessage({sourceName:dg,targetName:bg,stream:ng.ERROR,streamId:ug,reason:og(pg)}))},sinkCapability:new ig.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:rg.desiredSize,ready:null};wg.sinkCapability.resolve(),wg.ready=wg.sinkCapability.promise,this.streamSinks[ug]=wg,new Promise(function(pg){pg(Zg(rg.data,wg))}).then(function(){mg.postMessage({sourceName:dg,targetName:bg,stream:ng.START_COMPLETE,streamId:ug,success:!0})},function(pg){mg.postMessage({sourceName:dg,targetName:bg,stream:ng.START_COMPLETE,streamId:ug,reason:og(pg)})})},Tb=function(rg){const ug=rg.streamId,dg=this.sourceName,bg=rg.sourceName,mg=this.comObj,hg=this.streamControllers[ug],Zg=this.streamSinks[ug];switch(rg.stream){case ng.START_COMPLETE:rg.success?hg.startCall.resolve():hg.startCall.reject(og(rg.reason));break;case ng.PULL_COMPLETE:rg.success?hg.pullCall.resolve():hg.pullCall.reject(og(rg.reason));break;case ng.PULL:if(!Zg){mg.postMessage({sourceName:dg,targetName:bg,stream:ng.PULL_COMPLETE,streamId:ug,success:!0});break}Zg.desiredSize<=0&&rg.desiredSize>0&&Zg.sinkCapability.resolve(),Zg.desiredSize=rg.desiredSize,new Promise(function(wg){var pg;wg((pg=Zg.onPull)==null?void 0:pg.call(Zg))}).then(function(){mg.postMessage({sourceName:dg,targetName:bg,stream:ng.PULL_COMPLETE,streamId:ug,success:!0})},function(wg){mg.postMessage({sourceName:dg,targetName:bg,stream:ng.PULL_COMPLETE,streamId:ug,reason:og(wg)})});break;case ng.ENQUEUE:if((0,ig.assert)(hg,"enqueue should have stream controller"),hg.isClosed)break;hg.controller.enqueue(rg.chunk);break;case ng.CLOSE:if((0,ig.assert)(hg,"close should have stream controller"),hg.isClosed)break;hg.isClosed=!0,hg.controller.close(),zI(this,sg,Pd).call(this,hg,ug);break;case ng.ERROR:(0,ig.assert)(hg,"error should have stream controller"),hg.controller.error(og(rg.reason)),zI(this,sg,Pd).call(this,hg,ug);break;case ng.CANCEL_COMPLETE:rg.success?hg.cancelCall.resolve():hg.cancelCall.reject(og(rg.reason)),zI(this,sg,Pd).call(this,hg,ug);break;case ng.CANCEL:if(!Zg)break;new Promise(function(wg){var pg;wg((pg=Zg.onCancel)==null?void 0:pg.call(Zg,og(rg.reason)))}).then(function(){mg.postMessage({sourceName:dg,targetName:bg,stream:ng.CANCEL_COMPLETE,streamId:ug,success:!0})},function(wg){mg.postMessage({sourceName:dg,targetName:bg,stream:ng.CANCEL_COMPLETE,streamId:ug,reason:og(wg)})}),Zg.sinkCapability.reject(og(rg.reason)),Zg.isCancelled=!0,delete this.streamSinks[ug];break;default:throw new Error("Unexpected stream case")}},Pd=async function(rg,ug){var dg,bg,mg;await Promise.allSettled([(dg=rg.startCall)==null?void 0:dg.promise,(bg=rg.pullCall)==null?void 0:bg.promise,(mg=rg.cancelCall)==null?void 0:mg.promise]),delete this.streamControllers[ug]},eg.MessageHandler=ag}),((tg,eg,gg)=>{var ng,og;Object.defineProperty(eg,"__esModule",{value:!0}),eg.Metadata=void 0;var ig=gg(1);class Ig{constructor({parsedData:sg,rawData:Cg}){JI(this,ng);JI(this,og);EI(this,ng,sg),EI(this,og,Cg)}getRaw(){return aI(this,og)}get(sg){return aI(this,ng).get(sg)??null}getAll(){return(0,ig.objectFromMap)(aI(this,ng))}has(sg){return aI(this,ng).has(sg)}}ng=new WeakMap,og=new WeakMap,eg.Metadata=Ig}),((tg,eg,gg)=>{var sg,Cg,lg,Ag,cg,rg,Nu;Object.defineProperty(eg,"__esModule",{value:!0}),eg.OptionalContentConfig=void 0;var ig=gg(1),Ig=gg(8);const ng=Symbol("INTERNAL");class og{constructor(bg,mg){JI(this,sg,!0);this.name=bg,this.intent=mg}get visible(){return aI(this,sg)}_setVisible(bg,mg){bg!==ng&&(0,ig.unreachable)("Internal method `_setVisible` called."),EI(this,sg,mg)}}sg=new WeakMap;class ag{constructor(bg){JI(this,rg);JI(this,Cg,null);JI(this,lg,new Map);JI(this,Ag,null);JI(this,cg,null);if(this.name=null,this.creator=null,bg!==null){this.name=bg.name,this.creator=bg.creator,EI(this,cg,bg.order);for(const mg of bg.groups)aI(this,lg).set(mg.id,new og(mg.name,mg.intent));if(bg.baseState==="OFF")for(const mg of aI(this,lg).values())mg._setVisible(ng,!1);for(const mg of bg.on)aI(this,lg).get(mg)._setVisible(ng,!0);for(const mg of bg.off)aI(this,lg).get(mg)._setVisible(ng,!1);EI(this,Ag,this.getHash())}}isVisible(bg){if(aI(this,lg).size===0)return!0;if(!bg)return(0,ig.warn)("Optional content group not defined."),!0;if(bg.type==="OCG")return aI(this,lg).has(bg.id)?aI(this,lg).get(bg.id).visible:((0,ig.warn)(`Optional content group not found: ${bg.id}`),!0);if(bg.type==="OCMD"){if(bg.expression)return zI(this,rg,Nu).call(this,bg.expression);if(!bg.policy||bg.policy==="AnyOn"){for(const mg of bg.ids){if(!aI(this,lg).has(mg))return(0,ig.warn)(`Optional content group not found: ${mg}`),!0;if(aI(this,lg).get(mg).visible)return!0}return!1}else if(bg.policy==="AllOn"){for(const mg of bg.ids){if(!aI(this,lg).has(mg))return(0,ig.warn)(`Optional content group not found: ${mg}`),!0;if(!aI(this,lg).get(mg).visible)return!1}return!0}else if(bg.policy==="AnyOff"){for(const mg of bg.ids){if(!aI(this,lg).has(mg))return(0,ig.warn)(`Optional content group not found: ${mg}`),!0;if(!aI(this,lg).get(mg).visible)return!0}return!1}else if(bg.policy==="AllOff"){for(const mg of bg.ids){if(!aI(this,lg).has(mg))return(0,ig.warn)(`Optional content group not found: ${mg}`),!0;if(aI(this,lg).get(mg).visible)return!1}return!0}return(0,ig.warn)(`Unknown optional content policy ${bg.policy}.`),!0}return(0,ig.warn)(`Unknown group type ${bg.type}.`),!0}setVisibility(bg,mg=!0){if(!aI(this,lg).has(bg)){(0,ig.warn)(`Optional content group not found: ${bg}`);return}aI(this,lg).get(bg)._setVisible(ng,!!mg),EI(this,Cg,null)}get hasInitialVisibility(){return aI(this,Ag)===null||this.getHash()===aI(this,Ag)}getOrder(){return aI(this,lg).size?aI(this,cg)?aI(this,cg).slice():[...aI(this,lg).keys()]:null}getGroups(){return aI(this,lg).size>0?(0,ig.objectFromMap)(aI(this,lg)):null}getGroup(bg){return aI(this,lg).get(bg)||null}getHash(){if(aI(this,Cg)!==null)return aI(this,Cg);const bg=new Ig.MurmurHash3_64;for(const[mg,hg]of aI(this,lg))bg.update(`${mg}:${hg.visible}`);return EI(this,Cg,bg.hexdigest())}}Cg=new WeakMap,lg=new WeakMap,Ag=new WeakMap,cg=new WeakMap,rg=new WeakSet,Nu=function(bg){const mg=bg.length;if(mg<2)return!0;const hg=bg[0];for(let Zg=1;Zg<mg;Zg++){const wg=bg[Zg];let pg;if(Array.isArray(wg))pg=zI(this,rg,Nu).call(this,wg);else if(aI(this,lg).has(wg))pg=aI(this,lg).get(wg).visible;else return(0,ig.warn)(`Optional content group not found: ${wg}`),!0;switch(hg){case"And":if(!pg)return!1;break;case"Or":if(pg)return!0;break;case"Not":return!pg;default:return!0}}return hg==="And"},eg.OptionalContentConfig=ag}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.PDFDataTransportStream=void 0;var ig=gg(1),Ig=gg(6);class ng{constructor({length:Cg,initialData:lg,progressiveDone:Ag=!1,contentDispositionFilename:cg=null,disableRange:rg=!1,disableStream:ug=!1},dg){if((0,ig.assert)(dg,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=Ag,this._contentDispositionFilename=cg,(lg==null?void 0:lg.length)>0){const bg=lg instanceof Uint8Array&&lg.byteLength===lg.buffer.byteLength?lg.buffer:new Uint8Array(lg).buffer;this._queuedChunks.push(bg)}this._pdfDataRangeTransport=dg,this._isStreamingSupported=!ug,this._isRangeSupported=!rg,this._contentLength=Cg,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((bg,mg)=>{this._onReceiveData({begin:bg,chunk:mg})}),this._pdfDataRangeTransport.addProgressListener((bg,mg)=>{this._onProgress({loaded:bg,total:mg})}),this._pdfDataRangeTransport.addProgressiveReadListener(bg=>{this._onReceiveData({chunk:bg})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:Cg,chunk:lg}){const Ag=lg instanceof Uint8Array&&lg.byteLength===lg.buffer.byteLength?lg.buffer:new Uint8Array(lg).buffer;if(Cg===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(Ag):this._queuedChunks.push(Ag);else{const cg=this._rangeReaders.some(function(rg){return rg._begin!==Cg?!1:(rg._enqueue(Ag),!0)});(0,ig.assert)(cg,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var Cg;return((Cg=this._fullRequestReader)==null?void 0:Cg._loaded)??0}_onProgress(Cg){var lg,Ag,cg,rg;Cg.total===void 0?(Ag=(lg=this._rangeReaders[0])==null?void 0:lg.onProgress)==null||Ag.call(lg,{loaded:Cg.loaded}):(rg=(cg=this._fullRequestReader)==null?void 0:cg.onProgress)==null||rg.call(cg,{loaded:Cg.loaded,total:Cg.total})}_onProgressiveDone(){var Cg;(Cg=this._fullRequestReader)==null||Cg.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(Cg){const lg=this._rangeReaders.indexOf(Cg);lg>=0&&this._rangeReaders.splice(lg,1)}getFullReader(){(0,ig.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const Cg=this._queuedChunks;return this._queuedChunks=null,new og(this,Cg,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(Cg,lg){if(lg<=this._progressiveDataLength)return null;const Ag=new ag(this,Cg,lg);return this._pdfDataRangeTransport.requestDataRange(Cg,lg),this._rangeReaders.push(Ag),Ag}cancelAllRequests(Cg){var lg;(lg=this._fullRequestReader)==null||lg.cancel(Cg);for(const Ag of this._rangeReaders.slice(0))Ag.cancel(Cg);this._pdfDataRangeTransport.abort()}}eg.PDFDataTransportStream=ng;class og{constructor(Cg,lg,Ag=!1,cg=null){this._stream=Cg,this._done=Ag||!1,this._filename=(0,Ig.isPdfFile)(cg)?cg:null,this._queuedChunks=lg||[],this._loaded=0;for(const rg of this._queuedChunks)this._loaded+=rg.byteLength;this._requests=[],this._headersReady=Promise.resolve(),Cg._fullRequestReader=this,this.onProgress=null}_enqueue(Cg){this._done||(this._requests.length>0?this._requests.shift().resolve({value:Cg,done:!1}):this._queuedChunks.push(Cg),this._loaded+=Cg.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 Cg=new ig.PromiseCapability;return this._requests.push(Cg),Cg.promise}cancel(Cg){this._done=!0;for(const lg of this._requests)lg.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class ag{constructor(Cg,lg,Ag){this._stream=Cg,this._begin=lg,this._end=Ag,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(Cg){if(!this._done){if(this._requests.length===0)this._queuedChunk=Cg;else{this._requests.shift().resolve({value:Cg,done:!1});for(const Ag of this._requests)Ag.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 lg=this._queuedChunk;return this._queuedChunk=null,{value:lg,done:!1}}if(this._done)return{value:void 0,done:!0};const Cg=new ig.PromiseCapability;return this._requests.push(Cg),Cg.promise}cancel(Cg){this._done=!0;for(const lg of this._requests)lg.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.PDFFetchStream=void 0;var ig=gg(1),Ig=gg(20);function ng(Ag,cg,rg){return{method:"GET",headers:Ag,signal:rg.signal,mode:"cors",credentials:cg?"include":"same-origin",redirect:"follow"}}function og(Ag){const cg=new Headers;for(const rg in Ag){const ug=Ag[rg];ug!==void 0&&cg.append(rg,ug)}return cg}function ag(Ag){return Ag instanceof Uint8Array?Ag.buffer:Ag instanceof ArrayBuffer?Ag:((0,ig.warn)(`getArrayBuffer - unexpected data format: ${Ag}`),new Uint8Array(Ag).buffer)}class sg{constructor(cg){this.source=cg,this.isHttp=/^https?:/i.test(cg.url),this.httpHeaders=this.isHttp&&cg.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var cg;return((cg=this._fullRequestReader)==null?void 0:cg._loaded)??0}getFullReader(){return(0,ig.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Cg(this),this._fullRequestReader}getRangeReader(cg,rg){if(rg<=this._progressiveDataLength)return null;const ug=new lg(this,cg,rg);return this._rangeRequestReaders.push(ug),ug}cancelAllRequests(cg){var rg;(rg=this._fullRequestReader)==null||rg.cancel(cg);for(const ug of this._rangeRequestReaders.slice(0))ug.cancel(cg)}}eg.PDFFetchStream=sg;class Cg{constructor(cg){this._stream=cg,this._reader=null,this._loaded=0,this._filename=null;const rg=cg.source;this._withCredentials=rg.withCredentials||!1,this._contentLength=rg.length,this._headersCapability=new ig.PromiseCapability,this._disableRange=rg.disableRange||!1,this._rangeChunkSize=rg.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!rg.disableStream,this._isRangeSupported=!rg.disableRange,this._headers=og(this._stream.httpHeaders);const ug=rg.url;fetch(ug,ng(this._headers,this._withCredentials,this._abortController)).then(dg=>{if(!(0,Ig.validateResponseStatus)(dg.status))throw(0,Ig.createResponseStatusError)(dg.status,ug);this._reader=dg.body.getReader(),this._headersCapability.resolve();const bg=Zg=>dg.headers.get(Zg),{allowRangeRequests:mg,suggestedLength:hg}=(0,Ig.validateRangeRequestCapabilities)({getResponseHeader:bg,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=mg,this._contentLength=hg||this._contentLength,this._filename=(0,Ig.extractFilenameFromHeader)(bg),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ig.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var ug;await this._headersCapability.promise;const{value:cg,done:rg}=await this._reader.read();return rg?{value:cg,done:rg}:(this._loaded+=cg.byteLength,(ug=this.onProgress)==null||ug.call(this,{loaded:this._loaded,total:this._contentLength}),{value:ag(cg),done:!1})}cancel(cg){var rg;(rg=this._reader)==null||rg.cancel(cg),this._abortController.abort()}}class lg{constructor(cg,rg,ug){this._stream=cg,this._reader=null,this._loaded=0;const dg=cg.source;this._withCredentials=dg.withCredentials||!1,this._readCapability=new ig.PromiseCapability,this._isStreamingSupported=!dg.disableStream,this._abortController=new AbortController,this._headers=og(this._stream.httpHeaders),this._headers.append("Range",`bytes=${rg}-${ug-1}`);const bg=dg.url;fetch(bg,ng(this._headers,this._withCredentials,this._abortController)).then(mg=>{if(!(0,Ig.validateResponseStatus)(mg.status))throw(0,Ig.createResponseStatusError)(mg.status,bg);this._readCapability.resolve(),this._reader=mg.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var ug;await this._readCapability.promise;const{value:cg,done:rg}=await this._reader.read();return rg?{value:cg,done:rg}:(this._loaded+=cg.byteLength,(ug=this.onProgress)==null||ug.call(this,{loaded:this._loaded}),{value:ag(cg),done:!1})}cancel(cg){var rg;(rg=this._reader)==null||rg.cancel(cg),this._abortController.abort()}}}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.createResponseStatusError=sg,eg.extractFilenameFromHeader=ag,eg.validateRangeRequestCapabilities=og,eg.validateResponseStatus=Cg;var ig=gg(1),Ig=gg(21),ng=gg(6);function og({getResponseHeader:lg,isHttp:Ag,rangeChunkSize:cg,disableRange:rg}){const ug={allowRangeRequests:!1,suggestedLength:void 0},dg=parseInt(lg("Content-Length"),10);return!Number.isInteger(dg)||(ug.suggestedLength=dg,dg<=2*cg)||rg||!Ag||lg("Accept-Ranges")!=="bytes"||(lg("Content-Encoding")||"identity")!=="identity"||(ug.allowRangeRequests=!0),ug}function ag(lg){const Ag=lg("Content-Disposition");if(Ag){let cg=(0,Ig.getFilenameFromContentDispositionHeader)(Ag);if(cg.includes("%"))try{cg=decodeURIComponent(cg)}catch{}if((0,ng.isPdfFile)(cg))return cg}return null}function sg(lg,Ag){return lg===404||lg===0&&Ag.startsWith("file:")?new ig.MissingPDFException('Missing PDF "'+Ag+'".'):new ig.UnexpectedResponseException(`Unexpected server response (${lg}) while retrieving PDF "${Ag}".`,lg)}function Cg(lg){return lg===200||lg===206}}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.getFilenameFromContentDispositionHeader=Ig;var ig=gg(1);function Ig(ng){let og=!0,ag=sg("filename\\*","i").exec(ng);if(ag){ag=ag[1];let dg=cg(ag);return dg=unescape(dg),dg=rg(dg),dg=ug(dg),lg(dg)}if(ag=Ag(ng),ag){const dg=ug(ag);return lg(dg)}if(ag=sg("filename","i").exec(ng),ag){ag=ag[1];let dg=cg(ag);return dg=ug(dg),lg(dg)}function sg(dg,bg){return new RegExp("(?:^|;)\\s*"+dg+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',bg)}function Cg(dg,bg){if(dg){if(!/^[\x00-\xFF]+$/.test(bg))return bg;try{const mg=new TextDecoder(dg,{fatal:!0}),hg=(0,ig.stringToBytes)(bg);bg=mg.decode(hg),og=!1}catch{}}return bg}function lg(dg){return og&&/[\x80-\xff]/.test(dg)&&(dg=Cg("utf-8",dg),og&&(dg=Cg("iso-8859-1",dg))),dg}function Ag(dg){const bg=[];let mg;const hg=sg("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(mg=hg.exec(dg))!==null;){let[,wg,pg,fg]=mg;if(wg=parseInt(wg,10),wg in bg){if(wg===0)break;continue}bg[wg]=[pg,fg]}const Zg=[];for(let wg=0;wg<bg.length&&wg in bg;++wg){let[pg,fg]=bg[wg];fg=cg(fg),pg&&(fg=unescape(fg),wg===0&&(fg=rg(fg))),Zg.push(fg)}return Zg.join("")}function cg(dg){if(dg.startsWith('"')){const bg=dg.slice(1).split('\\"');for(let mg=0;mg<bg.length;++mg){const hg=bg[mg].indexOf('"');hg!==-1&&(bg[mg]=bg[mg].slice(0,hg),bg.length=mg+1),bg[mg]=bg[mg].replaceAll(/\\(.)/g,"$1")}dg=bg.join('"')}return dg}function rg(dg){const bg=dg.indexOf("'");if(bg===-1)return dg;const mg=dg.slice(0,bg),Zg=dg.slice(bg+1).replace(/^[^']*'/,"");return Cg(mg,Zg)}function ug(dg){return!dg.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(dg)?dg:dg.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(bg,mg,hg,Zg){if(hg==="q"||hg==="Q")return Zg=Zg.replaceAll("_"," "),Zg=Zg.replaceAll(/=([0-9a-fA-F]{2})/g,function(wg,pg){return String.fromCharCode(parseInt(pg,16))}),Cg(mg,Zg);try{Zg=atob(Zg)}catch{}return Cg(mg,Zg)})}return""}}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.PDFNetworkStream=void 0;var ig=gg(1),Ig=gg(20);const ng=200,og=206;function ag(cg){const rg=cg.response;return typeof rg!="string"?rg:(0,ig.stringToBytes)(rg).buffer}class sg{constructor(rg,ug={}){this.url=rg,this.isHttp=/^https?:/i.test(rg),this.httpHeaders=this.isHttp&&ug.httpHeaders||Object.create(null),this.withCredentials=ug.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(rg,ug,dg){const bg={begin:rg,end:ug};for(const mg in dg)bg[mg]=dg[mg];return this.request(bg)}requestFull(rg){return this.request(rg)}request(rg){const ug=new XMLHttpRequest,dg=this.currXhrId++,bg=this.pendingRequests[dg]={xhr:ug};ug.open("GET",this.url),ug.withCredentials=this.withCredentials;for(const mg in this.httpHeaders){const hg=this.httpHeaders[mg];hg!==void 0&&ug.setRequestHeader(mg,hg)}return this.isHttp&&"begin"in rg&&"end"in rg?(ug.setRequestHeader("Range",`bytes=${rg.begin}-${rg.end-1}`),bg.expectedStatus=og):bg.expectedStatus=ng,ug.responseType="arraybuffer",rg.onError&&(ug.onerror=function(mg){rg.onError(ug.status)}),ug.onreadystatechange=this.onStateChange.bind(this,dg),ug.onprogress=this.onProgress.bind(this,dg),bg.onHeadersReceived=rg.onHeadersReceived,bg.onDone=rg.onDone,bg.onError=rg.onError,bg.onProgress=rg.onProgress,ug.send(null),dg}onProgress(rg,ug){var bg;const dg=this.pendingRequests[rg];dg&&((bg=dg.onProgress)==null||bg.call(dg,ug))}onStateChange(rg,ug){var wg,pg,fg;const dg=this.pendingRequests[rg];if(!dg)return;const bg=dg.xhr;if(bg.readyState>=2&&dg.onHeadersReceived&&(dg.onHeadersReceived(),delete dg.onHeadersReceived),bg.readyState!==4||!(rg in this.pendingRequests))return;if(delete this.pendingRequests[rg],bg.status===0&&this.isHttp){(wg=dg.onError)==null||wg.call(dg,bg.status);return}const mg=bg.status||ng;if(!(mg===ng&&dg.expectedStatus===og)&&mg!==dg.expectedStatus){(pg=dg.onError)==null||pg.call(dg,bg.status);return}const Zg=ag(bg);if(mg===og){const Gg=bg.getResponseHeader("Content-Range"),yg=/bytes (\d+)-(\d+)\/(\d+)/.exec(Gg);dg.onDone({begin:parseInt(yg[1],10),chunk:Zg})}else Zg?dg.onDone({begin:0,chunk:Zg}):(fg=dg.onError)==null||fg.call(dg,bg.status)}getRequestXhr(rg){return this.pendingRequests[rg].xhr}isPendingRequest(rg){return rg in this.pendingRequests}abortRequest(rg){const ug=this.pendingRequests[rg].xhr;delete this.pendingRequests[rg],ug.abort()}}class Cg{constructor(rg){this._source=rg,this._manager=new sg(rg.url,{httpHeaders:rg.httpHeaders,withCredentials:rg.withCredentials}),this._rangeChunkSize=rg.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(rg){const ug=this._rangeRequestReaders.indexOf(rg);ug>=0&&this._rangeRequestReaders.splice(ug,1)}getFullReader(){return(0,ig.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new lg(this._manager,this._source),this._fullRequestReader}getRangeReader(rg,ug){const dg=new Ag(this._manager,rg,ug);return dg.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(dg),dg}cancelAllRequests(rg){var ug;(ug=this._fullRequestReader)==null||ug.cancel(rg);for(const dg of this._rangeRequestReaders.slice(0))dg.cancel(rg)}}eg.PDFNetworkStream=Cg;class lg{constructor(rg,ug){this._manager=rg;const dg={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=ug.url,this._fullRequestId=rg.requestFull(dg),this._headersReceivedCapability=new ig.PromiseCapability,this._disableRange=ug.disableRange||!1,this._contentLength=ug.length,this._rangeChunkSize=ug.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 rg=this._fullRequestId,ug=this._manager.getRequestXhr(rg),dg=hg=>ug.getResponseHeader(hg),{allowRangeRequests:bg,suggestedLength:mg}=(0,Ig.validateRangeRequestCapabilities)({getResponseHeader:dg,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});bg&&(this._isRangeSupported=!0),this._contentLength=mg||this._contentLength,this._filename=(0,Ig.extractFilenameFromHeader)(dg),this._isRangeSupported&&this._manager.abortRequest(rg),this._headersReceivedCapability.resolve()}_onDone(rg){if(rg&&(this._requests.length>0?this._requests.shift().resolve({value:rg.chunk,done:!1}):this._cachedChunks.push(rg.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const ug of this._requests)ug.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(rg){this._storedError=(0,Ig.createResponseStatusError)(rg,this._url),this._headersReceivedCapability.reject(this._storedError);for(const ug of this._requests)ug.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(rg){var ug;(ug=this.onProgress)==null||ug.call(this,{loaded:rg.loaded,total:rg.lengthComputable?rg.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 rg=new ig.PromiseCapability;return this._requests.push(rg),rg.promise}cancel(rg){this._done=!0,this._headersReceivedCapability.reject(rg);for(const ug of this._requests)ug.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Ag{constructor(rg,ug,dg){this._manager=rg;const bg={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=rg.url,this._requestId=rg.requestRange(ug,dg,bg),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var rg;(rg=this.onClosed)==null||rg.call(this,this)}_onDone(rg){const ug=rg.chunk;this._requests.length>0?this._requests.shift().resolve({value:ug,done:!1}):this._queuedChunk=ug,this._done=!0;for(const dg of this._requests)dg.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(rg){this._storedError=(0,Ig.createResponseStatusError)(rg,this._url);for(const ug of this._requests)ug.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(rg){var ug;this.isStreamingSupported||(ug=this.onProgress)==null||ug.call(this,{loaded:rg.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const ug=this._queuedChunk;return this._queuedChunk=null,{value:ug,done:!1}}if(this._done)return{value:void 0,done:!0};const rg=new ig.PromiseCapability;return this._requests.push(rg),rg.promise}cancel(rg){this._done=!0;for(const ug of this._requests)ug.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.PDFNodeStream=void 0;var ig=gg(1),Ig=gg(20);const ng=/^file:\/\/\/[a-zA-Z]:\//;function og(dg){const bg=require$$5,mg=bg.parse(dg);return mg.protocol==="file:"||mg.host?mg:/^[a-z]:[/\\]/i.test(dg)?bg.parse(`file:///${dg}`):(mg.host||(mg.protocol="file:"),mg)}class ag{constructor(bg){this.source=bg,this.url=og(bg.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&bg.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var bg;return((bg=this._fullRequestReader)==null?void 0:bg._loaded)??0}getFullReader(){return(0,ig.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new rg(this):new Ag(this),this._fullRequestReader}getRangeReader(bg,mg){if(mg<=this._progressiveDataLength)return null;const hg=this.isFsUrl?new ug(this,bg,mg):new cg(this,bg,mg);return this._rangeRequestReaders.push(hg),hg}cancelAllRequests(bg){var mg;(mg=this._fullRequestReader)==null||mg.cancel(bg);for(const hg of this._rangeRequestReaders.slice(0))hg.cancel(bg)}}eg.PDFNodeStream=ag;class sg{constructor(bg){this._url=bg.url,this._done=!1,this._storedError=null,this.onProgress=null;const mg=bg.source;this._contentLength=mg.length,this._loaded=0,this._filename=null,this._disableRange=mg.disableRange||!1,this._rangeChunkSize=mg.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!mg.disableStream,this._isRangeSupported=!mg.disableRange,this._readableStream=null,this._readCapability=new ig.PromiseCapability,this._headersCapability=new ig.PromiseCapability}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(){var hg;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const bg=this._readableStream.read();return bg===null?(this._readCapability=new ig.PromiseCapability,this.read()):(this._loaded+=bg.length,(hg=this.onProgress)==null||hg.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(bg).buffer,done:!1})}cancel(bg){if(!this._readableStream){this._error(bg);return}this._readableStream.destroy(bg)}_error(bg){this._storedError=bg,this._readCapability.resolve()}_setReadableStream(bg){this._readableStream=bg,bg.on("readable",()=>{this._readCapability.resolve()}),bg.on("end",()=>{bg.destroy(),this._done=!0,this._readCapability.resolve()}),bg.on("error",mg=>{this._error(mg)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ig.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Cg{constructor(bg){this._url=bg.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new ig.PromiseCapability;const mg=bg.source;this._isStreamingSupported=!mg.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var hg;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const bg=this._readableStream.read();return bg===null?(this._readCapability=new ig.PromiseCapability,this.read()):(this._loaded+=bg.length,(hg=this.onProgress)==null||hg.call(this,{loaded:this._loaded}),{value:new Uint8Array(bg).buffer,done:!1})}cancel(bg){if(!this._readableStream){this._error(bg);return}this._readableStream.destroy(bg)}_error(bg){this._storedError=bg,this._readCapability.resolve()}_setReadableStream(bg){this._readableStream=bg,bg.on("readable",()=>{this._readCapability.resolve()}),bg.on("end",()=>{bg.destroy(),this._done=!0,this._readCapability.resolve()}),bg.on("error",mg=>{this._error(mg)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function lg(dg,bg){return{protocol:dg.protocol,auth:dg.auth,host:dg.hostname,port:dg.port,path:dg.path,method:"GET",headers:bg}}class Ag extends sg{constructor(bg){super(bg);const mg=hg=>{if(hg.statusCode===404){const fg=new ig.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=fg,this._headersCapability.reject(fg);return}this._headersCapability.resolve(),this._setReadableStream(hg);const Zg=fg=>this._readableStream.headers[fg.toLowerCase()],{allowRangeRequests:wg,suggestedLength:pg}=(0,Ig.validateRangeRequestCapabilities)({getResponseHeader:Zg,isHttp:bg.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=wg,this._contentLength=pg||this._contentLength,this._filename=(0,Ig.extractFilenameFromHeader)(Zg)};if(this._request=null,this._url.protocol==="http:"){const hg=require$$5;this._request=hg.request(lg(this._url,bg.httpHeaders),mg)}else{const hg=require$$5;this._request=hg.request(lg(this._url,bg.httpHeaders),mg)}this._request.on("error",hg=>{this._storedError=hg,this._headersCapability.reject(hg)}),this._request.end()}}class cg extends Cg{constructor(bg,mg,hg){super(bg),this._httpHeaders={};for(const wg in bg.httpHeaders){const pg=bg.httpHeaders[wg];pg!==void 0&&(this._httpHeaders[wg]=pg)}this._httpHeaders.Range=`bytes=${mg}-${hg-1}`;const Zg=wg=>{if(wg.statusCode===404){const pg=new ig.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=pg;return}this._setReadableStream(wg)};if(this._request=null,this._url.protocol==="http:"){const wg=require$$5;this._request=wg.request(lg(this._url,this._httpHeaders),Zg)}else{const wg=require$$5;this._request=wg.request(lg(this._url,this._httpHeaders),Zg)}this._request.on("error",wg=>{this._storedError=wg}),this._request.end()}}class rg extends sg{constructor(bg){super(bg);let mg=decodeURIComponent(this._url.path);ng.test(this._url.href)&&(mg=mg.replace(/^\//,""));const hg=require$$5;hg.lstat(mg,(Zg,wg)=>{if(Zg){Zg.code==="ENOENT"&&(Zg=new ig.MissingPDFException(`Missing PDF "${mg}".`)),this._storedError=Zg,this._headersCapability.reject(Zg);return}this._contentLength=wg.size,this._setReadableStream(hg.createReadStream(mg)),this._headersCapability.resolve()})}}class ug extends Cg{constructor(bg,mg,hg){super(bg);let Zg=decodeURIComponent(this._url.path);ng.test(this._url.href)&&(Zg=Zg.replace(/^\//,""));const wg=require$$5;this._setReadableStream(wg.createReadStream(Zg,{start:mg,end:hg-1}))}}}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.SVGGraphics=void 0;var ig=gg(6),Ig=gg(1);const ng={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},og="http://www.w3.org/XML/1998/namespace",ag="http://www.w3.org/1999/xlink",sg=["butt","round","square"],Cg=["miter","round","bevel"],lg=function(wg,pg="",fg=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!fg)return URL.createObjectURL(new Blob([wg],{type:pg}));const Gg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let yg=`data:${pg};base64,`;for(let Bg=0,Wg=wg.length;Bg<Wg;Bg+=3){const $g=wg[Bg]&255,Ng=wg[Bg+1]&255,Vg=wg[Bg+2]&255,Rg=$g>>2,vg=($g&3)<<4|Ng>>4,Mg=Bg+1<Wg?(Ng&15)<<2|Vg>>6:64,kg=Bg+2<Wg?Vg&63:64;yg+=Gg[Rg]+Gg[vg]+Gg[Mg]+Gg[kg]}return yg},Ag=(function(){const wg=new Uint8Array([137,80,78,71,13,10,26,10]),pg=12,fg=new Int32Array(256);for(let Vg=0;Vg<256;Vg++){let Rg=Vg;for(let vg=0;vg<8;vg++)Rg=Rg&1?3988292384^Rg>>1&2147483647:Rg>>1&2147483647;fg[Vg]=Rg}function Gg(Vg,Rg,vg){let Mg=-1;for(let kg=Rg;kg<vg;kg++){const Sg=(Mg^Vg[kg])&255,Yg=fg[Sg];Mg=Mg>>>8^Yg}return Mg^-1}function yg(Vg,Rg,vg,Mg){let kg=Mg;const Sg=Rg.length;vg[kg]=Sg>>24&255,vg[kg+1]=Sg>>16&255,vg[kg+2]=Sg>>8&255,vg[kg+3]=Sg&255,kg+=4,vg[kg]=Vg.charCodeAt(0)&255,vg[kg+1]=Vg.charCodeAt(1)&255,vg[kg+2]=Vg.charCodeAt(2)&255,vg[kg+3]=Vg.charCodeAt(3)&255,kg+=4,vg.set(Rg,kg),kg+=Rg.length;const Yg=Gg(vg,Mg+4,kg);vg[kg]=Yg>>24&255,vg[kg+1]=Yg>>16&255,vg[kg+2]=Yg>>8&255,vg[kg+3]=Yg&255}function Bg(Vg,Rg,vg){let Mg=1,kg=0;for(let Sg=Rg;Sg<vg;++Sg)Mg=(Mg+(Vg[Sg]&255))%65521,kg=(kg+Mg)%65521;return kg<<16|Mg}function Wg(Vg){if(!Ig.isNodeJS)return $g(Vg);try{const Rg=parseInt(process.versions.node)>=8?Vg:Buffer.from(Vg),vg=require$$5.deflateSync(Rg,{level:9});return vg instanceof Uint8Array?vg:new Uint8Array(vg)}catch(Rg){(0,Ig.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+Rg)}return $g(Vg)}function $g(Vg){let Rg=Vg.length;const vg=65535,Mg=Math.ceil(Rg/vg),kg=new Uint8Array(2+Rg+Mg*5+4);let Sg=0;kg[Sg++]=120,kg[Sg++]=156;let Yg=0;for(;Rg>vg;)kg[Sg++]=0,kg[Sg++]=255,kg[Sg++]=255,kg[Sg++]=0,kg[Sg++]=0,kg.set(Vg.subarray(Yg,Yg+vg),Sg),Sg+=vg,Yg+=vg,Rg-=vg;kg[Sg++]=1,kg[Sg++]=Rg&255,kg[Sg++]=Rg>>8&255,kg[Sg++]=~Rg&65535&255,kg[Sg++]=(~Rg&65535)>>8&255,kg.set(Vg.subarray(Yg),Sg),Sg+=Vg.length-Yg;const Kg=Bg(Vg,0,Vg.length);return kg[Sg++]=Kg>>24&255,kg[Sg++]=Kg>>16&255,kg[Sg++]=Kg>>8&255,kg[Sg++]=Kg&255,kg}function Ng(Vg,Rg,vg,Mg){const kg=Vg.width,Sg=Vg.height;let Yg,Kg,Tg;const xg=Vg.data;switch(Rg){case Ig.ImageKind.GRAYSCALE_1BPP:Kg=0,Yg=1,Tg=kg+7>>3;break;case Ig.ImageKind.RGB_24BPP:Kg=2,Yg=8,Tg=kg*3;break;case Ig.ImageKind.RGBA_32BPP:Kg=6,Yg=8,Tg=kg*4;break;default:throw new Error("invalid format")}const Xg=new Uint8Array((1+Tg)*Sg);let jg=0,zg=0;for(let dI=0;dI<Sg;++dI)Xg[jg++]=0,Xg.set(xg.subarray(zg,zg+Tg),jg),zg+=Tg,jg+=Tg;if(Rg===Ig.ImageKind.GRAYSCALE_1BPP&&Mg){jg=0;for(let dI=0;dI<Sg;dI++){jg++;for(let ZI=0;ZI<Tg;ZI++)Xg[jg++]^=255}}const Qg=new Uint8Array([kg>>24&255,kg>>16&255,kg>>8&255,kg&255,Sg>>24&255,Sg>>16&255,Sg>>8&255,Sg&255,Yg,Kg,0,0,0]),_g=Wg(Xg),gI=wg.length+pg*3+Qg.length+_g.length,AI=new Uint8Array(gI);let CI=0;return AI.set(wg,CI),CI+=wg.length,yg("IHDR",Qg,AI,CI),CI+=pg+Qg.length,yg("IDATA",_g,AI,CI),CI+=pg+_g.length,yg("IEND",new Uint8Array(0),AI,CI),lg(AI,"image/png",vg)}return function(Rg,vg,Mg){const kg=Rg.kind===void 0?Ig.ImageKind.GRAYSCALE_1BPP:Rg.kind;return Ng(Rg,kg,vg,Mg)}})();class cg{constructor(){this.fontSizeScale=1,this.fontWeight=ng.fontWeight,this.fontSize=0,this.textMatrix=Ig.IDENTITY_MATRIX,this.fontMatrix=Ig.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=Ig.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=ng.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(pg,fg){this.x=pg,this.y=fg}}function rg(wg){let pg=[];const fg=[];for(const Gg of wg){if(Gg.fn==="save"){pg.push({fnId:92,fn:"group",items:[]}),fg.push(pg),pg=pg.at(-1).items;continue}Gg.fn==="restore"?pg=fg.pop():pg.push(Gg)}return pg}function ug(wg){if(Number.isInteger(wg))return wg.toString();const pg=wg.toFixed(10);let fg=pg.length-1;if(pg[fg]!=="0")return pg;do fg--;while(pg[fg]==="0");return pg.substring(0,pg[fg]==="."?fg:fg+1)}function dg(wg){if(wg[4]===0&&wg[5]===0){if(wg[1]===0&&wg[2]===0)return wg[0]===1&&wg[3]===1?"":`scale(${ug(wg[0])} ${ug(wg[3])})`;if(wg[0]===wg[3]&&wg[1]===-wg[2]){const pg=Math.acos(wg[0])*180/Math.PI;return`rotate(${ug(pg)})`}}else if(wg[0]===1&&wg[1]===0&&wg[2]===0&&wg[3]===1)return`translate(${ug(wg[4])} ${ug(wg[5])})`;return`matrix(${ug(wg[0])} ${ug(wg[1])} ${ug(wg[2])} ${ug(wg[3])} ${ug(wg[4])} ${ug(wg[5])})`}let bg=0,mg=0,hg=0;class Zg{constructor(pg,fg,Gg=!1){(0,ig.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new ig.DOMSVGFactory,this.current=new cg,this.transformMatrix=Ig.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=pg,this.objs=fg,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!Gg,this._operatorIdMapping=[];for(const yg in Ig.OPS)this._operatorIdMapping[Ig.OPS[yg]]=yg}getObject(pg,fg=null){return typeof pg=="string"?pg.startsWith("g_")?this.commonObjs.get(pg):this.objs.get(pg):fg}save(){this.transformStack.push(this.transformMatrix);const pg=this.current;this.extraStack.push(pg),this.current=pg.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(pg){this.save(),this.executeOpTree(pg),this.restore()}loadDependencies(pg){const fg=pg.fnArray,Gg=pg.argsArray;for(let yg=0,Bg=fg.length;yg<Bg;yg++)if(fg[yg]===Ig.OPS.dependency)for(const Wg of Gg[yg]){const $g=Wg.startsWith("g_")?this.commonObjs:this.objs,Ng=new Promise(Vg=>{$g.get(Wg,Vg)});this.current.dependencies.push(Ng)}return Promise.all(this.current.dependencies)}transform(pg,fg,Gg,yg,Bg,Wg){const $g=[pg,fg,Gg,yg,Bg,Wg];this.transformMatrix=Ig.Util.transform(this.transformMatrix,$g),this.tgrp=null}getSVG(pg,fg){this.viewport=fg;const Gg=this._initialize(fg);return this.loadDependencies(pg).then(()=>(this.transformMatrix=Ig.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(pg)),Gg))}convertOpList(pg){const fg=this._operatorIdMapping,Gg=pg.argsArray,yg=pg.fnArray,Bg=[];for(let Wg=0,$g=yg.length;Wg<$g;Wg++){const Ng=yg[Wg];Bg.push({fnId:Ng,fn:fg[Ng],args:Gg[Wg]})}return rg(Bg)}executeOpTree(pg){for(const fg of pg){const Gg=fg.fn,yg=fg.fnId,Bg=fg.args;switch(yg|0){case Ig.OPS.beginText:this.beginText();break;case Ig.OPS.dependency:break;case Ig.OPS.setLeading:this.setLeading(Bg);break;case Ig.OPS.setLeadingMoveText:this.setLeadingMoveText(Bg[0],Bg[1]);break;case Ig.OPS.setFont:this.setFont(Bg);break;case Ig.OPS.showText:this.showText(Bg[0]);break;case Ig.OPS.showSpacedText:this.showText(Bg[0]);break;case Ig.OPS.endText:this.endText();break;case Ig.OPS.moveText:this.moveText(Bg[0],Bg[1]);break;case Ig.OPS.setCharSpacing:this.setCharSpacing(Bg[0]);break;case Ig.OPS.setWordSpacing:this.setWordSpacing(Bg[0]);break;case Ig.OPS.setHScale:this.setHScale(Bg[0]);break;case Ig.OPS.setTextMatrix:this.setTextMatrix(Bg[0],Bg[1],Bg[2],Bg[3],Bg[4],Bg[5]);break;case Ig.OPS.setTextRise:this.setTextRise(Bg[0]);break;case Ig.OPS.setTextRenderingMode:this.setTextRenderingMode(Bg[0]);break;case Ig.OPS.setLineWidth:this.setLineWidth(Bg[0]);break;case Ig.OPS.setLineJoin:this.setLineJoin(Bg[0]);break;case Ig.OPS.setLineCap:this.setLineCap(Bg[0]);break;case Ig.OPS.setMiterLimit:this.setMiterLimit(Bg[0]);break;case Ig.OPS.setFillRGBColor:this.setFillRGBColor(Bg[0],Bg[1],Bg[2]);break;case Ig.OPS.setStrokeRGBColor:this.setStrokeRGBColor(Bg[0],Bg[1],Bg[2]);break;case Ig.OPS.setStrokeColorN:this.setStrokeColorN(Bg);break;case Ig.OPS.setFillColorN:this.setFillColorN(Bg);break;case Ig.OPS.shadingFill:this.shadingFill(Bg[0]);break;case Ig.OPS.setDash:this.setDash(Bg[0],Bg[1]);break;case Ig.OPS.setRenderingIntent:this.setRenderingIntent(Bg[0]);break;case Ig.OPS.setFlatness:this.setFlatness(Bg[0]);break;case Ig.OPS.setGState:this.setGState(Bg[0]);break;case Ig.OPS.fill:this.fill();break;case Ig.OPS.eoFill:this.eoFill();break;case Ig.OPS.stroke:this.stroke();break;case Ig.OPS.fillStroke:this.fillStroke();break;case Ig.OPS.eoFillStroke:this.eoFillStroke();break;case Ig.OPS.clip:this.clip("nonzero");break;case Ig.OPS.eoClip:this.clip("evenodd");break;case Ig.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case Ig.OPS.paintImageXObject:this.paintImageXObject(Bg[0]);break;case Ig.OPS.paintInlineImageXObject:this.paintInlineImageXObject(Bg[0]);break;case Ig.OPS.paintImageMaskXObject:this.paintImageMaskXObject(Bg[0]);break;case Ig.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(Bg[0],Bg[1]);break;case Ig.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case Ig.OPS.closePath:this.closePath();break;case Ig.OPS.closeStroke:this.closeStroke();break;case Ig.OPS.closeFillStroke:this.closeFillStroke();break;case Ig.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case Ig.OPS.nextLine:this.nextLine();break;case Ig.OPS.transform:this.transform(Bg[0],Bg[1],Bg[2],Bg[3],Bg[4],Bg[5]);break;case Ig.OPS.constructPath:this.constructPath(Bg[0],Bg[1]);break;case Ig.OPS.endPath:this.endPath();break;case 92:this.group(fg.items);break;default:(0,Ig.warn)(`Unimplemented operator ${Gg}`);break}}}setWordSpacing(pg){this.current.wordSpacing=pg}setCharSpacing(pg){this.current.charSpacing=pg}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(pg,fg,Gg,yg,Bg,Wg){const $g=this.current;$g.textMatrix=$g.lineMatrix=[pg,fg,Gg,yg,Bg,Wg],$g.textMatrixScale=Math.hypot(pg,fg),$g.x=$g.lineX=0,$g.y=$g.lineY=0,$g.xcoords=[],$g.ycoords=[],$g.tspan=this.svgFactory.createElement("svg:tspan"),$g.tspan.setAttributeNS(null,"font-family",$g.fontFamily),$g.tspan.setAttributeNS(null,"font-size",`${ug($g.fontSize)}px`),$g.tspan.setAttributeNS(null,"y",ug(-$g.y)),$g.txtElement=this.svgFactory.createElement("svg:text"),$g.txtElement.append($g.tspan)}beginText(){const pg=this.current;pg.x=pg.lineX=0,pg.y=pg.lineY=0,pg.textMatrix=Ig.IDENTITY_MATRIX,pg.lineMatrix=Ig.IDENTITY_MATRIX,pg.textMatrixScale=1,pg.tspan=this.svgFactory.createElement("svg:tspan"),pg.txtElement=this.svgFactory.createElement("svg:text"),pg.txtgrp=this.svgFactory.createElement("svg:g"),pg.xcoords=[],pg.ycoords=[]}moveText(pg,fg){const Gg=this.current;Gg.x=Gg.lineX+=pg,Gg.y=Gg.lineY+=fg,Gg.xcoords=[],Gg.ycoords=[],Gg.tspan=this.svgFactory.createElement("svg:tspan"),Gg.tspan.setAttributeNS(null,"font-family",Gg.fontFamily),Gg.tspan.setAttributeNS(null,"font-size",`${ug(Gg.fontSize)}px`),Gg.tspan.setAttributeNS(null,"y",ug(-Gg.y))}showText(pg){const fg=this.current,Gg=fg.font,yg=fg.fontSize;if(yg===0)return;const Bg=fg.fontSizeScale,Wg=fg.charSpacing,$g=fg.wordSpacing,Ng=fg.fontDirection,Vg=fg.textHScale*Ng,Rg=Gg.vertical,vg=Rg?1:-1,Mg=Gg.defaultVMetrics,kg=yg*fg.fontMatrix[0];let Sg=0;for(const Tg of pg){if(Tg===null){Sg+=Ng*$g;continue}else if(typeof Tg=="number"){Sg+=vg*Tg*yg/1e3;continue}const xg=(Tg.isSpace?$g:0)+Wg,Xg=Tg.fontChar;let jg,zg,Qg=Tg.width;if(Rg){let gI;const AI=Tg.vmetric||Mg;gI=Tg.vmetric?AI[1]:Qg*.5,gI=-gI*kg;const CI=AI[2]*kg;Qg=AI?-AI[0]:Qg,jg=gI/Bg,zg=(Sg+CI)/Bg}else jg=Sg/Bg,zg=0;(Tg.isInFont||Gg.missingFile)&&(fg.xcoords.push(fg.x+jg),Rg&&fg.ycoords.push(-fg.y+zg),fg.tspan.textContent+=Xg);const _g=Rg?Qg*kg-xg*Ng:Qg*kg+xg*Ng;Sg+=_g}fg.tspan.setAttributeNS(null,"x",fg.xcoords.map(ug).join(" ")),Rg?fg.tspan.setAttributeNS(null,"y",fg.ycoords.map(ug).join(" ")):fg.tspan.setAttributeNS(null,"y",ug(-fg.y)),Rg?fg.y-=Sg:fg.x+=Sg*Vg,fg.tspan.setAttributeNS(null,"font-family",fg.fontFamily),fg.tspan.setAttributeNS(null,"font-size",`${ug(fg.fontSize)}px`),fg.fontStyle!==ng.fontStyle&&fg.tspan.setAttributeNS(null,"font-style",fg.fontStyle),fg.fontWeight!==ng.fontWeight&&fg.tspan.setAttributeNS(null,"font-weight",fg.fontWeight);const Yg=fg.textRenderingMode&Ig.TextRenderingMode.FILL_STROKE_MASK;if(Yg===Ig.TextRenderingMode.FILL||Yg===Ig.TextRenderingMode.FILL_STROKE?(fg.fillColor!==ng.fillColor&&fg.tspan.setAttributeNS(null,"fill",fg.fillColor),fg.fillAlpha<1&&fg.tspan.setAttributeNS(null,"fill-opacity",fg.fillAlpha)):fg.textRenderingMode===Ig.TextRenderingMode.ADD_TO_PATH?fg.tspan.setAttributeNS(null,"fill","transparent"):fg.tspan.setAttributeNS(null,"fill","none"),Yg===Ig.TextRenderingMode.STROKE||Yg===Ig.TextRenderingMode.FILL_STROKE){const Tg=1/(fg.textMatrixScale||1);this._setStrokeAttributes(fg.tspan,Tg)}let Kg=fg.textMatrix;fg.textRise!==0&&(Kg=Kg.slice(),Kg[5]+=fg.textRise),fg.txtElement.setAttributeNS(null,"transform",`${dg(Kg)} scale(${ug(Vg)}, -1)`),fg.txtElement.setAttributeNS(og,"xml:space","preserve"),fg.txtElement.append(fg.tspan),fg.txtgrp.append(fg.txtElement),this._ensureTransformGroup().append(fg.txtElement)}setLeadingMoveText(pg,fg){this.setLeading(-fg),this.moveText(pg,fg)}addFontStyle(pg){if(!pg.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const fg=lg(pg.data,pg.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${pg.loadedName}"; src: url(${fg}); }
|
|
939
939
|
`}setFont(pg){const fg=this.current,Gg=this.commonObjs.get(pg[0]);let yg=pg[1];fg.font=Gg,this.embedFonts&&!Gg.missingFile&&!this.embeddedFonts[Gg.loadedName]&&(this.addFontStyle(Gg),this.embeddedFonts[Gg.loadedName]=Gg),fg.fontMatrix=Gg.fontMatrix||Ig.FONT_IDENTITY_MATRIX;let Bg="normal";Gg.black?Bg="900":Gg.bold&&(Bg="bold");const Wg=Gg.italic?"italic":"normal";yg<0?(yg=-yg,fg.fontDirection=-1):fg.fontDirection=1,fg.fontSize=yg,fg.fontFamily=Gg.loadedName,fg.fontWeight=Bg,fg.fontStyle=Wg,fg.tspan=this.svgFactory.createElement("svg:tspan"),fg.tspan.setAttributeNS(null,"y",ug(-fg.y)),fg.xcoords=[],fg.ycoords=[]}endText(){var fg;const pg=this.current;pg.textRenderingMode&Ig.TextRenderingMode.ADD_TO_PATH_FLAG&&((fg=pg.txtElement)!=null&&fg.hasChildNodes())&&(pg.element=pg.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(pg){pg>0&&(this.current.lineWidth=pg)}setLineCap(pg){this.current.lineCap=sg[pg]}setLineJoin(pg){this.current.lineJoin=Cg[pg]}setMiterLimit(pg){this.current.miterLimit=pg}setStrokeAlpha(pg){this.current.strokeAlpha=pg}setStrokeRGBColor(pg,fg,Gg){this.current.strokeColor=Ig.Util.makeHexColor(pg,fg,Gg)}setFillAlpha(pg){this.current.fillAlpha=pg}setFillRGBColor(pg,fg,Gg){this.current.fillColor=Ig.Util.makeHexColor(pg,fg,Gg),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(pg){this.current.strokeColor=this._makeColorN_Pattern(pg)}setFillColorN(pg){this.current.fillColor=this._makeColorN_Pattern(pg)}shadingFill(pg){const{width:fg,height:Gg}=this.viewport,yg=Ig.Util.inverseTransform(this.transformMatrix),[Bg,Wg,$g,Ng]=Ig.Util.getAxialAlignedBoundingBox([0,0,fg,Gg],yg),Vg=this.svgFactory.createElement("svg:rect");Vg.setAttributeNS(null,"x",Bg),Vg.setAttributeNS(null,"y",Wg),Vg.setAttributeNS(null,"width",$g-Bg),Vg.setAttributeNS(null,"height",Ng-Wg),Vg.setAttributeNS(null,"fill",this._makeShadingPattern(pg)),this.current.fillAlpha<1&&Vg.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(Vg)}_makeColorN_Pattern(pg){return pg[0]==="TilingPattern"?this._makeTilingPattern(pg):this._makeShadingPattern(pg)}_makeTilingPattern(pg){const fg=pg[1],Gg=pg[2],yg=pg[3]||Ig.IDENTITY_MATRIX,[Bg,Wg,$g,Ng]=pg[4],Vg=pg[5],Rg=pg[6],vg=pg[7],Mg=`shading${hg++}`,[kg,Sg,Yg,Kg]=Ig.Util.normalizeRect([...Ig.Util.applyTransform([Bg,Wg],yg),...Ig.Util.applyTransform([$g,Ng],yg)]),[Tg,xg]=Ig.Util.singularValueDecompose2dScale(yg),Xg=Vg*Tg,jg=Rg*xg,zg=this.svgFactory.createElement("svg:pattern");zg.setAttributeNS(null,"id",Mg),zg.setAttributeNS(null,"patternUnits","userSpaceOnUse"),zg.setAttributeNS(null,"width",Xg),zg.setAttributeNS(null,"height",jg),zg.setAttributeNS(null,"x",`${kg}`),zg.setAttributeNS(null,"y",`${Sg}`);const Qg=this.svg,_g=this.transformMatrix,gI=this.current.fillColor,AI=this.current.strokeColor,CI=this.svgFactory.create(Yg-kg,Kg-Sg);if(this.svg=CI,this.transformMatrix=yg,vg===2){const dI=Ig.Util.makeHexColor(...fg);this.current.fillColor=dI,this.current.strokeColor=dI}return this.executeOpTree(this.convertOpList(Gg)),this.svg=Qg,this.transformMatrix=_g,this.current.fillColor=gI,this.current.strokeColor=AI,zg.append(CI.childNodes[0]),this.defs.append(zg),`url(#${Mg})`}_makeShadingPattern(pg){switch(typeof pg=="string"&&(pg=this.objs.get(pg)),pg[0]){case"RadialAxial":const fg=`shading${hg++}`,Gg=pg[3];let yg;switch(pg[1]){case"axial":const Bg=pg[4],Wg=pg[5];yg=this.svgFactory.createElement("svg:linearGradient"),yg.setAttributeNS(null,"id",fg),yg.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),yg.setAttributeNS(null,"x1",Bg[0]),yg.setAttributeNS(null,"y1",Bg[1]),yg.setAttributeNS(null,"x2",Wg[0]),yg.setAttributeNS(null,"y2",Wg[1]);break;case"radial":const $g=pg[4],Ng=pg[5],Vg=pg[6],Rg=pg[7];yg=this.svgFactory.createElement("svg:radialGradient"),yg.setAttributeNS(null,"id",fg),yg.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),yg.setAttributeNS(null,"cx",Ng[0]),yg.setAttributeNS(null,"cy",Ng[1]),yg.setAttributeNS(null,"r",Rg),yg.setAttributeNS(null,"fx",$g[0]),yg.setAttributeNS(null,"fy",$g[1]),yg.setAttributeNS(null,"fr",Vg);break;default:throw new Error(`Unknown RadialAxial type: ${pg[1]}`)}for(const Bg of Gg){const Wg=this.svgFactory.createElement("svg:stop");Wg.setAttributeNS(null,"offset",Bg[0]),Wg.setAttributeNS(null,"stop-color",Bg[1]),yg.append(Wg)}return this.defs.append(yg),`url(#${fg})`;case"Mesh":return(0,Ig.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${pg[0]}`)}}setDash(pg,fg){this.current.dashArray=pg,this.current.dashPhase=fg}constructPath(pg,fg){const Gg=this.current;let yg=Gg.x,Bg=Gg.y,Wg=[],$g=0;for(const Ng of pg)switch(Ng|0){case Ig.OPS.rectangle:yg=fg[$g++],Bg=fg[$g++];const Vg=fg[$g++],Rg=fg[$g++],vg=yg+Vg,Mg=Bg+Rg;Wg.push("M",ug(yg),ug(Bg),"L",ug(vg),ug(Bg),"L",ug(vg),ug(Mg),"L",ug(yg),ug(Mg),"Z");break;case Ig.OPS.moveTo:yg=fg[$g++],Bg=fg[$g++],Wg.push("M",ug(yg),ug(Bg));break;case Ig.OPS.lineTo:yg=fg[$g++],Bg=fg[$g++],Wg.push("L",ug(yg),ug(Bg));break;case Ig.OPS.curveTo:yg=fg[$g+4],Bg=fg[$g+5],Wg.push("C",ug(fg[$g]),ug(fg[$g+1]),ug(fg[$g+2]),ug(fg[$g+3]),ug(yg),ug(Bg)),$g+=6;break;case Ig.OPS.curveTo2:Wg.push("C",ug(yg),ug(Bg),ug(fg[$g]),ug(fg[$g+1]),ug(fg[$g+2]),ug(fg[$g+3])),yg=fg[$g+2],Bg=fg[$g+3],$g+=4;break;case Ig.OPS.curveTo3:yg=fg[$g+2],Bg=fg[$g+3],Wg.push("C",ug(fg[$g]),ug(fg[$g+1]),ug(yg),ug(Bg),ug(yg),ug(Bg)),$g+=4;break;case Ig.OPS.closePath:Wg.push("Z");break}Wg=Wg.join(" "),Gg.path&&pg.length>0&&pg[0]!==Ig.OPS.rectangle&&pg[0]!==Ig.OPS.moveTo?Wg=Gg.path.getAttributeNS(null,"d")+Wg:(Gg.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(Gg.path)),Gg.path.setAttributeNS(null,"d",Wg),Gg.path.setAttributeNS(null,"fill","none"),Gg.element=Gg.path,Gg.setCurrentPoint(yg,Bg)}endPath(){const pg=this.current;if(pg.path=null,!this.pendingClip)return;if(!pg.element){this.pendingClip=null;return}const fg=`clippath${bg++}`,Gg=this.svgFactory.createElement("svg:clipPath");Gg.setAttributeNS(null,"id",fg),Gg.setAttributeNS(null,"transform",dg(this.transformMatrix));const yg=pg.element.cloneNode(!0);if(this.pendingClip==="evenodd"?yg.setAttributeNS(null,"clip-rule","evenodd"):yg.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,Gg.append(yg),this.defs.append(Gg),pg.activeClipUrl){pg.clipGroup=null;for(const Bg of this.extraStack)Bg.clipGroup=null;Gg.setAttributeNS(null,"clip-path",pg.activeClipUrl)}pg.activeClipUrl=`url(#${fg})`,this.tgrp=null}clip(pg){this.pendingClip=pg}closePath(){const pg=this.current;if(pg.path){const fg=`${pg.path.getAttributeNS(null,"d")}Z`;pg.path.setAttributeNS(null,"d",fg)}}setLeading(pg){this.current.leading=-pg}setTextRise(pg){this.current.textRise=pg}setTextRenderingMode(pg){this.current.textRenderingMode=pg}setHScale(pg){this.current.textHScale=pg/100}setRenderingIntent(pg){}setFlatness(pg){}setGState(pg){for(const[fg,Gg]of pg)switch(fg){case"LW":this.setLineWidth(Gg);break;case"LC":this.setLineCap(Gg);break;case"LJ":this.setLineJoin(Gg);break;case"ML":this.setMiterLimit(Gg);break;case"D":this.setDash(Gg[0],Gg[1]);break;case"RI":this.setRenderingIntent(Gg);break;case"FL":this.setFlatness(Gg);break;case"Font":this.setFont(Gg);break;case"CA":this.setStrokeAlpha(Gg);break;case"ca":this.setFillAlpha(Gg);break;default:(0,Ig.warn)(`Unimplemented graphic state operator ${fg}`);break}}fill(){const pg=this.current;pg.element&&(pg.element.setAttributeNS(null,"fill",pg.fillColor),pg.element.setAttributeNS(null,"fill-opacity",pg.fillAlpha),this.endPath())}stroke(){const pg=this.current;pg.element&&(this._setStrokeAttributes(pg.element),pg.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(pg,fg=1){const Gg=this.current;let yg=Gg.dashArray;fg!==1&&yg.length>0&&(yg=yg.map(function(Bg){return fg*Bg})),pg.setAttributeNS(null,"stroke",Gg.strokeColor),pg.setAttributeNS(null,"stroke-opacity",Gg.strokeAlpha),pg.setAttributeNS(null,"stroke-miterlimit",ug(Gg.miterLimit)),pg.setAttributeNS(null,"stroke-linecap",Gg.lineCap),pg.setAttributeNS(null,"stroke-linejoin",Gg.lineJoin),pg.setAttributeNS(null,"stroke-width",ug(fg*Gg.lineWidth)+"px"),pg.setAttributeNS(null,"stroke-dasharray",yg.map(ug).join(" ")),pg.setAttributeNS(null,"stroke-dashoffset",ug(fg*Gg.dashPhase)+"px")}eoFill(){var pg;(pg=this.current.element)==null||pg.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){var pg;(pg=this.current.element)==null||pg.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const pg=this.svgFactory.createElement("svg:rect");pg.setAttributeNS(null,"x","0"),pg.setAttributeNS(null,"y","0"),pg.setAttributeNS(null,"width","1px"),pg.setAttributeNS(null,"height","1px"),pg.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(pg)}paintImageXObject(pg){const fg=this.getObject(pg);if(!fg){(0,Ig.warn)(`Dependent image with object ID ${pg} is not ready yet`);return}this.paintInlineImageXObject(fg)}paintInlineImageXObject(pg,fg){const Gg=pg.width,yg=pg.height,Bg=Ag(pg,this.forceDataSchema,!!fg),Wg=this.svgFactory.createElement("svg:rect");Wg.setAttributeNS(null,"x","0"),Wg.setAttributeNS(null,"y","0"),Wg.setAttributeNS(null,"width",ug(Gg)),Wg.setAttributeNS(null,"height",ug(yg)),this.current.element=Wg,this.clip("nonzero");const $g=this.svgFactory.createElement("svg:image");$g.setAttributeNS(ag,"xlink:href",Bg),$g.setAttributeNS(null,"x","0"),$g.setAttributeNS(null,"y",ug(-yg)),$g.setAttributeNS(null,"width",ug(Gg)+"px"),$g.setAttributeNS(null,"height",ug(yg)+"px"),$g.setAttributeNS(null,"transform",`scale(${ug(1/Gg)} ${ug(-1/yg)})`),fg?fg.append($g):this._ensureTransformGroup().append($g)}paintImageMaskXObject(pg){const fg=this.getObject(pg.data,pg);if(fg.bitmap){(0,Ig.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const Gg=this.current,yg=fg.width,Bg=fg.height,Wg=Gg.fillColor;Gg.maskId=`mask${mg++}`;const $g=this.svgFactory.createElement("svg:mask");$g.setAttributeNS(null,"id",Gg.maskId);const Ng=this.svgFactory.createElement("svg:rect");Ng.setAttributeNS(null,"x","0"),Ng.setAttributeNS(null,"y","0"),Ng.setAttributeNS(null,"width",ug(yg)),Ng.setAttributeNS(null,"height",ug(Bg)),Ng.setAttributeNS(null,"fill",Wg),Ng.setAttributeNS(null,"mask",`url(#${Gg.maskId})`),this.defs.append($g),this._ensureTransformGroup().append(Ng),this.paintInlineImageXObject(fg,$g)}paintFormXObjectBegin(pg,fg){if(Array.isArray(pg)&&pg.length===6&&this.transform(pg[0],pg[1],pg[2],pg[3],pg[4],pg[5]),fg){const Gg=fg[2]-fg[0],yg=fg[3]-fg[1],Bg=this.svgFactory.createElement("svg:rect");Bg.setAttributeNS(null,"x",fg[0]),Bg.setAttributeNS(null,"y",fg[1]),Bg.setAttributeNS(null,"width",ug(Gg)),Bg.setAttributeNS(null,"height",ug(yg)),this.current.element=Bg,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(pg){const fg=this.svgFactory.create(pg.width,pg.height),Gg=this.svgFactory.createElement("svg:defs");fg.append(Gg),this.defs=Gg;const yg=this.svgFactory.createElement("svg:g");return yg.setAttributeNS(null,"transform",dg(pg.transform)),fg.append(yg),this.svg=yg,fg}_ensureClipGroup(){if(!this.current.clipGroup){const pg=this.svgFactory.createElement("svg:g");pg.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(pg),this.current.clipGroup=pg}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",dg(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}eg.SVGGraphics=Zg}),((tg,eg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.XfaText=void 0;class gg{static textContent(Ig){const ng=[],og={items:ng,styles:Object.create(null)};function ag(sg){var Ag;if(!sg)return;let Cg=null;const lg=sg.name;if(lg==="#text")Cg=sg.value;else if(gg.shouldBuildText(lg))(Ag=sg==null?void 0:sg.attributes)!=null&&Ag.textContent?Cg=sg.attributes.textContent:sg.value&&(Cg=sg.value);else return;if(Cg!==null&&ng.push({str:Cg}),!!sg.children)for(const cg of sg.children)ag(cg)}return ag(Ig),og}static shouldBuildText(Ig){return!(Ig==="textarea"||Ig==="input"||Ig==="option"||Ig==="select")}}eg.XfaText=gg}),((tg,eg,gg)=>{Object.defineProperty(eg,"__esModule",{value:!0}),eg.TextLayerRenderTask=void 0,eg.renderTextLayer=dg,eg.updateTextLayer=bg;var ig=gg(1),Ig=gg(6);const ng=1e5,og=30,ag=.8,sg=new Map;function Cg(mg,hg){let Zg;if(hg&&ig.FeatureTest.isOffscreenCanvasSupported)Zg=new OffscreenCanvas(mg,mg).getContext("2d",{alpha:!1});else{const wg=document.createElement("canvas");wg.width=wg.height=mg,Zg=wg.getContext("2d",{alpha:!1})}return Zg}function lg(mg,hg){const Zg=sg.get(mg);if(Zg)return Zg;const wg=Cg(og,hg);wg.font=`${og}px ${mg}`;const pg=wg.measureText("");let fg=pg.fontBoundingBoxAscent,Gg=Math.abs(pg.fontBoundingBoxDescent);if(fg){const Bg=fg/(fg+Gg);return sg.set(mg,Bg),wg.canvas.width=wg.canvas.height=0,Bg}wg.strokeStyle="red",wg.clearRect(0,0,og,og),wg.strokeText("g",0,0);let yg=wg.getImageData(0,0,og,og).data;Gg=0;for(let Bg=yg.length-1-3;Bg>=0;Bg-=4)if(yg[Bg]>0){Gg=Math.ceil(Bg/4/og);break}wg.clearRect(0,0,og,og),wg.strokeText("A",0,og),yg=wg.getImageData(0,0,og,og).data,fg=0;for(let Bg=0,Wg=yg.length;Bg<Wg;Bg+=4)if(yg[Bg]>0){fg=og-Math.floor(Bg/4/og);break}if(wg.canvas.width=wg.canvas.height=0,fg){const Bg=fg/(fg+Gg);return sg.set(mg,Bg),Bg}return sg.set(mg,ag),ag}function Ag(mg,hg,Zg){const wg=document.createElement("span"),pg={angle:0,canvasWidth:0,hasText:hg.str!=="",hasEOL:hg.hasEOL,fontSize:0};mg._textDivs.push(wg);const fg=ig.Util.transform(mg._transform,hg.transform);let Gg=Math.atan2(fg[1],fg[0]);const yg=Zg[hg.fontName];yg.vertical&&(Gg+=Math.PI/2);const Bg=Math.hypot(fg[2],fg[3]),Wg=Bg*lg(yg.fontFamily,mg._isOffscreenCanvasSupported);let $g,Ng;Gg===0?($g=fg[4],Ng=fg[5]-Wg):($g=fg[4]+Wg*Math.sin(Gg),Ng=fg[5]-Wg*Math.cos(Gg));const Vg="calc(var(--scale-factor)*",Rg=wg.style;mg._container===mg._rootContainer?(Rg.left=`${(100*$g/mg._pageWidth).toFixed(2)}%`,Rg.top=`${(100*Ng/mg._pageHeight).toFixed(2)}%`):(Rg.left=`${Vg}${$g.toFixed(2)}px)`,Rg.top=`${Vg}${Ng.toFixed(2)}px)`),Rg.fontSize=`${Vg}${Bg.toFixed(2)}px)`,Rg.fontFamily=yg.fontFamily,pg.fontSize=Bg,wg.setAttribute("role","presentation"),wg.textContent=hg.str,wg.dir=hg.dir,mg._fontInspectorEnabled&&(wg.dataset.fontName=hg.fontName),Gg!==0&&(pg.angle=Gg*(180/Math.PI));let vg=!1;if(hg.str.length>1)vg=!0;else if(hg.str!==" "&&hg.transform[0]!==hg.transform[3]){const Mg=Math.abs(hg.transform[0]),kg=Math.abs(hg.transform[3]);Mg!==kg&&Math.max(Mg,kg)/Math.min(Mg,kg)>1.5&&(vg=!0)}vg&&(pg.canvasWidth=yg.vertical?hg.height:hg.width),mg._textDivProperties.set(wg,pg),mg._isReadableStream&&mg._layoutText(wg)}function cg(mg){const{div:hg,scale:Zg,properties:wg,ctx:pg,prevFontSize:fg,prevFontFamily:Gg}=mg,{style:yg}=hg;let Bg="";if(wg.canvasWidth!==0&&wg.hasText){const{fontFamily:Wg}=yg,{canvasWidth:$g,fontSize:Ng}=wg;(fg!==Ng||Gg!==Wg)&&(pg.font=`${Ng*Zg}px ${Wg}`,mg.prevFontSize=Ng,mg.prevFontFamily=Wg);const{width:Vg}=pg.measureText(hg.textContent);Vg>0&&(Bg=`scaleX(${$g*Zg/Vg})`)}wg.angle!==0&&(Bg=`rotate(${wg.angle}deg) ${Bg}`),Bg.length>0&&(yg.transform=Bg)}function rg(mg){if(mg._canceled)return;const hg=mg._textDivs,Zg=mg._capability;if(hg.length>ng){Zg.resolve();return}if(!mg._isReadableStream)for(const pg of hg)mg._layoutText(pg);Zg.resolve()}class ug{constructor({textContentSource:hg,container:Zg,viewport:wg,textDivs:pg,textDivProperties:fg,textContentItemsStr:Gg,isOffscreenCanvasSupported:yg}){var Vg;this._textContentSource=hg,this._isReadableStream=hg instanceof ReadableStream,this._container=this._rootContainer=Zg,this._textDivs=pg||[],this._textContentItemsStr=Gg||[],this._isOffscreenCanvasSupported=yg,this._fontInspectorEnabled=!!((Vg=globalThis.FontInspector)!=null&&Vg.enabled),this._reader=null,this._textDivProperties=fg||new WeakMap,this._canceled=!1,this._capability=new ig.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:wg.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:Cg(0,yg)};const{pageWidth:Bg,pageHeight:Wg,pageX:$g,pageY:Ng}=wg.rawDims;this._transform=[1,0,0,-1,-$g,Ng+Wg],this._pageWidth=Bg,this._pageHeight=Wg,(0,Ig.setLayerDimensions)(Zg,wg),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new ig.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new ig.AbortException("TextLayer task cancelled."))}_processItems(hg,Zg){for(const wg of hg){if(wg.str===void 0){if(wg.type==="beginMarkedContentProps"||wg.type==="beginMarkedContent"){const pg=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),wg.id!==null&&this._container.setAttribute("id",`${wg.id}`),pg.append(this._container)}else wg.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(wg.str),Ag(this,wg,Zg)}}_layoutText(hg){const Zg=this._layoutTextParams.properties=this._textDivProperties.get(hg);if(this._layoutTextParams.div=hg,cg(this._layoutTextParams),Zg.hasText&&this._container.append(hg),Zg.hasEOL){const wg=document.createElement("br");wg.setAttribute("role","presentation"),this._container.append(wg)}}_render(){const hg=new ig.PromiseCapability;let Zg=Object.create(null);if(this._isReadableStream){const wg=()=>{this._reader.read().then(({value:pg,done:fg})=>{if(fg){hg.resolve();return}Object.assign(Zg,pg.styles),this._processItems(pg.items,Zg),wg()},hg.reject)};this._reader=this._textContentSource.getReader(),wg()}else if(this._textContentSource){const{items:wg,styles:pg}=this._textContentSource;this._processItems(wg,pg),hg.resolve()}else throw new Error('No "textContentSource" parameter specified.');hg.promise.then(()=>{Zg=null,rg(this)},this._capability.reject)}}eg.TextLayerRenderTask=ug;function dg(mg){!mg.textContentSource&&(mg.textContent||mg.textContentStream)&&((0,Ig.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),mg.textContentSource=mg.textContent||mg.textContentStream);const{container:hg,viewport:Zg}=mg,wg=getComputedStyle(hg),pg=wg.getPropertyValue("visibility"),fg=parseFloat(wg.getPropertyValue("--scale-factor"));pg==="visible"&&(!fg||Math.abs(fg-Zg.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");const Gg=new ug(mg);return Gg._render(),Gg}function bg({container:mg,viewport:hg,textDivs:Zg,textDivProperties:wg,isOffscreenCanvasSupported:pg,mustRotate:fg=!0,mustRescale:Gg=!0}){if(fg&&(0,Ig.setLayerDimensions)(mg,{rotation:hg.rotation}),Gg){const yg=Cg(0,pg),Wg={prevFontSize:null,prevFontFamily:null,div:null,scale:hg.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:yg};for(const $g of Zg)Wg.properties=wg.get($g),Wg.div=$g,cg(Wg)}}}),((tg,eg,gg)=>{var lg,Ag,cg,rg,ug,dg,bg,mg,hg,Zg,wg,Vu,qd,vu,Yu;Object.defineProperty(eg,"__esModule",{value:!0}),eg.AnnotationEditorLayer=void 0;var ig=gg(1),Ig=gg(4),ng=gg(28),og=gg(33),ag=gg(6),sg=gg(34);const Bg=class Bg{constructor({uiManager:$g,pageIndex:Ng,div:Vg,accessibilityManager:Rg,annotationLayer:vg,viewport:Mg,l10n:kg}){JI(this,wg);JI(this,lg);JI(this,Ag,!1);JI(this,cg,null);JI(this,rg,this.pointerup.bind(this));JI(this,ug,this.pointerdown.bind(this));JI(this,dg,new Map);JI(this,bg,!1);JI(this,mg,!1);JI(this,hg,!1);JI(this,Zg);const Sg=[ng.FreeTextEditor,og.InkEditor,sg.StampEditor];if(!Bg._initialized){Bg._initialized=!0;for(const Yg of Sg)Yg.initialize(kg)}$g.registerEditorTypes(Sg),EI(this,Zg,$g),this.pageIndex=Ng,this.div=Vg,EI(this,lg,Rg),EI(this,cg,vg),this.viewport=Mg,aI(this,Zg).addLayer(this)}get isEmpty(){return aI(this,dg).size===0}updateToolbar($g){aI(this,Zg).updateToolbar($g)}updateMode($g=aI(this,Zg).getMode()){zI(this,wg,Yu).call(this),$g===ig.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),$g!==ig.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",$g===ig.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",$g===ig.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",$g===ig.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded($g){if(!$g&&aI(this,Zg).getMode()!==ig.AnnotationEditorType.INK)return;if(!$g){for(const Vg of aI(this,dg).values())if(Vg.isEmpty()){Vg.setInBackground();return}}zI(this,wg,qd).call(this,{offsetX:0,offsetY:0},!1).setInBackground()}setEditingState($g){aI(this,Zg).setEditingState($g)}addCommands($g){aI(this,Zg).addCommands($g)}enable(){this.div.style.pointerEvents="auto";const $g=new Set;for(const Vg of aI(this,dg).values())Vg.enableEditing(),Vg.annotationElementId&&$g.add(Vg.annotationElementId);if(!aI(this,cg))return;const Ng=aI(this,cg).getEditableAnnotations();for(const Vg of Ng){if(Vg.hide(),aI(this,Zg).isDeletedAnnotationElement(Vg.data.id)||$g.has(Vg.data.id))continue;const Rg=this.deserialize(Vg);Rg&&(this.addOrRebuild(Rg),Rg.enableEditing())}}disable(){var Ng;EI(this,hg,!0),this.div.style.pointerEvents="none";const $g=new Set;for(const Vg of aI(this,dg).values()){if(Vg.disableEditing(),!Vg.annotationElementId||Vg.serialize()!==null){$g.add(Vg.annotationElementId);continue}(Ng=this.getEditableAnnotation(Vg.annotationElementId))==null||Ng.show(),Vg.remove()}if(aI(this,cg)){const Vg=aI(this,cg).getEditableAnnotations();for(const Rg of Vg){const{id:vg}=Rg.data;$g.has(vg)||aI(this,Zg).isDeletedAnnotationElement(vg)||Rg.show()}}zI(this,wg,Yu).call(this),this.isEmpty&&(this.div.hidden=!0),EI(this,hg,!1)}getEditableAnnotation($g){var Ng;return((Ng=aI(this,cg))==null?void 0:Ng.getEditableAnnotation($g))||null}setActiveEditor($g){aI(this,Zg).getActive()!==$g&&aI(this,Zg).setActiveEditor($g)}enableClick(){this.div.addEventListener("pointerdown",aI(this,ug)),this.div.addEventListener("pointerup",aI(this,rg))}disableClick(){this.div.removeEventListener("pointerdown",aI(this,ug)),this.div.removeEventListener("pointerup",aI(this,rg))}attach($g){aI(this,dg).set($g.id,$g);const{annotationElementId:Ng}=$g;Ng&&aI(this,Zg).isDeletedAnnotationElement(Ng)&&aI(this,Zg).removeDeletedAnnotationElement($g)}detach($g){var Ng;aI(this,dg).delete($g.id),(Ng=aI(this,lg))==null||Ng.removePointerInTextLayer($g.contentDiv),!aI(this,hg)&&$g.annotationElementId&&aI(this,Zg).addDeletedAnnotationElement($g)}remove($g){this.detach($g),aI(this,Zg).removeEditor($g),$g.div.contains(document.activeElement)&&setTimeout(()=>{aI(this,Zg).focusMainContainer()},0),$g.div.remove(),$g.isAttachedToDOM=!1,aI(this,mg)||this.addInkEditorIfNeeded(!1)}changeParent($g){var Ng;$g.parent!==this&&($g.annotationElementId&&(aI(this,Zg).addDeletedAnnotationElement($g.annotationElementId),Ig.AnnotationEditor.deleteAnnotationElement($g),$g.annotationElementId=null),this.attach($g),(Ng=$g.parent)==null||Ng.detach($g),$g.setParent(this),$g.div&&$g.isAttachedToDOM&&($g.div.remove(),this.div.append($g.div)))}add($g){if(this.changeParent($g),aI(this,Zg).addEditor($g),this.attach($g),!$g.isAttachedToDOM){const Ng=$g.render();this.div.append(Ng),$g.isAttachedToDOM=!0}$g.fixAndSetPosition(),$g.onceAdded(),aI(this,Zg).addToAnnotationStorage($g)}moveEditorInDOM($g){var Vg;if(!$g.isAttachedToDOM)return;const{activeElement:Ng}=document;$g.div.contains(Ng)&&($g._focusEventsAllowed=!1,setTimeout(()=>{$g.div.contains(document.activeElement)?$g._focusEventsAllowed=!0:($g.div.addEventListener("focusin",()=>{$g._focusEventsAllowed=!0},{once:!0}),Ng.focus())},0)),$g._structTreeParentId=(Vg=aI(this,lg))==null?void 0:Vg.moveElementInDOM(this.div,$g.div,$g.contentDiv,!0)}addOrRebuild($g){$g.needsToBeRebuilt()?$g.rebuild():this.add($g)}addUndoableEditor($g){const Ng=()=>$g._uiManager.rebuild($g),Vg=()=>{$g.remove()};this.addCommands({cmd:Ng,undo:Vg,mustExec:!1})}getNextId(){return aI(this,Zg).getId()}pasteEditor($g,Ng){aI(this,Zg).updateToolbar($g),aI(this,Zg).updateMode($g);const{offsetX:Vg,offsetY:Rg}=zI(this,wg,vu).call(this),vg=this.getNextId(),Mg=zI(this,wg,Vu).call(this,{parent:this,id:vg,x:Vg,y:Rg,uiManager:aI(this,Zg),isCentered:!0,...Ng});Mg&&this.add(Mg)}deserialize($g){switch($g.annotationType??$g.annotationEditorType){case ig.AnnotationEditorType.FREETEXT:return ng.FreeTextEditor.deserialize($g,this,aI(this,Zg));case ig.AnnotationEditorType.INK:return og.InkEditor.deserialize($g,this,aI(this,Zg));case ig.AnnotationEditorType.STAMP:return sg.StampEditor.deserialize($g,this,aI(this,Zg))}return null}addNewEditor(){zI(this,wg,qd).call(this,zI(this,wg,vu).call(this),!0)}setSelected($g){aI(this,Zg).setSelected($g)}toggleSelected($g){aI(this,Zg).toggleSelected($g)}isSelected($g){return aI(this,Zg).isSelected($g)}unselect($g){aI(this,Zg).unselect($g)}pointerup($g){const{isMac:Ng}=ig.FeatureTest.platform;if(!($g.button!==0||$g.ctrlKey&&Ng)&&$g.target===this.div&&aI(this,bg)){if(EI(this,bg,!1),!aI(this,Ag)){EI(this,Ag,!0);return}if(aI(this,Zg).getMode()===ig.AnnotationEditorType.STAMP){aI(this,Zg).unselectAll();return}zI(this,wg,qd).call(this,$g,!1)}}pointerdown($g){if(aI(this,bg)){EI(this,bg,!1);return}const{isMac:Ng}=ig.FeatureTest.platform;if($g.button!==0||$g.ctrlKey&&Ng||$g.target!==this.div)return;EI(this,bg,!0);const Vg=aI(this,Zg).getActive();EI(this,Ag,!Vg||Vg.isEmpty())}findNewParent($g,Ng,Vg){const Rg=aI(this,Zg).findParent(Ng,Vg);return Rg===null||Rg===this?!1:(Rg.changeParent($g),!0)}destroy(){var $g,Ng;(($g=aI(this,Zg).getActive())==null?void 0:$g.parent)===this&&(aI(this,Zg).commitOrRemove(),aI(this,Zg).setActiveEditor(null));for(const Vg of aI(this,dg).values())(Ng=aI(this,lg))==null||Ng.removePointerInTextLayer(Vg.contentDiv),Vg.setParent(null),Vg.isAttachedToDOM=!1,Vg.div.remove();this.div=null,aI(this,dg).clear(),aI(this,Zg).removeLayer(this)}render({viewport:$g}){this.viewport=$g,(0,ag.setLayerDimensions)(this.div,$g);for(const Ng of aI(this,Zg).getEditors(this.pageIndex))this.add(Ng);this.updateMode()}update({viewport:$g}){aI(this,Zg).commitOrRemove(),this.viewport=$g,(0,ag.setLayerDimensions)(this.div,{rotation:$g.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:$g,pageHeight:Ng}=this.viewport.rawDims;return[$g,Ng]}};lg=new WeakMap,Ag=new WeakMap,cg=new WeakMap,rg=new WeakMap,ug=new WeakMap,dg=new WeakMap,bg=new WeakMap,mg=new WeakMap,hg=new WeakMap,Zg=new WeakMap,wg=new WeakSet,Vu=function($g){switch(aI(this,Zg).getMode()){case ig.AnnotationEditorType.FREETEXT:return new ng.FreeTextEditor($g);case ig.AnnotationEditorType.INK:return new og.InkEditor($g);case ig.AnnotationEditorType.STAMP:return new sg.StampEditor($g)}return null},qd=function($g,Ng){const Vg=this.getNextId(),Rg=zI(this,wg,Vu).call(this,{parent:this,id:Vg,x:$g.offsetX,y:$g.offsetY,uiManager:aI(this,Zg),isCentered:Ng});return Rg&&this.add(Rg),Rg},vu=function(){const{x:$g,y:Ng,width:Vg,height:Rg}=this.div.getBoundingClientRect(),vg=Math.max(0,$g),Mg=Math.max(0,Ng),kg=Math.min(window.innerWidth,$g+Vg),Sg=Math.min(window.innerHeight,Ng+Rg),Yg=(vg+kg)/2-$g,Kg=(Mg+Sg)/2-Ng,[Tg,xg]=this.viewport.rotation%180===0?[Yg,Kg]:[Kg,Yg];return{offsetX:Tg,offsetY:xg}},Yu=function(){EI(this,mg,!0);for(const $g of aI(this,dg).values())$g.isEmpty()&&$g.remove();EI(this,mg,!1)},el(Bg,"_initialized",!1);let Cg=Bg;eg.AnnotationEditorLayer=Cg}),((tg,eg,gg)=>{var sg,Cg,lg,Ag,cg,rg,ug,dg,bg,mg,Lb,Jb,Ob,kd,ku,Eb,Ru;Object.defineProperty(eg,"__esModule",{value:!0}),eg.FreeTextEditor=void 0;var ig=gg(1),Ig=gg(5),ng=gg(4),og=gg(29);const Bg=class Bg extends ng.AnnotationEditor{constructor(Ng){super({...Ng,name:"freeTextEditor"});JI(this,mg);JI(this,sg,this.editorDivBlur.bind(this));JI(this,Cg,this.editorDivFocus.bind(this));JI(this,lg,this.editorDivInput.bind(this));JI(this,Ag,this.editorDivKeydown.bind(this));JI(this,cg);JI(this,rg,"");JI(this,ug,`${this.id}-editor`);JI(this,dg);JI(this,bg,null);EI(this,cg,Ng.color||Bg._defaultColor||ng.AnnotationEditor._defaultLineColor),EI(this,dg,Ng.fontSize||Bg._defaultFontSize)}static get _keyboardManager(){const Ng=Bg.prototype,Vg=Mg=>Mg.isEmpty(),Rg=Ig.AnnotationEditorUIManager.TRANSLATE_SMALL,vg=Ig.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,ig.shadow)(this,"_keyboardManager",new Ig.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],Ng.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],Ng.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],Ng._translateEmpty,{args:[-Rg,0],checker:Vg}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],Ng._translateEmpty,{args:[-vg,0],checker:Vg}],[["ArrowRight","mac+ArrowRight"],Ng._translateEmpty,{args:[Rg,0],checker:Vg}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],Ng._translateEmpty,{args:[vg,0],checker:Vg}],[["ArrowUp","mac+ArrowUp"],Ng._translateEmpty,{args:[0,-Rg],checker:Vg}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],Ng._translateEmpty,{args:[0,-vg],checker:Vg}],[["ArrowDown","mac+ArrowDown"],Ng._translateEmpty,{args:[0,Rg],checker:Vg}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],Ng._translateEmpty,{args:[0,vg],checker:Vg}]]))}static initialize(Ng){ng.AnnotationEditor.initialize(Ng,{strings:["free_text2_default_content","editor_free_text2_aria_label"]});const Vg=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(Vg.getPropertyValue("--freetext-padding"))}static updateDefaultParams(Ng,Vg){switch(Ng){case ig.AnnotationEditorParamsType.FREETEXT_SIZE:Bg._defaultFontSize=Vg;break;case ig.AnnotationEditorParamsType.FREETEXT_COLOR:Bg._defaultColor=Vg;break}}updateParams(Ng,Vg){switch(Ng){case ig.AnnotationEditorParamsType.FREETEXT_SIZE:zI(this,mg,Lb).call(this,Vg);break;case ig.AnnotationEditorParamsType.FREETEXT_COLOR:zI(this,mg,Jb).call(this,Vg);break}}static get defaultPropertiesToUpdate(){return[[ig.AnnotationEditorParamsType.FREETEXT_SIZE,Bg._defaultFontSize],[ig.AnnotationEditorParamsType.FREETEXT_COLOR,Bg._defaultColor||ng.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[ig.AnnotationEditorParamsType.FREETEXT_SIZE,aI(this,dg)],[ig.AnnotationEditorParamsType.FREETEXT_COLOR,aI(this,cg)]]}_translateEmpty(Ng,Vg){this._uiManager.translateSelectedEditors(Ng,Vg,!0)}getInitialTranslation(){const Ng=this.parentScale;return[-Bg._internalPadding*Ng,-(Bg._internalPadding+aI(this,dg))*Ng]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(ig.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",aI(this,Ag)),this.editorDiv.addEventListener("focus",aI(this,Cg)),this.editorDiv.addEventListener("blur",aI(this,sg)),this.editorDiv.addEventListener("input",aI(this,lg)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",aI(this,ug)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",aI(this,Ag)),this.editorDiv.removeEventListener("focus",aI(this,Cg)),this.editorDiv.removeEventListener("blur",aI(this,sg)),this.editorDiv.removeEventListener("input",aI(this,lg)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(Ng){this._focusEventsAllowed&&(super.focusin(Ng),Ng.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var Ng;if(this.width){zI(this,mg,Ru).call(this);return}this.enableEditMode(),this.editorDiv.focus(),(Ng=this._initialOptions)!=null&&Ng.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()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const Ng=aI(this,rg),Vg=EI(this,rg,zI(this,mg,Ob).call(this).trimEnd());if(Ng===Vg)return;const Rg=vg=>{if(EI(this,rg,vg),!vg){this.remove();return}zI(this,mg,ku).call(this),this._uiManager.rebuild(this),zI(this,mg,kd).call(this)};this.addCommands({cmd:()=>{Rg(Vg)},undo:()=>{Rg(Ng)},mustExec:!1}),zI(this,mg,kd).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(Ng){this.enterInEditMode()}keydown(Ng){Ng.target===this.div&&Ng.key==="Enter"&&(this.enterInEditMode(),Ng.preventDefault())}editorDivKeydown(Ng){Bg._keyboardManager.exec(this,Ng)}editorDivFocus(Ng){this.isEditing=!0}editorDivBlur(Ng){this.isEditing=!1}editorDivInput(Ng){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 Ng,Vg;this.width&&(Ng=this.x,Vg=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",aI(this,ug)),this.enableEditing(),ng.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then(vg=>{var Mg;return(Mg=this.editorDiv)==null?void 0:Mg.setAttribute("aria-label",vg)}),ng.AnnotationEditor._l10nPromise.get("free_text2_default_content").then(vg=>{var Mg;return(Mg=this.editorDiv)==null?void 0:Mg.setAttribute("default-content",vg)}),this.editorDiv.contentEditable=!0;const{style:Rg}=this.editorDiv;if(Rg.fontSize=`calc(${aI(this,dg)}px * var(--scale-factor))`,Rg.color=aI(this,cg),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,Ig.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[vg,Mg]=this.parentDimensions;if(this.annotationElementId){const{position:kg}=aI(this,bg);let[Sg,Yg]=this.getInitialTranslation();[Sg,Yg]=this.pageTranslationToScreen(Sg,Yg);const[Kg,Tg]=this.pageDimensions,[xg,Xg]=this.pageTranslation;let jg,zg;switch(this.rotation){case 0:jg=Ng+(kg[0]-xg)/Kg,zg=Vg+this.height-(kg[1]-Xg)/Tg;break;case 90:jg=Ng+(kg[0]-xg)/Kg,zg=Vg-(kg[1]-Xg)/Tg,[Sg,Yg]=[Yg,-Sg];break;case 180:jg=Ng-this.width+(kg[0]-xg)/Kg,zg=Vg-(kg[1]-Xg)/Tg,[Sg,Yg]=[-Sg,-Yg];break;case 270:jg=Ng+(kg[0]-xg-this.height*Tg)/Kg,zg=Vg+(kg[1]-Xg-this.width*Kg)/Tg,[Sg,Yg]=[-Yg,Sg];break}this.setAt(jg*vg,zg*Mg,Sg,Yg)}else this.setAt(Ng*vg,Vg*Mg,this.width*vg,this.height*Mg);zI(this,mg,ku).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(Ng,Vg,Rg){let vg=null;if(Ng instanceof og.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:kg,fontColor:Sg},rect:Yg,rotation:Kg,id:Tg},textContent:xg,textPosition:Xg,parent:{page:{pageNumber:jg}}}=Ng;if(!xg||xg.length===0)return null;vg=Ng={annotationType:ig.AnnotationEditorType.FREETEXT,color:Array.from(Sg),fontSize:kg,value:xg.join(`
|