@lateralus-ai/shipping-ui 1.2.0 → 1.3.1
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/components/DocumentEditor/DocumentEditor.d.ts +4 -0
- package/dist/components/DocumentEditor/index.d.ts +1 -0
- package/dist/components/PdfViewer/PdfViewer.d.ts +3 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs +272 -21
- package/dist/index.esm.js +28668 -10625
- package/dist/sample-document.docx +0 -0
- package/dist/types/documentEditor.d.ts +47 -0
- package/dist/utils/checkboxModule.d.ts +54 -0
- package/package.json +4 -1
- package/src/components/DocumentEditor/DocumentEditor.tsx +872 -0
- package/src/components/DocumentEditor/index.ts +1 -0
- package/src/components/PdfViewer/PdfViewer.tsx +20 -2
- package/src/components/index.ts +1 -0
- package/src/stories/DocumentEditor.stories.tsx +287 -0
- package/src/types/documentEditor.ts +56 -0
- package/src/utils/checkboxModule.ts +242 -0
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Db=Object.defineProperty;var Xf=c=>{throw TypeError(c)};var Nb=(c,t,e)=>t in c?Db(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var L=(c,t,e)=>Nb(c,typeof t!="symbol"?t+"":t,e),Vd=(c,t,e)=>t.has(c)||Xf("Cannot "+e);var r=(c,t,e)=>(Vd(c,t,"read from private field"),e?e.call(c):t.get(c)),m=(c,t,e)=>t.has(c)?Xf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,e),p=(c,t,e,s)=>(Vd(c,t,"write to private field"),s?s.call(c,e):t.set(c,e),e),b=(c,t,e)=>(Vd(c,t,"access private method"),e);var Me=(c,t,e,s)=>({set _(i){p(c,t,i,e)},get _(){return r(c,t,s)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),lt=require("@material-tailwind/react"),Fb=require("react-textarea-autosize"),_s=require("@iconify/react");var Ud=typeof document<"u"?document.currentScript:null;const Ob={fontFamily:{sans:["Work Sans","sans-serif"],mono:["Roboto Mono","monospace"],signature:["Alex Brush","Lucida Handwriting","cursive"]},fontSize:{subheader:["18px",{lineHeight:"28px",letterSpacing:"-0.01em"}],"subheader-em":["18px",{lineHeight:"28px",letterSpacing:"-0.01em",fontWeight:"500"}],body:["16px",{lineHeight:"28px",letterSpacing:"-0.01em"}],"body-em":["16px",{lineHeight:"28px",letterSpacing:"-0.01em",fontWeight:"500"}],"caption-1":["16px",{lineHeight:"22px"}],"caption-1-em":["16px",{lineHeight:"22px",fontWeight:"500"}],"caption-2":["14px",{lineHeight:"20px"}],"caption-2-em":["14px",{lineHeight:"20px",fontWeight:"500"}],footnote:["13px",{lineHeight:"17px"}],"footnote-em":["13px",{lineHeight:"17px",fontWeight:"500"}]},width:{authPageWidth:"370px"},keyframes:{"accordion-down":{from:{height:0},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"},colors:{brand:{50:"#e0fff2",100:"#adf0d3",200:"#8aeac1",300:"#67e4ae",400:"#45de9c",500:"#26d489",600:"#1da56a",700:"#15754c",800:"#0c452d",900:"#04160e"},gray:{50:"#fafafa",100:"#f0f0f0",200:"#d6d6d6",300:"#bdbdbd",400:"#a3a3a3",500:"#8a8a8a",600:"#6e6e6e",700:"#525252",800:"#363636",900:"#1a1a1a"},green:{50:"#e0fff2",100:"#adf0d3",200:"#8aeac1",300:"#67e4ae",400:"#45de9c",500:"#26d489",600:"#1da56a",700:"#15754c",800:"#0c452d",900:"#04160e"},blue:{50:"#cae8f7",100:"#b8e0f4",200:"#95d1ef",300:"#71c1ea",400:"#4eb2e4",500:"#2aa2df",600:"#1b82b6",700:"#145f85",800:"#0d3c54",900:"#051923"},red:{50:"#f9dcdc",100:"#f6cbcb",200:"#f0a8a8",300:"#ea8686",400:"#e36363",500:"#dd4040",600:"#c32222",700:"#931a1a",800:"#641212",900:"#340909"},orange:{50:"#fff7eb",100:"#f8e0bf",200:"#f4cf9a",300:"#f0bd75",400:"#ecab51",500:"#e89a2c",600:"#C77C0A",700:"#935d10",800:"#603d0b",900:"#2e1d05"},"brand-purple":"#ab68ff",presentation:"var(--presentation)","text-primary":"var(--text-primary)","text-secondary":"var(--text-secondary)","text-secondary-alt":"var(--text-secondary-alt)","text-tertiary":"var(--text-tertiary)","ring-primary":"var(--ring-primary)","header-primary":"var(--header-primary)","header-hover":"var(--header-hover)","header-button-hover":"var(--header-button-hover)","surface-active":"var(--surface-active)","surface-active-alt":"var(--surface-active-alt)","surface-hover":"var(--surface-hover)","surface-primary":"var(--surface-primary)","surface-primary-alt":"var(--surface-primary-alt)","surface-primary-contrast":"var(--surface-primary-contrast)","surface-secondary":"var(--surface-secondary)","surface-secondary-alt":"var(--surface-secondary-alt)","surface-tertiary":"var(--surface-tertiary)","surface-tertiary-alt":"var(--surface-tertiary-alt)","surface-dialog":"var(--surface-dialog)","surface-submit":"var(--surface-submit)","border-light":"var(--border-light)","border-medium":"var(--border-medium)","border-medium-alt":"var(--border-medium-alt)","border-heavy":"var(--border-heavy)","border-xheavy":"var(--border-xheavy)",border:"hsl(var(--border))",input:"hsl(var(--input))","switch-unchecked":"hsl(var(--switch-unchecked))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"8px",md:"calc(8px - 2px)",sm:"calc(8px - 4px)"}},Bb={button:{defaultProps:{className:"items-center normal-case shadow-none hover:shadow-none text-caption-1 font-medium h-10 rounded-lg flex gap-2 px-3 truncate tracking-[0.16px] justify-center",ripple:!1,color:"green"},styles:{sizes:{md:{fontSize:"text-md",className:"py-2"}},variants:{filled:{blue:{color:"!text-white",background:"bg-blue-400",hover:"hover:bg-blue-500",disabled:"disabled:bg-blue-200 disabled:!text-blue-600 !opacity-100"},green:{color:"!text-white",background:"bg-green-600",hover:"hover:bg-green-700",disabled:"disabled:bg-green-200 disabled:!text-green-600 !opacity-100"},red:{color:"!text-white",background:"bg-red-600",hover:"hover:bg-red-700",disabled:"disabled:bg-red-200 disabled:!text-red-600 !opacity-100"},gray:{color:"text-black",background:"bg-gray-50",hover:"hover:bg-gray-100",disabled:"disabled:bg-gray-50 disabled:!text-gray-200 !opacity-100"},orange:{color:"!text-orange-600",background:"bg-orange-50",hover:"hover:bg-orange-100",disabled:"disabled:bg-orange-50 disabled:!text-orange-200 !opacity-100"}},outlined:{gray:{background:"bg-white",color:"text-gray-700 border-gray-100",hover:"!text-gray-900 hover:bg-gray-100",disabled:"disabled:text-gray-500"}},text:{green:{color:"!text-green-600",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"},gray:{color:"!text-gray-700",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"}}}}},iconButton:{defaultProps:{className:"items-center justify-center normal-case shadow-none hover:shadow-none text-caption-1 font-medium h-10 rounded-lg flex gap-2 px-3 truncate",ripple:!1,color:"green"},styles:{sizes:{md:{fontSize:"text-md",className:"py-2"}},variants:{filled:{blue:{color:"!text-white",background:"bg-blue-400",hover:"hover:bg-blue-500",disabled:"disabled:bg-blue-200 disabled:!text-blue-600 !opacity-100"},green:{color:"!text-white",background:"bg-green-600",hover:"hover:bg-green-700",disabled:"disabled:bg-green-200 disabled:!text-green-600 !opacity-100"},red:{color:"!text-white",background:"bg-red-600",hover:"hover:bg-red-700",disabled:"disabled:bg-red-200 disabled:!text-red-600 !opacity-100"},gray:{color:"text-black",background:"bg-gray-50",hover:"hover:bg-gray-100",disabled:"disabled:bg-gray-50 disabled:!text-gray-200 !opacity-100"},orange:{color:"!text-orange-600",background:"bg-orange-50",hover:"hover:bg-orange-100",disabled:"disabled:bg-orange-50 disabled:!text-orange-200 !opacity-100"}},outlined:{gray:{background:"bg-white",color:"text-gray-700 border-gray-100",hover:"!text-gray-900 hover:bg-gray-100",disabled:"disabled:text-gray-500"}},text:{green:{color:"!text-green-600",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"},gray:{color:"!text-gray-700",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"}}}}},progress:{defaultProps:{className:"bg-gray-100",barProps:{className:"transform transition-all duration-300"}},styles:{sizes:{sm:{container:{initial:{height:"h-1"}}}}}},menu:{styles:{base:{menu:{border:"border border-gray-100",borderRadius:"rounded-xl",boxShadow:"shadow-sm",p:"p-2"},item:{initial:{display:"flex gap-2 items-center focus-within:outline-none text-gray-900",bg:"hover:bg-gray-100",p:"p-2"}}}}},dialog:{defaultProps:{size:"sm",dismiss:{},animate:{mount:{},unmount:{}},className:""},valid:{sizes:["xs","sm","md","lg","xl","xxl"]},styles:{base:{backdrop:{width:"w-full",display:"grid",placeItems:"place-items-center",position:"fixed",top:0,left:0,height:"h-screen",backgroundColor:"bg-[rgba(0,0,0,0.16)]",backgroundOpacity:"bg-opacity-100",backdropFilter:"backdrop-blur-none"},container:{height:"h-[450px]",position:"relative",bg:"bg-white",m:"m-4",borderRadius:"rounded-xl",boxShadow:"shadow-[0px_2px_8px_0px_#00000029,0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A]",fontSmoothing:"antialiased"}},sizes:{sm:{maxWidth:"!max-w-[550px]"},lg:{maxWidth:"!max-w-[700px]"}}}},dialogHeader:{styles:{base:{display:"text-gray-900 font-normal"}}},checkbox:{defaultProps:{color:"custom",ripple:!1},valid:{colors:["blue-gray","gray","red","green","custom"]},styles:{base:{root:{display:"inline-flex",alignItems:"items-center"},container:{position:"relative",display:"flex",alignItems:"items-center",cursor:"cursor-pointer",p:"!p-0",borderRadius:"rounded-full"},input:{peer:"peer",position:"relative",appearance:"appearance-none",width:"w-5",height:"h-5",borderWidth:"border-[1.5px]",borderRadius:"rounded-md",borderColor:"border-gray-100",cursor:"cursor-pointer",transition:"transition-all",before:{content:"before:content-['']",display:"before:block",bg:"before:bg-transparent",width:"before:w-12",height:"before:h-12",borderRadius:"before:rounded-full",position:"before:absolute",opacity:"before:opacity-0 hover:before:opacity-10"}},label:{color:"text-gray-700",fontWeight:"font-light",userSelect:"select-none",cursor:"cursor-pointer",mt:"mt-px",px:"px-2"},icon:{display:"flex",alignItems:"items-center",justifyContent:"justify-center",width:"w-5",height:"h-5",color:"text-green-600",position:"absolute",pointerEvents:"pointer-events-none",opacity:"opacity-0 peer-checked:opacity-100",transition:"transition-opacity"},disabled:{opacity:"opacity-50",pointerEvents:"pointer-events-none"}},colors:{custom:{border:"checked:border-green-600"}}}},popover:{defaultProps:{placement:"top",offset:5,dismiss:{},animate:{unmount:{},mount:{}},className:""},styles:{base:{bg:"bg-white",p:"p-4",borderWidth:"border",borderColor:"border-gray-200",borderRadius:"rounded-lg",boxShadow:"[box-shadow:0px_2px_2px_0px_#0000000A,_0px_8px_8px_-8px_#0000000A]",fontSize:"text-sm",fontWeight:"font-normal",color:"text-blue-gray-500",outline:"focus:outline-none",overflowWrap:"break-words",whiteSpace:"whitespace-normal"}}},switch:{defaultProps:{color:"blue",label:"",ripple:!0,className:"",disabled:!1,containerProps:void 0,labelProps:void 0,circleProps:void 0},valid:{colors:["blue-gray","gray","brown","deep-orange","orange","amber","yellow","lime","light-green","green","teal","cyan","light-blue","blue","indigo","deep-purple","purple","pink","red"]},styles:{base:{input:{background:"bg-gray-500"},circle:{borderColor:"border-gray-500",borderRadius:"rounded-full",boxShadow:"shadow-md",position:"absolute",top:"top-2/4",left:"-left-1",transform:"-translate-y-2/4 peer-checked:translate-x-full",transition:"transition-all duration-300",cursor:"cursor-pointer",before:{content:"before:content['']",display:"before:block",bg:"before:bg-blue-gray-500",width:"before:w-10",height:"before:h-10",borderRadius:"before:rounded-full",position:"before:absolute",top:"before:top-2/4",left:"before:left-2/4",transform:"before:-translate-y-2/4 before:-translate-x-2/4",transition:"before:transition-opacity",opacity:"before:opacity-0 hover:before:opacity-10"}},ripple:{display:"inline-block",top:"top-2/4",left:"left-2/4",transform:"-translate-x-2/4 -translate-y-2/4",p:"p-5",borderRadius:"rounded-full"},label:{color:"text-gray-700",fontWeight:"font-light",userSelect:"select-none",cursor:"cursor-pointer",mt:"mt-px",ml:"ml-3",mb:"mb-0"},disabled:{opacity:"opacity-50",pointerEvents:"pointer-events-none"}},colors:{gray:{input:"checked:bg-blue-gray-100",circle:"peer-checked:border-blue-gray-100",before:"peer-checked:before:bg-gray-500"},green:{input:"checked:bg-green-600",circle:"peer-checked:border-green-600",before:"peer-checked:before:bg-green-600"}}}},tabsHeader:{defaultProps:{className:"grow gap-6 rounded-none bg-transparent !p-0 border-b border-b-gray-100 flex items-end px-0 w-full mb-6"}},tab:{defaultProps:{className:"min-w-fit max-w-fit justify-start font-medium text-gray-600 pl-0 pr-2 h-12"},styles:{base:{indicator:{bg:"bg-transparent border-b-2 border-gray-900 !transform-none",borderRadius:"radius-none",boxShadow:"shadow-none"}}}},tabPanel:{styles:{base:{p:"px-0"}}}};function jb(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var su={exports:{}},Ko={};/**
|
|
1
|
+
"use strict";var CE=Object.defineProperty;var Hv=i=>{throw TypeError(i)};var SE=(i,e,t)=>e in i?CE(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Ie=(i,e,t)=>SE(i,typeof e!="symbol"?e+"":e,t),lm=(i,e,t)=>e.has(i)||Hv("Cannot "+t);var u=(i,e,t)=>(lm(i,e,"read from private field"),t?t.call(i):e.get(i)),N=(i,e,t)=>e.has(i)?Hv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),T=(i,e,t,r)=>(lm(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),L=(i,e,t)=>(lm(i,e,"access private method"),t);var bn=(i,e,t,r)=>({set _(n){T(i,e,n,t)},get _(){return u(i,e,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Pe=require("react"),Mt=require("@material-tailwind/react"),TE=require("react-textarea-autosize"),vi=require("@iconify/react");var um=typeof document<"u"?document.currentScript:null;const kE={fontFamily:{sans:["Work Sans","sans-serif"],mono:["Roboto Mono","monospace"],signature:["Alex Brush","Lucida Handwriting","cursive"]},fontSize:{subheader:["18px",{lineHeight:"28px",letterSpacing:"-0.01em"}],"subheader-em":["18px",{lineHeight:"28px",letterSpacing:"-0.01em",fontWeight:"500"}],body:["16px",{lineHeight:"28px",letterSpacing:"-0.01em"}],"body-em":["16px",{lineHeight:"28px",letterSpacing:"-0.01em",fontWeight:"500"}],"caption-1":["16px",{lineHeight:"22px"}],"caption-1-em":["16px",{lineHeight:"22px",fontWeight:"500"}],"caption-2":["14px",{lineHeight:"20px"}],"caption-2-em":["14px",{lineHeight:"20px",fontWeight:"500"}],footnote:["13px",{lineHeight:"17px"}],"footnote-em":["13px",{lineHeight:"17px",fontWeight:"500"}]},width:{authPageWidth:"370px"},keyframes:{"accordion-down":{from:{height:0},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"},colors:{brand:{50:"#e0fff2",100:"#adf0d3",200:"#8aeac1",300:"#67e4ae",400:"#45de9c",500:"#26d489",600:"#1da56a",700:"#15754c",800:"#0c452d",900:"#04160e"},gray:{50:"#fafafa",100:"#f0f0f0",200:"#d6d6d6",300:"#bdbdbd",400:"#a3a3a3",500:"#8a8a8a",600:"#6e6e6e",700:"#525252",800:"#363636",900:"#1a1a1a"},green:{50:"#e0fff2",100:"#adf0d3",200:"#8aeac1",300:"#67e4ae",400:"#45de9c",500:"#26d489",600:"#1da56a",700:"#15754c",800:"#0c452d",900:"#04160e"},blue:{50:"#cae8f7",100:"#b8e0f4",200:"#95d1ef",300:"#71c1ea",400:"#4eb2e4",500:"#2aa2df",600:"#1b82b6",700:"#145f85",800:"#0d3c54",900:"#051923"},red:{50:"#f9dcdc",100:"#f6cbcb",200:"#f0a8a8",300:"#ea8686",400:"#e36363",500:"#dd4040",600:"#c32222",700:"#931a1a",800:"#641212",900:"#340909"},orange:{50:"#fff7eb",100:"#f8e0bf",200:"#f4cf9a",300:"#f0bd75",400:"#ecab51",500:"#e89a2c",600:"#C77C0A",700:"#935d10",800:"#603d0b",900:"#2e1d05"},"brand-purple":"#ab68ff",presentation:"var(--presentation)","text-primary":"var(--text-primary)","text-secondary":"var(--text-secondary)","text-secondary-alt":"var(--text-secondary-alt)","text-tertiary":"var(--text-tertiary)","ring-primary":"var(--ring-primary)","header-primary":"var(--header-primary)","header-hover":"var(--header-hover)","header-button-hover":"var(--header-button-hover)","surface-active":"var(--surface-active)","surface-active-alt":"var(--surface-active-alt)","surface-hover":"var(--surface-hover)","surface-primary":"var(--surface-primary)","surface-primary-alt":"var(--surface-primary-alt)","surface-primary-contrast":"var(--surface-primary-contrast)","surface-secondary":"var(--surface-secondary)","surface-secondary-alt":"var(--surface-secondary-alt)","surface-tertiary":"var(--surface-tertiary)","surface-tertiary-alt":"var(--surface-tertiary-alt)","surface-dialog":"var(--surface-dialog)","surface-submit":"var(--surface-submit)","border-light":"var(--border-light)","border-medium":"var(--border-medium)","border-medium-alt":"var(--border-medium-alt)","border-heavy":"var(--border-heavy)","border-xheavy":"var(--border-xheavy)",border:"hsl(var(--border))",input:"hsl(var(--input))","switch-unchecked":"hsl(var(--switch-unchecked))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"8px",md:"calc(8px - 2px)",sm:"calc(8px - 4px)"}},DE={button:{defaultProps:{className:"items-center normal-case shadow-none hover:shadow-none text-caption-1 font-medium h-10 rounded-lg flex gap-2 px-3 truncate tracking-[0.16px] justify-center",ripple:!1,color:"green"},styles:{sizes:{md:{fontSize:"text-md",className:"py-2"}},variants:{filled:{blue:{color:"!text-white",background:"bg-blue-400",hover:"hover:bg-blue-500",disabled:"disabled:bg-blue-200 disabled:!text-blue-600 !opacity-100"},green:{color:"!text-white",background:"bg-green-600",hover:"hover:bg-green-700",disabled:"disabled:bg-green-200 disabled:!text-green-600 !opacity-100"},red:{color:"!text-white",background:"bg-red-600",hover:"hover:bg-red-700",disabled:"disabled:bg-red-200 disabled:!text-red-600 !opacity-100"},gray:{color:"text-black",background:"bg-gray-50",hover:"hover:bg-gray-100",disabled:"disabled:bg-gray-50 disabled:!text-gray-200 !opacity-100"},orange:{color:"!text-orange-600",background:"bg-orange-50",hover:"hover:bg-orange-100",disabled:"disabled:bg-orange-50 disabled:!text-orange-200 !opacity-100"}},outlined:{gray:{background:"bg-white",color:"text-gray-700 border-gray-100",hover:"!text-gray-900 hover:bg-gray-100",disabled:"disabled:text-gray-500"}},text:{green:{color:"!text-green-600",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"},gray:{color:"!text-gray-700",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"}}}}},iconButton:{defaultProps:{className:"items-center justify-center normal-case shadow-none hover:shadow-none text-caption-1 font-medium h-10 rounded-lg flex gap-2 px-3 truncate",ripple:!1,color:"green"},styles:{sizes:{md:{fontSize:"text-md",className:"py-2"}},variants:{filled:{blue:{color:"!text-white",background:"bg-blue-400",hover:"hover:bg-blue-500",disabled:"disabled:bg-blue-200 disabled:!text-blue-600 !opacity-100"},green:{color:"!text-white",background:"bg-green-600",hover:"hover:bg-green-700",disabled:"disabled:bg-green-200 disabled:!text-green-600 !opacity-100"},red:{color:"!text-white",background:"bg-red-600",hover:"hover:bg-red-700",disabled:"disabled:bg-red-200 disabled:!text-red-600 !opacity-100"},gray:{color:"text-black",background:"bg-gray-50",hover:"hover:bg-gray-100",disabled:"disabled:bg-gray-50 disabled:!text-gray-200 !opacity-100"},orange:{color:"!text-orange-600",background:"bg-orange-50",hover:"hover:bg-orange-100",disabled:"disabled:bg-orange-50 disabled:!text-orange-200 !opacity-100"}},outlined:{gray:{background:"bg-white",color:"text-gray-700 border-gray-100",hover:"!text-gray-900 hover:bg-gray-100",disabled:"disabled:text-gray-500"}},text:{green:{color:"!text-green-600",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"},gray:{color:"!text-gray-700",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"}}}}},progress:{defaultProps:{className:"bg-gray-100",barProps:{className:"transform transition-all duration-300"}},styles:{sizes:{sm:{container:{initial:{height:"h-1"}}}}}},menu:{styles:{base:{menu:{border:"border border-gray-100",borderRadius:"rounded-xl",boxShadow:"shadow-sm",p:"p-2"},item:{initial:{display:"flex gap-2 items-center focus-within:outline-none text-gray-900",bg:"hover:bg-gray-100",p:"p-2"}}}}},dialog:{defaultProps:{size:"sm",dismiss:{},animate:{mount:{},unmount:{}},className:""},valid:{sizes:["xs","sm","md","lg","xl","xxl"]},styles:{base:{backdrop:{width:"w-full",display:"grid",placeItems:"place-items-center",position:"fixed",top:0,left:0,height:"h-screen",backgroundColor:"bg-[rgba(0,0,0,0.16)]",backgroundOpacity:"bg-opacity-100",backdropFilter:"backdrop-blur-none"},container:{height:"h-[450px]",position:"relative",bg:"bg-white",m:"m-4",borderRadius:"rounded-xl",boxShadow:"shadow-[0px_2px_8px_0px_#00000029,0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A]",fontSmoothing:"antialiased"}},sizes:{sm:{maxWidth:"!max-w-[550px]"},lg:{maxWidth:"!max-w-[700px]"}}}},dialogHeader:{styles:{base:{display:"text-gray-900 font-normal"}}},checkbox:{defaultProps:{color:"custom",ripple:!1},valid:{colors:["blue-gray","gray","red","green","custom"]},styles:{base:{root:{display:"inline-flex",alignItems:"items-center"},container:{position:"relative",display:"flex",alignItems:"items-center",cursor:"cursor-pointer",p:"!p-0",borderRadius:"rounded-full"},input:{peer:"peer",position:"relative",appearance:"appearance-none",width:"w-5",height:"h-5",borderWidth:"border-[1.5px]",borderRadius:"rounded-md",borderColor:"border-gray-100",cursor:"cursor-pointer",transition:"transition-all",before:{content:"before:content-['']",display:"before:block",bg:"before:bg-transparent",width:"before:w-12",height:"before:h-12",borderRadius:"before:rounded-full",position:"before:absolute",opacity:"before:opacity-0 hover:before:opacity-10"}},label:{color:"text-gray-700",fontWeight:"font-light",userSelect:"select-none",cursor:"cursor-pointer",mt:"mt-px",px:"px-2"},icon:{display:"flex",alignItems:"items-center",justifyContent:"justify-center",width:"w-5",height:"h-5",color:"text-green-600",position:"absolute",pointerEvents:"pointer-events-none",opacity:"opacity-0 peer-checked:opacity-100",transition:"transition-opacity"},disabled:{opacity:"opacity-50",pointerEvents:"pointer-events-none"}},colors:{custom:{border:"checked:border-green-600"}}}},popover:{defaultProps:{placement:"top",offset:5,dismiss:{},animate:{unmount:{},mount:{}},className:""},styles:{base:{bg:"bg-white",p:"p-4",borderWidth:"border",borderColor:"border-gray-200",borderRadius:"rounded-lg",boxShadow:"[box-shadow:0px_2px_2px_0px_#0000000A,_0px_8px_8px_-8px_#0000000A]",fontSize:"text-sm",fontWeight:"font-normal",color:"text-blue-gray-500",outline:"focus:outline-none",overflowWrap:"break-words",whiteSpace:"whitespace-normal"}}},switch:{defaultProps:{color:"blue",label:"",ripple:!0,className:"",disabled:!1,containerProps:void 0,labelProps:void 0,circleProps:void 0},valid:{colors:["blue-gray","gray","brown","deep-orange","orange","amber","yellow","lime","light-green","green","teal","cyan","light-blue","blue","indigo","deep-purple","purple","pink","red"]},styles:{base:{input:{background:"bg-gray-500"},circle:{borderColor:"border-gray-500",borderRadius:"rounded-full",boxShadow:"shadow-md",position:"absolute",top:"top-2/4",left:"-left-1",transform:"-translate-y-2/4 peer-checked:translate-x-full",transition:"transition-all duration-300",cursor:"cursor-pointer",before:{content:"before:content['']",display:"before:block",bg:"before:bg-blue-gray-500",width:"before:w-10",height:"before:h-10",borderRadius:"before:rounded-full",position:"before:absolute",top:"before:top-2/4",left:"before:left-2/4",transform:"before:-translate-y-2/4 before:-translate-x-2/4",transition:"before:transition-opacity",opacity:"before:opacity-0 hover:before:opacity-10"}},ripple:{display:"inline-block",top:"top-2/4",left:"left-2/4",transform:"-translate-x-2/4 -translate-y-2/4",p:"p-5",borderRadius:"rounded-full"},label:{color:"text-gray-700",fontWeight:"font-light",userSelect:"select-none",cursor:"cursor-pointer",mt:"mt-px",ml:"ml-3",mb:"mb-0"},disabled:{opacity:"opacity-50",pointerEvents:"pointer-events-none"}},colors:{gray:{input:"checked:bg-blue-gray-100",circle:"peer-checked:border-blue-gray-100",before:"peer-checked:before:bg-gray-500"},green:{input:"checked:bg-green-600",circle:"peer-checked:border-green-600",before:"peer-checked:before:bg-green-600"}}}},tabsHeader:{defaultProps:{className:"grow gap-6 rounded-none bg-transparent !p-0 border-b border-b-gray-100 flex items-end px-0 w-full mb-6"}},tab:{defaultProps:{className:"min-w-fit max-w-fit justify-start font-medium text-gray-600 pl-0 pr-2 h-12"},styles:{base:{indicator:{bg:"bg-transparent border-b-2 border-gray-900 !transform-none",borderRadius:"radius-none",boxShadow:"shadow-none"}}}},tabPanel:{styles:{base:{p:"px-0"}}}};var sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _g(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var t0={exports:{}},qc={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var $v;function PE(){if($v)return qc;$v=1;var i=Pe,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,n=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,c){var h,d={},p=null,g=null;c!==void 0&&(p=""+c),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(g=l.ref);for(h in l)r.call(l,h)&&!s.hasOwnProperty(h)&&(d[h]=l[h]);if(o&&o.defaultProps)for(h in l=o.defaultProps,l)d[h]===void 0&&(d[h]=l[h]);return{$$typeof:e,type:o,key:p,ref:g,props:d,_owner:n.current}}return qc.Fragment=t,qc.jsx=a,qc.jsxs=a,qc}var Wc={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,28 +14,279 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var Vv;function RE(){return Vv||(Vv=1,process.env.NODE_ENV!=="production"&&function(){var i=Pe,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y=Symbol.iterator,b="@@iterator";function w(Q){if(Q===null||typeof Q!="object")return null;var Re=y&&Q[y]||Q[b];return typeof Re=="function"?Re:null}var v=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function A(Q){{for(var Re=arguments.length,He=new Array(Re>1?Re-1:0),Je=1;Je<Re;Je++)He[Je-1]=arguments[Je];E("error",Q,He)}}function E(Q,Re,He){{var Je=v.ReactDebugCurrentFrame,Pt=Je.getStackAddendum();Pt!==""&&(Re+="%s",He=He.concat([Pt]));var jt=He.map(function(At){return String(At)});jt.unshift("Warning: "+Re),Function.prototype.apply.call(console[Q],console,jt)}}var _=!1,C=!1,I=!1,k=!1,D=!1,R;R=Symbol.for("react.module.reference");function z(Q){return!!(typeof Q=="string"||typeof Q=="function"||Q===r||Q===s||D||Q===n||Q===c||Q===h||k||Q===g||_||C||I||typeof Q=="object"&&Q!==null&&(Q.$$typeof===p||Q.$$typeof===d||Q.$$typeof===a||Q.$$typeof===o||Q.$$typeof===l||Q.$$typeof===R||Q.getModuleId!==void 0))}function G(Q,Re,He){var Je=Q.displayName;if(Je)return Je;var Pt=Re.displayName||Re.name||"";return Pt!==""?He+"("+Pt+")":He}function O(Q){return Q.displayName||"Context"}function X(Q){if(Q==null)return null;if(typeof Q.tag=="number"&&A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof Q=="function")return Q.displayName||Q.name||null;if(typeof Q=="string")return Q;switch(Q){case r:return"Fragment";case t:return"Portal";case s:return"Profiler";case n:return"StrictMode";case c:return"Suspense";case h:return"SuspenseList"}if(typeof Q=="object")switch(Q.$$typeof){case o:var Re=Q;return O(Re)+".Consumer";case a:var He=Q;return O(He._context)+".Provider";case l:return G(Q,Q.render,"ForwardRef");case d:var Je=Q.displayName||null;return Je!==null?Je:X(Q.type)||"Memo";case p:{var Pt=Q,jt=Pt._payload,At=Pt._init;try{return X(At(jt))}catch{return null}}}return null}var S=Object.assign,J=0,Y,W,fe,K,be,te,j;function ie(){}ie.__reactDisabledLog=!0;function ae(){{if(J===0){Y=console.log,W=console.info,fe=console.warn,K=console.error,be=console.group,te=console.groupCollapsed,j=console.groupEnd;var Q={configurable:!0,enumerable:!0,value:ie,writable:!0};Object.defineProperties(console,{info:Q,log:Q,warn:Q,error:Q,group:Q,groupCollapsed:Q,groupEnd:Q})}J++}}function H(){{if(J--,J===0){var Q={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},Q,{value:Y}),info:S({},Q,{value:W}),warn:S({},Q,{value:fe}),error:S({},Q,{value:K}),group:S({},Q,{value:be}),groupCollapsed:S({},Q,{value:te}),groupEnd:S({},Q,{value:j})})}J<0&&A("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=v.ReactCurrentDispatcher,le;function oe(Q,Re,He){{if(le===void 0)try{throw Error()}catch(Pt){var Je=Pt.stack.trim().match(/\n( *(at )?)/);le=Je&&Je[1]||""}return`
|
|
18
|
+
`+le+Q}}var ce=!1,Ae;{var Se=typeof WeakMap=="function"?WeakMap:Map;Ae=new Se}function Ne(Q,Re){if(!Q||ce)return"";{var He=Ae.get(Q);if(He!==void 0)return He}var Je;ce=!0;var Pt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var jt;jt=se.current,se.current=null,ae();try{if(Re){var At=function(){throw Error()};if(Object.defineProperty(At.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(At,[])}catch(Xr){Je=Xr}Reflect.construct(Q,[],At)}else{try{At.call()}catch(Xr){Je=Xr}Q.call(At.prototype)}}else{try{throw Error()}catch(Xr){Je=Xr}Q()}}catch(Xr){if(Xr&&Je&&typeof Xr.stack=="string"){for(var yt=Xr.stack.split(`
|
|
19
|
+
`),Br=Je.stack.split(`
|
|
20
|
+
`),Yt=yt.length-1,Ut=Br.length-1;Yt>=1&&Ut>=0&&yt[Yt]!==Br[Ut];)Ut--;for(;Yt>=1&&Ut>=0;Yt--,Ut--)if(yt[Yt]!==Br[Ut]){if(Yt!==1||Ut!==1)do if(Yt--,Ut--,Ut<0||yt[Yt]!==Br[Ut]){var an=`
|
|
21
|
+
`+yt[Yt].replace(" at new "," at ");return Q.displayName&&an.includes("<anonymous>")&&(an=an.replace("<anonymous>",Q.displayName)),typeof Q=="function"&&Ae.set(Q,an),an}while(Yt>=1&&Ut>=0);break}}}finally{ce=!1,se.current=jt,H(),Error.prepareStackTrace=Pt}var pa=Q?Q.displayName||Q.name:"",_s=pa?oe(pa):"";return typeof Q=="function"&&Ae.set(Q,_s),_s}function Te(Q,Re,He){return Ne(Q,!1)}function x(Q){var Re=Q.prototype;return!!(Re&&Re.isReactComponent)}function U(Q,Re,He){if(Q==null)return"";if(typeof Q=="function")return Ne(Q,x(Q));if(typeof Q=="string")return oe(Q);switch(Q){case c:return oe("Suspense");case h:return oe("SuspenseList")}if(typeof Q=="object")switch(Q.$$typeof){case l:return Te(Q.render);case d:return U(Q.type,Re,He);case p:{var Je=Q,Pt=Je._payload,jt=Je._init;try{return U(jt(Pt),Re,He)}catch{}}}return""}var B=Object.prototype.hasOwnProperty,F={},M=v.ReactDebugCurrentFrame;function q(Q){if(Q){var Re=Q._owner,He=U(Q.type,Q._source,Re?Re.type:null);M.setExtraStackFrame(He)}else M.setExtraStackFrame(null)}function de(Q,Re,He,Je,Pt){{var jt=Function.call.bind(B);for(var At in Q)if(jt(Q,At)){var yt=void 0;try{if(typeof Q[At]!="function"){var Br=Error((Je||"React class")+": "+He+" type `"+At+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof Q[At]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Br.name="Invariant Violation",Br}yt=Q[At](Re,At,Je,He,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Yt){yt=Yt}yt&&!(yt instanceof Error)&&(q(Pt),A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Je||"React class",He,At,typeof yt),q(null)),yt instanceof Error&&!(yt.message in F)&&(F[yt.message]=!0,q(Pt),A("Failed %s type: %s",He,yt.message),q(null))}}}var we=Array.isArray;function ee(Q){return we(Q)}function Ee(Q){{var Re=typeof Symbol=="function"&&Symbol.toStringTag,He=Re&&Q[Symbol.toStringTag]||Q.constructor.name||"Object";return He}}function De(Q){try{return Ce(Q),!1}catch{return!0}}function Ce(Q){return""+Q}function Me(Q){if(De(Q))return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ee(Q)),Ce(Q)}var $e=v.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},Tt,nr;function yr(Q){if(B.call(Q,"ref")){var Re=Object.getOwnPropertyDescriptor(Q,"ref").get;if(Re&&Re.isReactWarning)return!1}return Q.ref!==void 0}function rr(Q){if(B.call(Q,"key")){var Re=Object.getOwnPropertyDescriptor(Q,"key").get;if(Re&&Re.isReactWarning)return!1}return Q.key!==void 0}function ge(Q,Re){typeof Q.ref=="string"&&$e.current}function ve(Q,Re){{var He=function(){Tt||(Tt=!0,A("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Re))};He.isReactWarning=!0,Object.defineProperty(Q,"key",{get:He,configurable:!0})}}function he(Q,Re){{var He=function(){nr||(nr=!0,A("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Re))};He.isReactWarning=!0,Object.defineProperty(Q,"ref",{get:He,configurable:!0})}}var me=function(Q,Re,He,Je,Pt,jt,At){var yt={$$typeof:e,type:Q,key:Re,ref:He,props:At,_owner:jt};return yt._store={},Object.defineProperty(yt._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(yt,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Je}),Object.defineProperty(yt,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Pt}),Object.freeze&&(Object.freeze(yt.props),Object.freeze(yt)),yt};function Fe(Q,Re,He,Je,Pt){{var jt,At={},yt=null,Br=null;He!==void 0&&(Me(He),yt=""+He),rr(Re)&&(Me(Re.key),yt=""+Re.key),yr(Re)&&(Br=Re.ref,ge(Re,Pt));for(jt in Re)B.call(Re,jt)&&!Xe.hasOwnProperty(jt)&&(At[jt]=Re[jt]);if(Q&&Q.defaultProps){var Yt=Q.defaultProps;for(jt in Yt)At[jt]===void 0&&(At[jt]=Yt[jt])}if(yt||Br){var Ut=typeof Q=="function"?Q.displayName||Q.name||"Unknown":Q;yt&&ve(At,Ut),Br&&he(At,Ut)}return me(Q,yt,Br,Pt,Je,$e.current,At)}}var Ue=v.ReactCurrentOwner,st=v.ReactDebugCurrentFrame;function Ye(Q){if(Q){var Re=Q._owner,He=U(Q.type,Q._source,Re?Re.type:null);st.setExtraStackFrame(He)}else st.setExtraStackFrame(null)}var ct;ct=!1;function pt(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===e}function mt(){{if(Ue.current){var Q=X(Ue.current.type);if(Q)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+Q+"`."}return""}}function Ft(Q){return""}var at={};function nn(Q){{var Re=mt();if(!Re){var He=typeof Q=="string"?Q:Q.displayName||Q.name;He&&(Re=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using
|
|
25
|
+
Check the top-level render call using <`+He+">.")}return Re}}function jn(Q,Re){{if(!Q._store||Q._store.validated||Q.key!=null)return;Q._store.validated=!0;var He=nn(Re);if(at[He])return;at[He]=!0;var Je="";Q&&Q._owner&&Q._owner!==Ue.current&&(Je=" It was passed a child from "+X(Q._owner.type)+"."),Ye(Q),A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',He,Je),Ye(null)}}function Ti(Q,Re){{if(typeof Q!="object")return;if(ee(Q))for(var He=0;He<Q.length;He++){var Je=Q[He];pt(Je)&&jn(Je,Re)}else if(pt(Q))Q._store&&(Q._store.validated=!0);else if(Q){var Pt=w(Q);if(typeof Pt=="function"&&Pt!==Q.entries)for(var jt=Pt.call(Q),At;!(At=jt.next()).done;)pt(At.value)&&jn(At.value,Re)}}}function mn(Q){{var Re=Q.type;if(Re==null||typeof Re=="string")return;var He;if(typeof Re=="function")He=Re.propTypes;else if(typeof Re=="object"&&(Re.$$typeof===l||Re.$$typeof===d))He=Re.propTypes;else return;if(He){var Je=X(Re);de(He,Q.props,"prop",Je,Q)}else if(Re.PropTypes!==void 0&&!ct){ct=!0;var Pt=X(Re);A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Pt||"Unknown")}typeof Re.getDefaultProps=="function"&&!Re.getDefaultProps.isReactClassApproved&&A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Zi(Q){{for(var Re=Object.keys(Q.props),He=0;He<Re.length;He++){var Je=Re[He];if(Je!=="children"&&Je!=="key"){Ye(Q),A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Je),Ye(null);break}}Q.ref!==null&&(Ye(Q),A("Invalid attribute `ref` supplied to `React.Fragment`."),Ye(null))}}var Un={};function sn(Q,Re,He,Je,Pt,jt){{var At=z(Q);if(!At){var yt="";(Q===void 0||typeof Q=="object"&&Q!==null&&Object.keys(Q).length===0)&&(yt+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Br=Ft();Br?yt+=Br:yt+=mt();var Yt;Q===null?Yt="null":ee(Q)?Yt="array":Q!==void 0&&Q.$$typeof===e?(Yt="<"+(X(Q.type)||"Unknown")+" />",yt=" Did you accidentally export a JSX literal instead of a component?"):Yt=typeof Q,A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Yt,yt)}var Ut=Fe(Q,Re,He,Pt,jt);if(Ut==null)return Ut;if(At){var an=Re.children;if(an!==void 0)if(Je)if(ee(an)){for(var pa=0;pa<an.length;pa++)Ti(an[pa],Q);Object.freeze&&Object.freeze(an)}else A("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ti(an,Q)}if(B.call(Re,"key")){var _s=X(Q),Xr=Object.keys(Re).filter(function(Qg){return Qg!=="key"}),Jl=Xr.length>0?"{key: someKey, "+Xr.join(": ..., ")+": ...}":"{key: someKey}";if(!Un[_s+Jl]){var Kg=Xr.length>0?"{"+Xr.join(": ..., ")+": ...}":"{}";A(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Gd,Qn,Mb,Qn),Wf[Qn+Gd]=!0}}return E===s?Tb(Yt):Cb(Yt),Yt}}function Rb(E,M,$){return qf(E,M,$,!0)}function Pb(E,M,$){return qf(E,M,$,!1)}var kb=Pb,Ib=Rb;Jo.Fragment=s,Jo.jsx=kb,Jo.jsxs=Ib}()),Jo}process.env.NODE_ENV==="production"?su.exports=Hb():su.exports=$b();var P=su.exports;const zb=()=>P.jsx("div",{className:"bg-red-800 text-white p-2",children:"Hello world"});function Gb(){for(var c=0,t,e,s="";c<arguments.length;)(t=arguments[c++])&&(e=Ip(t))&&(s&&(s+=" "),s+=e);return s}function Ip(c){if(typeof c=="string")return c;for(var t,e="",s=0;s<c.length;s++)c[s]&&(t=Ip(c[s]))&&(e&&(e+=" "),e+=t);return e}var wf="-";function Vb(c){var t=Wb(c);function e(i){var n=i.split(wf);return n[0]===""&&n.length!==1&&n.shift(),Mp(n,t)||Ub(i)}function s(i){return c.conflictingClassGroups[i]||[]}return{getClassGroupId:e,getConflictingClassGroupIds:s}}function Mp(c,t){var a;if(c.length===0)return t.classGroupId;var e=c[0],s=t.nextPart.get(e),i=s?Mp(c.slice(1),s):void 0;if(i)return i;if(t.validators.length!==0){var n=c.join(wf);return(a=t.validators.find(function(o){var l=o.validator;return l(n)}))==null?void 0:a.classGroupId}}var Jf=/^\[(.+)\]$/;function Ub(c){if(Jf.test(c)){var t=Jf.exec(c)[1],e=t==null?void 0:t.substring(0,t.indexOf(":"));if(e)return"arbitrary.."+e}}function Wb(c){var t=c.theme,e=c.prefix,s={nextPart:new Map,validators:[]},i=Xb(Object.entries(c.classGroups),e);return i.forEach(function(n){var a=n[0],o=n[1];iu(o,s,a,t)}),s}function iu(c,t,e,s){c.forEach(function(i){if(typeof i=="string"){var n=i===""?t:Zf(t,i);n.classGroupId=e;return}if(typeof i=="function"){if(qb(i)){iu(i(s),t,e,s);return}t.validators.push({validator:i,classGroupId:e});return}Object.entries(i).forEach(function(a){var o=a[0],l=a[1];iu(l,Zf(t,o),e,s)})})}function Zf(c,t){var e=c;return t.split(wf).forEach(function(s){e.nextPart.has(s)||e.nextPart.set(s,{nextPart:new Map,validators:[]}),e=e.nextPart.get(s)}),e}function qb(c){return c.isThemeGetter}function Xb(c,t){return t?c.map(function(e){var s=e[0],i=e[1],n=i.map(function(a){return typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(function(o){var l=o[0],h=o[1];return[t+l,h]})):a});return[s,n]}):c}function Yb(c){if(c<1)return{get:function(){},set:function(){}};var t=0,e=new Map,s=new Map;function i(n,a){e.set(n,a),t++,t>c&&(t=0,s=e,e=new Map)}return{get:function(a){var o=e.get(a);if(o!==void 0)return o;if((o=s.get(a))!==void 0)return i(a,o),o},set:function(a,o){e.has(a)?e.set(a,o):i(a,o)}}}var Lp="!";function Kb(c){var t=c.separator||":";return function(s){for(var i=0,n=[],a=0,o=0;o<s.length;o++){var l=s[o];i===0&&l===t[0]&&(t.length===1||s.slice(o,o+t.length)===t)&&(n.push(s.slice(a,o)),a=o+t.length),l==="["?i++:l==="]"&&i--}var h=n.length===0?s:s.substring(a),d=h.startsWith(Lp),u=d?h.substring(1):h;return{modifiers:n,hasImportantModifier:d,baseClassName:u}}}function Jb(c){if(c.length<=1)return c;var t=[],e=[];return c.forEach(function(s){var i=s[0]==="[";i?(t.push.apply(t,e.sort().concat([s])),e=[]):e.push(s)}),t.push.apply(t,e.sort()),t}function Zb(c){return{cache:Yb(c.cacheSize),splitModifiers:Kb(c),...Vb(c)}}var Qb=/\s+/;function t0(c,t){var e=t.splitModifiers,s=t.getClassGroupId,i=t.getConflictingClassGroupIds,n=new Set;return c.trim().split(Qb).map(function(a){var o=e(a),l=o.modifiers,h=o.hasImportantModifier,d=o.baseClassName,u=s(d);if(!u)return{isTailwindClass:!1,originalClassName:a};var f=Jb(l).join(":"),g=h?f+Lp:f;return{isTailwindClass:!0,modifierId:g,classGroupId:u,originalClassName:a}}).reverse().filter(function(a){if(!a.isTailwindClass)return!0;var o=a.modifierId,l=a.classGroupId,h=o+l;return n.has(h)?!1:(n.add(h),i(l).forEach(function(d){return n.add(o+d)}),!0)}).reverse().map(function(a){return a.originalClassName}).join(" ")}function e0(){for(var c=arguments.length,t=new Array(c),e=0;e<c;e++)t[e]=arguments[e];var s,i,n,a=o;function o(h){var d=t[0],u=t.slice(1),f=u.reduce(function(g,y){return y(g)},d());return s=Zb(f),i=s.cache.get,n=s.cache.set,a=l,l(h)}function l(h){var d=i(h);if(d)return d;var u=t0(h,s);return n(h,u),u}return function(){return a(Gb.apply(null,arguments))}}function Lt(c){var t=function(s){return s[c]||[]};return t.isThemeGetter=!0,t}var Dp=/^\[(?:([a-z-]+):)?(.+)\]$/i,s0=/^\d+\/\d+$/,i0=new Set(["px","full","screen"]),n0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r0=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,a0=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function Ms(c){return El(c)||i0.has(c)||s0.test(c)||er(c)}function er(c){return ya(c,"length",d0)}function o0(c){return ya(c,"size",Np)}function l0(c){return ya(c,"position",Np)}function c0(c){return ya(c,"url",u0)}function Wd(c){return ya(c,"number",El)}function El(c){return!Number.isNaN(Number(c))}function Zo(c){return Qf(c)||ya(c,"number",Qf)}function Kt(c){return Dp.test(c)}function Qo(){return!0}function cn(c){return n0.test(c)}function h0(c){return ya(c,"",f0)}function ya(c,t,e){var s=Dp.exec(c);return s?s[1]?s[1]===t:e(s[2]):!1}function d0(c){return r0.test(c)}function Np(){return!1}function u0(c){return c.startsWith("url(")}function Qf(c){return Number.isInteger(Number(c))}function f0(c){return a0.test(c)}function p0(){var c=Lt("colors"),t=Lt("spacing"),e=Lt("blur"),s=Lt("brightness"),i=Lt("borderColor"),n=Lt("borderRadius"),a=Lt("borderSpacing"),o=Lt("borderWidth"),l=Lt("contrast"),h=Lt("grayscale"),d=Lt("hueRotate"),u=Lt("invert"),f=Lt("gap"),g=Lt("gradientColorStops"),y=Lt("inset"),v=Lt("margin"),w=Lt("opacity"),A=Lt("padding"),x=Lt("saturate"),_=Lt("scale"),S=Lt("sepia"),C=Lt("skew"),R=Lt("space"),T=Lt("translate"),k=function(){return["auto","contain","none"]},I=function(){return["auto","hidden","clip","visible","scroll"]},D=function(){return["auto",t]},N=function(){return["",Ms]},Y=function(){return["auto",El,Kt]},q=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},H=function(){return["solid","dashed","dotted","double","none"]},st=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},F=function(){return["start","end","center","between","around","evenly"]},O=function(){return["","0",Kt]},yt=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},Tt=function(){return[El,Wd]},zt=function(){return[El,Kt]};return{cacheSize:500,theme:{colors:[Qo],spacing:[Ms],blur:["none","",cn,er],brightness:Tt(),borderColor:[c],borderRadius:["none","","full",cn,er],borderSpacing:[t],borderWidth:N(),contrast:Tt(),grayscale:O(),hueRotate:zt(),invert:O(),gap:[t],gradientColorStops:[c],inset:D(),margin:D(),opacity:Tt(),padding:[t],saturate:Tt(),scale:Tt(),sepia:O(),skew:zt(),space:[t],translate:[t]},classGroups:{aspect:[{aspect:["auto","square","video",Kt]}],container:["container"],columns:[{columns:[cn]}],"break-after":[{"break-after":yt()}],"break-before":[{"break-before":yt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(q(),[Kt])}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Zo]}],basis:[{basis:[t]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Kt]}],grow:[{grow:O()}],shrink:[{shrink:O()}],order:[{order:["first","last","none",Zo]}],"grid-cols":[{"grid-cols":[Qo]}],"col-start-end":[{col:["auto",{span:[Zo]},Kt]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[Qo]}],"row-start-end":[{row:["auto",{span:[Zo]},Kt]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Kt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Kt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:F()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(F(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(F(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",t]}],"min-w":[{"min-w":["min","max","fit",Ms]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[cn]},cn,er]}],h:[{h:[t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Ms]}],"max-h":[{"max-h":[t,"min","max","fit"]}],"font-size":[{text:["base",cn,er]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Wd]}],"font-family":[{font:[Qo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",er]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ms]}],"list-style-type":[{list:["none","disc","decimal",Kt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[c]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[c]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(H(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",Ms]}],"underline-offset":[{"underline-offset":["auto",Ms]}],"text-decoration-color":[{decoration:[c]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:[t]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",er]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",Kt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(q(),[l0])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",o0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},c0]}],"bg-color":[{bg:[c]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[n]}],"rounded-t":[{"rounded-t":[n]}],"rounded-r":[{"rounded-r":[n]}],"rounded-b":[{"rounded-b":[n]}],"rounded-l":[{"rounded-l":[n]}],"rounded-tl":[{"rounded-tl":[n]}],"rounded-tr":[{"rounded-tr":[n]}],"rounded-br":[{"rounded-br":[n]}],"rounded-bl":[{"rounded-bl":[n]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[].concat(H(),["hidden"])}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:H()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[""].concat(H())}],"outline-offset":[{"outline-offset":[Ms]}],"outline-w":[{outline:[Ms]}],"outline-color":[{outline:[c]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[c]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Ms]}],"ring-offset-color":[{"ring-offset":[c]}],shadow:[{shadow:["","inner","none",cn,h0]}],"shadow-color":[{shadow:[Qo]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":st()}],"bg-blend":[{"bg-blend":st()}],filter:[{filter:["","none"]}],blur:[{blur:[e]}],brightness:[{brightness:[s]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",cn,Kt]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[x]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[e]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Kt]}],duration:[{duration:zt()}],ease:[{ease:["linear","in","out","in-out",Kt]}],delay:[{delay:zt()}],animate:[{animate:["none","spin","ping","pulse","bounce",Kt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Zo,Kt]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Kt]}],accent:[{accent:["auto",c]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Kt]}],"caret-color":[{caret:[c]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":[t]}],"scroll-mx":[{"scroll-mx":[t]}],"scroll-my":[{"scroll-my":[t]}],"scroll-mt":[{"scroll-mt":[t]}],"scroll-mr":[{"scroll-mr":[t]}],"scroll-mb":[{"scroll-mb":[t]}],"scroll-ml":[{"scroll-ml":[t]}],"scroll-p":[{"scroll-p":[t]}],"scroll-px":[{"scroll-px":[t]}],"scroll-py":[{"scroll-py":[t]}],"scroll-pt":[{"scroll-pt":[t]}],"scroll-pr":[{"scroll-pr":[t]}],"scroll-pb":[{"scroll-pb":[t]}],"scroll-pl":[{"scroll-pl":[t]}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Kt]}],fill:[{fill:[c,"none"]}],"stroke-w":[{stroke:[Ms,Wd]}],stroke:[{stroke:[c,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]}}}var g0=e0(p0);function Fp(c){var t,e,s="";if(typeof c=="string"||typeof c=="number")s+=c;else if(typeof c=="object")if(Array.isArray(c))for(t=0;t<c.length;t++)c[t]&&(e=Fp(c[t]))&&(s&&(s+=" "),s+=e);else for(t in c)c[t]&&(s&&(s+=" "),s+=t);return s}function m0(){for(var c,t,e=0,s="";e<arguments.length;)(c=arguments[e++])&&(t=Fp(c))&&(s&&(s+=" "),s+=t);return s}function ga(...c){return g0(m0(c))}function b0({className:c="",size:t="1em"}){return P.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:c,children:[P.jsx("path",{d:"M12.001 7.7395C12.2367 7.73978 12.4591 7.85076 12.6006 8.03931L15.376 11.7395C15.5459 11.9666 15.5731 12.2708 15.4463 12.5247C15.3193 12.7785 15.0592 12.9395 14.7754 12.9397H12.75V17.2766C12.7499 17.6907 12.4142 18.0266 12 18.0266C11.5858 18.0266 11.2501 17.6907 11.25 17.2766V12.9397H9.22559C8.94169 12.9397 8.68182 12.7785 8.55469 12.5247C8.42778 12.2706 8.45558 11.9667 8.62598 11.7395L11.4004 8.03931L11.457 7.97192C11.5977 7.82422 11.7945 7.7395 12.001 7.7395Z",fill:"currentColor"}),P.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.65161C17.5228 2.65161 22 7.12876 22 12.6516C22 18.1744 17.5228 22.6516 12 22.6516C6.47715 22.6516 2 18.1744 2 12.6516C2 7.12876 6.47715 2.65161 12 2.65161ZM12 4.15161C7.30558 4.15161 3.5 7.95719 3.5 12.6516C3.5 17.346 7.30558 21.1516 12 21.1516C16.6944 21.1516 20.5 17.346 20.5 12.6516C20.5 7.95719 16.6944 4.15161 12 4.15161Z",fill:"currentColor"})]})}function y0({className:c="",size:t="1em"}){return P.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:c,children:P.jsx("path",{d:"M12 2C10.0222 2 8.08879 2.58649 6.4443 3.6853C4.79981 4.78412 3.51809 6.3459 2.76121 8.17316C2.00433 10.0004 1.8063 12.0111 2.19215 13.9509C2.578 15.8907 3.53041 17.6725 4.92894 19.0711C6.32746 20.4696 8.10929 21.422 10.0491 21.8078C11.9889 22.1937 13.9996 21.9957 15.8268 21.2388C17.6541 20.4819 19.2159 19.2002 20.3147 17.5557C21.4135 15.9112 22 13.9778 22 12C21.9971 9.34871 20.9426 6.80684 19.0679 4.9321C17.1932 3.05736 14.6513 2.00287 12 2ZM15.7092 11.7642C15.6751 11.8349 15.6217 11.8945 15.5553 11.9363C15.4888 11.978 15.4118 12.0001 15.3333 12H12.8333V16.1667C12.8333 16.3877 12.7455 16.5996 12.5893 16.7559C12.433 16.9122 12.221 17 12 17C11.779 17 11.567 16.9122 11.4107 16.7559C11.2545 16.5996 11.1667 16.3877 11.1667 16.1667V12H8.66667C8.58819 12 8.5113 11.9779 8.44484 11.9362C8.37839 11.8945 8.32507 11.8348 8.29102 11.7641C8.25697 11.6934 8.24359 11.6145 8.2524 11.5365C8.26121 11.4586 8.29187 11.3847 8.34084 11.3233L11.6742 7.15667C11.7146 7.10991 11.7646 7.07241 11.8209 7.04671C11.8771 7.021 11.9382 7.0077 12 7.0077C12.0618 7.0077 12.1229 7.021 12.1791 7.04671C12.2354 7.07241 12.2854 7.10991 12.3258 7.15667L15.6592 11.3233C15.7082 11.3846 15.7389 11.4585 15.7477 11.5365C15.7566 11.6145 15.7432 11.6934 15.7092 11.7642Z",fill:"#1DA56A"})})}const v0=({tooltipContent:c="Send message",className:t,...e})=>{const[s,i]=B.useState(!1);return P.jsx(lt.Tooltip,{content:c,children:P.jsx(lt.IconButton,{variant:"text",color:"gray",className:ga(t,"hover:rounded-lg hover:bg-gray-100"),type:"submit",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),...e,children:s?P.jsx(y0,{className:"size-6 "}):P.jsx(b0,{className:"size-6 "})})})},Op=({onSubmit:c=()=>{},...t})=>P.jsx(Fb,{autoFocus:!0,placeholder:"Write your message here",className:"pl-1 block w-full focus:outline-none max-h-32 resize-none placeholder:text-gray-400",onKeyDown:e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),c())},...t}),w0=({bottom:c,right:t,top:e,textArea:s=P.jsx(Op,{}),...i})=>P.jsxs("div",{className:"border gap-2 rounded-lg bg-white shadow-[0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A] border-gray-100",...i,children:[e,P.jsxs("div",{className:"flex gap-2 p-4 rounded-lg bg-white",children:[P.jsxs("div",{className:"grow flex flex-col items-start justify-center",children:[s,c]}),P.jsx("div",{className:"shrink flex items-end justify-end",children:t})]})]}),A0=Object.freeze(Object.defineProperty({__proto__:null,Container:w0,SubmitButton:v0,Textarea:Op},Symbol.toStringTag,{value:"Module"})),qo=B.createContext(void 0),Bp=({children:c,isCollapsed:t,onSwitchLayout:e})=>{const[s,i]=B.useState(!1),[n,a]=B.useState(!1),o=t!==void 0?t:s,l=h=>{const d=h??!o;t===void 0&&i(d),e==null||e(d)};return P.jsx(qo.Provider,{value:{isCollapsed:o,toggleCollapsed:l,isHovered:n,setIsHovered:a},children:c})},jp=({className:c,children:t,...e})=>{const{isCollapsed:s,isHovered:i,setIsHovered:n}=B.useContext(qo);return P.jsx("div",{className:ga(c,s&&"shadow-lg",s&&!i?"w-auto":"w-[280px]","bg-gray-50 p-2 flex flex-col justify-between items-center rounded-lg"),onMouseEnter:()=>s&&n(!0),onMouseLeave:()=>s&&n(!1),...e,children:t})},x0=({className:c,children:t,isCollapsed:e,onSwitchLayout:s,...i})=>P.jsx(Bp,{isCollapsed:e,onSwitchLayout:s,children:P.jsx(jp,{className:c,...i,children:t})}),E0=({icon:c,children:t,...e})=>{const{isCollapsed:s,isHovered:i}=B.useContext(qo);return P.jsxs("button",{className:"flex items-center gap-2 w-full hover:bg-gray-100 text-caption-1-em text-gray-600 hover:text-gray-900 h-[38px] rounded-lg px-2",...e,children:[c," ",(!s||i)&&t]})};function _0(c){return P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:P.jsx("path",{d:"M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM3.75 3.5C4.16421 3.5 4.5 3.83579 4.5 4.25V11.75C4.5 12.1642 4.16421 12.5 3.75 12.5C3.33579 12.5 3 12.1642 3 11.75V4.25C3 3.83579 3.33579 3.5 3.75 3.5Z",fill:"currentColor"})})}function S0(c){return P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:P.jsx("path",{d:"M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM7.5 4C7.77614 4 8 4.22386 8 4.5V11.5C8 11.7761 7.77614 12 7.5 12H3.5C3.22386 12 3 11.7761 3 11.5V4.5C3 4.22386 3.22386 4 3.5 4H7.5Z",fill:"currentColor"})})}const C0=()=>{const{isCollapsed:c,isHovered:t,toggleCollapsed:e}=B.useContext(qo);return c&&!t?null:P.jsx(lt.IconButton,{variant:"text",color:"gray",onClick:()=>e(),children:c?P.jsx(_0,{className:"size-4"}):P.jsx(S0,{className:"size-4"})})},T0=({children:c,className:t,icon:e,isActive:s,trailing:i,...n})=>{const{isCollapsed:a,isHovered:o}=B.useContext(qo);return P.jsxs("div",{className:ga(s?"!text-gray-900":"!text-gray-600","flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg px-2 cursor-pointer group",t),...n,children:[P.jsxs("div",{className:"flex items-center gap-2",children:[e,(!a||o)&&c]}),(!a||o)&&i]})},R0=({children:c,className:t,isActive:e,trailing:s,icon:i,...n})=>{const{isCollapsed:a,isHovered:o}=B.useContext(qo);return P.jsxs("div",{className:ga(e?"!text-gray-900":"!text-gray-600","flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg pr-2 pl-3 cursor-pointer group text-sm",t),...n,children:[P.jsxs("div",{className:"flex items-center gap-2 overflow-auto",children:[(!a||o)&&i," ",(!a||o)&&c]}),(!a||o)&&s]})},P0=Object.freeze(Object.defineProperty({__proto__:null,Button:E0,Container:jp,Item:T0,Layout:x0,Provider:Bp,SecondaryItem:R0,ToggleCollapseButton:C0},Symbol.toStringTag,{value:"Module"})),k0=c=>P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:P.jsx("path",{d:"M12.7197 2.21954C13.0125 1.92683 13.4874 1.92694 13.7803 2.21954C14.073 2.51241 14.073 2.98722 13.7803 3.28008L9.05955 7.99981L13.7803 12.7205L13.832 12.7772C14.0721 13.0717 14.0548 13.5065 13.7803 13.7811C13.5057 14.0555 13.0709 14.0729 12.7764 13.8328L12.7197 13.7811L7.99901 9.06036L3.27928 13.7811C2.9864 14.0737 2.51156 14.0738 2.21873 13.7811C1.92618 13.4882 1.92616 13.0133 2.21873 12.7205L6.93846 7.99981L2.21873 3.28008C1.92615 2.98722 1.92607 2.51235 2.21873 2.21954C2.51154 1.92673 2.98637 1.92691 3.27928 2.21954L7.99901 6.93926L12.7197 2.21954Z",fill:"currentColor"})}),I0=({onClose:c,right:t,children:e})=>P.jsxs("div",{className:"bg-gray-50 flex gap-2 items-center px-2 py-3 rounded-t-xl",children:[P.jsx("div",{className:"grow text-subheader-em",children:e}),P.jsxs("div",{className:"flex items-center gap-4",children:[t,P.jsx(lt.IconButton,{variant:"text",size:"sm",color:"gray",className:"rounded-full",onClick:c,children:P.jsx(k0,{className:"size-4 text-gray-600"})})]})]}),Hp={Header:I0},$p=c=>P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:P.jsx("path",{d:"M2.25 5.5C2.66421 5.5 3 5.83579 3 6.25C3 6.66421 2.66421 7 2.25 7H2C1.72386 7 1.5 7.22386 1.5 7.5V13.5C1.5 13.7761 1.72386 14 2 14H8C8.27614 14 8.5 13.7761 8.5 13.5V13.25C8.5 12.8358 8.83579 12.5 9.25 12.5C9.66421 12.5 10 12.8358 10 13.25V13.5C10 14.5357 9.21278 15.387 8.2041 15.4893L8 15.5H2L1.7959 15.4893C0.854346 15.3938 0.1062 14.6457 0.0107422 13.7041L0 13.5V7.5C0 6.39543 0.895431 5.5 2 5.5H2.25ZM13.75 0C14.7165 1.28853e-07 15.5 0.783502 15.5 1.75V9.75C15.5 10.7165 14.7165 11.5 13.75 11.5H5.75C4.7835 11.5 4 10.7165 4 9.75V1.75C4 0.783502 4.7835 8.0532e-09 5.75 0H13.75ZM5.75 1.5C5.61193 1.5 5.5 1.61193 5.5 1.75V9.75C5.5 9.88807 5.61193 10 5.75 10H13.75C13.8881 10 14 9.88807 14 9.75V1.75C14 1.61193 13.8881 1.5 13.75 1.5H5.75ZM11.75 3C11.795 3 11.839 3.00413 11.8818 3.01172C11.8874 3.0127 11.8929 3.01354 11.8984 3.01465C11.9118 3.01733 11.9244 3.02298 11.9375 3.02637C11.9707 3.03495 12.0041 3.04344 12.0361 3.05664C12.0653 3.06868 12.092 3.08512 12.1191 3.10059C12.1763 3.1331 12.2316 3.171 12.2803 3.21973C12.3287 3.26812 12.366 3.3232 12.3984 3.37988C12.414 3.40703 12.4303 3.43375 12.4424 3.46289C12.4631 3.51289 12.4779 3.56459 12.4873 3.61719C12.495 3.66035 12.5 3.70462 12.5 3.75V7.75C12.5 8.16421 12.1642 8.5 11.75 8.5C11.3358 8.5 11 8.16421 11 7.75V5.56055L8.28027 8.28027C7.98738 8.57317 7.51262 8.57317 7.21973 8.28027C6.92683 7.98738 6.92683 7.51262 7.21973 7.21973L9.93945 4.5H7.75C7.33579 4.5 7 4.16421 7 3.75C7 3.33579 7.33579 3 7.75 3H11.75Z",fill:"currentColor"})}),zp=(c=100,t=50,e=990,s=10)=>{const[i,n]=B.useState(c);return[i,{...{zoomIn:()=>n(l=>Math.min(l+s,e)),zoomOut:()=>n(l=>Math.max(l-s,t)),reset:()=>n(c),zoomToValue:l=>n(Math.max(t,Math.min(l,e)))},handleWheel:l=>{l.preventDefault();const h=l.deltaY>0?-s:s;n(d=>Math.max(t,Math.min(d+h,e)))}}]},Gp=()=>{const[c,t]=B.useState(0);return[c,{rotateClockwise:()=>t(s=>(s+90)%360),rotateCounterClockwise:()=>t(s=>(s-90+360)%360)}]},Vp=()=>{const[c,t]=B.useState({x:0,y:0}),[e,s]=B.useState(!1),[i,n]=B.useState({x:0,y:0});return[{pan:c,isDragging:e},{handleMouseDown:d=>{s(!0),n({x:d.clientX-c.x,y:d.clientY-c.y})},handleMouseMove:d=>{e&&t({x:d.clientX-i.x,y:d.clientY-i.y})},handleMouseUp:()=>{s(!1)},reset:()=>t({x:0,y:0})}]},Up=(c=0)=>{const[t,e]=B.useState(1),[s,i]=B.useState(c),n={nextPage:B.useCallback(()=>{e(a=>a<s?a+1:a)},[s]),prevPage:B.useCallback(()=>{e(a=>Math.max(a-1,1))},[]),goToPage:B.useCallback(a=>{e(()=>Math.max(1,Math.min(a,s)))},[s]),setTotalPages:B.useCallback(a=>{i(a),e(o=>Math.min(o,a))},[])};return[{currentPage:t,totalPages:s},n]},M0=({className:c,onClose:t,totalPages:e,getImageSrc:s,documentUrl:i,title:n="PDF Viewer"})=>{const[a,o]=zp(),[l,h]=Gp(),[{pan:d,isDragging:u},f]=Vp(),[{currentPage:g},y]=Up(e),v=P.jsx(lt.IconButton,{variant:"text",color:"gray",children:P.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:P.jsx($p,{className:"size-4"})})});return P.jsxs("div",{className:ga("shadow rounded-t-lg flex flex-col h-full",c),children:[P.jsx(Hp.Header,{onClose:t,right:v,children:n}),P.jsx("div",{className:"flex-1 grid",children:P.jsxs("div",{className:"grid relative",children:[P.jsx("div",{className:"overflow-hidden col-start-1 row-start-1 bg-gray-200 h-full relative",onMouseMove:f.handleMouseMove,onMouseUp:f.handleMouseUp,onMouseLeave:f.handleMouseUp,onWheel:o.handleWheel,children:P.jsx("div",{style:{transform:`translate(${d.x}px, ${d.y}px)`,cursor:u?"grabbing":"grab",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},onMouseDown:f.handleMouseDown,children:P.jsx("div",{style:{transform:`scale(${a/100}) rotate(${l}deg)`,transformOrigin:"center",transition:u?"none":"transform 0.3s ease"},children:P.jsx("img",{src:s(g),style:{userSelect:"none",pointerEvents:"none"}})})})}),P.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[P.jsxs(lt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.zoomOut,children:P.jsx(_s.Icon,{icon:"lucide:minus"})}),P.jsx(lt.Tooltip,{content:"Click to reset zoom and pan",children:P.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{o.reset(),f.reset()},children:[a,"%"]})}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.zoomIn,children:P.jsx(_s.Icon,{icon:"lucide:plus"})})]}),P.jsxs(lt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:h.rotateClockwise,children:P.jsx(_s.Icon,{icon:"lucide:iteration-cw"})}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:h.rotateCounterClockwise,children:P.jsx(_s.Icon,{icon:"lucide:iteration-ccw"})})]}),P.jsxs(lt.ButtonGroup,{className:"divide-x-0 ",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:y.prevPage,disabled:g===1,children:P.jsx(_s.Icon,{icon:"lucide:chevron-left"})}),P.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:g,onChange:w=>{const A=parseInt(w.target.value);isNaN(A)||y.goToPage(A)},type:"number",min:"1",max:e}),P.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",e]}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:y.nextPage,disabled:g===e,children:P.jsx(_s.Icon,{icon:"lucide:chevron-right"})})]})]})]})})]})},Be=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),nu=[.001,0,0,.001,0,0],qd=1.35,hs={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},gi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Wp="pdfjs_internal_editor_",J={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101},rt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},qp={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},xe={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},_l={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Vt={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},Sa={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},ah={ERRORS:0,WARNINGS:1,INFOS:5},Sl={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,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},mh={moveTo:0,lineTo:1,curveTo:2,closePath:3},Xp={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Cd=ah.WARNINGS;function L0(c){Number.isInteger(c)&&(Cd=c)}function D0(){return Cd}function Td(c){Cd>=ah.INFOS&&console.log(`Info: ${c}`)}function Z(c){Cd>=ah.WARNINGS&&console.log(`Warning: ${c}`)}function xt(c){throw new Error(c)}function Zt(c,t){c||xt(t)}function N0(c){switch(c==null?void 0:c.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Af(c,t=null,e=null){if(!c)return null;if(e&&typeof c=="string"){if(e.addDefaultProtocol&&c.startsWith("www.")){const i=c.match(/\./g);(i==null?void 0:i.length)>=2&&(c=`http://${c}`)}if(e.tryConvertEncoding)try{c=H0(c)}catch{}}const s=t?URL.parse(c,t):URL.parse(c);return N0(s)?s:null}function xf(c,t,e=!1){const s=URL.parse(c);return s?(s.hash=t,s.href):e&&Af(c,"http://example.com")?c.split("#",1)[0]+`${t?`#${t}`:""}`:""}function it(c,t,e,s=!1){return Object.defineProperty(c,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const va=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class tp extends va{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Xd extends va{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Qh extends va{constructor(t){super(t,"InvalidPDFException")}}class Cl extends va{constructor(t,e,s){super(t,"ResponseException"),this.status=e,this.missing=s}}class F0 extends va{constructor(t){super(t,"FormatError")}}class sn extends va{constructor(t){super(t,"AbortException")}}function Yp(c){(typeof c!="object"||(c==null?void 0:c.length)===void 0)&&xt("Invalid argument for bytesToString");const t=c.length,e=8192;if(t<e)return String.fromCharCode.apply(null,c);const s=[];for(let i=0;i<t;i+=e){const n=Math.min(i+e,t),a=c.subarray(i,n);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function oh(c){typeof c!="string"&&xt("Invalid argument for stringToBytes");const t=c.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=c.charCodeAt(s)&255;return e}function O0(c){return String.fromCharCode(c>>24&255,c>>16&255,c>>8&255,c&255)}function B0(){const c=new Uint8Array(4);return c[0]=1,new Uint32Array(c.buffer,0,1)[0]===1}function j0(){try{return new Function(""),!0}catch{return!1}}class ue{static get isLittleEndian(){return it(this,"isLittleEndian",B0())}static get isEvalSupported(){return it(this,"isEvalSupported",j0())}static get isOffscreenCanvasSupported(){return it(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return it(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:t,userAgent:e}=navigator;return it(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){var t,e;return it(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Yd=Array.from(Array(256).keys(),c=>c.toString(16).padStart(2,"0"));var tn,Eh,ru;class W{static makeHexColor(t,e,s){return`#${Yd[t]}${Yd[e]}${Yd[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e,s=0){const i=t[s],n=t[s+1];t[s]=i*e[0]+n*e[2]+e[4],t[s+1]=i*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,s=0){const i=e[0],n=e[1],a=e[2],o=e[3],l=e[4],h=e[5];for(let d=0;d<6;d+=2){const u=t[s+d],f=t[s+d+1];t[s+d]=u*i+f*a+l,t[s+d+1]=u*n+f*o+h}}static applyInverseTransform(t,e){const s=t[0],i=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(s*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-s*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,s){const i=e[0],n=e[1],a=e[2],o=e[3],l=e[4],h=e[5],d=t[0],u=t[1],f=t[2],g=t[3];let y=i*d+l,v=y,w=i*f+l,A=w,x=o*u+h,_=x,S=o*g+h,C=S;if(n!==0||a!==0){const R=n*d,T=n*f,k=a*u,I=a*g;y+=k,A+=k,w+=I,v+=I,x+=R,C+=R,S+=T,_+=T}s[0]=Math.min(s[0],y,w,v,A),s[1]=Math.min(s[1],x,S,_,C),s[2]=Math.max(s[2],y,w,v,A),s[3]=Math.max(s[3],x,S,_,C)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const s=t[0],i=t[1],n=t[2],a=t[3],o=s**2+i**2,l=s*n+i*a,h=n**2+a**2,d=(o+h)/2,u=Math.sqrt(d**2-(o*h-l**2));e[0]=Math.sqrt(d+u||1),e[1]=Math.sqrt(d-u||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[s,n,i,a]}static pointBoundingBox(t,e,s){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}static rectBoundingBox(t,e,s,i,n){n[0]=Math.min(n[0],t,s),n[1]=Math.min(n[1],e,i),n[2]=Math.max(n[2],t,s),n[3]=Math.max(n[3],e,i)}static bezierBoundingBox(t,e,s,i,n,a,o,l,h){h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l),b(this,tn,ru).call(this,t,s,n,o,e,i,a,l,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),h),b(this,tn,ru).call(this,t,s,n,o,e,i,a,l,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),h)}}tn=new WeakSet,Eh=function(t,e,s,i,n,a,o,l,h,d){if(h<=0||h>=1)return;const u=1-h,f=h*h,g=f*h,y=u*(u*(u*t+3*h*e)+3*f*s)+g*i,v=u*(u*(u*n+3*h*a)+3*f*o)+g*l;d[0]=Math.min(d[0],y),d[1]=Math.min(d[1],v),d[2]=Math.max(d[2],y),d[3]=Math.max(d[3],v)},ru=function(t,e,s,i,n,a,o,l,h,d,u,f){if(Math.abs(h)<1e-12){Math.abs(d)>=1e-12&&b(this,tn,Eh).call(this,t,e,s,i,n,a,o,l,-u/d,f);return}const g=d**2-4*u*h;if(g<0)return;const y=Math.sqrt(g),v=2*h;b(this,tn,Eh).call(this,t,e,s,i,n,a,o,l,(-d+y)/v,f),b(this,tn,Eh).call(this,t,e,s,i,n,a,o,l,(-d-y)/v,f)},m(W,tn);function H0(c){return decodeURIComponent(escape(c))}let Kd=null,ep=null;function Kp(c){return Kd||(Kd=/([\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,ep=new Map([["ſt","ſt"]])),c.replaceAll(Kd,(t,e,s)=>e?e.normalize("NFKC"):ep.get(s))}function Ef(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const c=new Uint8Array(32);return crypto.getRandomValues(c),Yp(c)}const _f="pdfjs_internal_id_";function $0(c,t,e){if(!Array.isArray(e)||e.length<2)return!1;const[s,i,...n]=e;if(!c(s)&&!Number.isInteger(s)||!t(i))return!1;const a=n.length;let o=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of n)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function Te(c,t,e){return Math.min(Math.max(c,t),e)}function Jp(c){return Uint8Array.prototype.toBase64?c.toBase64():btoa(Yp(c))}function z0(c){return Uint8Array.fromBase64?Uint8Array.fromBase64(c):oh(atob(c))}typeof Promise.try!="function"&&(Promise.try=function(c,...t){return new Promise(e=>{e(c(...t))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(c){return c.reduce((t,e)=>t+e,0)});const vi="http://www.w3.org/2000/svg",rr=class rr{};L(rr,"CSS",96),L(rr,"PDF",72),L(rr,"PDF_TO_CSS_UNITS",rr.CSS/rr.PDF);let nn=rr;async function Xo(c,t="text"){if(nl(c,document.baseURI)){const e=await fetch(c);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",c,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class lh{constructor({viewBox:t,userUnit:e,scale:s,rotation:i,offsetX:n=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=s,this.rotation=i,this.offsetX=n,this.offsetY=a,s*=e;const l=(t[2]+t[0])/2,h=(t[3]+t[1])/2;let d,u,f,g;switch(i%=360,i<0&&(i+=360),i){case 180:d=-1,u=0,f=0,g=1;break;case 90:d=0,u=1,f=1,g=0;break;case 270:d=0,u=-1,f=-1,g=0;break;case 0:d=1,u=0,f=0,g=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,g=-g);let y,v,w,A;d===0?(y=Math.abs(h-t[1])*s+n,v=Math.abs(l-t[0])*s+a,w=(t[3]-t[1])*s,A=(t[2]-t[0])*s):(y=Math.abs(l-t[0])*s+n,v=Math.abs(h-t[1])*s+a,w=(t[2]-t[0])*s,A=(t[3]-t[1])*s),this.transform=[d*s,u*s,f*s,g*s,y-d*s*l-f*s*h,v-u*s*l-g*s*h],this.width=w,this.height=A}get rawDims(){const t=this.viewBox;return it(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new lh({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){const s=[t,e];return W.applyTransform(s,this.transform),s}convertToViewportRectangle(t){const e=[t[0],t[1]];W.applyTransform(e,this.transform);const s=[t[2],t[3]];return W.applyTransform(s,this.transform),[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){const s=[t,e];return W.applyInverseTransform(s,this.transform),s}}class Rd extends va{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function ch(c){const t=c.length;let e=0;for(;e<t&&c[e].trim()==="";)e++;return c.substring(e,e+5).toLowerCase()==="data:"}function Pd(c){return typeof c=="string"&&/\.pdf$/i.test(c)}function Zp(c){return[c]=c.split(/[#?]/,1),c.substring(c.lastIndexOf("/")+1)}function Qp(c,t="document.pdf"){if(typeof c!="string")return t;if(ch(c))return Z('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const s=(o=>{try{return new URL(o)}catch{try{return new URL(decodeURIComponent(o))}catch{try{return new URL(o,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{return null}}}}})(c);if(!s)return t;const i=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},n=/\.pdf$/i,a=s.pathname.split("/").at(-1);if(n.test(a))return i(a);if(s.searchParams.size>0){const o=Array.from(s.searchParams.values()).reverse();for(const h of o)if(n.test(h))return i(h);const l=Array.from(s.searchParams.keys()).reverse();for(const h of l)if(n.test(h))return i(h)}if(s.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(s.hash);if(l)return i(l[0])}return t}class sp{constructor(){L(this,"started",Object.create(null));L(this,"times",[])}time(t){t in this.started&&Z(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||Z(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:s}of this.times)e=Math.max(s.length,e);for(const{name:s,start:i,end:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms
|
|
31
|
-
`);return t.join("")}}function nl(c,t){const e=t?URL.parse(c,t):URL.parse(c);return(e==null?void 0:e.protocol)==="http:"||(e==null?void 0:e.protocol)==="https:"}function Rs(c){c.preventDefault()}function qt(c){c.preventDefault(),c.stopPropagation()}function G0(c){console.log("Deprecated API usage: "+c)}var Ml;class kd{static toDateObject(t){if(!t||typeof t!="string")return null;r(this,Ml)||p(this,Ml,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=r(this,Ml).exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,h==="-"?(a+=d,o+=u):h==="+"&&(a-=d,o-=u),new Date(Date.UTC(s,i,n,a,o,l))}}Ml=new WeakMap,m(kd,Ml);function tg(c,{scale:t=1,rotation:e=0}){const{width:s,height:i}=c.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new lh({viewBox:n,userUnit:1,scale:t,rotation:e})}function Sf(c){if(c.startsWith("#")){const t=parseInt(c.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return c.startsWith("rgb(")?c.slice(4,-1).split(",").map(t=>parseInt(t)):c.startsWith("rgba(")?c.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(Z(`Not a valid color format: "${c}"`),[0,0,0])}function V0(c){const t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(const e of c.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;c.set(e,Sf(s))}t.remove()}function jt(c){const{a:t,b:e,c:s,d:i,e:n,f:a}=c.getTransform();return[t,e,s,i,n,a]}function Ys(c){const{a:t,b:e,c:s,d:i,e:n,f:a}=c.getTransform().invertSelf();return[t,e,s,i,n,a]}function Xn(c,t,e=!1,s=!0){if(t instanceof lh){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:a}=c,o=ue.isCSSRoundSupported,l=`var(--total-scale-factor) * ${i}px`,h=`var(--total-scale-factor) * ${n}px`,d=o?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,u=o?`round(down, ${h}, var(--scale-round-y))`:`calc(${h})`;!e||t.rotation%180===0?(a.width=d,a.height=u):(a.width=u,a.height=d)}s&&c.setAttribute("data-main-rotation",t.rotation)}class qs{constructor(){const{pixelRatio:t}=qs;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,s,i,n=-1){let a=1/0,o=1/0,l=1/0;s=qs.capPixels(s,n),s>0&&(a=Math.sqrt(s/(t*e))),i!==-1&&(o=i/t,l=i/e);const h=Math.min(a,o,l);return this.sx>h||this.sy>h?(this.sx=h,this.sy=h,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,s):s}return t}}const td=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];var dn,or,bs,un,Ll,Ba,Dl,od,eg,je,sg,ig,rl,_h;const xi=class xi{constructor(t){m(this,je);m(this,dn,null);m(this,or,null);m(this,bs);m(this,un,null);m(this,Ll,null);m(this,Ba,null);p(this,bs,t),r(xi,Dl)||p(xi,Dl,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const t=p(this,dn,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=r(this,bs)._uiManager._signal;t.addEventListener("contextmenu",Rs,{signal:e}),t.addEventListener("pointerdown",b(xi,od,eg),{signal:e});const s=p(this,un,document.createElement("div"));s.className="buttons",t.append(s);const i=r(this,bs).toolbarPosition;if(i){const{style:n}=t,a=r(this,bs)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return r(this,dn)}hide(){var t;r(this,dn).classList.add("hidden"),(t=r(this,or))==null||t.hideDropdown()}show(){var t;r(this,dn).classList.remove("hidden"),(t=r(this,Ll))==null||t.shown()}addDeleteButton(){const{editorType:t,_uiManager:e}=r(this,bs),s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",r(xi,Dl)[t]),b(this,je,rl).call(this,s),s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),r(this,un).append(s)}async addAltText(t){const e=await t.render();b(this,je,rl).call(this,e),r(this,un).append(e,r(this,je,_h)),p(this,Ll,t)}addColorPicker(t){p(this,or,t);const e=t.renderButton();b(this,je,rl).call(this,e),r(this,un).append(e,r(this,je,_h))}async addEditSignatureButton(t){const e=p(this,Ba,await t.renderEditButton(r(this,bs)));b(this,je,rl).call(this,e),r(this,un).append(e,r(this,je,_h))}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break}}updateEditSignatureButton(t){r(this,Ba)&&(r(this,Ba).title=t)}remove(){var t;r(this,dn).remove(),(t=r(this,or))==null||t.destroy(),p(this,or,null)}};dn=new WeakMap,or=new WeakMap,bs=new WeakMap,un=new WeakMap,Ll=new WeakMap,Ba=new WeakMap,Dl=new WeakMap,od=new WeakSet,eg=function(t){t.stopPropagation()},je=new WeakSet,sg=function(t){r(this,bs)._focusEventsAllowed=!1,qt(t)},ig=function(t){r(this,bs)._focusEventsAllowed=!0,qt(t)},rl=function(t){const e=r(this,bs)._uiManager._signal;t.addEventListener("focusin",b(this,je,sg).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,je,ig).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Rs,{signal:e})},_h=function(){const t=document.createElement("div");return t.className="divider",t},m(xi,od),m(xi,Dl,null);let au=xi;var Nl,lr,cr,Kn,ng,rg,ag;class U0{constructor(t){m(this,Kn);m(this,Nl,null);m(this,lr,null);m(this,cr);p(this,cr,t)}show(t,e,s){const[i,n]=b(this,Kn,rg).call(this,e,s),{style:a}=r(this,lr)||p(this,lr,b(this,Kn,ng).call(this));t.append(r(this,lr)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,lr).remove()}}Nl=new WeakMap,lr=new WeakMap,cr=new WeakMap,Kn=new WeakSet,ng=function(){const t=p(this,lr,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Rs,{signal:r(this,cr)._signal});const e=p(this,Nl,document.createElement("div"));return e.className="buttons",t.append(e),b(this,Kn,ag).call(this),t},rg=function(t,e){let s=0,i=0;for(const n of t){const a=n.y+n.height;if(a<s)continue;const o=n.x+(e?n.width:0);if(a>s){i=o,s=a;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]},ag=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const s=r(this,cr)._signal;t.addEventListener("contextmenu",Rs,{signal:s}),t.addEventListener("click",()=>{r(this,cr).highlightSelection("floating_button")},{signal:s}),r(this,Nl).append(t)};function og(c,t,e){for(const s of e)t.addEventListener(s,c[s].bind(c))}var ld;class W0{constructor(){m(this,ld,0)}get id(){return`${Wp}${Me(this,ld)._++}`}}ld=new WeakMap;var ja,Fl,_e,Ha,Sh;const Of=class Of{constructor(){m(this,Ha);m(this,ja,Ef());m(this,Fl,0);m(this,_e,null)}static get _isSVGFittingCanvas(){const t='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>',s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return it(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return b(this,Ha,Sh).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return b(this,Ha,Sh).call(this,t,t)}async getFromBlob(t,e){const s=await e;return b(this,Ha,Sh).call(this,t,s)}async getFromId(t){r(this,_e)||p(this,_e,new Map);const e=r(this,_e).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){r(this,_e)||p(this,_e,new Map);let s=r(this,_e).get(t);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${r(this,ja)}_${Me(this,Fl)._++}`,refCounter:1,isSvg:!1},r(this,_e).set(t,s),r(this,_e).set(s.id,s),s}getSvgUrl(t){const e=r(this,_e).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;r(this,_e)||p(this,_e,new Map);const e=r(this,_e).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:s}=e;if(!e.url&&!e.file){const n=new OffscreenCanvas(s.width,s.height);n.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=n.convertToBlob()}(i=s.close)==null||i.call(s),e.bitmap=null}isValidId(t){return t.startsWith(`image_${r(this,ja)}_`)}};ja=new WeakMap,Fl=new WeakMap,_e=new WeakMap,Ha=new WeakSet,Sh=async function(t,e){r(this,_e)||p(this,_e,new Map);let s=r(this,_e).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,ja)}_${Me(this,Fl)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Xo(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const n=Of._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((h,d)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=d});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){Z(i),s=null}return r(this,_e).set(t,s),s&&r(this,_e).set(s.id,s),s};let ou=Of;var Ut,fn,Ol,Bt;class q0{constructor(t=128){m(this,Ut,[]);m(this,fn,!1);m(this,Ol);m(this,Bt,-1);p(this,Ol,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),r(this,fn))return;const l={cmd:t,undo:e,post:s,type:n};if(r(this,Bt)===-1){r(this,Ut).length>0&&(r(this,Ut).length=0),p(this,Bt,0),r(this,Ut).push(l);return}if(a&&r(this,Ut)[r(this,Bt)].type===n){o&&(l.undo=r(this,Ut)[r(this,Bt)].undo),r(this,Ut)[r(this,Bt)]=l;return}const h=r(this,Bt)+1;h===r(this,Ol)?r(this,Ut).splice(0,1):(p(this,Bt,h),h<r(this,Ut).length&&r(this,Ut).splice(h)),r(this,Ut).push(l)}undo(){if(r(this,Bt)===-1)return;p(this,fn,!0);const{undo:t,post:e}=r(this,Ut)[r(this,Bt)];t(),e==null||e(),p(this,fn,!1),p(this,Bt,r(this,Bt)-1)}redo(){if(r(this,Bt)<r(this,Ut).length-1){p(this,Bt,r(this,Bt)+1),p(this,fn,!0);const{cmd:t,post:e}=r(this,Ut)[r(this,Bt)];t(),e==null||e(),p(this,fn,!1)}}hasSomethingToUndo(){return r(this,Bt)!==-1}hasSomethingToRedo(){return r(this,Bt)<r(this,Ut).length-1}cleanType(t){if(r(this,Bt)!==-1){for(let e=r(this,Bt);e>=0;e--)if(r(this,Ut)[e].type!==t){r(this,Ut).splice(e+1,r(this,Bt)-e),p(this,Bt,e);return}r(this,Ut).length=0,p(this,Bt,-1)}}destroy(){p(this,Ut,null)}}Ut=new WeakMap,fn=new WeakMap,Ol=new WeakMap,Bt=new WeakMap;var cd,lg;class hh{constructor(t){m(this,cd);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=ue.platform;for(const[s,i,n={}]of t)for(const a of s){const o=a.startsWith("mac+");e&&o?(this.callbacks.set(a.slice(4),{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1))):!e&&!o&&(this.callbacks.set(a,{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(b(this,cd,lg).call(this,e));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:a=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...a,e)(),n||qt(e))}}cd=new WeakSet,lg=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};const hd=class hd{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return V0(t),it(this,"_colors",t)}convert(t){const e=Sf(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((n,a)=>n===e[a]))return hd._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?W.makeHexColor(...e):t}};L(hd,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let lu=hd;var $a,Ke,se,fe,za,_i,Ga,ys,pn,gn,Va,hr,Zs,Ds,dr,Bl,jl,Ua,Hl,Qs,mn,Wa,bn,ti,dd,yn,$l,vn,ur,fr,wn,zl,re,bt,Si,An,pr,Gl,Vl,xn,ei,Ci,Ul,Wl,vs,j,Ch,cu,cg,hg,Th,dg,ug,fg,hu,pg,du,uu,gg,Le,wi,mg,bg,fu,yg,al,pu;const La=class La{constructor(t,e,s,i,n,a,o,l,h,d,u,f,g,y,v){m(this,j);m(this,$a,new AbortController);m(this,Ke,null);m(this,se,new Map);m(this,fe,new Map);m(this,za,null);m(this,_i,null);m(this,Ga,null);m(this,ys,new q0);m(this,pn,null);m(this,gn,null);m(this,Va,0);m(this,hr,new Set);m(this,Zs,null);m(this,Ds,null);m(this,dr,new Set);L(this,"_editorUndoBar",null);m(this,Bl,!1);m(this,jl,!1);m(this,Ua,!1);m(this,Hl,null);m(this,Qs,null);m(this,mn,null);m(this,Wa,null);m(this,bn,!1);m(this,ti,null);m(this,dd,new W0);m(this,yn,!1);m(this,$l,!1);m(this,vn,null);m(this,ur,null);m(this,fr,null);m(this,wn,null);m(this,zl,null);m(this,re,J.NONE);m(this,bt,new Set);m(this,Si,null);m(this,An,null);m(this,pr,null);m(this,Gl,null);m(this,Vl,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});m(this,xn,[0,0]);m(this,ei,null);m(this,Ci,null);m(this,Ul,null);m(this,Wl,null);m(this,vs,null);const w=this._signal=r(this,$a).signal;p(this,Ci,t),p(this,Ul,e),p(this,Wl,s),p(this,za,i),p(this,An,n),this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:w}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:w}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:w}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:w}),a._on("setpreference",this.onSetPreference.bind(this),{signal:w}),a._on("switchannotationeditorparams",A=>this.updateParams(A.type,A.value),{signal:w}),b(this,j,dg).call(this),b(this,j,gg).call(this),b(this,j,hu).call(this),p(this,_i,o.annotationStorage),p(this,Hl,o.filterFactory),p(this,pr,l),p(this,Wa,h||null),p(this,Bl,d),p(this,jl,u),p(this,Ua,f),p(this,zl,g||null),this.viewParameters={realScale:nn.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=v!==!1}static get _keyboardManager(){const t=La.prototype,e=a=>r(a,Ci).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return it(this,"_keyboardManager",new hh([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Ci).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Ci).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,s,i,n,a,o,l;(t=r(this,vs))==null||t.resolve(),p(this,vs,null),(e=r(this,$a))==null||e.abort(),p(this,$a,null),this._signal=null;for(const h of r(this,fe).values())h.destroy();r(this,fe).clear(),r(this,se).clear(),r(this,dr).clear(),(s=r(this,wn))==null||s.clear(),p(this,Ke,null),r(this,bt).clear(),r(this,ys).destroy(),(i=r(this,za))==null||i.destroy(),(n=r(this,An))==null||n.destroy(),(a=r(this,ti))==null||a.hide(),p(this,ti,null),(o=r(this,fr))==null||o.destroy(),p(this,fr,null),r(this,Qs)&&(clearTimeout(r(this,Qs)),p(this,Qs,null)),r(this,ei)&&(clearTimeout(r(this,ei)),p(this,ei,null)),(l=this._editorUndoBar)==null||l.destroy()}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return r(this,zl)}get useNewAltTextFlow(){return r(this,jl)}get useNewAltTextWhenAddingImage(){return r(this,Ua)}get hcmFilter(){return it(this,"hcmFilter",r(this,pr)?r(this,Hl).addHCMFilter(r(this,pr).foreground,r(this,pr).background):"none")}get direction(){return it(this,"direction",getComputedStyle(r(this,Ci)).direction)}get highlightColors(){return it(this,"highlightColors",r(this,Wa)?new Map(r(this,Wa).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColorNames(){return it(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),p(this,gn,t)}setMainHighlightColorPicker(t){p(this,fr,t)}editAltText(t,e=!1){var s;(s=r(this,za))==null||s.editAltText(this,t,e)}getSignature(t){var e;(e=r(this,An))==null||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return r(this,An)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":p(this,Ua,e);break}}onPageChanging({pageNumber:t}){p(this,Va,t-1)}focusMainContainer(){r(this,Ci).focus()}findParent(t,e){for(const s of r(this,fe).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){r(this,Ul).classList.toggle("noUserSelect",t)}addShouldRescale(t){r(this,dr).add(t)}removeShouldRescale(t){r(this,dr).delete(t)}onScaleChanging({scale:t}){var e;this.commitOrRemove(),this.viewParameters.realScale=t*nn.PDF_TO_CSS_UNITS;for(const s of r(this,dr))s.onScaleChanging();(e=r(this,gn))==null||e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a}=e,o=e.toString(),h=b(this,j,Ch).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;e.empty();const u=b(this,j,cu).call(this,h),f=r(this,re)===J.NONE,g=()=>{u==null||u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a,text:o}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(J.HIGHLIGHT,g);return}g()}addToAnnotationStorage(t){!t.isEmpty()&&r(this,_i)&&!r(this,_i).has(t.id)&&r(this,_i).setValue(t.id,t)}a11yAlert(t,e=null){const s=r(this,Wl);s&&(s.setAttribute("data-l10n-id",t),e?s.setAttribute("data-l10n-args",JSON.stringify(e)):s.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,r(this,bn)&&(p(this,bn,!1),b(this,j,Th).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of r(this,bt))if(e.div.contains(t)){p(this,ur,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!r(this,ur))return;const[t,e]=r(this,ur);p(this,ur,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,j,hu).call(this),b(this,j,du).call(this)}removeEditListeners(){b(this,j,pg).call(this),b(this,j,uu).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of r(this,Ds))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of r(this,Ds))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=r(this,Ke))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of r(this,bt)){const n=i.serialize(!0);n&&e.push(n)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const n of e.items)for(const a of r(this,Ds))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){Z(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const l of s){const h=await i.deserialize(l);if(!h)return;n.push(h)}const a=()=>{for(const l of n)b(this,j,fu).call(this,l);b(this,j,pu).call(this,n)},o=()=>{for(const l of n)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){Z(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,re)!==J.NONE&&!this.isEditorHandlingKeyboard&&La._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,bn)&&(p(this,bn,!1),b(this,j,Th).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(t){t?(b(this,j,ug).call(this),b(this,j,du).call(this),b(this,j,Le).call(this,{isEditing:r(this,re)!==J.NONE,isEmpty:b(this,j,al).call(this),hasSomethingToUndo:r(this,ys).hasSomethingToUndo(),hasSomethingToRedo:r(this,ys).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,j,fg).call(this),b(this,j,uu).call(this),b(this,j,Le).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!r(this,Ds)){p(this,Ds,t);for(const e of r(this,Ds))b(this,j,wi).call(this,e.defaultPropertiesToUpdate)}}getId(){return r(this,dd).id}get currentLayer(){return r(this,fe).get(r(this,Va))}getLayer(t){return r(this,fe).get(t)}get currentPageIndex(){return r(this,Va)}addLayer(t){r(this,fe).set(t.pageIndex,t),r(this,yn)?t.enable():t.disable()}removeLayer(t){r(this,fe).delete(t.pageIndex)}async updateMode(t,e=null,s=!1,i=!1){var n,a,o;if(r(this,re)!==t&&!(r(this,vs)&&(await r(this,vs).promise,!r(this,vs)))){if(p(this,vs,Promise.withResolvers()),(n=r(this,gn))==null||n.commitOrRemove(),p(this,re,t),t===J.NONE){this.setEditingState(!1),b(this,j,bg).call(this),(a=this._editorUndoBar)==null||a.hide(),r(this,vs).resolve();return}t===J.SIGNATURE&&await((o=r(this,An))==null?void 0:o.loadSignatures()),this.setEditingState(!0),await b(this,j,mg).call(this),this.unselectAll();for(const l of r(this,fe).values())l.updateMode(t);if(!e){s&&this.addNewEditorFromKeyboard(),r(this,vs).resolve();return}for(const l of r(this,se).values())l.annotationElementId===e||l.id===e?(this.setSelected(l),i&&l.enterInEditMode()):l.unselect();r(this,vs).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==r(this,re)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){var s;if(r(this,Ds)){switch(t){case rt.CREATE:this.currentLayer.addNewEditor(e);return;case rt.HIGHLIGHT_DEFAULT_COLOR:(s=r(this,fr))==null||s.updateColor(e);break;case rt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,Gl)||p(this,Gl,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of r(this,bt))i.updateParams(t,e);for(const i of r(this,Ds))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var n;for(const a of r(this,se).values())a.editorType===t&&a.show(e);(((n=r(this,Gl))==null?void 0:n.get(rt.HIGHLIGHT_SHOW_ALL))??!0)!==e&&b(this,j,wi).call(this,[[rt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(r(this,$l)!==t){p(this,$l,t);for(const e of r(this,fe).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of r(this,se).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return r(this,se).get(t)}addEditor(t){r(this,se).set(t.id,t)}removeEditor(t){var e,s;t.div.contains(document.activeElement)&&(r(this,Qs)&&clearTimeout(r(this,Qs)),p(this,Qs,setTimeout(()=>{this.focusMainContainer(),p(this,Qs,null)},0))),r(this,se).delete(t.id),t.annotationElementId&&((e=r(this,wn))==null||e.delete(t.annotationElementId)),this.unselect(t),(!t.annotationElementId||!r(this,hr).has(t.annotationElementId))&&((s=r(this,_i))==null||s.remove(t.id))}addDeletedAnnotationElement(t){r(this,hr).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return r(this,hr).has(t)}removeDeletedAnnotationElement(t){r(this,hr).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){r(this,Ke)!==t&&(p(this,Ke,t),t&&b(this,j,wi).call(this,t.propertiesToUpdate))}updateUI(t){r(this,j,yg)===t&&b(this,j,wi).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,j,wi).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(r(this,bt).has(t)){r(this,bt).delete(t),t.unselect(),b(this,j,Le).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,bt).add(t),t.select(),b(this,j,wi).call(this,t.propertiesToUpdate),b(this,j,Le).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;this.updateToolbar({mode:t.mode,editId:t.id}),(e=r(this,gn))==null||e.commitOrRemove();for(const s of r(this,bt))s!==t&&s.unselect();r(this,bt).clear(),r(this,bt).add(t),t.select(),b(this,j,wi).call(this,t.propertiesToUpdate),b(this,j,Le).call(this,{hasSelectedEditor:!0})}isSelected(t){return r(this,bt).has(t)}get firstSelectedEditor(){return r(this,bt).values().next().value}unselect(t){t.unselect(),r(this,bt).delete(t),b(this,j,Le).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,bt).size!==0}get isEnterHandled(){return r(this,bt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var t;r(this,ys).undo(),b(this,j,Le).call(this,{hasSomethingToUndo:r(this,ys).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,j,al).call(this)}),(t=this._editorUndoBar)==null||t.hide()}redo(){r(this,ys).redo(),b(this,j,Le).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,ys).hasSomethingToRedo(),isEmpty:b(this,j,al).call(this)})}addCommands(t){r(this,ys).add(t),b(this,j,Le).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,j,al).call(this)})}cleanUndoStack(t){r(this,ys).cleanType(t)}delete(){var n;this.commitOrRemove();const t=(n=this.currentLayer)==null?void 0:n.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...r(this,bt)],s=()=>{var a;(a=this._editorUndoBar)==null||a.show(i,e.length===1?e[0].editorType:e.length);for(const o of e)o.remove()},i=()=>{for(const a of e)b(this,j,fu).call(this,a)};this.addCommands({cmd:s,undo:i,mustExec:!0})}commitOrRemove(){var t;(t=r(this,Ke))==null||t.commitOrRemove()}hasSomethingToControl(){return r(this,Ke)||this.hasSelection}selectAll(){for(const t of r(this,bt))t.commit();b(this,j,pu).call(this,r(this,se).values())}unselectAll(){var t;if(!(r(this,Ke)&&(r(this,Ke).commitOrRemove(),r(this,re)!==J.NONE))&&!((t=r(this,gn))!=null&&t.commitOrRemove())&&this.hasSelection){for(const e of r(this,bt))e.unselect();r(this,bt).clear(),b(this,j,Le).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,xn)[0]+=t,r(this,xn)[1]+=e;const[i,n]=r(this,xn),a=[...r(this,bt)],o=1e3;r(this,ei)&&clearTimeout(r(this,ei)),p(this,ei,setTimeout(()=>{p(this,ei,null),r(this,xn)[0]=r(this,xn)[1]=0,this.addCommands({cmd:()=>{for(const l of a)r(this,se).has(l.id)&&(l.translateInPage(i,n),l.translationDone())},undo:()=>{for(const l of a)r(this,se).has(l.id)&&(l.translateInPage(-i,-n),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),p(this,Zs,new Map);for(const t of r(this,bt))r(this,Zs).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,Zs))return!1;this.disableUserSelect(!1);const t=r(this,Zs);p(this,Zs,null);let e=!1;for(const[{x:i,y:n,pageIndex:a},o]of t)o.newX=i,o.newY=n,o.newPageIndex=a,e||(e=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,n,a,o)=>{if(r(this,se).has(i.id)){const l=r(this,fe).get(o);l?i._setParentAndPosition(l,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of t)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of t)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(r(this,Zs))for(const s of r(this,Zs).keys())s.drag(t,e)}rebuild(t){if(t.parent===null){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||r(this,bt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return r(this,Ke)===t}getActive(){return r(this,Ke)}getMode(){return r(this,re)}get imageManager(){return it(this,"imageManager",new ou)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,d=e.rangeCount;h<d;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(h,d,u,f)=>({x:(d-i)/a,y:1-(h+u-s)/n,width:f/a,height:u/n});break;case"180":o=(h,d,u,f)=>({x:1-(h+u-s)/n,y:1-(d+f-i)/a,width:u/n,height:f/a});break;case"270":o=(h,d,u,f)=>({x:1-(d+f-i)/a,y:(h-s)/n,width:f/a,height:u/n});break;default:o=(h,d,u,f)=>({x:(h-s)/n,y:(d-i)/a,width:u/n,height:f/a});break}const l=[];for(let h=0,d=e.rangeCount;h<d;h++){const u=e.getRangeAt(h);if(!u.collapsed)for(const{x:f,y:g,width:y,height:v}of u.getClientRects())y===0||v===0||l.push(o(f,g,y,v))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(r(this,Ga)||p(this,Ga,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=r(this,Ga))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=r(this,Ga))==null?void 0:i.get(t.data.id);if(!e)return;const s=r(this,_i).getRawValue(e);s&&(r(this,re)===J.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}setMissingCanvas(t,e,s){var n;const i=(n=r(this,wn))==null?void 0:n.get(t);i&&(i.setCanvas(e,s),r(this,wn).delete(t))}addMissingCanvas(t,e){(r(this,wn)||p(this,wn,new Map)).set(t,e)}};$a=new WeakMap,Ke=new WeakMap,se=new WeakMap,fe=new WeakMap,za=new WeakMap,_i=new WeakMap,Ga=new WeakMap,ys=new WeakMap,pn=new WeakMap,gn=new WeakMap,Va=new WeakMap,hr=new WeakMap,Zs=new WeakMap,Ds=new WeakMap,dr=new WeakMap,Bl=new WeakMap,jl=new WeakMap,Ua=new WeakMap,Hl=new WeakMap,Qs=new WeakMap,mn=new WeakMap,Wa=new WeakMap,bn=new WeakMap,ti=new WeakMap,dd=new WeakMap,yn=new WeakMap,$l=new WeakMap,vn=new WeakMap,ur=new WeakMap,fr=new WeakMap,wn=new WeakMap,zl=new WeakMap,re=new WeakMap,bt=new WeakMap,Si=new WeakMap,An=new WeakMap,pr=new WeakMap,Gl=new WeakMap,Vl=new WeakMap,xn=new WeakMap,ei=new WeakMap,Ci=new WeakMap,Ul=new WeakMap,Wl=new WeakMap,vs=new WeakMap,j=new WeakSet,Ch=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},cu=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of r(this,fe).values())if(s.hasTextLayer(t))return s;return null},cg=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const s=b(this,j,Ch).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(r(this,ti)||p(this,ti,new U0(this)),r(this,ti).show(s,i,this.direction==="ltr"))},hg=function(){var n,a,o;const t=document.getSelection();if(!t||t.isCollapsed){r(this,Si)&&((n=r(this,ti))==null||n.hide(),p(this,Si,null),b(this,j,Le).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===r(this,Si))return;const i=b(this,j,Ch).call(this,t).closest(".textLayer");if(!i){r(this,Si)&&((a=r(this,ti))==null||a.hide(),p(this,Si,null),b(this,j,Le).call(this,{hasSelectedText:!1}));return}if((o=r(this,ti))==null||o.hide(),p(this,Si,e),b(this,j,Le).call(this,{hasSelectedText:!0}),!(r(this,re)!==J.HIGHLIGHT&&r(this,re)!==J.NONE)&&(r(this,re)===J.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),p(this,bn,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=r(this,re)===J.HIGHLIGHT?b(this,j,cu).call(this,i):null;l==null||l.toggleDrawing();const h=new AbortController,d=this.combinedSignal(h),u=f=>{f.type==="pointerup"&&f.button!==0||(h.abort(),l==null||l.toggleDrawing(!0),f.type==="pointerup"&&b(this,j,Th).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:d}),window.addEventListener("blur",u,{signal:d})}},Th=function(t=""){r(this,re)===J.HIGHLIGHT?this.highlightSelection(t):r(this,Bl)&&b(this,j,cg).call(this)},dg=function(){document.addEventListener("selectionchange",b(this,j,hg).bind(this),{signal:this._signal})},ug=function(){if(r(this,mn))return;p(this,mn,new AbortController);const t=this.combinedSignal(r(this,mn));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},fg=function(){var t;(t=r(this,mn))==null||t.abort(),p(this,mn,null)},hu=function(){if(r(this,vn))return;p(this,vn,new AbortController);const t=this.combinedSignal(r(this,vn));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},pg=function(){var t;(t=r(this,vn))==null||t.abort(),p(this,vn,null)},du=function(){if(r(this,pn))return;p(this,pn,new AbortController);const t=this.combinedSignal(r(this,pn));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},uu=function(){var t;(t=r(this,pn))==null||t.abort(),p(this,pn,null)},gg=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},Le=function(t){Object.entries(t).some(([s,i])=>r(this,Vl)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(r(this,Vl),t)}),r(this,re)===J.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,j,wi).call(this,[[rt.HIGHLIGHT_FREE,!0]]))},wi=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},mg=async function(){if(!r(this,yn)){p(this,yn,!0);const t=[];for(const e of r(this,fe).values())t.push(e.enable());await Promise.all(t);for(const e of r(this,se).values())e.enable()}},bg=function(){if(this.unselectAll(),r(this,yn)){p(this,yn,!1);for(const t of r(this,fe).values())t.disable();for(const t of r(this,se).values())t.disable()}},fu=function(t){const e=r(this,fe).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},yg=function(){let t=null;for(t of r(this,bt));return t},al=function(){if(r(this,se).size===0)return!0;if(r(this,se).size===1)for(const t of r(this,se).values())return t.isEmpty();return!1},pu=function(t){for(const e of r(this,bt))e.unselect();r(this,bt).clear();for(const e of t)e.isEmpty()||(r(this,bt).add(e),e.select());b(this,j,Le).call(this,{hasSelectedEditor:this.hasSelection})},L(La,"TRANSLATE_SMALL",1),L(La,"TRANSLATE_BIG",10);let Yn=La;var ae,si,Ns,qa,ii,Je,Xa,ni,Ue,Ti,gr,ri,En,Ws,ol,Rh;const De=class De{constructor(t){m(this,Ws);m(this,ae,null);m(this,si,!1);m(this,Ns,null);m(this,qa,null);m(this,ii,null);m(this,Je,null);m(this,Xa,!1);m(this,ni,null);m(this,Ue,null);m(this,Ti,null);m(this,gr,null);m(this,ri,!1);p(this,Ue,t),p(this,ri,t._uiManager.useNewAltTextFlow),r(De,En)||p(De,En,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){De._l10n??(De._l10n=t)}async render(){const t=p(this,Ns,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=p(this,qa,document.createElement("span"));t.append(e),r(this,ri)?(t.classList.add("new"),t.setAttribute("data-l10n-id",r(De,En).missing),e.setAttribute("data-l10n-id",r(De,En)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=r(this,Ue)._uiManager._signal;t.addEventListener("contextmenu",Rs,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),r(this,Ue)._uiManager.editAltText(r(this,Ue)),r(this,ri)&&r(this,Ue)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:r(this,Ws,ol)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(p(this,Xa,!0),i(n))},{signal:s}),await b(this,Ws,Rh).call(this),t}finish(){r(this,Ns)&&(r(this,Ns).focus({focusVisible:r(this,Xa)}),p(this,Xa,!1))}isEmpty(){return r(this,ri)?r(this,ae)===null:!r(this,ae)&&!r(this,si)}hasData(){return r(this,ri)?r(this,ae)!==null||!!r(this,Ti):this.isEmpty()}get guessedText(){return r(this,Ti)}async setGuessedText(t){r(this,ae)===null&&(p(this,Ti,t),p(this,gr,await De._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,Ws,Rh).call(this))}toggleAltTextBadge(t=!1){var e;if(!r(this,ri)||r(this,ae)){(e=r(this,ni))==null||e.remove(),p(this,ni,null);return}if(!r(this,ni)){const s=p(this,ni,document.createElement("div"));s.className="noAltTextBadge",r(this,Ue).div.append(s)}r(this,ni).classList.toggle("hidden",!t)}serialize(t){let e=r(this,ae);return!t&&r(this,Ti)===e&&(e=r(this,gr)),{altText:e,decorative:r(this,si),guessedText:r(this,Ti),textWithDisclaimer:r(this,gr)}}get data(){return{altText:r(this,ae),decorative:r(this,si)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(p(this,Ti,s),p(this,gr,i)),!(r(this,ae)===t&&r(this,si)===e)&&(n||(p(this,ae,t),p(this,si,e)),b(this,Ws,Rh).call(this))}toggle(t=!1){r(this,Ns)&&(!t&&r(this,Je)&&(clearTimeout(r(this,Je)),p(this,Je,null)),r(this,Ns).disabled=!t)}shown(){r(this,Ue)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:r(this,Ws,ol)}})}destroy(){var t,e;(t=r(this,Ns))==null||t.remove(),p(this,Ns,null),p(this,qa,null),p(this,ii,null),(e=r(this,ni))==null||e.remove(),p(this,ni,null)}};ae=new WeakMap,si=new WeakMap,Ns=new WeakMap,qa=new WeakMap,ii=new WeakMap,Je=new WeakMap,Xa=new WeakMap,ni=new WeakMap,Ue=new WeakMap,Ti=new WeakMap,gr=new WeakMap,ri=new WeakMap,En=new WeakMap,Ws=new WeakSet,ol=function(){return r(this,ae)&&"added"||r(this,ae)===null&&this.guessedText&&"review"||"missing"},Rh=async function(){var i,n,a;const t=r(this,Ns);if(!t)return;if(r(this,ri)){if(t.classList.toggle("done",!!r(this,ae)),t.setAttribute("data-l10n-id",r(De,En)[r(this,Ws,ol)]),(i=r(this,qa))==null||i.setAttribute("data-l10n-id",r(De,En)[`${r(this,Ws,ol)}-label`]),!r(this,ae)){(n=r(this,ii))==null||n.remove();return}}else{if(!r(this,ae)&&!r(this,si)){t.classList.remove("done"),(a=r(this,ii))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=r(this,ii);if(!e){p(this,ii,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${r(this,Ue).id}`;const o=100,l=r(this,Ue)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(r(this,Je)),p(this,Je,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,Je,setTimeout(()=>{p(this,Je,null),r(this,ii).classList.add("show"),r(this,Ue)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),t.addEventListener("mouseleave",()=>{var h;r(this,Je)&&(clearTimeout(r(this,Je)),p(this,Je,null)),(h=r(this,ii))==null||h.classList.remove("show")},{signal:l})}r(this,si)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=r(this,ae)),e.parentNode||t.append(e);const s=r(this,Ue).getElementForAltText();s==null||s.setAttribute("aria-describedby",e.id)},m(De,En,null),L(De,"_l10n",null);let ed=De;var Ya,mr,ql,Xl,Yl,Kl,Jl,Ri,br,Pi,yr,ki,Jn,vg,wg,Ag;const Bf=class Bf{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:s=null,onPinchStart:i=null,onPinching:n=null,onPinchEnd:a=null,signal:o}){m(this,Jn);m(this,Ya);m(this,mr,!1);m(this,ql,null);m(this,Xl);m(this,Yl);m(this,Kl);m(this,Jl);m(this,Ri,null);m(this,br);m(this,Pi,null);m(this,yr);m(this,ki,null);p(this,Ya,t),p(this,ql,s),p(this,Xl,e),p(this,Yl,i),p(this,Kl,n),p(this,Jl,a),p(this,yr,new AbortController),p(this,br,AbortSignal.any([o,r(this,yr).signal])),t.addEventListener("touchstart",b(this,Jn,vg).bind(this),{passive:!1,signal:r(this,br)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/qs.pixelRatio}destroy(){var t,e;(t=r(this,yr))==null||t.abort(),p(this,yr,null),(e=r(this,Ri))==null||e.abort(),p(this,Ri,null)}};Ya=new WeakMap,mr=new WeakMap,ql=new WeakMap,Xl=new WeakMap,Yl=new WeakMap,Kl=new WeakMap,Jl=new WeakMap,Ri=new WeakMap,br=new WeakMap,Pi=new WeakMap,yr=new WeakMap,ki=new WeakMap,Jn=new WeakSet,vg=function(t){var i,n,a;if((i=r(this,Xl))!=null&&i.call(this))return;if(t.touches.length===1){if(r(this,Ri))return;const o=p(this,Ri,new AbortController),l=AbortSignal.any([r(this,br),o.signal]),h=r(this,Ya),d={capture:!0,signal:l,passive:!1},u=f=>{var g;f.pointerType==="touch"&&((g=r(this,Ri))==null||g.abort(),p(this,Ri,null))};h.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(qt(f),u(f))},d),h.addEventListener("pointerup",u,d),h.addEventListener("pointercancel",u,d);return}if(!r(this,ki)){p(this,ki,new AbortController);const o=AbortSignal.any([r(this,br),r(this,ki).signal]),l=r(this,Ya),h={signal:o,capture:!1,passive:!1};l.addEventListener("touchmove",b(this,Jn,wg).bind(this),h);const d=b(this,Jn,Ag).bind(this);l.addEventListener("touchend",d,h),l.addEventListener("touchcancel",d,h),h.capture=!0,l.addEventListener("pointerdown",qt,h),l.addEventListener("pointermove",qt,h),l.addEventListener("pointercancel",qt,h),l.addEventListener("pointerup",qt,h),(n=r(this,Yl))==null||n.call(this)}if(qt(t),t.touches.length!==2||(a=r(this,ql))!=null&&a.call(this)){p(this,Pi,null);return}let[e,s]=t.touches;e.identifier>s.identifier&&([e,s]=[s,e]),p(this,Pi,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:s.screenX,touch1Y:s.screenY})},wg=function(t){var S;if(!r(this,Pi)||t.touches.length!==2)return;qt(t);let[e,s]=t.touches;e.identifier>s.identifier&&([e,s]=[s,e]);const{screenX:i,screenY:n}=e,{screenX:a,screenY:o}=s,l=r(this,Pi),{touch0X:h,touch0Y:d,touch1X:u,touch1Y:f}=l,g=u-h,y=f-d,v=a-i,w=o-n,A=Math.hypot(v,w)||1,x=Math.hypot(g,y)||1;if(!r(this,mr)&&Math.abs(x-A)<=Bf.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=i,l.touch0Y=n,l.touch1X=a,l.touch1Y=o,!r(this,mr)){p(this,mr,!0);return}const _=[(i+a)/2,(n+o)/2];(S=r(this,Kl))==null||S.call(this,_,x,A)},Ag=function(t){var e;t.touches.length>=2||(r(this,ki)&&(r(this,ki).abort(),p(this,ki,null),(e=r(this,Jl))==null||e.call(this)),r(this,Pi)&&(qt(t),p(this,Pi,null),p(this,mr,!1)))};let Tl=Bf;var vr,Fs,Nt,Ka,_n,Zl,wr,pe,Ar,Ii,Sn,Ql,xr,Ze,tc,Er,Mi,ai,Ja,Za,ws,_r,ec,ud,X,gu,sc,mu,Ph,xg,Eg,bu,kh,yu,_g,Sg,Cg,vu,Tg,wu,Rg,Pg,kg,Au,ll;const tt=class tt{constructor(t){m(this,X);m(this,vr,null);m(this,Fs,null);m(this,Nt,null);m(this,Ka,!1);m(this,_n,null);m(this,Zl,"");m(this,wr,!1);m(this,pe,null);m(this,Ar,null);m(this,Ii,null);m(this,Sn,null);m(this,Ql,"");m(this,xr,!1);m(this,Ze,null);m(this,tc,!1);m(this,Er,!1);m(this,Mi,!1);m(this,ai,null);m(this,Ja,0);m(this,Za,0);m(this,ws,null);m(this,_r,null);L(this,"isSelected",!1);L(this,"_isCopy",!1);L(this,"_editToolbar",null);L(this,"_initialOptions",Object.create(null));L(this,"_initialData",null);L(this,"_isVisible",!0);L(this,"_uiManager",null);L(this,"_focusEventsAllowed",!0);m(this,ec,!1);m(this,ud,tt._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,a];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=tt.prototype._resizeWithKeyboard,e=Yn.TRANSLATE_SMALL,s=Yn.TRANSLATE_BIG;return it(this,"_resizerKeyboardManager",new hh([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],tt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return it(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new X0({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(tt._l10n??(tt._l10n=t),tt._l10nResizer||(tt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),tt._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);tt._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){xt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,ec)}set _isDraggable(t){var e;p(this,ec,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=r(this,ud)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):b(this,X,ll).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(r(this,xr)?p(this,xr,!1):this.parent.setSelected(this))}focusout(t){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[n,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[s,i]=this.parentDimensions;this.setAt(t*s,e*i,this.width*s,this.height*i),this._onTranslated()}translate(t,e){b(this,X,gu).call(this,this.parentDimensions,t,e)}translateInPage(t,e){r(this,Ze)||p(this,Ze,[this.x,this.y,this.width,this.height]),b(this,X,gu).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){r(this,Ze)||p(this,Ze,[this.x,this.y,this.width,this.height]);const{div:s,parentDimensions:[i,n]}=this;if(this.x+=t/i,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,h]=this.getBaseTranslation();a+=l,o+=h;const{style:d}=s;d.left=`${(100*a).toFixed(2)}%`,d.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),s.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!r(this,Ze)&&(r(this,Ze)[0]!==this.x||r(this,Ze)[1]!==this.y)}get _hasBeenResized(){return!!r(this,Ze)&&(r(this,Ze)[2]!==this.width||r(this,Ze)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=tt,i=s/t,n=s/e;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[s,i]}=this;let{x:n,y:a,width:o,height:l}=this;if(o*=s,l*=i,n*=s,a*=i,this._mustFixPosition)switch(t){case 0:n=Te(n,0,s-o),a=Te(a,0,i-l);break;case 90:n=Te(n,0,s-l),a=Te(a,o,i);break;case 180:n=Te(n,o,s),a=Te(a,l,i);break;case 270:n=Te(n,l,s),a=Te(a,0,i-o);break}this.x=n/=s,this.y=a/=i;const[h,d]=this.getBaseTranslation();n+=h,a+=d,e.left=`${(100*n).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return b(s=tt,sc,mu).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return b(s=tt,sc,mu).call(s,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(t,e){const[s,i]=this.parentDimensions,{style:n}=this.div;n.width=`${(100*t/s).toFixed(2)}%`,r(this,wr)||(n.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),n=!r(this,wr)&&e.endsWith("%");if(i&&n)return;const[a,o]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/a).toFixed(2)}%`),!r(this,wr)&&!n&&(t.height=`${(100*parseFloat(e)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){var t;(t=r(this,Nt))==null||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||r(this,Er))return this._editToolbar;this._editToolbar=new au(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,s]of t)await this._editToolbar.addButton(e,s);return this._editToolbar.addButton("delete"),this._editToolbar}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(t=r(this,Nt))==null||t.destroy())}addContainer(t){var s;const e=(s=this._editToolbar)==null?void 0:s.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return r(this,Nt)||(ed.initialize(tt._l10n),p(this,Nt,new ed(this)),r(this,vr)&&(r(this,Nt).data=r(this,vr),p(this,vr,null))),r(this,Nt)}get altTextData(){var t;return(t=r(this,Nt))==null?void 0:t.data}set altTextData(t){r(this,Nt)&&(r(this,Nt).data=t)}get guessedAltText(){var t;return(t=r(this,Nt))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=r(this,Nt))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=r(this,Nt))==null?void 0:e.serialize(t)}hasAltText(){return!!r(this,Nt)&&!r(this,Nt).isEmpty()}hasAltTextData(){var t;return((t=r(this,Nt))==null?void 0:t.hasData())??!1}render(){var a;const t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=r(this,Ka)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),b(this,X,wu).call(this);const[e,s]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*s/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/s).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),og(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(r(this,_r)||p(this,_r,new Tl({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,X,_g).bind(this),onPinching:b(this,X,Sg).bind(this),onPinchEnd:b(this,X,Cg).bind(this),signal:this._uiManager._signal}))),(a=this._uiManager._editorUndoBar)==null||a.hide(),t}pointerdown(t){const{isMac:e}=ue.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,xr,!0),this._isDraggable){b(this,X,Tg).call(this,t);return}b(this,X,vu).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){r(this,ai)&&clearTimeout(r(this,ai)),p(this,ai,setTimeout(()=>{var t;p(this,ai,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,a]=this.pageDimensions,[o,l]=this.pageTranslation,h=t/i,d=e/i,u=this.x*n,f=this.y*a,g=this.width*n,y=this.height*a;switch(s){case 0:return[u+h+o,a-f-d-y+l,u+h+g+o,a-f-d+l];case 90:return[u+d+o,a-f+h+l,u+d+y+o,a-f+h+g+l];case 180:return[u-h-g+o,a-f+d+l,u-h+o,a-f+d+y+l];case 270:return[u-d-y+o,a-f-h-g+l,u-d+o,a-f-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,a]=t,o=n-s,l=a-i;switch(this.rotation){case 0:return[s,e-a,o,l];case 90:return[s,e-i,l,o];case 180:return[n,e-i,o,l];case 270:return[n,e-a,l,o];default:throw new Error("Invalid rotation")}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),p(this,Er,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),p(this,Er,!1),!0):!1}isInEditMode(){return r(this,Er)}shouldGetKeyboardEvents(){return r(this,Mi)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:s,right:i}=this.getClientDimensions(),{innerHeight:n,innerWidth:a}=window;return e<a&&i>0&&t<n&&s>0}rebuild(){b(this,X,wu).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((t=this._initialData)==null?void 0:t.popupRef)||""}}serialize(t=!1,e=null){xt("An editor must be serializable")}static async deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s,annotationElementId:t.annotationElementId});i.rotation=t.rotation,p(i,vr,t.accessibilityData),i._isCopy=t.isCopy||!1;const[n,a]=i.pageDimensions,[o,l,h,d]=i.getRectInCurrentCoords(t.rect,a);return i.x=o/n,i.y=l/a,i.width=h/n,i.height=d/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t,e;if((t=r(this,Sn))==null||t.abort(),p(this,Sn,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),r(this,ai)&&(clearTimeout(r(this,ai)),p(this,ai,null)),b(this,X,ll).call(this),this.removeEditToolbar(),r(this,ws)){for(const s of r(this,ws).values())clearTimeout(s);p(this,ws,null)}this.parent=null,(e=r(this,_r))==null||e.destroy(),p(this,_r,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,X,xg).call(this),r(this,pe).classList.remove("hidden"))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,Ii,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=r(this,pe).children;if(!r(this,Fs)){p(this,Fs,Array.from(e));const a=b(this,X,Rg).bind(this),o=b(this,X,Pg).bind(this),l=this._uiManager._signal;for(const h of r(this,Fs)){const d=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",b(this,X,kg).bind(this,d),{signal:l}),h.setAttribute("data-l10n-id",tt._l10nResizer[d])}}const s=r(this,Fs)[0];let i=0;for(const a of e){if(a===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,Fs).length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)r(this,pe).append(r(this,pe).firstChild);else if(n>i)for(let o=0;o<n-i;o++)r(this,pe).firstChild.before(r(this,pe).lastChild);let a=0;for(const o of e){const h=r(this,Fs)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",tt._l10nResizer[h])}}b(this,X,Au).call(this,0),p(this,Mi,!0),r(this,pe).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){r(this,Mi)&&b(this,X,yu).call(this,r(this,Ql),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){b(this,X,ll).call(this),this.div.focus()}select(){var t,e,s;if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(e=this._editToolbar)==null||e.show(),(s=r(this,Nt))==null||s.toggleAltTextBadge(!1)}}unselect(){var t,e,s,i,n;this.isSelected&&(this.isSelected=!1,(t=r(this,pe))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(n=r(this,Nt))==null||n.toggleAltTextBadge(!0))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return r(this,tc)}set isEditing(t){p(this,tc,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){p(this,wr,!0);const s=t/e,{style:i}=this.div;i.aspectRatio=s,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){r(this,ws)||p(this,ws,new Map);const{action:s}=t;let i=r(this,ws).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),r(this,ws).delete(s),r(this,ws).size===0&&p(this,ws,null)},tt._telemetryTimeout),r(this,ws).set(s,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),p(this,Ka,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,Ka,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){const{firstChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};vr=new WeakMap,Fs=new WeakMap,Nt=new WeakMap,Ka=new WeakMap,_n=new WeakMap,Zl=new WeakMap,wr=new WeakMap,pe=new WeakMap,Ar=new WeakMap,Ii=new WeakMap,Sn=new WeakMap,Ql=new WeakMap,xr=new WeakMap,Ze=new WeakMap,tc=new WeakMap,Er=new WeakMap,Mi=new WeakMap,ai=new WeakMap,Ja=new WeakMap,Za=new WeakMap,ws=new WeakMap,_r=new WeakMap,ec=new WeakMap,ud=new WeakMap,X=new WeakSet,gu=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},sc=new WeakSet,mu=function(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},Ph=function(t){switch(t){case 90:{const[e,s]=this.pageDimensions;return[0,-e/s,s/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,s]=this.pageDimensions;return[0,e/s,-s/e,0]}default:return[1,0,0,1]}},xg=function(){if(r(this,pe))return;p(this,pe,document.createElement("div")),r(this,pe).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const s of t){const i=document.createElement("div");r(this,pe).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",b(this,X,Eg).bind(this,s),{signal:e}),i.addEventListener("contextmenu",Rs,{signal:e}),i.tabIndex=-1}this.div.prepend(r(this,pe))},Eg=function(t,e){var d;e.preventDefault();const{isMac:s}=ue.platform;if(e.button!==0||e.ctrlKey&&s)return;(d=r(this,Nt))==null||d.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,p(this,Ar,[e.screenX,e.screenY]);const n=new AbortController,a=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,X,yu).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",qt,{passive:!1,signal:a}),window.addEventListener("contextmenu",Rs,{signal:a}),p(this,Ii,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const h=()=>{var u;n.abort(),this.parent.togglePointerEvents(!0),(u=r(this,Nt))==null||u.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=l,b(this,X,kh).call(this)};window.addEventListener("pointerup",h,{signal:a}),window.addEventListener("blur",h,{signal:a})},bu=function(t,e,s,i){this.width=s,this.height=i,this.x=t,this.y=e;const[n,a]=this.parentDimensions;this.setDims(n*s,a*i),this.fixAndSetPosition(),this._onResized()},kh=function(){if(!r(this,Ii))return;const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=r(this,Ii);p(this,Ii,null);const n=this.x,a=this.y,o=this.width,l=this.height;n===t&&a===e&&o===s&&l===i||this.addCommands({cmd:b(this,X,bu).bind(this,n,a,o,l),undo:b(this,X,bu).bind(this,t,e,s,i),mustExec:!0})},yu=function(t,e){const[s,i]=this.parentDimensions,n=this.x,a=this.y,o=this.width,l=this.height,h=tt.MIN_SIZE/s,d=tt.MIN_SIZE/i,u=b(this,X,Ph).call(this,this.rotation),f=(F,O)=>[u[0]*F+u[2]*O,u[1]*F+u[3]*O],g=b(this,X,Ph).call(this,360-this.rotation),y=(F,O)=>[g[0]*F+g[2]*O,g[1]*F+g[3]*O];let v,w,A=!1,x=!1;switch(t){case"topLeft":A=!0,v=(F,O)=>[0,0],w=(F,O)=>[F,O];break;case"topMiddle":v=(F,O)=>[F/2,0],w=(F,O)=>[F/2,O];break;case"topRight":A=!0,v=(F,O)=>[F,0],w=(F,O)=>[0,O];break;case"middleRight":x=!0,v=(F,O)=>[F,O/2],w=(F,O)=>[0,O/2];break;case"bottomRight":A=!0,v=(F,O)=>[F,O],w=(F,O)=>[0,0];break;case"bottomMiddle":v=(F,O)=>[F/2,O],w=(F,O)=>[F/2,0];break;case"bottomLeft":A=!0,v=(F,O)=>[0,O],w=(F,O)=>[F,0];break;case"middleLeft":x=!0,v=(F,O)=>[0,O/2],w=(F,O)=>[F,O/2];break}const _=v(o,l),S=w(o,l);let C=f(...S);const R=tt._round(n+C[0]),T=tt._round(a+C[1]);let k=1,I=1,D,N;if(e.fromKeyboard)({deltaX:D,deltaY:N}=e);else{const{screenX:F,screenY:O}=e,[yt,Tt]=r(this,Ar);[D,N]=this.screenToPageTranslation(F-yt,O-Tt),r(this,Ar)[0]=F,r(this,Ar)[1]=O}if([D,N]=y(D/s,N/i),A){const F=Math.hypot(o,l);k=I=Math.max(Math.min(Math.hypot(S[0]-_[0]-D,S[1]-_[1]-N)/F,1/o,1/l),h/o,d/l)}else x?k=Te(Math.abs(S[0]-_[0]-D),h,1)/o:I=Te(Math.abs(S[1]-_[1]-N),d,1)/l;const Y=tt._round(o*k),q=tt._round(l*I);C=f(...w(Y,q));const H=R-C[0],st=T-C[1];r(this,Ze)||p(this,Ze,[this.x,this.y,this.width,this.height]),this.width=Y,this.height=q,this.x=H,this.y=st,this.setDims(s*Y,i*q),this.fixAndSetPosition(),this._onResizing()},_g=function(){var t;p(this,Ii,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(t=r(this,Nt))==null||t.toggle(!1),this.parent.togglePointerEvents(!1)},Sg=function(t,e,s){let n=.7*(s/e)+1-.7;if(n===1)return;const a=b(this,X,Ph).call(this,this.rotation),o=(R,T)=>[a[0]*R+a[2]*T,a[1]*R+a[3]*T],[l,h]=this.parentDimensions,d=this.x,u=this.y,f=this.width,g=this.height,y=tt.MIN_SIZE/l,v=tt.MIN_SIZE/h;n=Math.max(Math.min(n,1/f,1/g),y/f,v/g);const w=tt._round(f*n),A=tt._round(g*n);if(w===f&&A===g)return;r(this,Ze)||p(this,Ze,[d,u,f,g]);const x=o(f/2,g/2),_=tt._round(d+x[0]),S=tt._round(u+x[1]),C=o(w/2,A/2);this.x=_-C[0],this.y=S-C[1],this.width=w,this.height=A,this.setDims(l*w,h*A),this.fixAndSetPosition(),this._onResizing()},Cg=function(){var t;(t=r(this,Nt))==null||t.toggle(!0),this.parent.togglePointerEvents(!0),b(this,X,kh).call(this)},vu=function(t){const{isMac:e}=ue.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Tg=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let s=!1;const i=new AbortController,n=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:n},o=h=>{i.abort(),p(this,_n,null),p(this,xr,!1),this._uiManager.endDragSession()||b(this,X,vu).call(this,h),s&&this._onStopDragging()};e&&(p(this,Ja,t.clientX),p(this,Za,t.clientY),p(this,_n,t.pointerId),p(this,Zl,t.pointerType),window.addEventListener("pointermove",h=>{s||(s=!0,this._onStartDragging());const{clientX:d,clientY:u,pointerId:f}=h;if(f!==r(this,_n)){qt(h);return}const[g,y]=this.screenToPageTranslation(d-r(this,Ja),u-r(this,Za));p(this,Ja,d),p(this,Za,u),this._uiManager.dragSelectedEditors(g,y)},a),window.addEventListener("touchmove",qt,a),window.addEventListener("pointerdown",h=>{h.pointerType===r(this,Zl)&&(r(this,_r)||h.isPrimary)&&o(h),qt(h)},a));const l=h=>{if(!r(this,_n)||r(this,_n)===h.pointerId){o(h);return}qt(h)};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})},wu=function(){if(r(this,Sn)||!this.div)return;p(this,Sn,new AbortController);const t=this._uiManager.combinedSignal(r(this,Sn));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},Rg=function(t){tt._resizerKeyboardManager.exec(this,t)},Pg=function(t){var e;r(this,Mi)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==r(this,pe)&&b(this,X,ll).call(this)},kg=function(t){p(this,Ql,r(this,Mi)?t:"")},Au=function(t){if(r(this,Fs))for(const e of r(this,Fs))e.tabIndex=t},ll=function(){p(this,Mi,!1),b(this,X,Au).call(this,-1),b(this,X,kh).call(this)},m(tt,sc),L(tt,"_l10n",null),L(tt,"_l10nResizer",null),L(tt,"_borderLineWidth",-1),L(tt,"_colorManager",new lu),L(tt,"_zIndex",1),L(tt,"_telemetryTimeout",1e3);let kt=tt;class X0 extends kt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const ip=3285377520,ms=4294901760,Ks=65535;class Ig{constructor(t){this.h1=t?t&4294967295:ip,this.h2=t?t&4294967295:ip}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let v=0,w=t.length;v<w;v++){const A=t.charCodeAt(v);A<=255?e[s++]=A:(e[s++]=A>>>8,e[s++]=A&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,n=s-i*4,a=new Uint32Array(e.buffer,0,i);let o=0,l=0,h=this.h1,d=this.h2;const u=3432918353,f=461845907,g=u&Ks,y=f&Ks;for(let v=0;v<i;v++)v&1?(o=a[v],o=o*u&ms|o*g&Ks,o=o<<15|o>>>17,o=o*f&ms|o*y&Ks,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=a[v],l=l*u&ms|l*g&Ks,l=l<<15|l>>>17,l=l*f&ms|l*y&Ks,d^=l,d=d<<13|d>>>19,d=d*5+3864292196);switch(o=0,n){case 3:o^=e[i*4+2]<<16;case 2:o^=e[i*4+1]<<8;case 1:o^=e[i*4],o=o*u&ms|o*g&Ks,o=o<<15|o>>>17,o=o*f&ms|o*y&Ks,i&1?h^=o:d^=o}this.h1=h,this.h2=d}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&ms|t*36045&Ks,e=e*4283543511&ms|((e<<16|t>>>16)*2950163797&ms)>>>16,t^=e>>>1,t=t*444984403&ms|t*60499&Ks,e=e*3301882366&ms|((e<<16|t>>>16)*3120437893&ms)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const xu=Object.freeze({map:null,hash:"",transfer:void 0});var Sr,Cr,ge,fd,Mg;class Cf{constructor(){m(this,fd);m(this,Sr,!1);m(this,Cr,null);m(this,ge,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=r(this,ge).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return r(this,ge).get(t)}remove(t){if(r(this,ge).delete(t),r(this,ge).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of r(this,ge).values())if(e instanceof kt)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=r(this,ge).get(t);let i=!1;if(s!==void 0)for(const[n,a]of Object.entries(e))s[n]!==a&&(i=!0,s[n]=a);else i=!0,r(this,ge).set(t,e);i&&b(this,fd,Mg).call(this),e instanceof kt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return r(this,ge).has(t)}get size(){return r(this,ge).size}resetModified(){r(this,Sr)&&(p(this,Sr,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Lg(this)}get serializable(){if(r(this,ge).size===0)return xu;const t=new Map,e=new Ig,s=[],i=Object.create(null);let n=!1;for(const[a,o]of r(this,ge)){const l=o instanceof kt?o.serialize(!1,i):o;l&&(t.set(a,l),e.update(`${a}:${JSON.stringify(l)}`),n||(n=!!l.bitmap))}if(n)for(const a of t.values())a.bitmap&&s.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:xu}get editorStats(){let t=null;const e=new Map;for(const s of r(this,ge).values()){if(!(s instanceof kt))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:n}=i;e.has(n)||e.set(n,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));const a=t[n]||(t[n]=new Map);for(const[o,l]of Object.entries(i)){if(o==="type")continue;let h=a.get(o);h||(h=new Map,a.set(o,h));const d=h.get(l)??0;h.set(l,d+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){p(this,Cr,null)}get modifiedIds(){if(r(this,Cr))return r(this,Cr);const t=[];for(const e of r(this,ge).values())!(e instanceof kt)||!e.annotationElementId||!e.serialize()||t.push(e.annotationElementId);return p(this,Cr,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return r(this,ge).entries()}}Sr=new WeakMap,Cr=new WeakMap,ge=new WeakMap,fd=new WeakSet,Mg=function(){r(this,Sr)||(p(this,Sr,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var ic;class Lg extends Cf{constructor(e){super();m(this,ic);const{map:s,hash:i,transfer:n}=e.serializable,a=structuredClone(s,n?{transfer:n}:null);p(this,ic,{map:a,hash:i,transfer:n})}get print(){xt("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,ic)}get modifiedIds(){return it(this,"modifiedIds",{ids:new Set,hash:""})}}ic=new WeakMap;var Qa;class Y0{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){m(this,Qa,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),r(this,Qa).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:s}){if(!(!t||r(this,Qa).has(t.loadedName))){if(Zt(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:n,style:a}=t,o=new FontFace(i,n,a);this.addNativeFontFace(o);try{await o.load(),r(this,Qa).add(i),s==null||s(t)}catch{Z(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}xt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw Z(`Failed to load font '${s.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return it(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return it(this,"isSyncFontLoadingSupported",Be||ue.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Zt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:e,callback:t};return s.push(i),i}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return it(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(S,C){return S.charCodeAt(C)<<24|S.charCodeAt(C+1)<<16|S.charCodeAt(C+2)<<8|S.charCodeAt(C+3)&255}function i(S,C,R,T){const k=S.substring(0,C),I=S.substring(C+R);return k+T+I}let n,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let h=0;function d(S,C){if(++h>30){Z("Load test font never loaded."),C();return}if(l.font="30px "+S,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(d.bind(null,S,C))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=i(f,976,u.length,u);const y=16,v=1482184792;let w=s(f,y);for(n=0,a=u.length-3;n<a;n+=4)w=w-v+s(u,n)|0;n<u.length&&(w=w-v+s(u+"XXX",n)|0),f=i(f,y,4,O0(w));const A=`url(data:font/opentype;base64,${btoa(f)});`,x=`@font-face {font-family:"${u}";src:${A}}`;this.insertRule(x);const _=this._document.createElement("div");_.style.visibility="hidden",_.style.width=_.style.height="10px",_.style.position="absolute",_.style.top=_.style.left="0px";for(const S of[t.loadedName,u]){const C=this._document.createElement("span");C.textContent="Hi",C.style.fontFamily=S,_.append(C)}this._document.body.append(_),d(u,()=>{_.remove(),e.complete()})}}Qa=new WeakMap;class K0{constructor(t,e=null){this.compiledGlyphs=Object.create(null);for(const s in t)this[s]=t[s];this._inspectFont=e}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,s)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${Jp(this.data)});`;let e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return(s=this._inspectFont)==null||s.call(this,this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];const s=this.loadedName+"_path_"+e;let i;try{i=t.get(s)}catch(a){Z(`getPathGenerator - ignoring character: "${a}".`)}const n=new Path2D(i||"");return this.fontExtraProperties||t.delete(s),this.compiledGlyphs[e]=n}}function J0(c){if(c instanceof URL)return c.href;if(typeof c=="string"){if(Be)return c;const t=URL.parse(c,window.location);if(t)return t.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function Z0(c){if(Be&&typeof Buffer<"u"&&c instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(c instanceof Uint8Array&&c.byteLength===c.buffer.byteLength)return c;if(typeof c=="string")return oh(c);if(c instanceof ArrayBuffer||ArrayBuffer.isView(c)||typeof c=="object"&&!isNaN(c==null?void 0:c.length))return new Uint8Array(c);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function bh(c){if(typeof c!="string")return null;if(c.endsWith("/"))return c;throw new Error(`Invalid factory url: "${c}" must include trailing slash.`)}const Eu=c=>typeof c=="object"&&Number.isInteger(c==null?void 0:c.num)&&c.num>=0&&Number.isInteger(c==null?void 0:c.gen)&&c.gen>=0,Q0=c=>typeof c=="object"&&typeof(c==null?void 0:c.name)=="string",Dg=$0.bind(null,Eu,Q0);var Li,pd;class ty{constructor(){m(this,Li,new Map);m(this,pd,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};r(this,pd).then(()=>{for(const[i]of r(this,Li))i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:n}=s;if(n.aborted){Z("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}r(this,Li).set(e,i)}removeEventListener(t,e){const s=r(this,Li).get(e);s==null||s(),r(this,Li).delete(e)}terminate(){for(const[,t]of r(this,Li))t==null||t();r(this,Li).clear()}}Li=new WeakMap,pd=new WeakMap;const yh={DATA:1,ERROR:2},Jt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function np(){}function Ge(c){if(c instanceof sn||c instanceof Qh||c instanceof tp||c instanceof Cl||c instanceof Xd)return c;switch(c instanceof Error||typeof c=="object"&&c!==null||xt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),c.name){case"AbortException":return new sn(c.message);case"InvalidPDFException":return new Qh(c.message);case"PasswordException":return new tp(c.message,c.code);case"ResponseException":return new Cl(c.message,c.status,c.missing);case"UnknownErrorException":return new Xd(c.message,c.details)}return new Xd(c.message,c.toString())}var to,Ts,Ng,Fg,Og,Ih;class cl{constructor(t,e,s){m(this,Ts);m(this,to,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=s,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),s.addEventListener("message",b(this,Ts,Ng).bind(this),{signal:r(this,to).signal})}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}sendWithPromise(t,e,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,s,i){const n=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const d=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:t,streamId:n,data:e,desiredSize:h.desiredSize},i),d.promise},pull:h=>{const d=Promise.withResolvers();return this.streamControllers[n].pullCall=d,l.postMessage({sourceName:a,targetName:o,stream:Jt.PULL,streamId:n,desiredSize:h.desiredSize}),d.promise},cancel:h=>{Zt(h instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[n].cancelCall=d,this.streamControllers[n].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:Jt.CANCEL,streamId:n,reason:Ge(h)}),d.promise}},s)}destroy(){var t;(t=r(this,to))==null||t.abort(),p(this,to,null)}}to=new WeakMap,Ts=new WeakSet,Ng=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,Ts,Og).call(this,t);return}if(t.callback){const s=t.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],t.callback===yh.DATA)i.resolve(t.data);else if(t.callback===yh.ERROR)i.reject(Ge(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const s=this.sourceName,i=t.sourceName,n=this.comObj;Promise.try(e,t.data).then(function(a){n.postMessage({sourceName:s,targetName:i,callback:yh.DATA,callbackId:t.callbackId,data:a})},function(a){n.postMessage({sourceName:s,targetName:i,callback:yh.ERROR,callbackId:t.callbackId,reason:Ge(a)})});return}if(t.streamId){b(this,Ts,Fg).call(this,t);return}e(t.data)},Fg=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this,o=this.actionHandler[t.action],l={enqueue(h,d=1,u){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=d,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:Jt.ENQUEUE,streamId:e,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Jt.CLOSE,streamId:e}),delete a.streamSinks[e])},error(h){Zt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Jt.ERROR,streamId:e,reason:Ge(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,Promise.try(o,t.data,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Jt.START_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Jt.START_COMPLETE,streamId:e,reason:Ge(h)})})},Og=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case Jt.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(Ge(t.reason));break;case Jt.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(Ge(t.reason));break;case Jt.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:Jt.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||np).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Jt.PULL_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Jt.PULL_COMPLETE,streamId:e,reason:Ge(h)})});break;case Jt.ENQUEUE:if(Zt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case Jt.CLOSE:if(Zt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),b(this,Ts,Ih).call(this,a,e);break;case Jt.ERROR:Zt(a,"error should have stream controller"),a.controller.error(Ge(t.reason)),b(this,Ts,Ih).call(this,a,e);break;case Jt.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(Ge(t.reason)),b(this,Ts,Ih).call(this,a,e);break;case Jt.CANCEL:if(!o)break;const l=Ge(t.reason);Promise.try(o.onCancel||np,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Jt.CANCEL_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Jt.CANCEL_COMPLETE,streamId:e,reason:Ge(h)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},Ih=async function(t,e){var s,i,n;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(n=t.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[e]};var nc;class Bg{constructor({enableHWA:t=!1}){m(this,nc,!1);p(this,nc,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!r(this,nc)})}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){xt("Abstract method `_createCanvas` called.")}}nc=new WeakMap;class ey extends Bg{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}class jg{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(s=>({cMapData:s,isCompressed:this.isCompressed})).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){xt("Abstract method `_fetch` called.")}}class rp extends jg{async _fetch(t){const e=await Xo(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):oh(e)}}class Hg{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}}var Tr,eo,Di,Ni,Se,Rr,Pr,z,Ee,hl,Ca,Mh,Ta,$g,_u,Ra,dl,ul,Su,fl;class sy extends Hg{constructor({docId:e,ownerDocument:s=globalThis.document}){super();m(this,z);m(this,Tr);m(this,eo);m(this,Di);m(this,Ni);m(this,Se);m(this,Rr);m(this,Pr,0);p(this,Ni,e),p(this,Se,s)}addFilter(e){if(!e)return"none";let s=r(this,z,Ee).get(e);if(s)return s;const[i,n,a]=b(this,z,Mh).call(this,e),o=e.length===1?i:`${i}${n}${a}`;if(s=r(this,z,Ee).get(o),s)return r(this,z,Ee).set(e,s),s;const l=`g_${r(this,Ni)}_transfer_map_${Me(this,Pr)._++}`,h=b(this,z,Ta).call(this,l);r(this,z,Ee).set(e,h),r(this,z,Ee).set(o,h);const d=b(this,z,Ra).call(this,l);return b(this,z,ul).call(this,i,n,a,d),h}addHCMFilter(e,s){var y;const i=`${e}-${s}`,n="base";let a=r(this,z,hl).get(n);if((a==null?void 0:a.key)===i||(a?((y=a.filter)==null||y.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},r(this,z,hl).set(n,a)),!e||!s))return a.url;const o=b(this,z,fl).call(this,e);e=W.makeHexColor(...o);const l=b(this,z,fl).call(this,s);if(s=W.makeHexColor(...l),r(this,z,Ca).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return a.url;const h=new Array(256);for(let v=0;v<=255;v++){const w=v/255;h[v]=w<=.03928?w/12.92:((w+.055)/1.055)**2.4}const d=h.join(","),u=`g_${r(this,Ni)}_hcm_filter`,f=a.filter=b(this,z,Ra).call(this,u);b(this,z,ul).call(this,d,d,d,f),b(this,z,_u).call(this,f);const g=(v,w)=>{const A=o[v]/255,x=l[v]/255,_=new Array(w+1);for(let S=0;S<=w;S++)_[S]=A+S/w*(x-A);return _.join(",")};return b(this,z,ul).call(this,g(0,5),g(1,5),g(2,5),f),a.url=b(this,z,Ta).call(this,u),a.url}addAlphaFilter(e){let s=r(this,z,Ee).get(e);if(s)return s;const[i]=b(this,z,Mh).call(this,[e]),n=`alpha_${i}`;if(s=r(this,z,Ee).get(n),s)return r(this,z,Ee).set(e,s),s;const a=`g_${r(this,Ni)}_alpha_map_${Me(this,Pr)._++}`,o=b(this,z,Ta).call(this,a);r(this,z,Ee).set(e,o),r(this,z,Ee).set(n,o);const l=b(this,z,Ra).call(this,a);return b(this,z,Su).call(this,i,l),o}addLuminosityFilter(e){let s=r(this,z,Ee).get(e||"luminosity");if(s)return s;let i,n;if(e?([i]=b(this,z,Mh).call(this,[e]),n=`luminosity_${i}`):n="luminosity",s=r(this,z,Ee).get(n),s)return r(this,z,Ee).set(e,s),s;const a=`g_${r(this,Ni)}_luminosity_map_${Me(this,Pr)._++}`,o=b(this,z,Ta).call(this,a);r(this,z,Ee).set(e,o),r(this,z,Ee).set(n,o);const l=b(this,z,Ra).call(this,a);return b(this,z,$g).call(this,l),e&&b(this,z,Su).call(this,i,l),o}addHighlightHCMFilter(e,s,i,n,a){var x;const o=`${s}-${i}-${n}-${a}`;let l=r(this,z,hl).get(e);if((l==null?void 0:l.key)===o||(l?((x=l.filter)==null||x.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},r(this,z,hl).set(e,l)),!s||!i))return l.url;const[h,d]=[s,i].map(b(this,z,fl).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[g,y]=[n,a].map(b(this,z,fl).bind(this));f<u&&([u,f,g,y]=[f,u,y,g]),r(this,z,Ca).style.color="";const v=(_,S,C)=>{const R=new Array(256),T=(f-u)/C,k=_/255,I=(S-_)/(255*C);let D=0;for(let N=0;N<=C;N++){const Y=Math.round(u+N*T),q=k+N*I;for(let H=D;H<=Y;H++)R[H]=q;D=Y+1}for(let N=D;N<256;N++)R[N]=R[D-1];return R.join(",")},w=`g_${r(this,Ni)}_hcm_${e}_filter`,A=l.filter=b(this,z,Ra).call(this,w);return b(this,z,_u).call(this,A),b(this,z,ul).call(this,v(g[0],y[0],5),v(g[1],y[1],5),v(g[2],y[2],5),A),l.url=b(this,z,Ta).call(this,w),l.url}destroy(e=!1){var s,i,n,a;e&&((s=r(this,Rr))!=null&&s.size)||((i=r(this,Di))==null||i.parentNode.parentNode.remove(),p(this,Di,null),(n=r(this,eo))==null||n.clear(),p(this,eo,null),(a=r(this,Rr))==null||a.clear(),p(this,Rr,null),p(this,Pr,0))}}Tr=new WeakMap,eo=new WeakMap,Di=new WeakMap,Ni=new WeakMap,Se=new WeakMap,Rr=new WeakMap,Pr=new WeakMap,z=new WeakSet,Ee=function(){return r(this,eo)||p(this,eo,new Map)},hl=function(){return r(this,Rr)||p(this,Rr,new Map)},Ca=function(){if(!r(this,Di)){const e=r(this,Se).createElement("div"),{style:s}=e;s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=r(this,Se).createElementNS(vi,"svg");i.setAttribute("width",0),i.setAttribute("height",0),p(this,Di,r(this,Se).createElementNS(vi,"defs")),e.append(i),i.append(r(this,Di)),r(this,Se).body.append(e)}return r(this,Di)},Mh=function(e){if(e.length===1){const h=e[0],d=new Array(256);for(let f=0;f<256;f++)d[f]=h[f]/255;const u=d.join(",");return[u,u,u]}const[s,i,n]=e,a=new Array(256),o=new Array(256),l=new Array(256);for(let h=0;h<256;h++)a[h]=s[h]/255,o[h]=i[h]/255,l[h]=n[h]/255;return[a.join(","),o.join(","),l.join(",")]},Ta=function(e){if(r(this,Tr)===void 0){p(this,Tr,"");const s=r(this,Se).URL;s!==r(this,Se).baseURI&&(ch(s)?Z('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,Tr,xf(s,"")))}return`url(${r(this,Tr)}#${e})`},$g=function(e){const s=r(this,Se).createElementNS(vi,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(s)},_u=function(e){const s=r(this,Se).createElementNS(vi,"feColorMatrix");s.setAttribute("type","matrix"),s.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"),e.append(s)},Ra=function(e){const s=r(this,Se).createElementNS(vi,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),r(this,z,Ca).append(s),s},dl=function(e,s,i){const n=r(this,Se).createElementNS(vi,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},ul=function(e,s,i,n){const a=r(this,Se).createElementNS(vi,"feComponentTransfer");n.append(a),b(this,z,dl).call(this,a,"feFuncR",e),b(this,z,dl).call(this,a,"feFuncG",s),b(this,z,dl).call(this,a,"feFuncB",i)},Su=function(e,s){const i=r(this,Se).createElementNS(vi,"feComponentTransfer");s.append(i),b(this,z,dl).call(this,i,"feFuncA",e)},fl=function(e){return r(this,z,Ca).style.color=e,Sf(getComputedStyle(r(this,z,Ca)).getPropertyValue("color"))};class zg{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){xt("Abstract method `_fetch` called.")}}class ap extends zg{async _fetch(t){const e=await Xo(t,"arraybuffer");return new Uint8Array(e)}}class Gg{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw new Error("Wasm filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load wasm data at: ${e}`)})}async _fetch(t){xt("Abstract method `_fetch` called.")}}class op extends Gg{async _fetch(t){const e=await Xo(t,"arraybuffer");return new Uint8Array(e)}}Be&&Z("Please use the `legacy` build in Node.js environments.");async function Tf(c){const e=await process.getBuiltinModule("fs").promises.readFile(c);return new Uint8Array(e)}class iy extends Hg{}class ny extends Bg{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:Ud&&Ud.tagName.toUpperCase()==="SCRIPT"&&Ud.src||new URL("index.cjs",document.baseURI).href)("@napi-rs/canvas").createCanvas(t,e)}}class ry extends jg{async _fetch(t){return Tf(t)}}class ay extends zg{async _fetch(t){return Tf(t)}}class oy extends Gg{async _fetch(t){return Tf(t)}}const ye={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Cu(c,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),c.clip(i)}class Rf{isModifyingCurrentTransform(){return!1}getPattern(){xt("Abstract method `getPattern` called.")}}class ly extends Rf{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,i){let n;if(i===ye.STROKE||i===ye.FILL){const a=e.current.getClippedPathBoundingBox(i,jt(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,h=e.cachedCanvases.getCanvas("pattern",o,l),d=h.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-a[0],-a[1]),s=W.transform(s,[1,0,0,1,a[0],a[1]]),d.transform(...e.baseTransform),this.matrix&&d.transform(...this.matrix),Cu(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),n=t.createPattern(h.canvas,"no-repeat");const u=new DOMMatrix(s);n.setTransform(u)}else Cu(t,this._bbox),n=this._createGradient(t);return n}}function Jd(c,t,e,s,i,n,a,o){const l=t.coords,h=t.colors,d=c.data,u=c.width*4;let f;l[e+1]>l[s+1]&&(f=e,e=s,s=f,f=n,n=a,a=f),l[s+1]>l[i+1]&&(f=s,s=i,i=f,f=a,a=o,o=f),l[e+1]>l[s+1]&&(f=e,e=s,s=f,f=n,n=a,a=f);const g=(l[e]+t.offsetX)*t.scaleX,y=(l[e+1]+t.offsetY)*t.scaleY,v=(l[s]+t.offsetX)*t.scaleX,w=(l[s+1]+t.offsetY)*t.scaleY,A=(l[i]+t.offsetX)*t.scaleX,x=(l[i+1]+t.offsetY)*t.scaleY;if(y>=x)return;const _=h[n],S=h[n+1],C=h[n+2],R=h[a],T=h[a+1],k=h[a+2],I=h[o],D=h[o+1],N=h[o+2],Y=Math.round(y),q=Math.round(x);let H,st,F,O,yt,Tt,zt,mt;for(let _t=Y;_t<=q;_t++){if(_t<w){const dt=_t<y?0:(y-_t)/(y-w);H=g-(g-v)*dt,st=_-(_-R)*dt,F=S-(S-T)*dt,O=C-(C-k)*dt}else{let dt;_t>x?dt=1:w===x?dt=0:dt=(w-_t)/(w-x),H=v-(v-A)*dt,st=R-(R-I)*dt,F=T-(T-D)*dt,O=k-(k-N)*dt}let ft;_t<y?ft=0:_t>x?ft=1:ft=(y-_t)/(y-x),yt=g-(g-A)*ft,Tt=_-(_-I)*ft,zt=S-(S-D)*ft,mt=C-(C-N)*ft;const we=Math.round(Math.min(H,yt)),Ae=Math.round(Math.max(H,yt));let te=u*_t+we*4;for(let dt=we;dt<=Ae;dt++)ft=(H-dt)/(H-yt),ft<0?ft=0:ft>1&&(ft=1),d[te++]=st-(st-Tt)*ft|0,d[te++]=F-(F-zt)*ft|0,d[te++]=O-(O-mt)*ft|0,d[te++]=255}}function cy(c,t,e){const s=t.coords,i=t.colors;let n,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(n=0;n<l;n++){let d=n*o;for(let u=0;u<h;u++,d++)Jd(c,e,s[d],s[d+1],s[d+o],i[d],i[d+1],i[d+o]),Jd(c,e,s[d+o+1],s[d+1],s[d+o],i[d+o+1],i[d+1],i[d+o])}break;case"triangles":for(n=0,a=s.length;n<a;n+=3)Jd(c,e,s[n],s[n+1],s[n+2],i[n],i[n+1],i[n+2]);break;default:throw new Error("illegal figure")}}class hy extends Rf{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,s){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,d=Math.ceil(this._bounds[3])-l,u=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(d*t[1]*1.1)),3e3),g=h/u,y=d/f,v={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/g,scaleY:1/y},w=u+2*2,A=f+2*2,x=s.getCanvas("mesh",w,A),_=x.context,S=_.createImageData(u,f);if(e){const R=S.data;for(let T=0,k=R.length;T<k;T+=4)R[T]=e[0],R[T+1]=e[1],R[T+2]=e[2],R[T+3]=255}for(const R of this._figures)cy(S,R,v);return _.putImageData(S,2,2),{canvas:x.canvas,offsetX:o-2*g,offsetY:l-2*y,scaleX:g,scaleY:y}}isModifyingCurrentTransform(){return!0}getPattern(t,e,s,i){Cu(t,this._bbox);const n=new Float32Array(2);if(i===ye.SHADING)W.singularValueDecompose2dScale(jt(t),n);else if(this.matrix){W.singularValueDecompose2dScale(this.matrix,n);const[o,l]=n;W.singularValueDecompose2dScale(e.baseTransform,n),n[0]*=o,n[1]*=l}else W.singularValueDecompose2dScale(e.baseTransform,n);const a=this._createMeshCanvas(n,i===ye.SHADING?null:this._background,e.cachedCanvases);return i!==ye.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class dy extends Rf{getPattern(){return"hotpink"}}function uy(c){switch(c[0]){case"RadialAxial":return new ly(c);case"Mesh":return new hy(c);case"Dummy":return new dy}throw new Error(`Unknown IR type: ${c[0]}`)}const lp={COLORED:1,UNCOLORED:2},gd=class gd{constructor(t,e,s,i){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=s,this.baseTransform=i}createPatternCanvas(t){const{bbox:e,operatorList:s,paintType:i,tilingType:n,color:a,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:h}=this;l=Math.abs(l),h=Math.abs(h),Td("TilingType: "+n);const d=e[0],u=e[1],f=e[2],g=e[3],y=f-d,v=g-u,w=new Float32Array(2);W.singularValueDecompose2dScale(this.matrix,w);const[A,x]=w;W.singularValueDecompose2dScale(this.baseTransform,w);const _=A*w[0],S=x*w[1];let C=y,R=v,T=!1,k=!1;const I=Math.ceil(l*_),D=Math.ceil(h*S),N=Math.ceil(y*_),Y=Math.ceil(v*S);I>=N?C=l:T=!0,D>=Y?R=h:k=!0;const q=this.getSizeAndScale(C,this.ctx.canvas.width,_),H=this.getSizeAndScale(R,this.ctx.canvas.height,S),st=t.cachedCanvases.getCanvas("pattern",q.size,H.size),F=st.context,O=o.createCanvasGraphics(F);if(O.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(O,i,a),F.translate(-q.scale*d,-H.scale*u),O.transform(q.scale,0,0,H.scale,0,0),F.save(),this.clipBbox(O,d,u,f,g),O.baseTransform=jt(O.ctx),O.executeOperatorList(s),O.endDrawing(),F.restore(),T||k){const yt=st.canvas;T&&(C=l),k&&(R=h);const Tt=this.getSizeAndScale(C,this.ctx.canvas.width,_),zt=this.getSizeAndScale(R,this.ctx.canvas.height,S),mt=Tt.size,_t=zt.size,ft=t.cachedCanvases.getCanvas("pattern-workaround",mt,_t),we=ft.context,Ae=T?Math.floor(y/l):0,te=k?Math.floor(v/h):0;for(let dt=0;dt<=Ae;dt++)for(let Pe=0;Pe<=te;Pe++)we.drawImage(yt,mt*dt,_t*Pe,mt,_t,0,0,mt,_t);return{canvas:ft.canvas,scaleX:Tt.scale,scaleY:zt.scale,offsetX:d,offsetY:u}}return{canvas:st.canvas,scaleX:q.scale,scaleY:H.scale,offsetX:d,offsetY:u}}getSizeAndScale(t,e,s){const i=Math.max(gd.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){const a=i-e,o=n-s;t.ctx.rect(e,s,a,o),W.axialAlignedBoundingBox([e,s,i,n],jt(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,n=t.current;switch(e){case lp.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;i.fillStyle=n.fillColor=a,i.strokeStyle=n.strokeColor=o;break;case lp.UNCOLORED:i.fillStyle=i.strokeStyle=s,n.fillColor=n.strokeColor=s;break;default:throw new F0(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,s,i){let n=s;i!==ye.SHADING&&(n=W.transform(n,e.baseTransform),this.matrix&&(n=W.transform(n,this.matrix)));const a=this.createPatternCanvas(e);let o=new DOMMatrix(n);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}};L(gd,"MAX_PATTERN_SIZE",3e3);let Tu=gd;function fy({src:c,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=ue.isLittleEndian?4278190080:255,[l,h]=a?[n,o]:[o,n],d=s>>3,u=s&7,f=c.length;e=new Uint32Array(e.buffer);let g=0;for(let y=0;y<i;y++){for(const w=t+d;t<w;t++){const A=t<f?c[t]:255;e[g++]=A&128?h:l,e[g++]=A&64?h:l,e[g++]=A&32?h:l,e[g++]=A&16?h:l,e[g++]=A&8?h:l,e[g++]=A&4?h:l,e[g++]=A&2?h:l,e[g++]=A&1?h:l}if(u===0)continue;const v=t<f?c[t++]:255;for(let w=0;w<u;w++)e[g++]=v&1<<7-w?h:l}return{srcPos:t,destPos:g}}const cp=16,hp=100,py=15,dp=10,Xe=16,Zd=new DOMMatrix,ds=new Float32Array(2),Ma=new Float32Array([1/0,1/0,-1/0,-1/0]);function gy(c,t){if(c._removeMirroring)throw new Error("Context is already forwarding operations.");c.__originalSave=c.save,c.__originalRestore=c.restore,c.__originalRotate=c.rotate,c.__originalScale=c.scale,c.__originalTranslate=c.translate,c.__originalTransform=c.transform,c.__originalSetTransform=c.setTransform,c.__originalResetTransform=c.resetTransform,c.__originalClip=c.clip,c.__originalMoveTo=c.moveTo,c.__originalLineTo=c.lineTo,c.__originalBezierCurveTo=c.bezierCurveTo,c.__originalRect=c.rect,c.__originalClosePath=c.closePath,c.__originalBeginPath=c.beginPath,c._removeMirroring=()=>{c.save=c.__originalSave,c.restore=c.__originalRestore,c.rotate=c.__originalRotate,c.scale=c.__originalScale,c.translate=c.__originalTranslate,c.transform=c.__originalTransform,c.setTransform=c.__originalSetTransform,c.resetTransform=c.__originalResetTransform,c.clip=c.__originalClip,c.moveTo=c.__originalMoveTo,c.lineTo=c.__originalLineTo,c.bezierCurveTo=c.__originalBezierCurveTo,c.rect=c.__originalRect,c.closePath=c.__originalClosePath,c.beginPath=c.__originalBeginPath,delete c._removeMirroring},c.save=function(){t.save(),this.__originalSave()},c.restore=function(){t.restore(),this.__originalRestore()},c.translate=function(e,s){t.translate(e,s),this.__originalTranslate(e,s)},c.scale=function(e,s){t.scale(e,s),this.__originalScale(e,s)},c.transform=function(e,s,i,n,a,o){t.transform(e,s,i,n,a,o),this.__originalTransform(e,s,i,n,a,o)},c.setTransform=function(e,s,i,n,a,o){t.setTransform(e,s,i,n,a,o),this.__originalSetTransform(e,s,i,n,a,o)},c.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},c.rotate=function(e){t.rotate(e),this.__originalRotate(e)},c.clip=function(e){t.clip(e),this.__originalClip(e)},c.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},c.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},c.bezierCurveTo=function(e,s,i,n,a,o){t.bezierCurveTo(e,s,i,n,a,o),this.__originalBezierCurveTo(e,s,i,n,a,o)},c.rect=function(e,s,i,n){t.rect(e,s,i,n),this.__originalRect(e,s,i,n)},c.closePath=function(){t.closePath(),this.__originalClosePath()},c.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class my{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return this.cache[t]!==void 0?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function vh(c,t,e,s,i,n,a,o,l,h){const[d,u,f,g,y,v]=jt(c);if(u===0&&f===0){const x=a*d+y,_=Math.round(x),S=o*g+v,C=Math.round(S),R=(a+l)*d+y,T=Math.abs(Math.round(R)-_)||1,k=(o+h)*g+v,I=Math.abs(Math.round(k)-C)||1;return c.setTransform(Math.sign(d),0,0,Math.sign(g),_,C),c.drawImage(t,e,s,i,n,0,0,T,I),c.setTransform(d,u,f,g,y,v),[T,I]}if(d===0&&g===0){const x=o*f+y,_=Math.round(x),S=a*u+v,C=Math.round(S),R=(o+h)*f+y,T=Math.abs(Math.round(R)-_)||1,k=(a+l)*u+v,I=Math.abs(Math.round(k)-C)||1;return c.setTransform(0,Math.sign(u),Math.sign(f),0,_,C),c.drawImage(t,e,s,i,n,0,0,I,T),c.setTransform(d,u,f,g,y,v),[I,T]}c.drawImage(t,e,s,i,n,a,o,l,h);const w=Math.hypot(d,u),A=Math.hypot(f,g);return[w*l,A*h]}class up{constructor(t,e){L(this,"alphaIsShape",!1);L(this,"fontSize",0);L(this,"fontSizeScale",1);L(this,"textMatrix",null);L(this,"textMatrixScale",1);L(this,"fontMatrix",nu);L(this,"leading",0);L(this,"x",0);L(this,"y",0);L(this,"lineX",0);L(this,"lineY",0);L(this,"charSpacing",0);L(this,"wordSpacing",0);L(this,"textHScale",1);L(this,"textRenderingMode",xe.FILL);L(this,"textRise",0);L(this,"fillColor","#000000");L(this,"strokeColor","#000000");L(this,"patternFill",!1);L(this,"patternStroke",!1);L(this,"fillAlpha",1);L(this,"strokeAlpha",1);L(this,"lineWidth",1);L(this,"activeSMask",null);L(this,"transferMaps","none");this.clipBox=new Float32Array([0,0,t,e]),this.minMax=Ma.slice()}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=ye.FILL,e=null){const s=this.minMax.slice();if(t===ye.STROKE){e||xt("Stroke bounding box must include transform."),W.singularValueDecompose2dScale(e,ds);const i=ds[0]*this.lineWidth/2,n=ds[1]*this.lineWidth/2;s[0]-=i,s[1]-=n,s[2]+=i,s[3]+=n}return s}updateClipFromPath(){const t=W.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(Ma,0)}getClippedPathBoundingBox(t=ye.FILL,e=null){return W.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function fp(c,t){if(t instanceof ImageData){c.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%Xe,n=(e-i)/Xe,a=i===0?n:n+1,o=c.createImageData(s,Xe);let l=0,h;const d=t.data,u=o.data;let f,g,y,v;if(t.kind===_l.GRAYSCALE_1BPP){const w=d.byteLength,A=new Uint32Array(u.buffer,0,u.byteLength>>2),x=A.length,_=s+7>>3,S=4294967295,C=ue.isLittleEndian?4278190080:255;for(f=0;f<a;f++){for(y=f<n?Xe:i,h=0,g=0;g<y;g++){const R=w-l;let T=0;const k=R>_?s:R*8-7,I=k&-8;let D=0,N=0;for(;T<I;T+=8)N=d[l++],A[h++]=N&128?S:C,A[h++]=N&64?S:C,A[h++]=N&32?S:C,A[h++]=N&16?S:C,A[h++]=N&8?S:C,A[h++]=N&4?S:C,A[h++]=N&2?S:C,A[h++]=N&1?S:C;for(;T<k;T++)D===0&&(N=d[l++],D=128),A[h++]=N&D?S:C,D>>=1}for(;h<x;)A[h++]=0;c.putImageData(o,0,f*Xe)}}else if(t.kind===_l.RGBA_32BPP){for(g=0,v=s*Xe*4,f=0;f<n;f++)u.set(d.subarray(l,l+v)),l+=v,c.putImageData(o,0,g),g+=Xe;f<a&&(v=s*i*4,u.set(d.subarray(l,l+v)),c.putImageData(o,0,g))}else if(t.kind===_l.RGB_24BPP)for(y=Xe,v=s*y,f=0;f<a;f++){for(f>=n&&(y=i,v=s*y),h=0,g=v;g--;)u[h++]=d[l++],u[h++]=d[l++],u[h++]=d[l++],u[h++]=255;c.putImageData(o,0,f*Xe)}else throw new Error(`bad image kind: ${t.kind}`)}function pp(c,t){if(t.bitmap){c.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%Xe,n=(e-i)/Xe,a=i===0?n:n+1,o=c.createImageData(s,Xe);let l=0;const h=t.data,d=o.data;for(let u=0;u<a;u++){const f=u<n?Xe:i;({srcPos:l}=fy({src:h,srcPos:l,dest:d,width:s,height:f,nonBlackColor:0})),c.putImageData(o,0,u*Xe)}}function tl(c,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)c[s]!==void 0&&(t[s]=c[s]);c.setLineDash!==void 0&&(t.setLineDash(c.getLineDash()),t.lineDashOffset=c.lineDashOffset)}function wh(c){c.strokeStyle=c.fillStyle="#000000",c.fillRule="nonzero",c.globalAlpha=1,c.lineWidth=1,c.lineCap="butt",c.lineJoin="miter",c.miterLimit=10,c.globalCompositeOperation="source-over",c.font="10px sans-serif",c.setLineDash!==void 0&&(c.setLineDash([]),c.lineDashOffset=0);const{filter:t}=c;t!=="none"&&t!==""&&(c.filter="none")}function gp(c,t){if(t)return!0;W.singularValueDecompose2dScale(c,ds);const e=Math.fround(qs.pixelRatio*nn.PDF_TO_CSS_UNITS);return ds[0]<=e&&ds[1]<=e}const by=["butt","round","square"],yy=["miter","round","bevel"],vy={},mp={};var Xs,Ru,Pu,ku;const jf=class jf{constructor(t,e,s,i,n,{optionalContentConfig:a,markedContentStack:o=null},l,h){m(this,Xs);this.ctx=t,this.current=new up(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedCanvases=new my(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,s){const l=this.cachedCanvases.getCanvas("transparent",n,a);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...jt(this.compositeCtx))}this.ctx.save(),wh(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=jt(this.ctx)}executeOperatorList(t,e,s,i){const n=t.argsArray,a=t.fnArray;let o=e||0;const l=n.length;if(l===o)return o;const h=l-o>dp&&typeof s=="function",d=h?Date.now()+py:0;let u=0;const f=this.commonObjs,g=this.objs;let y;for(;;){if(i!==void 0&&o===i.nextBreakPoint)return i.breakIt(o,s),o;if(y=a[o],y!==Sl.dependency)this[y].apply(this,n[o]);else for(const v of n[o]){const w=v.startsWith("g_")?f:g;if(!w.has(v))return w.get(v,s),o}if(o++,o===l)return o;if(h&&++u>dp){if(Date.now()>d)return s(),o;u=0}}}endDrawing(){b(this,Xs,Ru).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),b(this,Xs,Pu).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let n=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=s,l=i,h="prescale1",d,u;for(;n>2&&o>1||a>2&&l>1;){let f=o,g=l;n>2&&o>1&&(f=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),n/=o/f),a>2&&l>1&&(g=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/g),d=this.cachedCanvases.getCanvas(h,f,g),u=d.context,u.clearRect(0,0,f,g),u.drawImage(t,0,0,o,l,0,0,f,g),t=d.canvas,o=f,l=g,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:l}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,n=this.current.fillColor,a=this.current.patternFill,o=jt(e);let l,h,d,u;if((t.bitmap||t.data)&&t.count>1){const I=t.bitmap||t.data.buffer;h=JSON.stringify(a?o:[o.slice(0,4),n]),l=this._cachedBitmapsMap.get(I),l||(l=new Map,this._cachedBitmapsMap.set(I,l));const D=l.get(h);if(D&&!a){const N=Math.round(Math.min(o[0],o[2])+o[4]),Y=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:D,offsetX:N,offsetY:Y}}d=D}d||(u=this.cachedCanvases.getCanvas("maskCanvas",s,i),pp(u.context,t));let f=W.transform(o,[1/s,0,0,-1/i,0,0]);f=W.transform(f,[1,0,0,1,0,-i]);const g=Ma.slice();W.axialAlignedBoundingBox([0,0,s,i],f,g);const[y,v,w,A]=g,x=Math.round(w-y)||1,_=Math.round(A-v)||1,S=this.cachedCanvases.getCanvas("fillCanvas",x,_),C=S.context,R=y,T=v;C.translate(-R,-T),C.transform(...f),d||(d=this._scaleImage(u.canvas,Ys(C)),d=d.img,l&&a&&l.set(h,d)),C.imageSmoothingEnabled=gp(jt(C),t.interpolate),vh(C,d,0,0,d.width,d.height,0,0,s,i),C.globalCompositeOperation="source-in";const k=W.transform(Ys(C),[1,0,0,1,-R,-T]);return C.fillStyle=a?n.getPattern(e,this,k,ye.FILL):n,C.fillRect(0,0,s,i),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(h,S.canvas)),{canvas:S.canvas,offsetX:Math.round(R),offsetY:Math.round(T)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=by[t]}setLineJoin(t){this.ctx.lineJoin=yy[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(t),s.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,s]of t)switch(e){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,t,e);this.suspendedCtx=this.ctx;const n=this.ctx=i.context;n.setTransform(this.suspendedCtx.getTransform()),tl(this.suspendedCtx,n),gy(n,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),tl(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,s,i){const n=i[0],a=i[1],o=i[2]-n,l=i[3]-a;o===0||l===0||(this.genericComposeSMask(e.context,s,o,l,e.subtype,e.backdrop,e.transferMap,n,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}genericComposeSMask(t,e,s,i,n,a,o,l,h,d,u){let f=t.canvas,g=l-d,y=h-u;if(a)if(g<0||y<0||g+s>f.width||y+i>f.height){const w=this.cachedCanvases.getCanvas("maskExtension",s,i),A=w.context;A.drawImage(f,-g,-y),A.globalCompositeOperation="destination-atop",A.fillStyle=a,A.fillRect(0,0,s,i),A.globalCompositeOperation="source-over",f=w.canvas,g=y=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const w=new Path2D;w.rect(g,y,s,i),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=a,t.fillRect(g,y,s,i),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));const v=new Path2D;v.rect(l,h,s,i),e.clip(v),e.globalCompositeOperation="destination-in",e.drawImage(f,g,y,s,i,l,h,s,i),e.restore()}save(){this.inSMaskMode&&tl(this.ctx,this.suspendedCtx),this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&tl(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,s,i,n,a){this.ctx.transform(t,e,s,i,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){let[i]=e;if(!s){i||(i=e[0]=new Path2D),this[t](i);return}if(!(i instanceof Path2D)){const n=e[0]=new Path2D;for(let a=0,o=i.length;a<o;)switch(i[a++]){case mh.moveTo:n.moveTo(i[a++],i[a++]);break;case mh.lineTo:n.lineTo(i[a++],i[a++]);break;case mh.curveTo:n.bezierCurveTo(i[a++],i[a++],i[a++],i[a++],i[a++],i[a++]);break;case mh.closePath:n.closePath();break;default:Z(`Unrecognized drawing path operator: ${i[a-1]}`);break}i=n}W.axialAlignedBoundingBox(s,jt(this.ctx),this.current.minMax),this[t](i)}closePath(){this.ctx.closePath()}stroke(t,e=!0){const s=this.ctx,i=this.current.strokeColor;if(s.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof i=="object"&&(i!=null&&i.getPattern)){const n=i.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.strokeStyle=i.getPattern(s,this,Ys(s),ye.STROKE),n){const a=new Path2D;a.addPath(t,s.getTransform().invertSelf().multiplySelf(n)),t=a}this.rescaleAndStroke(t,!1),s.restore()}else this.rescaleAndStroke(t,!0);e&&this.consumePath(t,this.current.getClippedPathBoundingBox(ye.STROKE,jt(this.ctx))),s.globalAlpha=this.current.fillAlpha}closeStroke(t){this.stroke(t)}fill(t,e=!0){const s=this.ctx,i=this.current.fillColor,n=this.current.patternFill;let a=!1;if(n){const l=i.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.fillStyle=i.getPattern(s,this,Ys(s),ye.FILL),l){const h=new Path2D;h.addPath(t,s.getTransform().invertSelf().multiplySelf(l)),t=h}a=!0}const o=this.current.getClippedPathBoundingBox();this.contentVisible&&o!==null&&(this.pendingEOFill?(s.fill(t,"evenodd"),this.pendingEOFill=!1):s.fill(t)),a&&s.restore(),e&&this.consumePath(t,o)}eoFill(t){this.pendingEOFill=!0,this.fill(t)}fillStroke(t){this.fill(t,!1),this.stroke(t,!1),this.consumePath(t)}eoFillStroke(t){this.pendingEOFill=!0,this.fillStroke(t)}closeFillStroke(t){this.fillStroke(t)}closeEOFillStroke(t){this.pendingEOFill=!0,this.fillStroke(t)}endPath(t){this.consumePath(t)}rawFillPath(t){this.ctx.fill(t)}clip(){this.pendingClip=vy}eoClip(){this.pendingClip=mp}beginText(){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(t===void 0)return;const s=new Path2D,i=e.getTransform().invertSelf();for(const{transform:n,x:a,y:o,fontSize:l,path:h}of t)s.addPath(h,new DOMMatrix(n).preMultiplySelf(i).translate(a,o).scale(l,-l));e.clip(s),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var d;const s=this.commonObjs.get(t),i=this.current;if(!s)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=s.fontMatrix||nu,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&Z("Invalid font matrix for font "+t),e<0?(e=-e,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const n=s.loadedName||"sans-serif",a=((d=s.systemFontInfo)==null?void 0:d.css)||`"${n}", ${s.fallbackName}`;let o="normal";s.black?o="900":s.bold&&(o="bold");const l=s.italic?"italic":"normal";let h=e;e<cp?h=cp:e>hp&&(h=hp),this.current.fontSizeScale=e/h,this.ctx.font=`${l} ${o} ${h}px ${a}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t){const{current:e}=this;e.textMatrix=t,e.textMatrixScale=Math.hypot(t[0],t[1]),e.x=e.lineX=0,e.y=e.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i,n){const a=this.ctx,o=this.current,l=o.font,h=o.textRenderingMode,d=o.fontSize/o.fontSizeScale,u=h&xe.FILL_STROKE_MASK,f=!!(h&xe.ADD_TO_PATH_FLAG),g=o.patternFill&&!l.missingFile,y=o.patternStroke&&!l.missingFile;let v;if((l.disableFontFace||f||g||y)&&(v=l.getPathGenerator(this.commonObjs,t)),l.disableFontFace||g||y){a.save(),a.translate(e,s),a.scale(d,-d);let w;if((u===xe.FILL||u===xe.FILL_STROKE)&&(i?(w=a.getTransform(),a.setTransform(...i),a.fill(b(this,Xs,ku).call(this,v,w,i))):a.fill(v)),u===xe.STROKE||u===xe.FILL_STROKE)if(n){w||(w=a.getTransform()),a.setTransform(...n);const{a:A,b:x,c:_,d:S}=w,C=W.inverseTransform(n),R=W.transform([A,x,_,S,0,0],C);W.singularValueDecompose2dScale(R,ds),a.lineWidth*=Math.max(ds[0],ds[1])/d,a.stroke(b(this,Xs,ku).call(this,v,w,n))}else a.lineWidth/=d,a.stroke(v);a.restore()}else(u===xe.FILL||u===xe.FILL_STROKE)&&a.fillText(t,e,s),(u===xe.STROKE||u===xe.FILL_STROKE)&&a.strokeText(t,e,s);f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:jt(a),x:e,y:s,fontSize:d,path:v})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<255){s=!0;break}return it(this,"isFontSubpixelAAEnabled",s)}showText(t){const e=this.current,s=e.font;if(s.isType3Font)return this.showType3Text(t);const i=e.fontSize;if(i===0)return;const n=this.ctx,a=e.fontSizeScale,o=e.charSpacing,l=e.wordSpacing,h=e.fontDirection,d=e.textHScale*h,u=t.length,f=s.vertical,g=f?1:-1,y=s.defaultVMetrics,v=i*e.fontMatrix[0],w=e.textRenderingMode===xe.FILL&&!s.disableFontFace&&!e.patternFill;n.save(),e.textMatrix&&n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),h>0?n.scale(d,-1):n.scale(d,1);let A,x;if(e.patternFill){n.save();const T=e.fillColor.getPattern(n,this,Ys(n),ye.FILL);A=jt(n),n.restore(),n.fillStyle=T}if(e.patternStroke){n.save();const T=e.strokeColor.getPattern(n,this,Ys(n),ye.STROKE);x=jt(n),n.restore(),n.strokeStyle=T}let _=e.lineWidth;const S=e.textMatrixScale;if(S===0||_===0){const T=e.textRenderingMode&xe.FILL_STROKE_MASK;(T===xe.STROKE||T===xe.FILL_STROKE)&&(_=this.getSinglePixelWidth())}else _/=S;if(a!==1&&(n.scale(a,a),_/=a),n.lineWidth=_,s.isInvalidPDFjsFont){const T=[];let k=0;for(const I of t)T.push(I.unicode),k+=I.width;n.fillText(T.join(""),0,0),e.x+=k*v*d,n.restore(),this.compose();return}let C=0,R;for(R=0;R<u;++R){const T=t[R];if(typeof T=="number"){C+=g*T*i/1e3;continue}let k=!1;const I=(T.isSpace?l:0)+o,D=T.fontChar,N=T.accent;let Y,q,H=T.width;if(f){const F=T.vmetric||y,O=-(T.vmetric?F[1]:H*.5)*v,yt=F[2]*v;H=F?-F[0]:H,Y=O/a,q=(C+yt)/a}else Y=C/a,q=0;if(s.remeasure&&H>0){const F=n.measureText(D).width*1e3/i*a;if(H<F&&this.isFontSubpixelAAEnabled){const O=H/F;k=!0,n.save(),n.scale(O,1),Y/=O}else H!==F&&(Y+=(H-F)/2e3*i/a)}if(this.contentVisible&&(T.isInFont||s.missingFile)){if(w&&!N)n.fillText(D,Y,q);else if(this.paintChar(D,Y,q,A,x),N){const F=Y+i*N.offset.x/a,O=q-i*N.offset.y/a;this.paintChar(N.fontChar,F,O,A,x)}}const st=f?H*v-I*h:H*v+I*h;C+=st,k&&n.restore()}f?e.y-=C:e.x+=C*d,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,n=s.fontSize,a=s.fontDirection,o=i.vertical?1:-1,l=s.charSpacing,h=s.wordSpacing,d=s.textHScale*a,u=s.fontMatrix||nu,f=t.length,g=s.textRenderingMode===xe.INVISIBLE;let y,v,w,A;if(!(g||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),s.textMatrix&&e.transform(...s.textMatrix),e.translate(s.x,s.y+s.textRise),e.scale(d,a),y=0;y<f;++y){if(v=t[y],typeof v=="number"){A=o*v*n/1e3,this.ctx.translate(A,0),s.x+=A*d;continue}const x=(v.isSpace?h:0)+l,_=i.charProcOperatorList[v.operatorListId];_?this.contentVisible&&(this.save(),e.scale(n,n),e.transform(...u),this.executeOperatorList(_),this.restore()):Z(`Type3 character "${v.operatorListId}" is not available.`);const S=[v.width,0];W.applyTransform(S,u),w=S[0]*n+x,e.translate(w,0),s.x+=w*d}e.restore()}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,n,a){const o=new Path2D;o.rect(s,i,n-s,a-i),this.ctx.clip(o),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const s=this.baseTransform||jt(this.ctx),i={createCanvasGraphics:n=>new jf(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Tu(t,this.ctx,i,s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t){this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t){this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let s;return this.cachedPatterns.has(t)?s=this.cachedPatterns.get(t):(s=uy(this.getObject(t)),this.cachedPatterns.set(t,s)),e&&(s.matrix=e),s}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const s=this._getPattern(t);e.fillStyle=s.getPattern(e,this,Ys(e),ye.SHADING);const i=Ys(e);if(i){const{width:n,height:a}=e.canvas,o=Ma.slice();W.axialAlignedBoundingBox([0,0,n,a],i,o);const[l,h,d,u]=o;this.ctx.fillRect(l,h,d-l,u-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){xt("Should not call beginInlineImage")}beginImageData(){xt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=jt(this.ctx),e)){W.axialAlignedBoundingBox(e,this.baseTransform,this.current.minMax);const[s,i,n,a]=e,o=new Path2D;o.rect(s,i,n-s,a-i),this.ctx.clip(o),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||Td("TODO: Support non-isolated groups."),t.knockout&&Z("Knockout groups not supported.");const s=jt(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=Ma.slice();W.axialAlignedBoundingBox(t.bbox,jt(e),i);const n=[0,0,e.canvas.width,e.canvas.height];i=W.intersect(i,n)||[0,0,0,0];const a=Math.floor(i[0]),o=Math.floor(i[1]),l=Math.max(Math.ceil(i[2])-a,1),h=Math.max(Math.ceil(i[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,h]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,l,h),f=u.context;f.translate(-a,-o),f.transform(...s);let g=new Path2D;const[y,v,w,A]=t.bbox;if(g.rect(y,v,w-y,A-v),t.matrix){const x=new Path2D;x.addPath(g,new DOMMatrix(t.matrix)),g=x}f.clip(g),t.smask?this.smaskStack.push({canvas:u.canvas,context:f,offsetX:a,offsetY:o,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,o),e.save()),tl(e,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const i=jt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const n=Ma.slice();W.axialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i,n),this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,s,i,n){if(b(this,Xs,Ru).call(this),wh(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const a=e[2]-e[0],o=e[3]-e[1];if(n&&this.annotationCanvasMap){s=s.slice(),s[4]-=e[0],s[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=a,e[3]=o,W.singularValueDecompose2dScale(jt(this.ctx),ds);const{viewportScale:l}=this,h=Math.ceil(a*this.outputScaleX*l),d=Math.ceil(o*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(h,d);const{canvas:u,context:f}=this.annotationCanvas;this.annotationCanvasMap.set(t,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=f,this.ctx.save(),this.ctx.setTransform(ds[0],0,0,-ds[1],0,o*ds[1]),wh(this.ctx)}else{wh(this.ctx),this.endPath();const l=new Path2D;l.rect(e[0],e[1],a,o),this.ctx.clip(l)}}this.current=new up(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),b(this,Xs,Pu).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;t=this.getObject(t.data,t),t.count=e;const s=this.ctx,i=this._createMaskCanvas(t),n=i.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(n,i.offsetX,i.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,n,a){if(!this.contentVisible)return;t=this.getObject(t.data,t);const o=this.ctx;o.save();const l=jt(o);o.transform(e,s,i,n,0,0);const h=this._createMaskCanvas(t);o.setTransform(1,0,0,1,h.offsetX-l[4],h.offsetY-l[5]);for(let d=0,u=a.length;d<u;d+=2){const f=W.transform(l,[e,s,i,n,a[d],a[d+1]]);o.drawImage(h.canvas,f[4],f[5])}o.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const n of t){const{data:a,width:o,height:l,transform:h}=n,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),u=d.context;u.save();const f=this.getObject(a,n);pp(u,f),u.globalCompositeOperation="source-in",u.fillStyle=i?s.getPattern(u,this,Ys(e),ye.FILL):s,u.fillRect(0,0,o,l),u.restore(),e.save(),e.transform(...h),e.scale(1,-1),vh(e,d.canvas,0,0,o,l,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);if(!e){Z("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const n=this.getObject(t);if(!n){Z("Dependent image isn't ready yet");return}const a=n.width,o=n.height,l=[];for(let h=0,d=i.length;h<d;h+=2)l.push({transform:[e,0,0,s,i[h],i[h+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(n,l)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:e,width:s,height:i}=t,n=this.cachedCanvases.getCanvas("inlineImage",s,i),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;this.save();const{filter:n}=i;n!=="none"&&n!==""&&(i.filter="none"),i.scale(1/e,-1/s);let a;if(t.bitmap)a=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)a=t;else{const h=this.cachedCanvases.getCanvas("inlineImage",e,s).context;fp(h,t),a=this.applyTransferMapsToCanvas(h)}const o=this._scaleImage(a,Ys(i));i.imageSmoothingEnabled=gp(jt(i),t.interpolate),vh(i,o.img,0,0,o.paintWidth,o.paintHeight,0,-s,e,s),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const s=this.ctx;let i;if(t.bitmap)i=t.bitmap;else{const n=t.width,a=t.height,l=this.cachedCanvases.getCanvas("inlineImage",n,a).context;fp(l,t),i=this.applyTransferMapsToCanvas(l)}for(const n of e)s.save(),s.transform(...n.transform),s.scale(1,-1),vh(s,i,n.x,n.y,n.w,n.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t,e){const s=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const i=this.ctx;this.pendingClip&&(s||(this.pendingClip===mp?i.clip(t,"evenodd"):i.clip(t)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=jt(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:s,c:i,d:n}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const l=Math.abs(e),h=Math.abs(n);if(l===h)if(t===0)a=o=1/l;else{const d=l*t;a=o=d<1?1/d:1}else if(t===0)a=1/l,o=1/h;else{const d=l*t,u=h*t;a=d<1?1/d:1,o=u<1?1/u:1}}else{const l=Math.abs(e*n-s*i),h=Math.hypot(e,s),d=Math.hypot(i,n);if(t===0)a=d/l,o=h/l;else{const u=t*l;a=d>u?d/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:s,current:{lineWidth:i}}=this,[n,a]=this.getScaleForStroking();if(n===a){s.lineWidth=(i||1)*n,s.stroke(t);return}const o=s.getLineDash();e&&s.save(),s.scale(n,a),Zd.a=1/n,Zd.d=1/a;const l=new Path2D;if(l.addPath(t,Zd),o.length>0){const h=Math.max(n,a);s.setLineDash(o.map(d=>d/h)),s.lineDashOffset/=h}s.lineWidth=i||1,s.stroke(l),e&&s.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Xs=new WeakSet,Ru=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,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)},Pu=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},ku=function(t,e,s){const i=new Path2D;return i.addPath(t,new DOMMatrix(s).invertSelf().multiplySelf(e)),i};let Na=jf;for(const c in Sl)Na.prototype[c]!==void 0&&(Na.prototype[Sl[c]]=Na.prototype[c]);var rc,ac;class Ss{static get workerPort(){return r(this,rc)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,rc,t)}static get workerSrc(){return r(this,ac)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,ac,t)}}rc=new WeakMap,ac=new WeakMap,m(Ss,rc,null),m(Ss,ac,"");var so,oc;class wy{constructor({parsedData:t,rawData:e}){m(this,so);m(this,oc);p(this,so,t),p(this,oc,e)}getRaw(){return r(this,oc)}get(t){return r(this,so).get(t)??null}[Symbol.iterator](){return r(this,so).entries()}}so=new WeakMap,oc=new WeakMap;const Pa=Symbol("INTERNAL");var lc,cc,hc,io;class Ay{constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){m(this,lc,!1);m(this,cc,!1);m(this,hc,!1);m(this,io,!0);p(this,lc,!!(t&hs.DISPLAY)),p(this,cc,!!(t&hs.PRINT)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(r(this,hc))return r(this,io);if(!r(this,io))return!1;const{print:t,view:e}=this.usage;return r(this,lc)?(e==null?void 0:e.viewState)!=="OFF":r(this,cc)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==Pa&&xt("Internal method `_setVisible` called."),p(this,hc,s),p(this,io,e)}}lc=new WeakMap,cc=new WeakMap,hc=new WeakMap,io=new WeakMap;var Cn,wt,no,ro,dc,Iu;class xy{constructor(t,e=hs.DISPLAY){m(this,dc);m(this,Cn,null);m(this,wt,new Map);m(this,no,null);m(this,ro,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,ro,t.order);for(const s of t.groups)r(this,wt).set(s.id,new Ay(e,s));if(t.baseState==="OFF")for(const s of r(this,wt).values())s._setVisible(Pa,!1);for(const s of t.on)r(this,wt).get(s)._setVisible(Pa,!0);for(const s of t.off)r(this,wt).get(s)._setVisible(Pa,!1);p(this,no,this.getHash())}}isVisible(t){if(r(this,wt).size===0)return!0;if(!t)return Td("Optional content group not defined."),!0;if(t.type==="OCG")return r(this,wt).has(t.id)?r(this,wt).get(t.id).visible:(Z(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,dc,Iu).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!r(this,wt).has(e))return Z(`Optional content group not found: ${e}`),!0;if(r(this,wt).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!r(this,wt).has(e))return Z(`Optional content group not found: ${e}`),!0;if(!r(this,wt).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!r(this,wt).has(e))return Z(`Optional content group not found: ${e}`),!0;if(!r(this,wt).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!r(this,wt).has(e))return Z(`Optional content group not found: ${e}`),!0;if(r(this,wt).get(e).visible)return!1}return!0}return Z(`Unknown optional content policy ${t.policy}.`),!0}return Z(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var n;const i=r(this,wt).get(t);if(!i){Z(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==t&&((n=r(this,wt).get(o))==null||n._setVisible(Pa,!1,!0));i._setVisible(Pa,!!e,!0),p(this,Cn,null)}setOCGState({state:t,preserveRB:e}){let s;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const n=r(this,wt).get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!n.visible,e);break}}p(this,Cn,null)}get hasInitialVisibility(){return r(this,no)===null||this.getHash()===r(this,no)}getOrder(){return r(this,wt).size?r(this,ro)?r(this,ro).slice():[...r(this,wt).keys()]:null}getGroup(t){return r(this,wt).get(t)||null}getHash(){if(r(this,Cn)!==null)return r(this,Cn);const t=new Ig;for(const[e,s]of r(this,wt))t.update(`${e}:${s.visible}`);return p(this,Cn,t.hexdigest())}[Symbol.iterator](){return r(this,wt).entries()}}Cn=new WeakMap,wt=new WeakMap,no=new WeakMap,ro=new WeakMap,dc=new WeakSet,Iu=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const n=t[i];let a;if(Array.isArray(n))a=b(this,dc,Iu).call(this,n);else if(r(this,wt).has(n))a=r(this,wt).get(n).visible;else return Z(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return s==="And"};class Ey{constructor(t,{disableRange:e=!1,disableStream:s=!1}){Zt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:n,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(n==null?void 0:n.length)>0){const l=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,h)=>{this._onReceiveData({begin:l,chunk:h})}),t.addProgressListener((l,h)=>{this._onProgress({loaded:l,total:h})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const s=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{const i=this._rangeReaders.some(function(n){return n._begin!==t?!1:(n._enqueue(s),!0)});Zt(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}_onProgress(t){var e,s,i,n;t.total===void 0?(s=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||s.call(e,{loaded:t.loaded}):(n=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||n.call(i,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;(t=this._fullRequestReader)==null||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){Zt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new _y(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Sy(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeReaders.slice(0))s.cancel(t);this._pdfDataRangeTransport.abort()}}class _y{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=Pd(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Sy{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const s of this._requests)s.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 e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Cy(c){let t=!0,e=s("filename\\*","i").exec(c);if(e){e=e[1];let d=o(e);return d=unescape(d),d=l(d),d=h(d),n(d)}if(e=a(c),e){const d=h(e);return n(d)}if(e=s("filename","i").exec(c),e){e=e[1];let d=o(e);return d=h(d),n(d)}function s(d,u){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function i(d,u){if(d){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const f=new TextDecoder(d,{fatal:!0}),g=oh(u);u=f.decode(g),t=!1}catch{}}return u}function n(d){return t&&/[\x80-\xff]/.test(d)&&(d=i("utf-8",d),t&&(d=i("iso-8859-1",d))),d}function a(d){const u=[];let f;const g=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=g.exec(d))!==null;){let[,v,w,A]=f;if(v=parseInt(v,10),v in u){if(v===0)break;continue}u[v]=[w,A]}const y=[];for(let v=0;v<u.length&&v in u;++v){let[w,A]=u[v];A=o(A),w&&(A=unescape(A),v===0&&(A=l(A))),y.push(A)}return y.join("")}function o(d){if(d.startsWith('"')){const u=d.slice(1).split('\\"');for(let f=0;f<u.length;++f){const g=u[f].indexOf('"');g!==-1&&(u[f]=u[f].slice(0,g),u.length=f+1),u[f]=u[f].replaceAll(/\\(.)/g,"$1")}d=u.join('"')}return d}function l(d){const u=d.indexOf("'");if(u===-1)return d;const f=d.slice(0,u),y=d.slice(u+1).replace(/^[^']*'/,"");return i(f,y)}function h(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,f,g,y){if(g==="q"||g==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(v,w){return String.fromCharCode(parseInt(w,16))}),i(f,y);try{y=atob(y)}catch{}return i(f,y)})}return""}function Vg(c,t){const e=new Headers;if(!c||!t||typeof t!="object")return e;for(const s in t){const i=t[s];i!==void 0&&e.append(s,i)}return e}function Id(c){var t;return((t=URL.parse(c))==null?void 0:t.origin)??null}function Ug({responseHeaders:c,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(c.get("Content-Length"),10);return!Number.isInteger(n)||(i.suggestedLength=n,n<=2*e)||s||!t||c.get("Accept-Ranges")!=="bytes"||(c.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Wg(c){const t=c.get("Content-Disposition");if(t){let e=Cy(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Pd(e))return e}return null}function dh(c,t){return new Cl(`Unexpected server response (${c}) while retrieving PDF "${t}".`,c,c===404||c===0&&t.startsWith("file:"))}function qg(c){return c===200||c===206}function Xg(c,t,e){return{method:"GET",headers:c,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Yg(c){return c instanceof Uint8Array?c.buffer:c instanceof ArrayBuffer?c:(Z(`getArrayBuffer - unexpected data format: ${c}`),new Uint8Array(c).buffer)}class Ty{constructor(t){L(this,"_responseOrigin",null);this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Vg(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return Zt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Ry(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Py(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Ry{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const s=new Headers(t.headers),i=e.url;fetch(i,Xg(s,this._withCredentials,this._abortController)).then(n=>{if(t._responseOrigin=Id(n.url),!qg(n.status))throw dh(n.status,i);this._reader=n.body.getReader(),this._headersCapability.resolve();const a=n.headers,{allowRangeRequests:o,suggestedLength:l}=Ug({responseHeaders:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=Wg(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new sn("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 s;await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Yg(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class Py{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;const i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;const n=new Headers(t.headers);n.append("Range",`bytes=${e}-${s-1}`);const a=i.url;fetch(a,Xg(n,this._withCredentials,this._abortController)).then(o=>{const l=Id(o.url);if(l!==t._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${t._responseOrigin}".`);if(!qg(o.status))throw dh(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:Yg(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const Qd=200,tu=206;function ky(c){const t=c.response;return typeof t!="string"?t:oh(t).buffer}class Iy{constructor({url:t,httpHeaders:e,withCredentials:s}){L(this,"_responseOrigin",null);this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Vg(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[n,a]of this.headers)e.setRequestHeader(n,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=tu):i.expectedStatus=Qd,e.responseType="arraybuffer",Zt(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&((i=s.onProgress)==null||i.call(s,e))}onStateChange(t,e){const s=this.pendingRequests[t];if(!s)return;const i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),i.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],i.status===0&&this.isHttp){s.onError(i.status);return}const n=i.status||Qd;if(!(n===Qd&&s.expectedStatus===tu)&&n!==s.expectedStatus){s.onError(i.status);return}const o=ky(i);if(n===tu){const l=i.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);h?s.onDone({begin:parseInt(h[1],10),chunk:o}):(Z('Missing or invalid "Content-Range" header.'),s.onError(0))}else o?s.onDone({begin:0,chunk:o}):s.onError(i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class My{constructor(t){this._source=t,this._manager=new Iy(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return Zt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Ly(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new Dy(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Ly{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=Id(e.responseURL);const s=e.getAllResponseHeaders(),i=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{const[l,...h]=o.split(": ");return[l,h.join(": ")]}):[]),{allowRangeRequests:n,suggestedLength:a}=Ug({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=Wg(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=dh(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;(e=this.onProgress)==null||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Dy{constructor(t,e,s){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:s,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var e;const t=Id((e=this._manager.getRequestXhr(this._requestId))==null?void 0:e.responseURL);t!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${t}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var t;(t=this.onClosed)==null||t.call(this,this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError??(this._storedError=dh(t,this._url));for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(e=this.onProgress)==null||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Ny=/^[a-z][a-z0-9\-+.]+:/i;function Fy(c){if(Ny.test(c))return new URL(c);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(c))}class Oy{constructor(t){this.source=t,this.url=Fy(t.url),Zt(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return Zt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new By(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new jy(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class By{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const s=process.getBuiltinModule("fs");s.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(s.createReadStream(this._url)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=dh(0,this._url.href)),this._storedError=i,this._headersCapability.reject(i)})}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 s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new sn("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class jy{constructor(t,e,s){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const i=t.source;this._isStreamingSupported=!i.disableStream;const n=process.getBuiltinModule("fs");this._setReadableStream(n.createReadStream(this._url,{start:e,end:s-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const el=Symbol("INITIAL_DATA");var Qe,uc,Mu;class Kg{constructor(){m(this,uc);m(this,Qe,Object.create(null))}get(t,e=null){if(e){const i=b(this,uc,Mu).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=r(this,Qe)[t];if(!s||s.data===el)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=r(this,Qe)[t];return!!e&&e.data!==el}delete(t){const e=r(this,Qe)[t];return!e||e.data===el?!1:(delete r(this,Qe)[t],!0)}resolve(t,e=null){const s=b(this,uc,Mu).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in r(this,Qe)){const{data:s}=r(this,Qe)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}p(this,Qe,Object.create(null))}*[Symbol.iterator](){for(const t in r(this,Qe)){const{data:e}=r(this,Qe)[t];e!==el&&(yield[t,e])}}}Qe=new WeakMap,uc=new WeakSet,Mu=function(t){var e;return(e=r(this,Qe))[t]||(e[t]={...Promise.withResolvers(),data:el})};const Hy=1e5,bp=30;var Pp,Tn,We,fc,pc,kr,Fi,gc,mc,Ir,ao,oo,Rn,lo,bc,co,Mr,yc,vc,$t,ho,Lr,wc,Pn,uo,rn,Jg,Zg,Lu,fs,Lh,Du,Qg,tm;let Rl=($t=class{constructor({textContentSource:t,container:e,viewport:s}){m(this,rn);m(this,Tn,Promise.withResolvers());m(this,We,null);m(this,fc,!1);m(this,pc,!!((Pp=globalThis.FontInspector)!=null&&Pp.enabled));m(this,kr,null);m(this,Fi,null);m(this,gc,0);m(this,mc,0);m(this,Ir,null);m(this,ao,null);m(this,oo,0);m(this,Rn,0);m(this,lo,Object.create(null));m(this,bc,[]);m(this,co,null);m(this,Mr,[]);m(this,yc,new WeakMap);m(this,vc,null);var l;if(t instanceof ReadableStream)p(this,co,t);else if(typeof t=="object")p(this,co,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,We,p(this,ao,e)),p(this,Rn,s.scale*qs.pixelRatio),p(this,oo,s.rotation),p(this,Fi,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:n,pageX:a,pageY:o}=s.rawDims;p(this,vc,[1,0,0,-1,-a,o+n]),p(this,mc,i),p(this,gc,n),b(l=$t,fs,Qg).call(l),Xn(e,s),r(this,Tn).promise.finally(()=>{r($t,uo).delete(this),p(this,Fi,null),p(this,lo,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=ue.platform;return it(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){const t=()=>{r(this,Ir).read().then(({value:e,done:s})=>{if(s){r(this,Tn).resolve();return}r(this,kr)??p(this,kr,e.lang),Object.assign(r(this,lo),e.styles),b(this,rn,Jg).call(this,e.items),t()},r(this,Tn).reject)};return p(this,Ir,r(this,co).getReader()),r($t,uo).add(this),t(),r(this,Tn).promise}update({viewport:t,onBefore:e=null}){var n;const s=t.scale*qs.pixelRatio,i=t.rotation;if(i!==r(this,oo)&&(e==null||e(),p(this,oo,i),Xn(r(this,ao),{rotation:i})),s!==r(this,Rn)){e==null||e(),p(this,Rn,s);const a={div:null,properties:null,ctx:b(n=$t,fs,Lh).call(n,r(this,kr))};for(const o of r(this,Mr))a.properties=r(this,yc).get(o),a.div=o,b(this,rn,Lu).call(this,a)}}cancel(){var e;const t=new sn("TextLayer task cancelled.");(e=r(this,Ir))==null||e.cancel(t).catch(()=>{}),p(this,Ir,null),r(this,Tn).reject(t)}get textDivs(){return r(this,Mr)}get textContentItemsStr(){return r(this,bc)}static cleanup(){if(!(r(this,uo).size>0)){r(this,ho).clear();for(const{canvas:t}of r(this,Lr).values())t.remove();r(this,Lr).clear()}}},Tn=new WeakMap,We=new WeakMap,fc=new WeakMap,pc=new WeakMap,kr=new WeakMap,Fi=new WeakMap,gc=new WeakMap,mc=new WeakMap,Ir=new WeakMap,ao=new WeakMap,oo=new WeakMap,Rn=new WeakMap,lo=new WeakMap,bc=new WeakMap,co=new WeakMap,Mr=new WeakMap,yc=new WeakMap,vc=new WeakMap,ho=new WeakMap,Lr=new WeakMap,wc=new WeakMap,Pn=new WeakMap,uo=new WeakMap,rn=new WeakSet,Jg=function(t){var i,n;if(r(this,fc))return;(n=r(this,Fi)).ctx??(n.ctx=b(i=$t,fs,Lh).call(i,r(this,kr)));const e=r(this,Mr),s=r(this,bc);for(const a of t){if(e.length>Hy){Z("Ignoring additional textDivs for performance reasons."),p(this,fc,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=r(this,We);p(this,We,document.createElement("span")),r(this,We).classList.add("markedContent"),a.id!==null&&r(this,We).setAttribute("id",`${a.id}`),o.append(r(this,We))}else a.type==="endMarkedContent"&&p(this,We,r(this,We).parentNode);continue}s.push(a.str),b(this,rn,Zg).call(this,a)}},Zg=function(t){var v;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};r(this,Mr).push(e);const i=W.transform(r(this,vc),t.transform);let n=Math.atan2(i[1],i[0]);const a=r(this,lo)[t.fontName];a.vertical&&(n+=Math.PI/2);let o=r(this,pc)&&a.fontSubstitution||a.fontFamily;o=$t.fontFamilyMap.get(o)||o;const l=Math.hypot(i[2],i[3]),h=l*b(v=$t,fs,tm).call(v,o,a,r(this,kr));let d,u;n===0?(d=i[4],u=i[5]-h):(d=i[4]+h*Math.sin(n),u=i[5]-h*Math.cos(n));const f="calc(var(--total-scale-factor) *",g=e.style;r(this,We)===r(this,ao)?(g.left=`${(100*d/r(this,mc)).toFixed(2)}%`,g.top=`${(100*u/r(this,gc)).toFixed(2)}%`):(g.left=`${f}${d.toFixed(2)}px)`,g.top=`${f}${u.toFixed(2)}px)`),g.fontSize=`${f}${(r($t,Pn)*l).toFixed(2)}px)`,g.fontFamily=o,s.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,r(this,pc)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const w=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);w!==A&&Math.max(w,A)/Math.min(w,A)>1.5&&(y=!0)}if(y&&(s.canvasWidth=a.vertical?t.height:t.width),r(this,yc).set(e,s),r(this,Fi).div=e,r(this,Fi).properties=s,b(this,rn,Lu).call(this,r(this,Fi)),s.hasText&&r(this,We).append(e),s.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),r(this,We).append(w)}},Lu=function(t){var o;const{div:e,properties:s,ctx:i}=t,{style:n}=e;let a="";if(r($t,Pn)>1&&(a=`scale(${1/r($t,Pn)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:l}=n,{canvasWidth:h,fontSize:d}=s;b(o=$t,fs,Du).call(o,i,d*r(this,Rn),l);const{width:u}=i.measureText(e.textContent);u>0&&(a=`scaleX(${h*r(this,Rn)/u}) ${a}`)}s.angle!==0&&(a=`rotate(${s.angle}deg) ${a}`),a.length>0&&(n.transform=a)},fs=new WeakSet,Lh=function(t=null){let e=r(this,Lr).get(t||(t=""));if(!e){const s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(this,Lr).set(t,e),r(this,wc).set(e,{size:0,family:""})}return e},Du=function(t,e,s){const i=r(this,wc).get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)},Qg=function(){if(r(this,Pn)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),p(this,Pn,t.getBoundingClientRect().height),t.remove()},tm=function(t,e,s){const i=r(this,ho).get(t);if(i)return i;const n=b(this,fs,Lh).call(this,s);n.canvas.width=n.canvas.height=bp,b(this,fs,Du).call(this,n,bp,t);const a=n.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let h=.8;return o?h=o/(o+l):(ue.platform.isFirefox&&Z("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?h=e.ascent:e.descent&&(h=1+e.descent)),r(this,ho).set(t,h),h},m($t,fs),m($t,ho,new Map),m($t,Lr,new Map),m($t,wc,new WeakMap),m($t,Pn,null),m($t,uo,new Set),$t);class Pl{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(n){var l;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(Pl.shouldBuildText(o))(l=n==null?void 0:n.attributes)!=null&&l.textContent?a=n.attributes.textContent:n.value&&(a=n.value);else return;if(a!==null&&e.push({str:a}),!!n.children)for(const h of n.children)i(h)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const $y=100;function Pf(c={}){typeof c=="string"||c instanceof URL?c={url:c}:(c instanceof ArrayBuffer||ArrayBuffer.isView(c))&&(c={data:c});const t=new Nu,{docId:e}=t,s=c.url?J0(c.url):null,i=c.data?Z0(c.data):null,n=c.httpHeaders||null,a=c.withCredentials===!0,o=c.password??null,l=c.range instanceof kf?c.range:null,h=Number.isInteger(c.rangeChunkSize)&&c.rangeChunkSize>0?c.rangeChunkSize:2**16;let d=c.worker instanceof Uo?c.worker:null;const u=c.verbosity,f=typeof c.docBaseUrl=="string"&&!ch(c.docBaseUrl)?c.docBaseUrl:null,g=bh(c.cMapUrl),y=c.cMapPacked!==!1,v=c.CMapReaderFactory||(Be?ry:rp),w=bh(c.iccUrl),A=bh(c.standardFontDataUrl),x=c.StandardFontDataFactory||(Be?ay:ap),_=bh(c.wasmUrl),S=c.WasmFactory||(Be?oy:op),C=c.stopAtErrors!==!0,R=Number.isInteger(c.maxImageSize)&&c.maxImageSize>-1?c.maxImageSize:-1,T=c.isEvalSupported!==!1,k=typeof c.isOffscreenCanvasSupported=="boolean"?c.isOffscreenCanvasSupported:!Be,I=typeof c.isImageDecoderSupported=="boolean"?c.isImageDecoderSupported:!Be&&(ue.platform.isFirefox||!globalThis.chrome),D=Number.isInteger(c.canvasMaxAreaInBytes)?c.canvasMaxAreaInBytes:-1,N=typeof c.disableFontFace=="boolean"?c.disableFontFace:Be,Y=c.fontExtraProperties===!0,q=c.enableXfa===!0,H=c.ownerDocument||globalThis.document,st=c.disableRange===!0,F=c.disableStream===!0,O=c.disableAutoFetch===!0,yt=c.pdfBug===!0,Tt=c.CanvasFactory||(Be?ny:ey),zt=c.FilterFactory||(Be?iy:sy),mt=c.enableHWA===!0,_t=c.useWasm!==!1,ft=l?l.length:c.length??NaN,we=typeof c.useSystemFonts=="boolean"?c.useSystemFonts:!Be&&!N,Ae=typeof c.useWorkerFetch=="boolean"?c.useWorkerFetch:!!(v===rp&&x===ap&&S===op&&g&&A&&_&&nl(g,document.baseURI)&&nl(A,document.baseURI)&&nl(_,document.baseURI)),te=null;L0(u);const dt={canvasFactory:new Tt({ownerDocument:H,enableHWA:mt}),filterFactory:new zt({docId:e,ownerDocument:H}),cMapReaderFactory:Ae?null:new v({baseUrl:g,isCompressed:y}),standardFontDataFactory:Ae?null:new x({baseUrl:A}),wasmFactory:Ae?null:new S({baseUrl:_})};d||(d=Uo.create({verbosity:u,port:Ss.workerPort}),t._worker=d);const Pe={docId:e,apiVersion:"5.3.93",data:i,password:o,disableAutoFetch:O,rangeChunkSize:h,length:ft,docBaseUrl:f,enableXfa:q,evaluatorOptions:{maxImageSize:R,disableFontFace:N,ignoreErrors:C,isEvalSupported:T,isOffscreenCanvasSupported:k,isImageDecoderSupported:I,canvasMaxAreaInBytes:D,fontExtraProperties:Y,useSystemFonts:we,useWasm:_t,useWorkerFetch:Ae,cMapUrl:g,iccUrl:w,standardFontDataUrl:A,wasmUrl:_}},ke={ownerDocument:H,pdfBug:yt,styleElement:te,loadingParams:{disableAutoFetch:O,enableXfa:q}};return d.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const vt=d.messageHandler.sendWithPromise("GetDocRequest",Pe,i?[i.buffer]:null);let Ps;if(l)Ps=new Ey(l,{disableRange:st,disableStream:F});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");const ps=nl(s)?Ty:Be?Oy:My;Ps=new ps({url:s,length:ft,httpHeaders:n,withCredentials:a,rangeChunkSize:h,disableRange:st,disableStream:F})}return vt.then(ps=>{if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const ot=new cl(e,ps,d.port),Rt=new Vy(ot,t,Ps,ke,dt);t._transport=Rt,ot.send("Ready",null)})}).catch(t._capability.reject),t}var md;const bd=class bd{constructor(){L(this,"_capability",Promise.withResolvers());L(this,"_transport",null);L(this,"_worker",null);L(this,"docId",`d${Me(bd,md)._++}`);L(this,"destroyed",!1);L(this,"onPassword",null);L(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t,e,s,i;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(n){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,n}this._transport=null,(i=this._worker)==null||i.destroy(),this._worker=null}async getData(){return this._transport.getData()}};md=new WeakMap,m(bd,md,0);let Nu=bd;var Dr,Ac,xc,Ec,_c,kp;let kf=(kp=class{constructor(t,e,s=!1,i=null){m(this,Dr,Promise.withResolvers());m(this,Ac,[]);m(this,xc,[]);m(this,Ec,[]);m(this,_c,[]);this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i}addRangeListener(t){r(this,_c).push(t)}addProgressListener(t){r(this,Ec).push(t)}addProgressiveReadListener(t){r(this,xc).push(t)}addProgressiveDoneListener(t){r(this,Ac).push(t)}onDataRange(t,e){for(const s of r(this,_c))s(t,e)}onDataProgress(t,e){r(this,Dr).promise.then(()=>{for(const s of r(this,Ec))s(t,e)})}onDataProgressiveRead(t){r(this,Dr).promise.then(()=>{for(const e of r(this,xc))e(t)})}onDataProgressiveDone(){r(this,Dr).promise.then(()=>{for(const t of r(this,Ac))t()})}transportReady(){r(this,Dr).resolve()}requestDataRange(t,e){xt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},Dr=new WeakMap,Ac=new WeakMap,xc=new WeakMap,Ec=new WeakMap,_c=new WeakMap,kp);class zy{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return it(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Oi,Nr,pl;class Gy{constructor(t,e,s,i=!1){m(this,Nr);m(this,Oi,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new sp:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new Kg,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:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new lh({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return it(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:e,intent:s="display",annotationMode:i=gi.ENABLE,transform:n=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:u=!1}){var S,C;(S=this._stats)==null||S.time("Overall");const f=this._transport.getRenderingIntent(s,i,d,u),{renderingIntent:g,cacheKey:y}=f;p(this,Oi,!1),o||(o=this._transport.getOptionalContentConfig(g));let v=this._intentStates.get(y);v||(v=Object.create(null),this._intentStates.set(y,v)),v.streamReaderCancelTimeout&&(clearTimeout(v.streamReaderCancelTimeout),v.streamReaderCancelTimeout=null);const w=!!(g&hs.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(C=this._stats)==null||C.time("Page Request"),this._pumpOperatorList(f));const A=R=>{var T;v.renderTasks.delete(x),w&&p(this,Oi,!0),b(this,Nr,pl).call(this),R?(x.capability.reject(R),this._abortOperatorList({intentState:v,reason:R instanceof Error?R:new Error(R)})):x.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(T=globalThis.Stats)!=null&&T.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},x=new Fu({callback:A,params:{canvasContext:t,viewport:e,transform:n,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:h});(v.renderTasks||(v.renderTasks=new Set)).add(x);const _=x.task;return Promise.all([v.displayReadyCapability.promise,o]).then(([R,T])=>{var k;if(this.destroyed){A();return}if((k=this._stats)==null||k.time("Rendering"),!(T.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:R,optionalContentConfig:T}),x.operatorListChanged()}).catch(A),_}getOperatorList({intent:t="display",annotationMode:e=gi.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(t,e,s,i,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Pl.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){function n(){a.read().then(function({value:l,done:h}){if(h){s(o);return}o.lang??(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),n()},i)}const a=e.getReader(),o={items:[],styles:Object.create(null),lang:null};n()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),p(this,Oi,!1),Promise.all(t)}cleanup(t=!1){p(this,Oi,!0);const e=b(this,Nr,pl).call(this);return t&&e&&this._stats&&(this._stats=new sp),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&b(this,Nr,pl).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:a}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:i},a).getReader(),h=this._intentStates.get(e);h.streamReader=l;const d=()=>{l.read().then(({value:u,done:f})=>{if(f){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),d())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const f of h.renderTasks)f.operatorListChanged();b(this,Nr,pl).call(this)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};d()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof Rd){let i=$y;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new sn(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}Oi=new WeakMap,Nr=new WeakSet,pl=function(){if(!r(this,Oi)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),p(this,Oi,!1),!0};var kn,Os,Bi,Fr,yd,Or,Br,He,Dh,em,sm,gl,fo,Nh;const Dt=class Dt{constructor({name:t=null,port:e=null,verbosity:s=D0()}={}){m(this,He);m(this,kn,Promise.withResolvers());m(this,Os,null);m(this,Bi,null);m(this,Fr,null);if(this.name=t,this.destroyed=!1,this.verbosity=s,e){if(r(Dt,Br).has(e))throw new Error("Cannot use more than one PDFWorker per port.");r(Dt,Br).set(e,this),b(this,He,em).call(this,e)}else b(this,He,sm).call(this)}get promise(){return r(this,kn).promise}get port(){return r(this,Bi)}get messageHandler(){return r(this,Os)}destroy(){var t,e;this.destroyed=!0,(t=r(this,Fr))==null||t.terminate(),p(this,Fr,null),r(Dt,Br).delete(r(this,Bi)),p(this,Bi,null),(e=r(this,Os))==null||e.destroy(),p(this,Os,null)}static create(t){const e=r(this,Br).get(t==null?void 0:t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Dt(t)}static get workerSrc(){if(Ss.workerSrc)return Ss.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return it(this,"_setupFakeWorkerGlobal",(async()=>r(this,fo,Nh)?r(this,fo,Nh):(await import(this.workerSrc)).WorkerMessageHandler)())}};kn=new WeakMap,Os=new WeakMap,Bi=new WeakMap,Fr=new WeakMap,yd=new WeakMap,Or=new WeakMap,Br=new WeakMap,He=new WeakSet,Dh=function(){r(this,kn).resolve(),r(this,Os).send("configure",{verbosity:this.verbosity})},em=function(t){p(this,Bi,t),p(this,Os,new cl("main","worker",t)),r(this,Os).on("ready",()=>{}),b(this,He,Dh).call(this)},sm=function(){if(r(Dt,Or)||r(Dt,fo,Nh)){b(this,He,gl).call(this);return}let{workerSrc:t}=Dt;try{Dt._isSameOrigin(window.location,t)||(t=Dt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new cl("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?r(this,kn).reject(new Error("Worker was destroyed")):b(this,He,gl).call(this)},n=new AbortController;e.addEventListener("error",()=>{r(this,Fr)||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}p(this,Os,s),p(this,Bi,e),p(this,Fr,e),b(this,He,Dh).call(this)}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{a()}catch{b(this,He,gl).call(this)}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{Td("The worker has been disabled.")}b(this,He,gl).call(this)},gl=function(){r(Dt,Or)||(Z("Setting up fake worker."),p(Dt,Or,!0)),Dt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){r(this,kn).reject(new Error("Worker was destroyed"));return}const e=new ty;p(this,Bi,e);const s=`fake${Me(Dt,yd)._++}`,i=new cl(s+"_worker",s,e);t.setup(i,e),p(this,Os,new cl(s,s+"_worker",e)),b(this,He,Dh).call(this)}).catch(t=>{r(this,kn).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},fo=new WeakSet,Nh=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},m(Dt,fo),m(Dt,yd,0),m(Dt,Or,!1),m(Dt,Br,new WeakMap),Be&&(p(Dt,Or,!0),Ss.workerSrc||(Ss.workerSrc="./pdf.worker.mjs")),Dt._isSameOrigin=(t,e)=>{const s=URL.parse(t);if(!(s!=null&&s.origin)||s.origin==="null")return!1;const i=new URL(e,s);return s.origin===i.origin},Dt._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Dt.fromPort=t=>{if(G0("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return Dt.create(t)};let Uo=Dt;var ji,oi,po,go,Hi,jr,ml;class Vy{constructor(t,e,s,i,n){m(this,jr);m(this,ji,new Map);m(this,oi,new Map);m(this,po,new Map);m(this,go,new Map);m(this,Hi,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Kg,this.fontLoader=new Y0({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.wasmFactory=n.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return it(this,"annotationStorage",new Cf)}getRenderingIntent(t,e=gi.ENABLE,s=null,i=!1,n=!1){let a=hs.DISPLAY,o=xu;switch(t){case"any":a=hs.ANY;break;case"display":break;case"print":a=hs.PRINT;break;default:Z(`getRenderingIntent - invalid intent: ${t}`)}const l=a&hs.PRINT&&s instanceof Lg?s:this.annotationStorage;switch(e){case gi.DISABLE:a+=hs.ANNOTATIONS_DISABLE;break;case gi.ENABLE:break;case gi.ENABLE_FORMS:a+=hs.ANNOTATIONS_FORMS;break;case gi.ENABLE_STORAGE:a+=hs.ANNOTATIONS_STORAGE,o=l.serializable;break;default:Z(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=hs.IS_EDITING),n&&(a+=hs.OPLIST);const{ids:h,hash:d}=l.modifiedIds,u=[a,o.hash,d];return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=r(this,Hi))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of r(this,oi).values())t.push(i._destroy());r(this,oi).clear(),r(this,po).clear(),r(this,go).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i,n;this.commonObjs.clear(),this.fontLoader.clear(),r(this,ji).clear(),this.filterFactory.destroy(),Rl.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new sn("Worker was terminated.")),(n=this.messageHandler)==null||n.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{Zt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},i.onPull=()=>{this._fullReader.read().then(function({value:n,done:a}){if(a){i.close();return}Zt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{this._fullReader.cancel(n),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async s=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:a}=this._fullReader;return(!i||!n)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),this._fullReader.onProgress=l=>{var h;(h=e.onProgress)==null||h.call(e,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:i,isRangeSupported:n,contentLength:a}}),t.on("GetRangeReader",(s,i)=>{Zt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){i.close();return}Zt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{n.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new zy(s,this))}),t.on("DocException",s=>{e._capability.reject(Ge(s))}),t.on("PasswordRequest",s=>{p(this,Hi,Promise.withResolvers());try{if(!e.onPassword)throw Ge(s);const i=n=>{n instanceof Error?r(this,Hi).reject(n):r(this,Hi).resolve({password:n})};e.onPassword(i,s.code)}catch(i){r(this,Hi).reject(i)}return r(this,Hi).promise}),t.on("DataLoaded",s=>{var i;(i=e.onProgress)==null||i.call(e,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{if(this.destroyed)return;r(this,oi).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":if("error"in n){const d=n.error;Z(`Error during font loading: ${d}`),this.commonObjs.resolve(s,d);break}const o=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(d,u)=>globalThis.FontInspector.fontAdded(d,u):null,l=new K0(n,o);this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!l.fontExtraProperties&&l.data&&(l.data=null),this.commonObjs.resolve(s,l)});break;case"CopyLocalImage":const{imageRef:h}=n;Zt(h,"The imageRef must be defined.");for(const d of r(this,oi).values())for(const[,u]of d.objs)if((u==null?void 0:u.ref)===h)return u.dataLen?(this.commonObjs.resolve(s,structuredClone(u)),u.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,n,a])=>{var l;if(this.destroyed)return;const o=r(this,oi).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(n){case"Image":case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${n}`)}}}),t.on("DocProgress",s=>{var i;this.destroyed||(i=e.onProgress)==null||i.call(e,{loaded:s.loaded,total:s.total})}),t.on("FetchBinaryData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");const i=this[s.type];if(!i)throw new Error(`${s.type} not initialized, see the \`useWorkerFetch\` parameter.`);return i.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&Z("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((s=this._fullReader)==null?void 0:s.filename)??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=r(this,po).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&r(this,go).set(n.refStr,t);const a=new Gy(e,n,this,this._params.pdfBug);return r(this,oi).set(e,a),a});return r(this,po).set(e,i),i}getPageIndex(t){return Eu(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return b(this,jr,ml).call(this,"GetFieldObjects")}hasJSActions(){return b(this,jr,ml).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return b(this,jr,ml).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return b(this,jr,ml).call(this,"GetOptionalContentConfig").then(e=>new xy(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=r(this,ji).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var n,a;return{info:i[0],metadata:i[1]?new wy(i[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return r(this,ji).set(t,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of r(this,oi).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),r(this,ji).clear(),this.filterFactory.destroy(!0),Rl.cleanup()}}cachedPageNumber(t){if(!Eu(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return r(this,go).get(e)??null}}ji=new WeakMap,oi=new WeakMap,po=new WeakMap,go=new WeakMap,Hi=new WeakMap,jr=new WeakSet,ml=function(t,e=null){const s=r(this,ji).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return r(this,ji).set(t,i),i};var In;class Uy{constructor(t){m(this,In,null);L(this,"onContinue",null);L(this,"onError",null);p(this,In,t)}get promise(){return r(this,In).capability.promise}cancel(t=0){r(this,In).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=r(this,In).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=r(this,In);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}In=new WeakMap;var Mn,Hr;const ar=class ar{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:f=null}){m(this,Mn,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Uy(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=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var o,l;if(this.cancelled)return;if(this._canvas){if(r(ar,Hr).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");r(ar,Hr).add(this._canvas)}this._pdfBug&&((o=globalThis.StepperManager)!=null&&o.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:i,transform:n,background:a}=this.params;this.gfx=new Na(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(l=this.graphicsReadyCallback)==null||l.call(this)}cancel(t=null,e=0){var s,i,n;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),r(this,Mn)&&(window.cancelAnimationFrame(r(this,Mn)),p(this,Mn,null)),r(ar,Hr).delete(this._canvas),t||(t=new Rd(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),(n=(i=this.task).onError)==null||n.call(i,t)}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.stepper)==null||t.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?p(this,Mn,window.requestAnimationFrame(()=>{p(this,Mn,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r(ar,Hr).delete(this._canvas),this.callback())))}};Mn=new WeakMap,Hr=new WeakMap,m(ar,Hr,new WeakSet);let Fu=ar;const If="5.3.93",im="cbeef3233";function yp(c){return Math.floor(Math.max(0,Math.min(1,c))*255).toString(16).padStart(2,"0")}function sl(c){return Math.max(0,Math.min(255,255*c))}class vp{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=sl(t),[t,t,t]}static G_HTML([t]){const e=yp(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(sl)}static RGB_HTML(t){return`#${t.map(yp).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[sl(1-Math.min(1,t+i)),sl(1-Math.min(1,s+i)),sl(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,n=1-e,a=1-s,o=Math.min(i,n,a);return["CMYK",i,n,a,o]}}class Wy{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){xt("Abstract method `_createSVG` called.")}}class kl extends Wy{_createSVG(t){return document.createElementNS(vi,t)}}class Mf{static setupStorage(t,e,s,i,n){const a=i.getValue(e,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?t.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[l,h]of Object.entries(a))if(h!=null)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}o&&n.addLinkAttributes(t,a.href,a.newWindow),s&&a.dataId&&this.setupStorage(t,a.dataId,e,s)}static render(t){var u,f;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:n,linkService:s});const o=n!=="richText",l=t.div;if(l.append(a),t.viewport){const g=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=g}o&&l.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const g=document.createTextNode(i.value);a.append(g),o&&Pl.shouldBuildText(i.name)&&h.push(g)}return{textDivs:h}}const d=[[i,-1,a]];for(;d.length>0;){const[g,y,v]=d.at(-1);if(y+1===g.children.length){d.pop();continue}const w=g.children[++d.at(-1)[1]];if(w===null)continue;const{name:A}=w;if(A==="#text"){const _=document.createTextNode(w.value);h.push(_),v.append(_);continue}const x=(u=w==null?void 0:w.attributes)!=null&&u.xmlns?document.createElementNS(w.attributes.xmlns,A):document.createElement(A);if(v.append(x),w.attributes&&this.setAttributes({html:x,element:w,storage:e,intent:n,linkService:s}),((f=w.children)==null?void 0:f.length)>0)d.push([w,-1,x]);else if(w.value){const _=document.createTextNode(w.value);o&&Pl.shouldBuildText(A)&&h.push(_),x.append(_)}}for(const g of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const qy=9,ma=new WeakSet;class wp{static create(t){switch(t.data.annotationType){case Vt.LINK:return new nm(t);case Vt.TEXT:return new Xy(t);case Vt.WIDGET:switch(t.data.fieldType){case"Tx":return new Yy(t);case"Btn":return t.data.radioButton?new om(t):t.data.checkBox?new Jy(t):new Zy(t);case"Ch":return new Qy(t);case"Sig":return new Ky(t)}return new wa(t);case Vt.POPUP:return new Bu(t);case Vt.FREETEXT:return new um(t);case Vt.LINE:return new ev(t);case Vt.SQUARE:return new sv(t);case Vt.CIRCLE:return new iv(t);case Vt.POLYLINE:return new fm(t);case Vt.CARET:return new rv(t);case Vt.INK:return new Lf(t);case Vt.POLYGON:return new nv(t);case Vt.HIGHLIGHT:return new pm(t);case Vt.UNDERLINE:return new av(t);case Vt.SQUIGGLY:return new ov(t);case Vt.STRIKEOUT:return new lv(t);case Vt.STAMP:return new gm(t);case Vt.FILEATTACHMENT:return new cv(t);default:return new Xt(t)}}}var $r,mo,bo,Sc,Ou;const Hf=class Hf{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){m(this,Sc);m(this,$r,null);m(this,mo,!1);m(this,bo,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t!=null&&t.str||e!=null&&e.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Hf._hasPopupData(this.data)}updateEdited(t){var s;if(!this.container)return;r(this,$r)||p(this,$r,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&b(this,Sc,Ou).call(this,e),(s=r(this,bo))==null||s.popup.updateEdited(t)}resetEdited(){var t;r(this,$r)&&(b(this,Sc,Ou).call(this,r(this,$r).rect),(t=r(this,bo))==null||t.popup.resetEdited(),p(this,$r,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof wa||(n.tabIndex=0);const{style:a}=n;if(a.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Bu){const{rotation:v}=e;return!e.hasOwnCanvas&&v!==0&&this.setRotation(v,n),n}const{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const v=e.borderStyle.horizontalCornerRadius,w=e.borderStyle.verticalCornerRadius;if(v>0||w>0){const x=`calc(${v}px * var(--total-scale-factor)) / calc(${w}px * var(--total-scale-factor))`;a.borderRadius=x}else if(this instanceof om){const x=`calc(${o}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;a.borderRadius=x}switch(e.borderStyle.style){case Sa.SOLID:a.borderStyle="solid";break;case Sa.DASHED:a.borderStyle="dashed";break;case Sa.BEVELED:Z("Unimplemented border style: beveled");break;case Sa.INSET:Z("Unimplemented border style: inset");break;case Sa.UNDERLINE:a.borderBottomStyle="solid";break}const A=e.borderColor||null;A?(p(this,mo,!0),a.borderColor=W.makeHexColor(A[0]|0,A[1]|0,A[2]|0)):a.borderWidth=0}const h=W.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:d,pageHeight:u,pageX:f,pageY:g}=i.rawDims;a.left=`${100*(h[0]-f)/d}%`,a.top=`${100*(h[1]-g)/u}%`;const{rotation:y}=e;return e.hasOwnCanvas||y===0?(a.width=`${100*o/d}%`,a.height=`${100*l/u}%`):this.setRotation(y,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims;let{width:n,height:a}=this;t%180!==0&&([n,a]=[a,n]),e.style.width=`${100*n/s}%`,e.style.height=`${100*a/i}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const n=i.detail[e],a=n[0],o=n.slice(1);i.target.style[s]=vp[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:vp[`${a}_rgb`](o)})};return it(this,"_commonActions",{display:e=>{const{display:s}=e.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const n=t[i]||s[i];n==null||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,n]of Object.entries(e)){const a=s[i];if(a){const o={detail:{[i]:n},target:t};a(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,n]=this.data.rect.map(v=>Math.fround(v));if(t.length===8){const[v,w,A,x]=t.subarray(2,6);if(i===v&&n===w&&e===A&&s===x)return}const{style:a}=this.container;let o;if(r(this,mo)){const{borderColor:v,borderWidth:w}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${v}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const l=i-e,h=n-s,{svgFactory:d}=this,u=d.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const f=d.createElement("defs");u.append(f);const g=d.createElement("clipPath"),y=`clippath_${this.data.id}`;g.setAttribute("id",y),g.setAttribute("clipPathUnits","objectBoundingBox"),f.append(g);for(let v=2,w=t.length;v<w;v+=8){const A=t[v],x=t[v+1],_=t[v+2],S=t[v+3],C=d.createElement("rect"),R=(_-e)/l,T=(n-x)/h,k=(A-_)/l,I=(x-S)/h;C.setAttribute("x",R),C.setAttribute("y",T),C.setAttribute("width",k),C.setAttribute("height",I),g.append(C),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${R}" y="${T}" width="${k}" height="${I}"/>`)}r(this,mo)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{data:t}=this,e=p(this,bo,new Bu({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){xt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:n,id:a,exportValues:o}of i){if(n===-1||a===e)continue;const l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);if(h&&!ma.has(h)){Z(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:l,domElement:h})}return s}for(const i of document.getElementsByName(t)){const{exportValue:n}=i,a=i.getAttribute("data-element-id");a!==e&&ma.has(i)&&s.push({id:a,exportValue:n,domElement:i})}return s}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};$r=new WeakMap,mo=new WeakMap,bo=new WeakMap,Sc=new WeakSet,Ou=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}}}=this;s==null||s.splice(0,4,...t),e.left=`${100*(t[0]-o)/n}%`,e.top=`${100*(a-t[3]+l)/a}%`,i===0?(e.width=`${100*(t[2]-t[0])/n}%`,e.height=`${100*(t[3]-t[1])/a}%`):this.setRotation(i)};let Xt=Hf;var us,sr,rm,am;class nm extends Xt{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});m(this,us);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(b(this,us,rm).call(this,i,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(b(this,us,am).call(this,i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}_bindLink(e,s){e.href=this.linkService.getDestinationHash(s),e.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&b(this,us,sr).call(this)}_bindNamedAction(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),b(this,us,sr).call(this)}_bindJSAction(e,s){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(s.actions)){const a=i.get(n);a&&(e[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:n}}),!1})}e.onclick||(e.onclick=()=>!1),b(this,us,sr).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),b(this,us,sr).call(this),!this._fieldObjects){Z('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{var u;i==null||i();const{fields:n,refs:a,include:o}=s,l=[];if(n.length!==0||a.length!==0){const f=new Set(a);for(const g of n){const y=this._fieldObjects[g]||[];for(const{id:v}of y)f.add(v)}for(const g of Object.values(this._fieldObjects))for(const y of g)f.has(y.id)===o&&l.push(y)}else for(const f of Object.values(this._fieldObjects))l.push(...f);const h=this.annotationStorage,d=[];for(const f of l){const{id:g}=f;switch(d.push(g),f.type){case"text":{const v=f.defaultValue||"";h.setValue(g,{value:v});break}case"checkbox":case"radiobutton":{const v=f.defaultValue===f.exportValues;h.setValue(g,{value:v});break}case"combobox":case"listbox":{const v=f.defaultValue||"";h.setValue(g,{value:v});break}default:continue}const y=document.querySelector(`[data-element-id="${g}"]`);if(y){if(!ma.has(y)){Z(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;y.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}us=new WeakSet,sr=function(){this.container.setAttribute("data-internal-link","")},rm=function(e,s,i=null){e.href=this.linkService.getAnchorUrl(""),s.description&&(e.title=s.description),e.onclick=()=>{var n;return(n=this.downloadManager)==null||n.openOrDownloadData(s.content,s.filename,i),!1},b(this,us,sr).call(this)},am=function(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),b(this,us,sr).call(this)};class Xy extends Xt{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class wa extends Xt{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&(((e=t.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return ue.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(s,a=>{var o;if(s==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a)}}))})}_setEventListeners(t,e,s,i){var n,a,o;for(const[l,h]of s)(h==="Action"||(n=this.data.actions)!=null&&n[h])&&((h==="Focus"||h==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,l,h,i),h==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(t,e,"blur","Blur",null):h==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":W.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||qy,n=t.style;let a;const o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),d=Math.round(h/(qd*i))||1,u=h/d;a=Math.min(i,l(u/qd))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,l(h/qd))}n.fontSize=`calc(${a}px * var(--total-scale-factor))`,n.color=W.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Yy extends wa{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,i){const n=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=s),n.setValue(a.id,{[i]:s})}render(){var i,n;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let h=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
|
|
32
|
-
`))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const d={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type=this.data.password?"password":"text",s.setAttribute("value",h??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),ma.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=0;const u=this.data.dateFormat||this.data.timeFormat;u&&(s.title=u),this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",g=>{t.setValue(e,{value:g.target.value}),this.setPropertyOnSiblings(s,"value",g.target.value,"value"),d.formattedValue=null}),s.addEventListener("resetform",g=>{const y=this.data.defaultFieldValue??"";s.value=d.userValue=y,d.formattedValue=null});let f=g=>{const{formattedValue:y}=d;y!=null&&(g.target.value=y),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",y=>{var w;if(d.focused)return;const{target:v}=y;d.userValue&&(v.value=d.userValue),d.lastCommittedValue=v.value,d.commitKey=1,(w=this.data.actions)!=null&&w.Focus||(d.focused=!0)}),s.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);const v={value(w){d.userValue=w.detail.value??"",t.setValue(e,{value:d.userValue.toString()}),w.target.value=d.userValue},formattedValue(w){const{formattedValue:A}=w.detail;d.formattedValue=A,A!=null&&w.target!==document.activeElement&&(w.target.value=A),t.setValue(e,{formattedValue:A})},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{var S;const{charLimit:A}=w.detail,{target:x}=w;if(A===0){x.removeAttribute("maxLength");return}x.setAttribute("maxLength",A);let _=d.userValue;!_||_.length<=A||(_=_.slice(0,A),x.value=d.userValue=_,t.setValue(e,{value:_}),(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:1,selStart:x.selectionStart,selEnd:x.selectionEnd}}))}};this._dispatchEventFromSandbox(v,y)}),s.addEventListener("keydown",y=>{var A;d.commitKey=1;let v=-1;if(y.key==="Escape"?v=0:y.key==="Enter"&&!this.data.multiLine?v=2:y.key==="Tab"&&(d.commitKey=3),v===-1)return;const{value:w}=y.target;d.lastCommittedValue!==w&&(d.lastCommittedValue=w,d.userValue=w,(A=this.linkService.eventBus)==null||A.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,willCommit:!0,commitKey:v,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const g=f;f=null,s.addEventListener("blur",y=>{var w,A;if(!d.focused||!y.relatedTarget)return;(w=this.data.actions)!=null&&w.Blur||(d.focused=!1);const{value:v}=y.target;d.userValue=v,d.lastCommittedValue!==v&&((A=this.linkService.eventBus)==null||A.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,willCommit:!0,commitKey:d.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),g(y)}),(n=this.data.actions)!=null&&n.Keystroke&&s.addEventListener("beforeinput",y=>{var R;d.lastCommittedValue=null;const{data:v,target:w}=y,{value:A,selectionStart:x,selectionEnd:_}=w;let S=x,C=_;switch(y.inputType){case"deleteWordBackward":{const T=A.substring(0,x).match(/\w*[^\w]*$/);T&&(S-=T[0].length);break}case"deleteWordForward":{const T=A.substring(x).match(/^[^\w]*\w*/);T&&(C+=T[0].length);break}case"deleteContentBackward":x===_&&(S-=1);break;case"deleteContentForward":x===_&&(C+=1);break}y.preventDefault(),(R=this.linkService.eventBus)==null||R.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:A,change:v||"",willCommit:!1,selStart:S,selEnd:C}})}),this._setEventListeners(s,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(f&&s.addEventListener("blur",f),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Ky extends wa{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Jy extends wa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return ma.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s)){const d=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=d),t.setValue(h.id,{value:d})}t.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class om extends wa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(const a of this._getElementsByName(e.fieldName,s))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(ma.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s))t.setValue(h.id,{value:!1});t.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;n.addEventListener("updatefromsandbox",o=>{const l={value:h=>{const d=a===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const f=d&&u.id===s;u.domElement&&(u.domElement.checked=f),t.setValue(u.id,{value:f})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Zy extends nm{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),t}}class Qy extends wa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");ma.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",d=>{const u=this.data.defaultFieldValue;for(const f of i.options)f.selected=f.value===u});for(const d of this.data.options){const u=document.createElement("option");u.textContent=d.displayValue,u.value=d.exportValue,s.value.includes(d.exportValue)&&(u.setAttribute("selected",!0),n=!1),i.append(u)}let a=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),i.prepend(d),a=()=>{d.remove(),i.removeEventListener("input",a),a=null},i.addEventListener("input",a)}const o=d=>{const u=d?"value":"textContent",{options:f,multiple:g}=i;return g?Array.prototype.filter.call(f,y=>y.selected).map(y=>y[u]):f.selectedIndex===-1?null:f[f.selectedIndex][u]};let l=o(!1);const h=d=>{const u=d.target.options;return Array.prototype.map.call(u,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",d=>{const u={value(f){a==null||a();const g=f.detail.value,y=new Set(Array.isArray(g)?g:[g]);for(const v of i.options)v.selected=y.has(v.value);t.setValue(e,{value:o(!0)}),l=o(!1)},multipleSelection(f){i.multiple=!0},remove(f){const g=i.options,y=f.detail.remove;g[y].selected=!1,i.remove(y),g.length>0&&Array.prototype.findIndex.call(g,w=>w.selected)===-1&&(g[0].selected=!0),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},clear(f){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),l=o(!1)},insert(f){const{index:g,displayValue:y,exportValue:v}=f.detail.insert,w=i.children[g],A=document.createElement("option");A.textContent=y,A.value=v,w?w.before(A):i.append(A),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},items(f){const{items:g}=f.detail;for(;i.length!==0;)i.remove(0);for(const y of g){const{displayValue:v,exportValue:w}=y,A=document.createElement("option");A.textContent=v,A.value=w,i.append(A)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},indices(f){const g=new Set(f.detail.indices);for(const y of f.target.options)y.selected=g.has(y.index);t.setValue(e,{value:o(!0)}),l=o(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(u,d)}),i.addEventListener("input",d=>{var g;const u=o(!0),f=o(!1);t.setValue(e,{value:u}),d.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:f,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):i.addEventListener("input",function(d){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Bu extends Xt{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:Xt._hasPopupData(e)}),this.elements=s,this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const e=this.popup=new tv({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),s=[];for(const i of this.elements)i.popup=e,i.container.ariaHasPopup="dialog",s.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",s.map(i=>`${_f}${i}`).join(",")),this.container}}var yo,vd,wd,vo,wo,Ht,$i,zr,Cc,Tc,Ao,zi,Bs,Gi,Rc,Vi,Pc,Gr,Vr,Et,Fh,ju,lm,cm,hm,dm,Oh,Bh,Hu;class tv{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:a,richText:o,parent:l,rect:h,parentRect:d,open:u}){m(this,Et);m(this,yo,b(this,Et,hm).bind(this));m(this,vd,b(this,Et,Hu).bind(this));m(this,wd,b(this,Et,Bh).bind(this));m(this,vo,b(this,Et,Oh).bind(this));m(this,wo,null);m(this,Ht,null);m(this,$i,null);m(this,zr,null);m(this,Cc,null);m(this,Tc,null);m(this,Ao,null);m(this,zi,!1);m(this,Bs,null);m(this,Gi,null);m(this,Rc,null);m(this,Vi,null);m(this,Pc,null);m(this,Gr,null);m(this,Vr,!1);var f;p(this,Ht,t),p(this,Pc,i),p(this,$i,a),p(this,Vi,o),p(this,Tc,l),p(this,wo,e),p(this,Rc,h),p(this,Ao,d),p(this,Cc,s),p(this,zr,kd.toDateObject(n)),this.trigger=s.flatMap(g=>g.getElementsToTriggerPopup());for(const g of this.trigger)g.addEventListener("click",r(this,vo)),g.addEventListener("mouseenter",r(this,wd)),g.addEventListener("mouseleave",r(this,vd)),g.classList.add("popupTriggerArea");for(const g of s)(f=g.container)==null||f.addEventListener("keydown",r(this,yo));r(this,Ht).hidden=!0,u&&b(this,Et,Oh).call(this)}render(){if(r(this,Bs))return;const t=p(this,Bs,document.createElement("div"));if(t.className="popup",r(this,wo)){const n=t.style.outlineColor=W.makeHexColor(...r(this,wo));t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}const e=document.createElement("span");e.className="header";const s=document.createElement("h1");if(e.append(s),{dir:s.dir,str:s.textContent}=r(this,Pc),t.append(e),r(this,zr)){const n=document.createElement("time");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:r(this,zr).valueOf()})),n.dateTime=r(this,zr).toISOString(),e.append(n)}const i=r(this,Et,Fh);if(i)Mf.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(r(this,$i));t.append(n)}r(this,Ht).append(t)}_formatContents({str:t,dir:e}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let n=0,a=i.length;n<a;++n){const o=i[n];s.append(document.createTextNode(o)),n<a-1&&s.append(document.createElement("br"))}return s}updateEdited({rect:t,popupContent:e}){var s;r(this,Gr)||p(this,Gr,{contentsObj:r(this,$i),richText:r(this,Vi)}),t&&p(this,Gi,null),e&&(p(this,Vi,b(this,Et,cm).call(this,e)),p(this,$i,null)),(s=r(this,Bs))==null||s.remove(),p(this,Bs,null)}resetEdited(){var t;r(this,Gr)&&({contentsObj:Me(this,$i)._,richText:Me(this,Vi)._}=r(this,Gr),p(this,Gr,null),(t=r(this,Bs))==null||t.remove(),p(this,Bs,null),p(this,Gi,null))}forceHide(){p(this,Vr,this.isVisible),r(this,Vr)&&(r(this,Ht).hidden=!0)}maybeShow(){r(this,Vr)&&(r(this,Bs)||b(this,Et,Bh).call(this),p(this,Vr,!1),r(this,Ht).hidden=!1)}get isVisible(){return r(this,Ht).hidden===!1}}yo=new WeakMap,vd=new WeakMap,wd=new WeakMap,vo=new WeakMap,wo=new WeakMap,Ht=new WeakMap,$i=new WeakMap,zr=new WeakMap,Cc=new WeakMap,Tc=new WeakMap,Ao=new WeakMap,zi=new WeakMap,Bs=new WeakMap,Gi=new WeakMap,Rc=new WeakMap,Vi=new WeakMap,Pc=new WeakMap,Gr=new WeakMap,Vr=new WeakMap,Et=new WeakSet,Fh=function(){const t=r(this,Vi),e=r(this,$i);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&r(this,Vi).html||null},ju=function(){var t,e,s;return((s=(e=(t=r(this,Et,Fh))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},lm=function(){var t,e,s;return((s=(e=(t=r(this,Et,Fh))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},cm=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:r(this,Et,lm),fontSize:r(this,Et,ju)?`calc(${r(this,Et,ju)}px * var(--total-scale-factor))`:""}};for(const n of t.split(`
|
|
33
|
-
`))e.push({name:"span",value:n,attributes:i});return s},hm=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&r(this,zi))&&b(this,Et,Oh).call(this)},dm=function(){if(r(this,Gi)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=r(this,Tc);let a=!!r(this,Ao),o=a?r(this,Ao):r(this,Rc);for(const y of r(this,Cc))if(!o||W.intersect(y.data.rect,o)!==null){o=y.data.rect,a=!0;break}const l=W.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),d=a?o[2]-o[0]+5:0,u=l[0]+d,f=l[1];p(this,Gi,[100*(u-i)/e,100*(f-n)/s]);const{style:g}=r(this,Ht);g.left=`${r(this,Gi)[0]}%`,g.top=`${r(this,Gi)[1]}%`},Oh=function(){p(this,zi,!r(this,zi)),r(this,zi)?(b(this,Et,Bh).call(this),r(this,Ht).addEventListener("click",r(this,vo)),r(this,Ht).addEventListener("keydown",r(this,yo))):(b(this,Et,Hu).call(this),r(this,Ht).removeEventListener("click",r(this,vo)),r(this,Ht).removeEventListener("keydown",r(this,yo)))},Bh=function(){r(this,Bs)||this.render(),this.isVisible?r(this,zi)&&r(this,Ht).classList.add("focused"):(b(this,Et,dm).call(this),r(this,Ht).hidden=!1,r(this,Ht).style.zIndex=parseInt(r(this,Ht).style.zIndex)+1e3)},Hu=function(){r(this,Ht).classList.remove("focused"),!(r(this,zi)||!this.isVisible)&&(r(this,Ht).hidden=!0,r(this,Ht).style.zIndex=parseInt(r(this,Ht).style.zIndex)-1e3)};class um extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=J.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var kc;class ev extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,kc,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=p(this,kc,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,kc)}addHighlightArea(){this.container.classList.add("highlightArea")}}kc=new WeakMap;var Ic;class sv extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Ic,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,Ic,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Ic)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ic=new WeakMap;var Mc;class iv extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Mc,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,Mc,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-a/2),o.setAttribute("ry",i/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Mc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Mc=new WeakMap;var Lc;class fm extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Lc,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:s,borderStyle:i,popupRef:n},width:a,height:o}=this;if(!s)return this.container;const l=this.svgFactory.create(a,o,!0);let h=[];for(let u=0,f=s.length;u<f;u+=2){const g=s[u]-e[0],y=e[3]-s[u+1];h.push(`${g},${y}`)}h=h.join(" ");const d=p(this,Lc,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",h),d.setAttribute("stroke-width",i.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),l.append(d),this.container.append(l),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Lc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Lc=new WeakMap;class nv extends fm{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class rv extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Dc,Ur,Nc,$u;class Lf extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Nc);m(this,Dc,null);m(this,Ur,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?J.HIGHLIGHT:J.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:s,inkLists:i,borderStyle:n,popupRef:a}}=this,{transform:o,width:l,height:h}=b(this,Nc,$u).call(this,s,e),d=this.svgFactory.create(l,h,!0),u=p(this,Dc,this.svgFactory.createElement("svg:g"));d.append(u),u.setAttribute("stroke-width",n.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",o);for(let f=0,g=i.length;f<g;f++){const y=this.svgFactory.createElement(this.svgElementName);r(this,Ur).push(y),y.setAttribute("points",i[f].join(",")),u.append(y)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(d),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:s,points:i,rect:n}=e,a=r(this,Dc);if(s>=0&&a.setAttribute("stroke-width",s||1),i)for(let o=0,l=r(this,Ur).length;o<l;o++)r(this,Ur)[o].setAttribute("points",i[o].join(","));if(n){const{transform:o,width:l,height:h}=b(this,Nc,$u).call(this,this.data.rotation,n);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${h}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return r(this,Ur)}addHighlightArea(){this.container.classList.add("highlightArea")}}Dc=new WeakMap,Ur=new WeakMap,Nc=new WeakSet,$u=function(e,s){switch(e){case 90:return{transform:`rotate(90) translate(${-s[0]},${s[1]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};case 180:return{transform:`rotate(180) translate(${-s[2]},${s[1]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]};case 270:return{transform:`rotate(270) translate(${-s[2]},${s[3]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};default:return{transform:`translate(${-s[0]},${s[3]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]}}};class pm extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=J.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const s=document.createElement("mark");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class av extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),t){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class ov extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),t){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class lv extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),t){const s=document.createElement("s");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class gm extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=J.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Fc,Oc,zu;class cv extends Xt{constructor(e){var i;super(e,{isRenderable:!0});m(this,Oc);m(this,Fc,null);const{file:s}=this.data;this.filename=s.filename,this.content=s.content,(i=this.linkService.eventBus)==null||i.dispatch("fileattachmentannotation",{source:this,...s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",b(this,Oc,zu).bind(this)),p(this,Fc,i);const{isMac:n}=ue.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&b(this,Oc,zu).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return r(this,Fc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Fc=new WeakMap,Oc=new WeakSet,zu=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var Bc,Wr,Ln,jc,Zn,Gu,Vu,xo;let Df=(xo=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:a,structTreeLayer:o}){m(this,Zn);m(this,Bc,null);m(this,Wr,null);m(this,Ln,new Map);m(this,jc,null);this.div=t,p(this,Bc,e),p(this,Wr,s),p(this,jc,o||null),this.page=n,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return r(this,Ln).size>0}async render(t){var a;const{annotations:e}=t,s=this.div;Xn(s,this.viewport);const i=new Map,n={data:null,layer:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new kl,annotationStorage:t.annotationStorage||new Cf,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const l=o.annotationType===Vt.POPUP;if(l){const u=i.get(o.id);if(!u)continue;n.elements=u}else if(o.rect[2]===o.rect[0]||o.rect[3]===o.rect[1])continue;n.data=o;const h=wp.create(n);if(!h.isRenderable)continue;if(!l&&o.popupRef){const u=i.get(o.popupRef);u?u.push(h):i.set(o.popupRef,[h])}const d=h.render();o.hidden&&(d.style.visibility="hidden"),await b(this,Zn,Gu).call(this,d,o.id,n.elements),h._isEditable&&(r(this,Ln).set(h.data.id,h),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(h))}b(this,Zn,Vu).call(this)}async addLinkAnnotations(t,e){const s={data:null,layer:this.div,linkService:e,svgFactory:new kl,parent:this};for(const i of t){i.borderStyle||(i.borderStyle=xo._defaultBorderStyle),s.data=i;const n=wp.create(s);if(!n.isRenderable)continue;const a=n.render();await b(this,Zn,Gu).call(this,a,i.id,null)}}update({viewport:t}){const e=this.div;this.viewport=t,Xn(e,{rotation:t.rotation}),b(this,Zn,Vu).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(r(this,Ln).values())}getEditableAnnotation(t){return r(this,Ln).get(t)}static get _defaultBorderStyle(){return it(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Sa.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Bc=new WeakMap,Wr=new WeakMap,Ln=new WeakMap,jc=new WeakMap,Zn=new WeakSet,Gu=async function(t,e,s){var o,l;const i=t.firstChild||t,n=i.id=`${_f}${e}`,a=await((o=r(this,jc))==null?void 0:o.getAriaAttributes(n));if(a)for(const[h,d]of a)i.setAttribute(h,d);s?s.at(-1).container.after(t):(this.div.append(t),(l=r(this,Bc))==null||l.moveElementInDOM(this.div,t,i,!1))},Vu=function(){var e;if(!r(this,Wr))return;const t=this.div;for(const[s,i]of r(this,Wr)){const n=t.querySelector(`[data-annotation-id="${s}"]`);if(!n)continue;i.className="annotationContent";const{firstChild:a}=n;a?a.nodeName==="CANVAS"?a.replaceWith(i):a.classList.contains("annotationContent")?a.after(i):a.before(i):n.append(i);const o=r(this,Ln).get(s);o&&(o._hasNoCanvas?((e=this._annotationEditorUIManager)==null||e.setMissingCanvas(s,n.id,i),o._hasNoCanvas=!1):o.canvas=i)}r(this,Wr).clear()},xo);const Ah=/\r\n?|\n/g;var js,ts,Hc,qr,es,Qt,mm,bm,ym,jh,en,Hh,$h,vm,Wu,wm;const Pt=class Pt extends kt{constructor(e){super({...e,name:"freeTextEditor"});m(this,Qt);m(this,js);m(this,ts,"");m(this,Hc,`${this.id}-editor`);m(this,qr,null);m(this,es);p(this,js,e.color||Pt._defaultColor||kt._defaultLineColor),p(this,es,e.fontSize||Pt._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const e=Pt.prototype,s=a=>a.isEmpty(),i=Yn.TRANSLATE_SMALL,n=Yn.TRANSLATE_BIG;return it(this,"_keyboardManager",new hh([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:s}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(e,s){kt.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case rt.FREETEXT_SIZE:Pt._defaultFontSize=s;break;case rt.FREETEXT_COLOR:Pt._defaultColor=s;break}}updateParams(e,s){switch(e){case rt.FREETEXT_SIZE:b(this,Qt,mm).call(this,s);break;case rt.FREETEXT_COLOR:b(this,Qt,bm).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[rt.FREETEXT_SIZE,Pt._defaultFontSize],[rt.FREETEXT_COLOR,Pt._defaultColor||kt._defaultLineColor]]}get propertiesToUpdate(){return[[rt.FREETEXT_SIZE,r(this,es)],[rt.FREETEXT_COLOR,r(this,js)]]}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-Pt._internalPadding*e,-(Pt._internalPadding+r(this,es))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),p(this,qr,new AbortController);const e=this._uiManager.combinedSignal(r(this,qr));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){var e;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,Hc)),this._isDraggable=!0,(e=r(this,qr))==null||e.abort(),p(this,qr,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){var s;this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),(s=this._initialOptions)!=null&&s.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 e=r(this,ts),s=p(this,ts,b(this,Qt,ym).call(this).trimEnd());if(e===s)return;const i=n=>{if(p(this,ts,n),!n){this.remove();return}b(this,Qt,$h).call(this),this._uiManager.rebuild(this),b(this,Qt,jh).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),b(this,Qt,jh).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Pt._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){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)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,s;(this._isCopy||this.annotationElementId)&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,Hc)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${r(this,es)}px * var(--total-scale-factor))`,i.color=r(this,js),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[d,u]=this.pageDimensions,[f,g]=this.pageTranslation;let y,v;switch(this.rotation){case 0:y=e+(o[0]-f)/d,v=s+this.height-(o[1]-g)/u;break;case 90:y=e+(o[0]-f)/d,v=s-(o[1]-g)/u,[l,h]=[h,-l];break;case 180:y=e-this.width+(o[0]-f)/d,v=s-(o[1]-g)/u,[l,h]=[-l,-h];break;case 270:y=e+(o[0]-f-this.height*u)/d,v=s+(o[1]-g-this.width*d)/u,[l,h]=[-h,l];break}this.setAt(y*n,v*a,l,h)}else this._moveAfterPaste(e,s);b(this,Qt,$h).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var y,v,w;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const n=b(y=Pt,en,Wu).call(y,s.getData("text")||"").replaceAll(Ah,`
|
|
34
|
-
`);if(!
|
|
35
|
-
`)){o.insertNode(document.createTextNode(
|
|
36
|
-
`)}${
|
|
37
|
-
`)}`),
|
|
38
|
-
`),position:
|
|
39
|
-
`)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),
|
|
40
|
-
`)},
|
|
41
|
-
`)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},vm=function(){return r(this,ts).replaceAll(" "," ")},Wu=function(e){return e.replaceAll(" "," ")},wm=function(e){const{value:s,fontSize:i,color:n,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,l)=>o!==n[l])||e.pageIndex!==a},m(Pt,en),L(Pt,"_freeTextDefaultContent",""),L(Pt,"_internalPadding",0),L(Pt,"_defaultColor",null),L(Pt,"_defaultFontSize",10),L(Pt,"_type","freetext"),L(Pt,"_editorType",J.FREETEXT);let Uu=Pt;class G{toSVGPath(){xt("Abstract method `toSVGPath` must be implemented.")}get box(){xt("Abstract getter `box` must be implemented.")}serialize(t,e){xt("Abstract method `serialize` must be implemented.")}static _rescale(t,e,s,i,n,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o]*i,a[o+1]=s+t[o+1]*n;return a}static _rescaleAndSwap(t,e,s,i,n,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o+1]*i,a[o+1]=s+t[o]*n;return a}static _translate(t,e,s,i){i||(i=new Float32Array(t.length));for(let n=0,a=t.length;n<a;n+=2)i[n]=e+t[n],i[n+1]=s+t[n+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,s,i,n){switch(n){case 90:return[1-e/s,t/i];case 180:return[1-t/s,1-e/i];case 270:return[e/s,1-t/i];default:return[t/s,e/i]}}static _normalizePagePoint(t,e,s){switch(s){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,s,i,n,a){return[(t+5*s)/6,(e+5*i)/6,(5*s+n)/6,(5*i+a)/6,(s+n)/2,(i+a)/2]}}L(G,"PRECISION",1e-4);var ss,Hs,Eo,_o,li,et,Xr,Yr,$c,zc,So,Co,Dn,Gc,Ad,xd,ne,bl,Am,xm,Em,_m,Sm,Cm;const Ei=class Ei{constructor({x:t,y:e},s,i,n,a,o=0){m(this,ne);m(this,ss);m(this,Hs,[]);m(this,Eo);m(this,_o);m(this,li,[]);m(this,et,new Float32Array(18));m(this,Xr);m(this,Yr);m(this,$c);m(this,zc);m(this,So);m(this,Co);m(this,Dn,[]);p(this,ss,s),p(this,Co,n*i),p(this,_o,a),r(this,et).set([NaN,NaN,NaN,NaN,t,e],6),p(this,Eo,o),p(this,zc,r(Ei,Gc)*i),p(this,$c,r(Ei,xd)*i),p(this,So,i),r(this,Dn).push(t,e)}isEmpty(){return isNaN(r(this,et)[8])}add({x:t,y:e}){var I;p(this,Xr,t),p(this,Yr,e);const[s,i,n,a]=r(this,ss);let[o,l,h,d]=r(this,et).subarray(8,12);const u=t-h,f=e-d,g=Math.hypot(u,f);if(g<r(this,$c))return!1;const y=g-r(this,zc),v=y/g,w=v*u,A=v*f;let x=o,_=l;o=h,l=d,h+=w,d+=A,(I=r(this,Dn))==null||I.push(t,e);const S=-A/y,C=w/y,R=S*r(this,Co),T=C*r(this,Co);return r(this,et).set(r(this,et).subarray(2,8),0),r(this,et).set([h+R,d+T],4),r(this,et).set(r(this,et).subarray(14,18),12),r(this,et).set([h-R,d-T],16),isNaN(r(this,et)[6])?(r(this,li).length===0&&(r(this,et).set([o+R,l+T],2),r(this,li).push(NaN,NaN,NaN,NaN,(o+R-s)/n,(l+T-i)/a),r(this,et).set([o-R,l-T],14),r(this,Hs).push(NaN,NaN,NaN,NaN,(o-R-s)/n,(l-T-i)/a)),r(this,et).set([x,_,o,l,h,d],6),!this.isEmpty()):(r(this,et).set([x,_,o,l,h,d],6),Math.abs(Math.atan2(_-l,x-o)-Math.atan2(A,w))<Math.PI/2?([o,l,h,d]=r(this,et).subarray(2,6),r(this,li).push(NaN,NaN,NaN,NaN,((o+h)/2-s)/n,((l+d)/2-i)/a),[o,l,x,_]=r(this,et).subarray(14,18),r(this,Hs).push(NaN,NaN,NaN,NaN,((x+o)/2-s)/n,((_+l)/2-i)/a),!0):([x,_,o,l,h,d]=r(this,et).subarray(0,6),r(this,li).push(((x+5*o)/6-s)/n,((_+5*l)/6-i)/a,((5*o+h)/6-s)/n,((5*l+d)/6-i)/a,((o+h)/2-s)/n,((l+d)/2-i)/a),[h,d,o,l,x,_]=r(this,et).subarray(12,18),r(this,Hs).push(((x+5*o)/6-s)/n,((_+5*l)/6-i)/a,((5*o+h)/6-s)/n,((5*l+d)/6-i)/a,((o+h)/2-s)/n,((l+d)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=r(this,li),e=r(this,Hs);if(isNaN(r(this,et)[6])&&!this.isEmpty())return b(this,ne,Am).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);b(this,ne,Em).call(this,s);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return b(this,ne,xm).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,n,a){return new Tm(t,e,s,i,n,a)}getOutlines(){var u;const t=r(this,li),e=r(this,Hs),s=r(this,et),[i,n,a,o]=r(this,ss),l=new Float32Array((((u=r(this,Dn))==null?void 0:u.length)??0)+2);for(let f=0,g=l.length-2;f<g;f+=2)l[f]=(r(this,Dn)[f]-i)/a,l[f+1]=(r(this,Dn)[f+1]-n)/o;if(l[l.length-2]=(r(this,Xr)-i)/a,l[l.length-1]=(r(this,Yr)-n)/o,isNaN(s[6])&&!this.isEmpty())return b(this,ne,_m).call(this,l);const h=new Float32Array(r(this,li).length+24+r(this,Hs).length);let d=t.length;for(let f=0;f<d;f+=2){if(isNaN(t[f])){h[f]=h[f+1]=NaN;continue}h[f]=t[f],h[f+1]=t[f+1]}d=b(this,ne,Cm).call(this,h,d);for(let f=e.length-6;f>=6;f-=6)for(let g=0;g<6;g+=2){if(isNaN(e[f+g])){h[d]=h[d+1]=NaN,d+=2;continue}h[d]=e[f+g],h[d+1]=e[f+g+1],d+=2}return b(this,ne,Sm).call(this,h,d),this.newFreeDrawOutline(h,l,r(this,ss),r(this,So),r(this,Eo),r(this,_o))}};ss=new WeakMap,Hs=new WeakMap,Eo=new WeakMap,_o=new WeakMap,li=new WeakMap,et=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,$c=new WeakMap,zc=new WeakMap,So=new WeakMap,Co=new WeakMap,Dn=new WeakMap,Gc=new WeakMap,Ad=new WeakMap,xd=new WeakMap,ne=new WeakSet,bl=function(){const t=r(this,et).subarray(4,6),e=r(this,et).subarray(16,18),[s,i,n,a]=r(this,ss);return[(r(this,Xr)+(t[0]-e[0])/2-s)/n,(r(this,Yr)+(t[1]-e[1])/2-i)/a,(r(this,Xr)+(e[0]-t[0])/2-s)/n,(r(this,Yr)+(e[1]-t[1])/2-i)/a]},Am=function(){const[t,e,s,i]=r(this,ss),[n,a,o,l]=b(this,ne,bl).call(this);return`M${(r(this,et)[2]-t)/s} ${(r(this,et)[3]-e)/i} L${(r(this,et)[4]-t)/s} ${(r(this,et)[5]-e)/i} L${n} ${a} L${o} ${l} L${(r(this,et)[16]-t)/s} ${(r(this,et)[17]-e)/i} L${(r(this,et)[14]-t)/s} ${(r(this,et)[15]-e)/i} Z`},xm=function(t){const e=r(this,Hs);t.push(`L${e[4]} ${e[5]} Z`)},Em=function(t){const[e,s,i,n]=r(this,ss),a=r(this,et).subarray(4,6),o=r(this,et).subarray(16,18),[l,h,d,u]=b(this,ne,bl).call(this);t.push(`L${(a[0]-e)/i} ${(a[1]-s)/n} L${l} ${h} L${d} ${u} L${(o[0]-e)/i} ${(o[1]-s)/n}`)},_m=function(t){const e=r(this,et),[s,i,n,a]=r(this,ss),[o,l,h,d]=b(this,ne,bl).call(this),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/a,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/a,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/a],0),this.newFreeDrawOutline(u,t,r(this,ss),r(this,So),r(this,Eo),r(this,_o))},Sm=function(t,e){const s=r(this,Hs);return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+=6},Cm=function(t,e){const s=r(this,et).subarray(4,6),i=r(this,et).subarray(16,18),[n,a,o,l]=r(this,ss),[h,d,u,f]=b(this,ne,bl).call(this);return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-a)/l,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,u,f,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-a)/l],e),e+=24},m(Ei,Gc,8),m(Ei,Ad,2),m(Ei,xd,r(Ei,Gc)+r(Ei,Ad));let sd=Ei;var To,Kr,Ui,Vc,is,Uc,Wt,Ed,Rm;class Tm extends G{constructor(e,s,i,n,a,o){super();m(this,Ed);m(this,To);m(this,Kr,new Float32Array(4));m(this,Ui);m(this,Vc);m(this,is);m(this,Uc);m(this,Wt);p(this,Wt,e),p(this,is,s),p(this,To,i),p(this,Uc,n),p(this,Ui,a),p(this,Vc,o),this.lastPoint=[NaN,NaN],b(this,Ed,Rm).call(this,o);const[l,h,d,u]=r(this,Kr);for(let f=0,g=e.length;f<g;f+=2)e[f]=(e[f]-l)/d,e[f+1]=(e[f+1]-h)/u;for(let f=0,g=s.length;f<g;f+=2)s[f]=(s[f]-l)/d,s[f+1]=(s[f+1]-h)/u}toSVGPath(){const e=[`M${r(this,Wt)[4]} ${r(this,Wt)[5]}`];for(let s=6,i=r(this,Wt).length;s<i;s+=6){if(isNaN(r(this,Wt)[s])){e.push(`L${r(this,Wt)[s+4]} ${r(this,Wt)[s+5]}`);continue}e.push(`C${r(this,Wt)[s]} ${r(this,Wt)[s+1]} ${r(this,Wt)[s+2]} ${r(this,Wt)[s+3]} ${r(this,Wt)[s+4]} ${r(this,Wt)[s+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,s,i,n],a){const o=i-e,l=n-s;let h,d;switch(a){case 0:h=G._rescale(r(this,Wt),e,n,o,-l),d=G._rescale(r(this,is),e,n,o,-l);break;case 90:h=G._rescaleAndSwap(r(this,Wt),e,s,o,l),d=G._rescaleAndSwap(r(this,is),e,s,o,l);break;case 180:h=G._rescale(r(this,Wt),i,s,-o,l),d=G._rescale(r(this,is),i,s,-o,l);break;case 270:h=G._rescaleAndSwap(r(this,Wt),i,n,-o,-l),d=G._rescaleAndSwap(r(this,is),i,n,-o,-l);break}return{outline:Array.from(h),points:[Array.from(d)]}}get box(){return r(this,Kr)}newOutliner(e,s,i,n,a,o=0){return new sd(e,s,i,n,a,o)}getNewOutline(e,s){const[i,n,a,o]=r(this,Kr),[l,h,d,u]=r(this,To),f=a*d,g=o*u,y=i*d+l,v=n*u+h,w=this.newOutliner({x:r(this,is)[0]*f+y,y:r(this,is)[1]*g+v},r(this,To),r(this,Uc),e,r(this,Vc),s??r(this,Ui));for(let A=2;A<r(this,is).length;A+=2)w.add({x:r(this,is)[A]*f+y,y:r(this,is)[A+1]*g+v});return w.getOutlines()}}To=new WeakMap,Kr=new WeakMap,Ui=new WeakMap,Vc=new WeakMap,is=new WeakMap,Uc=new WeakMap,Wt=new WeakMap,Ed=new WeakSet,Rm=function(e){const s=r(this,Wt);let i=s[4],n=s[5];const a=[i,n,i,n];let o=i,l=n;const h=e?Math.max:Math.min;for(let u=6,f=s.length;u<f;u+=6){const g=s[u+4],y=s[u+5];if(isNaN(s[u]))W.pointBoundingBox(g,y,a),l<y?(o=g,l=y):l===y&&(o=h(o,g));else{const v=[1/0,1/0,-1/0,-1/0];W.bezierBoundingBox(i,n,...s.slice(u,u+6),v),W.rectBoundingBox(...v,a),l<v[3]?(o=v[2],l=v[3]):l===v[3]&&(o=h(o,v[2]))}i=g,n=y}const d=r(this,Kr);d[0]=a[0]-r(this,Ui),d[1]=a[1]-r(this,Ui),d[2]=a[2]-a[0]+2*r(this,Ui),d[3]=a[3]-a[1]+2*r(this,Ui),this.lastPoint=[o,l]};var Wc,qc,Nn,$s,$e,Pm,zh,km,Im,Xu;class qu{constructor(t,e=0,s=0,i=!0){m(this,$e);m(this,Wc);m(this,qc);m(this,Nn,[]);m(this,$s,[]);const n=[1/0,1/0,-1/0,-1/0],a=10**-4;for(const{x:g,y,width:v,height:w}of t){const A=Math.floor((g-e)/a)*a,x=Math.ceil((g+v+e)/a)*a,_=Math.floor((y-e)/a)*a,S=Math.ceil((y+w+e)/a)*a,C=[A,_,S,!0],R=[x,_,S,!1];r(this,Nn).push(C,R),W.rectBoundingBox(A,_,x,S,n)}const o=n[2]-n[0]+2*s,l=n[3]-n[1]+2*s,h=n[0]-s,d=n[1]-s,u=r(this,Nn).at(i?-1:-2),f=[u[0],u[2]];for(const g of r(this,Nn)){const[y,v,w]=g;g[0]=(y-h)/o,g[1]=(v-d)/l,g[2]=(w-d)/l}p(this,Wc,new Float32Array([h,d,o,l])),p(this,qc,f)}getOutlines(){r(this,Nn).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of r(this,Nn))e[3]?(t.push(...b(this,$e,Xu).call(this,e)),b(this,$e,km).call(this,e)):(b(this,$e,Im).call(this,e),t.push(...b(this,$e,Xu).call(this,e)));return b(this,$e,Pm).call(this,t)}}Wc=new WeakMap,qc=new WeakMap,Nn=new WeakMap,$s=new WeakMap,$e=new WeakSet,Pm=function(t){const e=[],s=new Set;for(const a of t){const[o,l,h]=a;e.push([o,l,a],[o,h,a])}e.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=e.length;a<o;a+=2){const l=e[a][2],h=e[a+1][2];l.push(h),h.push(l),s.add(l),s.add(h)}const i=[];let n;for(;s.size>0;){const a=s.values().next().value;let[o,l,h,d,u]=a;s.delete(a);let f=o,g=l;for(n=[o,h],i.push(n);;){let y;if(s.has(d))y=d;else if(s.has(u))y=u;else break;s.delete(y),[o,l,h,d,u]=y,f!==o&&(n.push(f,g,o,g===l?l:h),f=o),g=g===l?h:l}n.push(f,g)}return new hv(i,r(this,Wc),r(this,qc))},zh=function(t){const e=r(this,$s);let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,a=e[n][0];if(a===t)return n;a<t?s=n+1:i=n-1}return i+1},km=function([,t,e]){const s=b(this,$e,zh).call(this,t);r(this,$s).splice(s,0,[t,e])},Im=function([,t,e]){const s=b(this,$e,zh).call(this,t);for(let i=s;i<r(this,$s).length;i++){const[n,a]=r(this,$s)[i];if(n!==t)break;if(n===t&&a===e){r(this,$s).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,a]=r(this,$s)[i];if(n!==t)break;if(n===t&&a===e){r(this,$s).splice(i,1);return}}},Xu=function(t){const[e,s,i]=t,n=[[e,s,i]],a=b(this,$e,zh).call(this,i);for(let o=0;o<a;o++){const[l,h]=r(this,$s)[o];for(let d=0,u=n.length;d<u;d++){const[,f,g]=n[d];if(!(h<=f||g<=l)){if(f>=l){if(g>h)n[d][1]=h;else{if(u===1)return[];n.splice(d,1),d--,u--}continue}n[d][2]=l,g>h&&n.push([e,h,g])}}}return n};var Xc,Ro;class hv extends G{constructor(e,s,i){super();m(this,Xc);m(this,Ro);p(this,Ro,e),p(this,Xc,s),this.lastPoint=i}toSVGPath(){const e=[];for(const s of r(this,Ro)){let[i,n]=s;e.push(`M${i} ${n}`);for(let a=2;a<s.length;a+=2){const o=s[a],l=s[a+1];o===i?(e.push(`V${l}`),n=l):l===n&&(e.push(`H${o}`),i=o)}e.push("Z")}return e.join(" ")}serialize([e,s,i,n],a){const o=[],l=i-e,h=n-s;for(const d of r(this,Ro)){const u=new Array(d.length);for(let f=0;f<d.length;f+=2)u[f]=e+d[f]*l,u[f+1]=n-d[f+1]*h;o.push(u)}return o}get box(){return r(this,Xc)}get classNamesForOutlining(){return["highlightOutline"]}}Xc=new WeakMap,Ro=new WeakMap;class Yu extends sd{newFreeDrawOutline(t,e,s,i,n,a){return new dv(t,e,s,i,n,a)}}class dv extends Tm{newOutliner(t,e,s,i,n,a=0){return new Yu(t,e,s,i,n,a)}}var ns,Jr,Po,ie,Yc,ko,Wi,Kc,Fn,zs,Io,Jc,At,Ku,Ju,Zu,ir,Mm,hn;const Ve=class Ve{constructor({editor:t=null,uiManager:e=null}){m(this,At);m(this,ns,null);m(this,Jr,null);m(this,Po);m(this,ie,null);m(this,Yc,!1);m(this,ko,!1);m(this,Wi,null);m(this,Kc);m(this,Fn,null);m(this,zs,null);m(this,Io);var s,i;t?(p(this,ko,!1),p(this,Io,rt.HIGHLIGHT_COLOR),p(this,Wi,t)):(p(this,ko,!0),p(this,Io,rt.HIGHLIGHT_DEFAULT_COLOR)),p(this,zs,(t==null?void 0:t._uiManager)||e),p(this,Kc,r(this,zs)._eventBus),p(this,Po,((s=t==null?void 0:t.color)==null?void 0:s.toUpperCase())||((i=r(this,zs))==null?void 0:i.highlightColors.values().next().value)||"#FFFF98"),r(Ve,Jc)||p(Ve,Jc,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return it(this,"_keyboardManager",new hh([[["Escape","mac+Escape"],Ve.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Ve.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Ve.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Ve.prototype._moveToPrevious],[["Home","mac+Home"],Ve.prototype._moveToBeginning],[["End","mac+End"],Ve.prototype._moveToEnd]]))}renderButton(){const t=p(this,ns,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",r(this,Wi)&&(t.ariaControls=`${r(this,Wi).id}_colorpicker_dropdown`);const e=r(this,zs)._signal;t.addEventListener("click",b(this,At,ir).bind(this),{signal:e}),t.addEventListener("keydown",b(this,At,Zu).bind(this),{signal:e});const s=p(this,Jr,document.createElement("span"));return s.className="swatch",s.ariaHidden="true",s.style.backgroundColor=r(this,Po),t.append(s),t}renderMainDropdown(){const t=p(this,ie,b(this,At,Ku).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===r(this,ns)){b(this,At,ir).call(this,t);return}const e=t.target.getAttribute("data-color");e&&b(this,At,Ju).call(this,e,t)}_moveToNext(t){var e,s;if(!r(this,At,hn)){b(this,At,ir).call(this,t);return}if(t.target===r(this,ns)){(e=r(this,ie).firstChild)==null||e.focus();return}(s=t.target.nextSibling)==null||s.focus()}_moveToPrevious(t){var e,s;if(t.target===((e=r(this,ie))==null?void 0:e.firstChild)||t.target===r(this,ns)){r(this,At,hn)&&this._hideDropdownFromKeyboard();return}r(this,At,hn)||b(this,At,ir).call(this,t),(s=t.target.previousSibling)==null||s.focus()}_moveToBeginning(t){var e;if(!r(this,At,hn)){b(this,At,ir).call(this,t);return}(e=r(this,ie).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!r(this,At,hn)){b(this,At,ir).call(this,t);return}(e=r(this,ie).lastChild)==null||e.focus()}hideDropdown(){var t,e;(t=r(this,ie))==null||t.classList.add("hidden"),r(this,ns).ariaExpanded="false",(e=r(this,Fn))==null||e.abort(),p(this,Fn,null)}_hideDropdownFromKeyboard(){var t;if(!r(this,ko)){if(!r(this,At,hn)){(t=r(this,Wi))==null||t.unselect();return}this.hideDropdown(),r(this,ns).focus({preventScroll:!0,focusVisible:r(this,Yc)})}}updateColor(t){if(r(this,Jr)&&(r(this,Jr).style.backgroundColor=t),!r(this,ie))return;const e=r(this,zs).highlightColors.values();for(const s of r(this,ie).children)s.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;(t=r(this,ns))==null||t.remove(),p(this,ns,null),p(this,Jr,null),(e=r(this,ie))==null||e.remove(),p(this,ie,null)}};ns=new WeakMap,Jr=new WeakMap,Po=new WeakMap,ie=new WeakMap,Yc=new WeakMap,ko=new WeakMap,Wi=new WeakMap,Kc=new WeakMap,Fn=new WeakMap,zs=new WeakMap,Io=new WeakMap,Jc=new WeakMap,At=new WeakSet,Ku=function(){const t=document.createElement("div"),e=r(this,zs)._signal;t.addEventListener("contextmenu",Rs,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),r(this,Wi)&&(t.id=`${r(this,Wi).id}_colorpicker_dropdown`);for(const[s,i]of r(this,zs).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",r(Ve,Jc)[s]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=i,n.ariaSelected=i===r(this,Po),n.addEventListener("click",b(this,At,Ju).bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",b(this,At,Zu).bind(this),{signal:e}),t},Ju=function(t,e){e.stopPropagation(),r(this,Kc).dispatch("switchannotationeditorparams",{source:this,type:r(this,Io),value:t})},Zu=function(t){Ve._keyboardManager.exec(this,t)},ir=function(t){if(r(this,At,hn)){this.hideDropdown();return}if(p(this,Yc,t.detail===0),r(this,Fn)||(p(this,Fn,new AbortController),window.addEventListener("pointerdown",b(this,At,Mm).bind(this),{signal:r(this,zs).combinedSignal(r(this,Fn))})),r(this,ns).ariaExpanded="true",r(this,ie)){r(this,ie).classList.remove("hidden");return}const e=p(this,ie,b(this,At,Ku).call(this));r(this,ns).append(e)},Mm=function(t){var e;(e=r(this,ie))!=null&&e.contains(t.target)||this.hideDropdown()},hn=function(){return r(this,ie)&&!r(this,ie).classList.contains("hidden")},m(Ve,Jc,null);let Il=Ve;var Mo,Zc,qi,Zr,Qc,qe,th,eh,Qr,As,rs,me,Lo,Xi,Ce,Do,xs,sh,Q,Qu,Gh,Lm,Dm,Nm,tf,nr,Cs,ka,Fm,Vh,yl,Om,Bm,jm,Hm,$m;const ut=class ut extends kt{constructor(e){super({...e,name:"highlightEditor"});m(this,Q);m(this,Mo,null);m(this,Zc,0);m(this,qi);m(this,Zr,null);m(this,Qc,null);m(this,qe,null);m(this,th,null);m(this,eh,0);m(this,Qr,null);m(this,As,null);m(this,rs,null);m(this,me,!1);m(this,Lo,null);m(this,Xi);m(this,Ce,null);m(this,Do,"");m(this,xs);m(this,sh,"");this.color=e.color||ut._defaultColor,p(this,xs,e.thickness||ut._defaultThickness),p(this,Xi,e.opacity||ut._defaultOpacity),p(this,qi,e.boxes||null),p(this,sh,e.methodOfCreation||""),p(this,Do,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(p(this,me,!0),b(this,Q,Gh).call(this,e),b(this,Q,nr).call(this)):r(this,qi)&&(p(this,Mo,e.anchorNode),p(this,Zc,e.anchorOffset),p(this,th,e.focusNode),p(this,eh,e.focusOffset),b(this,Q,Qu).call(this),b(this,Q,nr).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const e=ut.prototype;return it(this,"_keyboardManager",new hh([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:r(this,me)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:r(this,xs),methodOfCreation:r(this,sh)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,s){var i;kt.initialize(e,s),ut._defaultColor||(ut._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,s){switch(e){case rt.HIGHLIGHT_DEFAULT_COLOR:ut._defaultColor=s;break;case rt.HIGHLIGHT_THICKNESS:ut._defaultThickness=s;break}}translateInPage(e,s){}get toolbarPosition(){return r(this,Lo)}updateParams(e,s){switch(e){case rt.HIGHLIGHT_COLOR:b(this,Q,Lm).call(this,s);break;case rt.HIGHLIGHT_THICKNESS:b(this,Q,Dm).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[rt.HIGHLIGHT_DEFAULT_COLOR,ut._defaultColor],[rt.HIGHLIGHT_THICKNESS,ut._defaultThickness]]}get propertiesToUpdate(){return[[rt.HIGHLIGHT_COLOR,this.color||ut._defaultColor],[rt.HIGHLIGHT_THICKNESS,r(this,xs)||ut._defaultThickness],[rt.HIGHLIGHT_FREE,r(this,me)]]}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",p(this,Qc,new Il({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(b(this,Q,yl).call(this))}getBaseTranslation(){return[0,0]}getRect(e,s){return super.getRect(e,s,b(this,Q,yl).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){b(this,Q,tf).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Q,nr).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?b(this,Q,tf).call(this):e&&(b(this,Q,nr).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),s&&this.select()}rotate(e){var n,a,o;const{drawLayer:s}=this.parent;let i;r(this,me)?(e=(e-this.rotation+360)%360,i=b(n=ut,Cs,ka).call(n,r(this,As).box,e)):i=b(a=ut,Cs,ka).call(a,[this.x,this.y,this.width,this.height],e),s.updateProperties(r(this,rs),{bbox:i,root:{"data-main-rotation":e}}),s.updateProperties(r(this,Ce),{bbox:b(o=ut,Cs,ka).call(o,r(this,qe).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();r(this,Do)&&(e.setAttribute("aria-label",r(this,Do)),e.setAttribute("role","mark")),r(this,me)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,Q,Fm).bind(this),{signal:this._uiManager._signal});const s=p(this,Qr,document.createElement("div"));e.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=r(this,Zr);const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),og(this,r(this,Qr),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){var e;this.isSelected||(e=this.parent)==null||e.drawLayer.updateProperties(r(this,Ce),{rootClass:{hovered:!0}})}pointerleave(){var e;this.isSelected||(e=this.parent)==null||e.drawLayer.updateProperties(r(this,Ce),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,Q,Vh).call(this,!0);break;case 1:case 3:b(this,Q,Vh).call(this,!1);break}}select(){var e;super.select(),r(this,Ce)&&((e=this.parent)==null||e.drawLayer.updateProperties(r(this,Ce),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var e;super.unselect(),r(this,Ce)&&((e=this.parent)==null||e.drawLayer.updateProperties(r(this,Ce),{rootClass:{selected:!1}}),r(this,me)||b(this,Q,Vh).call(this,!1))}get _mustFixPosition(){return!r(this,me)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(r(this,rs),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(r(this,Ce),{rootClass:{hidden:!e}}))}static startHighlighting(e,s,{target:i,x:n,y:a}){const{x:o,y:l,width:h,height:d}=i.getBoundingClientRect(),u=new AbortController,f=e.combinedSignal(u),g=y=>{u.abort(),b(this,Cs,Hm).call(this,e,y)};window.addEventListener("blur",g,{signal:f}),window.addEventListener("pointerup",g,{signal:f}),window.addEventListener("pointerdown",qt,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Rs,{signal:f}),i.addEventListener("pointermove",b(this,Cs,jm).bind(this,e),{signal:f}),this._freeHighlight=new Yu({x:n,y:a},[o,l,h,d],e.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(e,s,i){var v,w,A,x;let n=null;if(e instanceof pm){const{data:{quadPoints:_,rect:S,rotation:C,id:R,color:T,opacity:k,popupRef:I},parent:{page:{pageNumber:D}}}=e;n=e={annotationType:J.HIGHLIGHT,color:Array.from(T),opacity:k,quadPoints:_,boxes:null,pageIndex:D-1,rect:S.slice(0),rotation:C,annotationElementId:R,id:R,deleted:!1,popupRef:I}}else if(e instanceof Lf){const{data:{inkLists:_,rect:S,rotation:C,id:R,color:T,borderStyle:{rawWidth:k},popupRef:I},parent:{page:{pageNumber:D}}}=e;n=e={annotationType:J.HIGHLIGHT,color:Array.from(T),thickness:k,inkLists:_,boxes:null,pageIndex:D-1,rect:S.slice(0),rotation:C,annotationElementId:R,id:R,deleted:!1,popupRef:I}}const{color:a,quadPoints:o,inkLists:l,opacity:h}=e,d=await super.deserialize(e,s,i);d.color=W.makeHexColor(...a),p(d,Xi,h||1),l&&p(d,xs,e.thickness),d._initialData=n;const[u,f]=d.pageDimensions,[g,y]=d.pageTranslation;if(o){const _=p(d,qi,[]);for(let S=0;S<o.length;S+=8)_.push({x:(o[S]-g)/u,y:1-(o[S+1]-y)/f,width:(o[S+2]-o[S])/u,height:(o[S+1]-o[S+5])/f});b(v=d,Q,Qu).call(v),b(w=d,Q,nr).call(w),d.rotate(d.rotation)}else if(l){p(d,me,!0);const _=l[0],S={x:_[0]-g,y:f-(_[1]-y)},C=new Yu(S,[0,0,u,f],1,r(d,xs)/2,!0,.001);for(let k=0,I=_.length;k<I;k+=2)S.x=_[k]-g,S.y=f-(_[k+1]-y),C.add(S);const{id:R,clipPathId:T}=s.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:C.toSVGPath()}},!0,!0);b(A=d,Q,Gh).call(A,{highlightOutlines:C.getOutlines(),highlightId:R,clipPathId:T}),b(x=d,Q,nr).call(x),d.rotate(d.parentRotation)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const s=this.getRect(0,0),i=kt._colorManager.convert(this.color),n={annotationType:J.HIGHLIGHT,color:i,opacity:r(this,Xi),thickness:r(this,xs),quadPoints:b(this,Q,Om).call(this),outlines:b(this,Q,Bm).call(this,s),pageIndex:this.pageIndex,rect:s,rotation:b(this,Q,yl).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!b(this,Q,$m).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};Mo=new WeakMap,Zc=new WeakMap,qi=new WeakMap,Zr=new WeakMap,Qc=new WeakMap,qe=new WeakMap,th=new WeakMap,eh=new WeakMap,Qr=new WeakMap,As=new WeakMap,rs=new WeakMap,me=new WeakMap,Lo=new WeakMap,Xi=new WeakMap,Ce=new WeakMap,Do=new WeakMap,xs=new WeakMap,sh=new WeakMap,Q=new WeakSet,Qu=function(){const e=new qu(r(this,qi),.001);p(this,As,e.getOutlines()),[this.x,this.y,this.width,this.height]=r(this,As).box;const s=new qu(r(this,qi),.0025,.001,this._uiManager.direction==="ltr");p(this,qe,s.getOutlines());const{lastPoint:i}=r(this,qe);p(this,Lo,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},Gh=function({highlightOutlines:e,highlightId:s,clipPathId:i}){var u,f;if(p(this,As,e),p(this,qe,e.getNewOutline(r(this,xs)/2+1.5,.0025)),s>=0)p(this,rs,s),p(this,Zr,i),this.parent.drawLayer.finalizeDraw(s,{bbox:e.box,path:{d:e.toSVGPath()}}),p(this,Ce,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:r(this,qe).box,path:{d:r(this,qe).toSVGPath()}},!0));else if(this.parent){const g=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(r(this,rs),{bbox:b(u=ut,Cs,ka).call(u,r(this,As).box,(g-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(r(this,Ce),{bbox:b(f=ut,Cs,ka).call(f,r(this,qe).box,g),path:{d:r(this,qe).toSVGPath()}})}const[a,o,l,h]=e.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=h;break;case 90:{const[g,y]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*y/g,this.height=h*g/y;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=h;break;case 270:{const[g,y]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*y/g,this.height=h*g/y;break}}const{lastPoint:d}=r(this,qe);p(this,Lo,[(d[0]-a)/l,(d[1]-o)/h])},Lm=function(e){const s=(a,o)=>{var l,h;this.color=a,p(this,Xi,o),(l=this.parent)==null||l.drawLayer.updateProperties(r(this,rs),{root:{fill:a,"fill-opacity":o}}),(h=r(this,Qc))==null||h.updateColor(a)},i=this.color,n=r(this,Xi);this.addCommands({cmd:s.bind(this,e,ut._defaultOpacity),undo:s.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:rt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},Dm=function(e){const s=r(this,xs),i=n=>{p(this,xs,n),b(this,Q,Nm).call(this,n)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:rt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Nm=function(e){if(!r(this,me))return;b(this,Q,Gh).call(this,{highlightOutlines:r(this,As).getNewOutline(e/2)}),this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)},tf=function(){r(this,rs)===null||!this.parent||(this.parent.drawLayer.remove(r(this,rs)),p(this,rs,null),this.parent.drawLayer.remove(r(this,Ce)),p(this,Ce,null))},nr=function(e=this.parent){r(this,rs)===null&&({id:Me(this,rs)._,clipPathId:Me(this,Zr)._}=e.drawLayer.draw({bbox:r(this,As).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":r(this,Xi)},rootClass:{highlight:!0,free:r(this,me)},path:{d:r(this,As).toSVGPath()}},!1,!0),p(this,Ce,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:r(this,me)},bbox:r(this,qe).box,path:{d:r(this,qe).toSVGPath()}},r(this,me))),r(this,Qr)&&(r(this,Qr).style.clipPath=r(this,Zr)))},Cs=new WeakSet,ka=function([e,s,i,n],a){switch(a){case 90:return[1-s-n,e,n,i];case 180:return[1-e-i,1-s-n,i,n];case 270:return[s,1-e-i,n,i]}return[e,s,i,n]},Fm=function(e){ut._keyboardManager.exec(this,e)},Vh=function(e){if(!r(this,Mo))return;const s=window.getSelection();e?s.setPosition(r(this,Mo),r(this,Zc)):s.setPosition(r(this,th),r(this,eh))},yl=function(){return r(this,me)?this.rotation:0},Om=function(){if(r(this,me))return null;const[e,s]=this.pageDimensions,[i,n]=this.pageTranslation,a=r(this,qi),o=new Float32Array(a.length*8);let l=0;for(const{x:h,y:d,width:u,height:f}of a){const g=h*e+i,y=(1-d)*s+n;o[l]=o[l+4]=g,o[l+1]=o[l+3]=y,o[l+2]=o[l+6]=g+u*e,o[l+5]=o[l+7]=y-f*s,l+=8}return o},Bm=function(e){return r(this,As).serialize(e,b(this,Q,yl).call(this))},jm=function(e,s){this._freeHighlight.add(s)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},Hm=function(e,s){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(s,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},$m=function(e){const{color:s}=this._initialData;return e.color.some((i,n)=>i!==s[n])},m(ut,Cs),L(ut,"_defaultColor",null),L(ut,"_defaultOpacity",1),L(ut,"_defaultThickness",12),L(ut,"_type","highlight"),L(ut,"_editorType",J.HIGHLIGHT),L(ut,"_freeHighlightId",-1),L(ut,"_freeHighlight",null),L(ut,"_freeHighlightClipId","");let id=ut;var ta;class zm{constructor(){m(this,ta,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,s]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,s)}updateSVGProperty(t,e){r(this,ta)[t]=e}toSVGProperties(){const t=r(this,ta);return p(this,ta,Object.create(null)),{root:t}}reset(){p(this,ta,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){xt("Not implemented")}}ta=new WeakMap;var as,No,oe,ea,sa,On,Bn,jn,ia,ct,ef,sf,nf,vl,Gm,Uh,wl,Ia;const V=class V extends kt{constructor(e){super(e);m(this,ct);m(this,as,null);m(this,No);L(this,"_drawId",null);p(this,No,e.mustBeCommitted||!1),this._addOutlines(e)}_addOutlines(e){e.drawOutlines&&(b(this,ct,ef).call(this,e),b(this,ct,vl).call(this))}static _mergeSVGProperties(e,s){const i=new Set(Object.keys(e));for(const[n,a]of Object.entries(s))i.has(n)?Object.assign(e[n],a):e[n]=a;return e}static getDefaultDrawingOptions(e){xt("Not implemented")}static get typesMap(){xt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,s){const i=this.typesMap.get(e);i&&this._defaultDrawingOptions.updateProperty(i,s),this._currentParent&&(r(V,oe).updateProperty(i,s),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,s){const i=this.constructor.typesMap.get(e);i&&this._updateProperty(e,i,s)}static get defaultPropertiesToUpdate(){const e=[],s=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)e.push([i,s[n]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:s}=this;for(const[i,n]of this.constructor.typesMap)e.push([i,s[n]]);return e}_updateProperty(e,s,i){const n=this._drawingOptions,a=n[s],o=l=>{var d;n.updateProperty(s,l);const h=r(this,as).updateProperty(s,l);h&&b(this,ct,wl).call(this,h),(d=this.parent)==null||d.drawLayer.updateProperties(this._drawId,n.toSVGProperties())};this.addCommands({cmd:o.bind(this,i),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,V._mergeSVGProperties(r(this,as).getPathResizingSVGProperties(b(this,ct,Uh).call(this)),{bbox:b(this,ct,Ia).call(this)}))}_onResized(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,V._mergeSVGProperties(r(this,as).getPathResizedSVGProperties(b(this,ct,Uh).call(this)),{bbox:b(this,ct,Ia).call(this)}))}_onTranslating(e,s){var i;(i=this.parent)==null||i.drawLayer.updateProperties(this._drawId,{bbox:b(this,ct,Ia).call(this)})}_onTranslated(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,V._mergeSVGProperties(r(this,as).getPathTranslatedSVGProperties(b(this,ct,Uh).call(this),this.parentDimensions),{bbox:b(this,ct,Ia).call(this)}))}_onStartDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,r(this,No)&&(p(this,No,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){b(this,ct,nf).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,ct,vl).call(this),b(this,ct,wl).call(this,r(this,as).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,ct,nf).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,ct,vl).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),s&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,V._mergeSVGProperties({bbox:b(this,ct,Ia).call(this)},r(this,as).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&b(this,ct,wl).call(this,r(this,as).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,s;this._isCopy&&(e=this.x,s=this.y);const i=super.render();i.classList.add("draw");const n=document.createElement("div");i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal";const[a,o]=this.parentDimensions;return this.setDims(this.width*a,this.height*o),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,s),i}static createDrawerInstance(e,s,i,n,a){xt("Not implemented")}static startDrawing(e,s,i,n){var w;const{target:a,offsetX:o,offsetY:l,pointerId:h,pointerType:d}=n;if(r(V,Bn)&&r(V,Bn)!==d)return;const{viewport:{rotation:u}}=e,{width:f,height:g}=a.getBoundingClientRect(),y=p(V,ea,new AbortController),v=e.combinedSignal(y);if(r(V,On)||p(V,On,h),r(V,Bn)??p(V,Bn,d),window.addEventListener("pointerup",A=>{var x;r(V,On)===A.pointerId?this._endDraw(A):(x=r(V,jn))==null||x.delete(A.pointerId)},{signal:v}),window.addEventListener("pointercancel",A=>{var x;r(V,On)===A.pointerId?this._currentParent.endDrawingSession():(x=r(V,jn))==null||x.delete(A.pointerId)},{signal:v}),window.addEventListener("pointerdown",A=>{r(V,Bn)===A.pointerType&&((r(V,jn)||p(V,jn,new Set)).add(A.pointerId),r(V,oe).isCancellable()&&(r(V,oe).removeLastElement(),r(V,oe).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:v}),window.addEventListener("contextmenu",Rs,{signal:v}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:v}),a.addEventListener("touchmove",A=>{A.timeStamp===r(V,ia)&&qt(A)},{signal:v}),e.toggleDrawing(),(w=s._editorUndoBar)==null||w.hide(),r(V,oe)){e.drawLayer.updateProperties(this._currentDrawId,r(V,oe).startNew(o,l,f,g,u));return}s.updateUIForDefaultProperties(this),p(V,oe,this.createDrawerInstance(o,l,f,g,u)),p(V,sa,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(r(V,sa).toSVGProperties(),r(V,oe).defaultSVGProperties),!0,!1)}static _drawMove(e){var a;if(p(V,ia,-1),!r(V,oe))return;const{offsetX:s,offsetY:i,pointerId:n}=e;if(r(V,On)===n){if(((a=r(V,jn))==null?void 0:a.size)>=1){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,r(V,oe).add(s,i)),p(V,ia,e.timeStamp),qt(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,p(V,oe,null),p(V,sa,null),p(V,Bn,null),p(V,ia,NaN)),r(V,ea)&&(r(V,ea).abort(),p(V,ea,null),p(V,On,NaN),p(V,jn,null))}static _endDraw(e){const s=this._currentParent;if(s){if(s.toggleDrawing(!0),this._cleanup(!1),(e==null?void 0:e.target)===s.div&&s.drawLayer.updateProperties(this._currentDrawId,r(V,oe).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const i=r(V,oe),n=this._currentDrawId,a=i.getLastElement();s.addCommands({cmd:()=>{s.drawLayer.updateProperties(n,i.setLastElement(a))},undo:()=>{s.drawLayer.updateProperties(n,i.removeLastElement())},mustExec:!1,type:rt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const s=this._currentParent;if(!s)return null;if(s.toggleDrawing(!0),s.cleanUndoStack(rt.DRAW_STEP),!r(V,oe).isEmpty()){const{pageDimensions:[i,n],scale:a}=s,o=s.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:r(V,oe).getOutlines(i*a,n*a,a,this._INNER_MARGIN),drawingOptions:r(V,sa),mustBeCommitted:!e});return this._cleanup(!0),o}return s.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,s,i,n,a,o){xt("Not implemented")}static async deserialize(e,s,i){var u,f;const{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}=s.viewport,h=this.deserializeDraw(o,l,n,a,this._INNER_MARGIN,e),d=await super.deserialize(e,s,i);return d.createDrawingOptions(e),b(u=d,ct,ef).call(u,{drawOutlines:h}),b(f=d,ct,vl).call(f),d.onScaleChanging(),d.rotate(),d}serializeDraw(e){const[s,i]=this.pageTranslation,[n,a]=this.pageDimensions;return r(this,as).serialize([s,i,n,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};as=new WeakMap,No=new WeakMap,oe=new WeakMap,ea=new WeakMap,sa=new WeakMap,On=new WeakMap,Bn=new WeakMap,jn=new WeakMap,ia=new WeakMap,ct=new WeakSet,ef=function({drawOutlines:e,drawId:s,drawingOptions:i}){p(this,as,e),this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),s>=0?(this._drawId=s,this.parent.drawLayer.finalizeDraw(s,e.defaultProperties)):this._drawId=b(this,ct,sf).call(this,e,this.parent),b(this,ct,wl).call(this,e.box)},sf=function(e,s){const{id:i}=s.drawLayer.draw(V._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return i},nf=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},vl=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=b(this,ct,sf).call(this,r(this,as),e)}},Gm=function([e,s,i,n]){const{parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[s,1-e,i*(o/a),n*(a/o)];case 180:return[1-e,1-s,i,n];case 270:return[1-s,e,i*(o/a),n*(a/o)];default:return[e,s,i,n]}},Uh=function(){const{x:e,y:s,width:i,height:n,parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[1-s,e,i*(a/o),n*(o/a)];case 180:return[1-e,1-s,i,n];case 270:return[s,1-e,i*(a/o),n*(o/a)];default:return[e,s,i,n]}},wl=function(e){if([this.x,this.y,this.width,this.height]=b(this,ct,Gm).call(this,e),this.div){this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)}this._onResized()},Ia=function(){const{x:e,y:s,width:i,height:n,rotation:a,parentRotation:o,parentDimensions:[l,h]}=this;switch((a*4+o)/90){case 1:return[1-s-n,e,n,i];case 2:return[1-e-i,1-s-n,i,n];case 3:return[s,1-e-i,n,i];case 4:return[e,s-i*(l/h),n*(h/l),i*(l/h)];case 5:return[1-s,e,i*(l/h),n*(h/l)];case 6:return[1-e-n*(h/l),1-s,n*(h/l),i*(l/h)];case 7:return[s-i*(l/h),1-e-n*(h/l),i*(l/h),n*(h/l)];case 8:return[e-i,s-n,i,n];case 9:return[1-s,e-i,n,i];case 10:return[1-e,1-s,i,n];case 11:return[s-n,1-e,n,i];case 12:return[e-n*(h/l),s,n*(h/l),i*(l/h)];case 13:return[1-s-i*(l/h),e-n*(h/l),i*(l/h),n*(h/l)];case 14:return[1-e,1-s-i*(l/h),n*(h/l),i*(l/h)];case 15:return[s,1-e,i*(l/h),n*(h/l)];default:return[e,s,i,n]}},L(V,"_currentDrawId",-1),L(V,"_currentParent",null),m(V,oe,null),m(V,ea,null),m(V,sa,null),m(V,On,NaN),m(V,Bn,null),m(V,jn,null),m(V,ia,NaN),L(V,"_INNER_MARGIN",3);let nd=V;var ci,le,ce,na,Fo,Ne,be,Es,ra,aa,oa,Oo,Wh;class uv{constructor(t,e,s,i,n,a){m(this,Oo);m(this,ci,new Float64Array(6));m(this,le);m(this,ce);m(this,na);m(this,Fo);m(this,Ne);m(this,be,"");m(this,Es,0);m(this,ra,new uh);m(this,aa);m(this,oa);p(this,aa,s),p(this,oa,i),p(this,na,n),p(this,Fo,a),[t,e]=b(this,Oo,Wh).call(this,t,e);const o=p(this,le,[NaN,NaN,NaN,NaN,t,e]);p(this,Ne,[t,e]),p(this,ce,[{line:o,points:r(this,Ne)}]),r(this,ci).set(o,0)}updateProperty(t,e){t==="stroke-width"&&p(this,Fo,e)}isEmpty(){return!r(this,ce)||r(this,ce).length===0}isCancellable(){return r(this,Ne).length<=10}add(t,e){[t,e]=b(this,Oo,Wh).call(this,t,e);const[s,i,n,a]=r(this,ci).subarray(2,6),o=t-n,l=e-a;return Math.hypot(r(this,aa)*o,r(this,oa)*l)<=2?null:(r(this,Ne).push(t,e),isNaN(s)?(r(this,ci).set([n,a,t,e],2),r(this,le).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(r(this,ci)[0])&&r(this,le).splice(6,6),r(this,ci).set([s,i,n,a,t,e],0),r(this,le).push(...G.createBezierPoints(s,i,n,a,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const s=this.add(t,e);return s||(r(this,Ne).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,s,i,n){p(this,aa,s),p(this,oa,i),p(this,na,n),[t,e]=b(this,Oo,Wh).call(this,t,e);const a=p(this,le,[NaN,NaN,NaN,NaN,t,e]);p(this,Ne,[t,e]);const o=r(this,ce).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),r(this,ce).push({line:a,points:r(this,Ne)}),r(this,ci).set(a,0),p(this,Es,0),this.toSVGPath(),null}getLastElement(){return r(this,ce).at(-1)}setLastElement(t){return r(this,ce)?(r(this,ce).push(t),p(this,le,t.line),p(this,Ne,t.points),p(this,Es,0),{path:{d:this.toSVGPath()}}):r(this,ra).setLastElement(t)}removeLastElement(){if(!r(this,ce))return r(this,ra).removeLastElement();r(this,ce).pop(),p(this,be,"");for(let t=0,e=r(this,ce).length;t<e;t++){const{line:s,points:i}=r(this,ce)[t];p(this,le,s),p(this,Ne,i),p(this,Es,0),this.toSVGPath()}return{path:{d:r(this,be)}}}toSVGPath(){const t=G.svgRound(r(this,le)[4]),e=G.svgRound(r(this,le)[5]);if(r(this,Ne).length===2)return p(this,be,`${r(this,be)} M ${t} ${e} Z`),r(this,be);if(r(this,Ne).length<=6){const i=r(this,be).lastIndexOf("M");p(this,be,`${r(this,be).slice(0,i)} M ${t} ${e}`),p(this,Es,6)}if(r(this,Ne).length===4){const i=G.svgRound(r(this,le)[10]),n=G.svgRound(r(this,le)[11]);return p(this,be,`${r(this,be)} L ${i} ${n}`),p(this,Es,12),r(this,be)}const s=[];r(this,Es)===0&&(s.push(`M ${t} ${e}`),p(this,Es,6));for(let i=r(this,Es),n=r(this,le).length;i<n;i+=6){const[a,o,l,h,d,u]=r(this,le).slice(i,i+6).map(G.svgRound);s.push(`C${a} ${o} ${l} ${h} ${d} ${u}`)}return p(this,be,r(this,be)+s.join(" ")),p(this,Es,r(this,le).length),r(this,be)}getOutlines(t,e,s,i){const n=r(this,ce).at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),r(this,ra).build(r(this,ce),t,e,s,r(this,na),r(this,Fo),i),p(this,ci,null),p(this,le,null),p(this,ce,null),p(this,be,null),r(this,ra)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}ci=new WeakMap,le=new WeakMap,ce=new WeakMap,na=new WeakMap,Fo=new WeakMap,Ne=new WeakMap,be=new WeakMap,Es=new WeakMap,ra=new WeakMap,aa=new WeakMap,oa=new WeakMap,Oo=new WeakSet,Wh=function(t,e){return G._normalizePoint(t,e,r(this,aa),r(this,oa),r(this,na))};var Fe,ih,nh,os,hi,di,Bo,jo,la,ve,Ai,Vm,Um,Wm;class uh extends G{constructor(){super(...arguments);m(this,ve);m(this,Fe);m(this,ih,0);m(this,nh);m(this,os);m(this,hi);m(this,di);m(this,Bo);m(this,jo);m(this,la)}build(e,s,i,n,a,o,l){p(this,hi,s),p(this,di,i),p(this,Bo,n),p(this,jo,a),p(this,la,o),p(this,nh,l??0),p(this,os,e),b(this,ve,Um).call(this)}get thickness(){return r(this,la)}setLastElement(e){return r(this,os).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return r(this,os).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:s}of r(this,os)){if(e.push(`M${G.svgRound(s[4])} ${G.svgRound(s[5])}`),s.length===6){e.push("Z");continue}if(s.length===12&&isNaN(s[6])){e.push(`L${G.svgRound(s[10])} ${G.svgRound(s[11])}`);continue}for(let i=6,n=s.length;i<n;i+=6){const[a,o,l,h,d,u]=s.subarray(i,i+6).map(G.svgRound);e.push(`C${a} ${o} ${l} ${h} ${d} ${u}`)}}return e.join("")}serialize([e,s,i,n],a){const o=[],l=[],[h,d,u,f]=b(this,ve,Vm).call(this);let g,y,v,w,A,x,_,S,C;switch(r(this,jo)){case 0:C=G._rescale,g=e,y=s+n,v=i,w=-n,A=e+h*i,x=s+(1-d-f)*n,_=e+(h+u)*i,S=s+(1-d)*n;break;case 90:C=G._rescaleAndSwap,g=e,y=s,v=i,w=n,A=e+d*i,x=s+h*n,_=e+(d+f)*i,S=s+(h+u)*n;break;case 180:C=G._rescale,g=e+i,y=s,v=-i,w=n,A=e+(1-h-u)*i,x=s+d*n,_=e+(1-h)*i,S=s+(d+f)*n;break;case 270:C=G._rescaleAndSwap,g=e+i,y=s+n,v=-i,w=-n,A=e+(1-d-f)*i,x=s+(1-h-u)*n,_=e+(1-d)*i,S=s+(1-h)*n;break}for(const{line:R,points:T}of r(this,os))o.push(C(R,g,y,v,w,a?new Array(R.length):null)),l.push(C(T,g,y,v,w,a?new Array(T.length):null));return{lines:o,points:l,rect:[A,x,_,S]}}static deserialize(e,s,i,n,a,{paths:{lines:o,points:l},rotation:h,thickness:d}){const u=[];let f,g,y,v,w;switch(h){case 0:w=G._rescale,f=-e/i,g=s/n+1,y=1/i,v=-1/n;break;case 90:w=G._rescaleAndSwap,f=-s/n,g=-e/i,y=1/n,v=1/i;break;case 180:w=G._rescale,f=e/i+1,g=-s/n,y=-1/i,v=1/n;break;case 270:w=G._rescaleAndSwap,f=s/n+1,g=e/i+1,y=-1/n,v=-1/i;break}if(!o){o=[];for(const x of l){const _=x.length;if(_===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,x[0],x[1]]));continue}if(_===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,x[0],x[1],NaN,NaN,NaN,NaN,x[2],x[3]]));continue}const S=new Float32Array(3*(_-2));o.push(S);let[C,R,T,k]=x.subarray(0,4);S.set([NaN,NaN,NaN,NaN,C,R],0);for(let I=4;I<_;I+=2){const D=x[I],N=x[I+1];S.set(G.createBezierPoints(C,R,T,k,D,N),(I-2)*3),[C,R,T,k]=[T,k,D,N]}}}for(let x=0,_=o.length;x<_;x++)u.push({line:w(o[x].map(S=>S??NaN),f,g,y,v),points:w(l[x].map(S=>S??NaN),f,g,y,v)});const A=new this.prototype.constructor;return A.build(u,i,n,1,h,d,a),A}get box(){return r(this,Fe)}updateProperty(e,s){return e==="stroke-width"?b(this,ve,Wm).call(this,s):null}updateParentDimensions([e,s],i){const[n,a]=b(this,ve,Ai).call(this);p(this,hi,e),p(this,di,s),p(this,Bo,i);const[o,l]=b(this,ve,Ai).call(this),h=o-n,d=l-a,u=r(this,Fe);return u[0]-=h,u[1]-=d,u[2]+=2*h,u[3]+=2*d,u}updateRotation(e){return p(this,ih,e),{path:{transform:this.rotationTransform}}}get viewBox(){return r(this,Fe).map(G.svgRound).join(" ")}get defaultProperties(){const[e,s]=r(this,Fe);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`}}}get rotationTransform(){const[,,e,s]=r(this,Fe);let i=0,n=0,a=0,o=0,l=0,h=0;switch(r(this,ih)){case 90:n=s/e,a=-e/s,l=e;break;case 180:i=-1,o=-1,l=e,h=s;break;case 270:n=-s/e,a=e/s,h=s;break;default:return""}return`matrix(${i} ${n} ${a} ${o} ${G.svgRound(l)} ${G.svgRound(h)})`}getPathResizingSVGProperties([e,s,i,n]){const[a,o]=b(this,ve,Ai).call(this),[l,h,d,u]=r(this,Fe);if(Math.abs(d-a)<=G.PRECISION||Math.abs(u-o)<=G.PRECISION){const w=e+i/2-(l+d/2),A=s+n/2-(h+u/2);return{path:{"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`,transform:`${this.rotationTransform} translate(${w} ${A})`}}}const f=(i-2*a)/(d-2*a),g=(n-2*o)/(u-2*o),y=d/i,v=u/n;return{path:{"transform-origin":`${G.svgRound(l)} ${G.svgRound(h)}`,transform:`${this.rotationTransform} scale(${y} ${v}) translate(${G.svgRound(a)} ${G.svgRound(o)}) scale(${f} ${g}) translate(${G.svgRound(-a)} ${G.svgRound(-o)})`}}}getPathResizedSVGProperties([e,s,i,n]){const[a,o]=b(this,ve,Ai).call(this),l=r(this,Fe),[h,d,u,f]=l;if(l[0]=e,l[1]=s,l[2]=i,l[3]=n,Math.abs(u-a)<=G.PRECISION||Math.abs(f-o)<=G.PRECISION){const A=e+i/2-(h+u/2),x=s+n/2-(d+f/2);for(const{line:_,points:S}of r(this,os))G._translate(_,A,x,_),G._translate(S,A,x,S);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const g=(i-2*a)/(u-2*a),y=(n-2*o)/(f-2*o),v=-g*(h+a)+e+a,w=-y*(d+o)+s+o;if(g!==1||y!==1||v!==0||w!==0)for(const{line:A,points:x}of r(this,os))G._rescale(A,v,w,g,y,A),G._rescale(x,v,w,g,y,x);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,s],i){const[n,a]=i,o=r(this,Fe),l=e-o[0],h=s-o[1];if(r(this,hi)===n&&r(this,di)===a)for(const{line:d,points:u}of r(this,os))G._translate(d,l,h,d),G._translate(u,l,h,u);else{const d=r(this,hi)/n,u=r(this,di)/a;p(this,hi,n),p(this,di,a);for(const{line:f,points:g}of r(this,os))G._rescale(f,l,h,d,u,f),G._rescale(g,l,h,d,u,g);o[2]*=d,o[3]*=u}return o[0]=e,o[1]=s,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`}}}get defaultSVGProperties(){const e=r(this,Fe);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${G.svgRound(e[0])} ${G.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}Fe=new WeakMap,ih=new WeakMap,nh=new WeakMap,os=new WeakMap,hi=new WeakMap,di=new WeakMap,Bo=new WeakMap,jo=new WeakMap,la=new WeakMap,ve=new WeakSet,Ai=function(e=r(this,la)){const s=r(this,nh)+e/2*r(this,Bo);return r(this,jo)%180===0?[s/r(this,hi),s/r(this,di)]:[s/r(this,di),s/r(this,hi)]},Vm=function(){const[e,s,i,n]=r(this,Fe),[a,o]=b(this,ve,Ai).call(this,0);return[e+a,s+o,i-2*a,n-2*o]},Um=function(){const e=p(this,Fe,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:n}of r(this,os)){if(n.length<=12){for(let l=4,h=n.length;l<h;l+=6)W.pointBoundingBox(n[l],n[l+1],e);continue}let a=n[4],o=n[5];for(let l=6,h=n.length;l<h;l+=6){const[d,u,f,g,y,v]=n.subarray(l,l+6);W.bezierBoundingBox(a,o,d,u,f,g,y,v,e),a=y,o=v}}const[s,i]=b(this,ve,Ai).call(this);e[0]=Te(e[0]-s,0,1),e[1]=Te(e[1]-i,0,1),e[2]=Te(e[2]+s,0,1),e[3]=Te(e[3]+i,0,1),e[2]-=e[0],e[3]-=e[1]},Wm=function(e){const[s,i]=b(this,ve,Ai).call(this);p(this,la,e);const[n,a]=b(this,ve,Ai).call(this),[o,l]=[n-s,a-i],h=r(this,Fe);return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h};class Md extends zm{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:kt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new Md(this._viewParameters);return t.updateAll(this),t}}var _d,qm;const Da=class Da extends nd{constructor(e){super({...e,name:"inkEditor"});m(this,_d);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,s){kt.initialize(e,s),this._defaultDrawingOptions=new Md(s.viewParameters)}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get supportMultipleDrawings(){return!0}static get typesMap(){return it(this,"typesMap",new Map([[rt.INK_THICKNESS,"stroke-width"],[rt.INK_COLOR,"stroke"],[rt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,s,i,n,a){return new uv(e,s,i,n,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,s,i,n,a,o){return uh.deserialize(e,s,i,n,a,o)}static async deserialize(e,s,i){let n=null;if(e instanceof Lf){const{data:{inkLists:o,rect:l,rotation:h,id:d,color:u,opacity:f,borderStyle:{rawWidth:g},popupRef:y},parent:{page:{pageNumber:v}}}=e;n=e={annotationType:J.INK,color:Array.from(u),thickness:g,opacity:f,paths:{points:o},boxes:null,pageIndex:v-1,rect:l.slice(0),rotation:h,annotationElementId:d,id:d,deleted:!1,popupRef:y}}const a=await super.deserialize(e,s,i);return a._initialData=n,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:s,parent:i}=this;s.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(e,s.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:s,opacity:i}){this._drawingOptions=Da.getDefaultDrawingOptions({stroke:W.makeHexColor(...e),"stroke-width":s,"stroke-opacity":i})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:s,points:i,rect:n}=this.serializeDraw(e),{_drawingOptions:{stroke:a,"stroke-opacity":o,"stroke-width":l}}=this,h={annotationType:J.INK,color:kt._colorManager.convert(a),opacity:o,thickness:l,paths:{lines:s,points:i},pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?(h.isCopy=!0,h):this.annotationElementId&&!b(this,_d,qm).call(this,h)?null:(h.id=this.annotationElementId,h)}renderAnnotationElement(e){const{points:s,rect:i}=this.serializeDraw(!1);return e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:s}),null}};_d=new WeakSet,qm=function(e){const{color:s,thickness:i,opacity:n,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||e.color.some((o,l)=>o!==s[l])||e.thickness!==i||e.opacity!==n||e.pageIndex!==a},L(Da,"_type","ink"),L(Da,"_editorType",J.INK),L(Da,"_defaultDrawingOptions",null);let rf=Da;class af extends uh{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}const xh=8,il=3;var ca,gt,of,Gs,Xm,Ym,lf,qh,Km,Jm,Zm,cf,hf,Qm;class mi{static extractContoursFromText(t,{fontFamily:e,fontStyle:s,fontWeight:i},n,a,o,l){let h=new OffscreenCanvas(1,1),d=h.getContext("2d",{alpha:!1});const u=200,f=d.font=`${s} ${i} ${u}px ${e}`,{actualBoundingBoxLeft:g,actualBoundingBoxRight:y,actualBoundingBoxAscent:v,actualBoundingBoxDescent:w,fontBoundingBoxAscent:A,fontBoundingBoxDescent:x,width:_}=d.measureText(t),S=1.5,C=Math.ceil(Math.max(Math.abs(g)+Math.abs(y)||0,_)*S),R=Math.ceil(Math.max(Math.abs(v)+Math.abs(w)||u,Math.abs(A)+Math.abs(x)||u)*S);h=new OffscreenCanvas(C,R),d=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),d.font=f,d.filter="grayscale(1)",d.fillStyle="white",d.fillRect(0,0,C,R),d.fillStyle="black",d.fillText(t,C*(S-1)/2,R*(3-S)/2);const T=b(this,gt,cf).call(this,d.getImageData(0,0,C,R).data),k=b(this,gt,Zm).call(this,T),I=b(this,gt,hf).call(this,k),D=b(this,gt,lf).call(this,T,C,R,I);return this.processDrawnLines({lines:{curves:D,width:C,height:R},pageWidth:n,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,e,s,i,n){const[a,o,l]=b(this,gt,Qm).call(this,t),[h,d]=b(this,gt,Jm).call(this,a,o,l,Math.hypot(o,l)*r(this,ca).sigmaSFactor,r(this,ca).sigmaR,r(this,ca).kernelSize),u=b(this,gt,hf).call(this,d),f=b(this,gt,lf).call(this,h,o,l,u);return this.processDrawnLines({lines:{curves:f,width:o,height:l},pageWidth:e,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:a,areContours:o}){i%180!==0&&([e,s]=[s,e]);const{curves:l,width:h,height:d}=t,u=t.thickness??0,f=[],g=Math.min(e/h,s/d),y=g/e,v=g/s,w=[];for(const{points:x}of l){const _=a?b(this,gt,Km).call(this,x):x;if(!_)continue;w.push(_);const S=_.length,C=new Float32Array(S),R=new Float32Array(3*(S===2?2:S-2));if(f.push({line:R,points:C}),S===2){C[0]=_[0]*y,C[1]=_[1]*v,R.set([NaN,NaN,NaN,NaN,C[0],C[1]],0);continue}let[T,k,I,D]=_;T*=y,k*=v,I*=y,D*=v,C.set([T,k,I,D],0),R.set([NaN,NaN,NaN,NaN,T,k],0);for(let N=4;N<S;N+=2){const Y=C[N]=_[N]*y,q=C[N+1]=_[N+1]*v;R.set(G.createBezierPoints(T,k,I,D,Y,q),(N-2)*3),[T,k,I,D]=[I,D,Y,q]}}if(f.length===0)return null;const A=o?new af:new uh;return A.build(f,e,s,1,i,o?0:u,n),{outline:A,newCurves:w,areContours:o,thickness:u,width:h,height:d}}static async compressSignature({outlines:t,areContours:e,thickness:s,width:i,height:n}){let a=1/0,o=-1/0,l=0;for(const _ of t){l+=_.length;for(let S=2,C=_.length;S<C;S++){const R=_[S]-_[S-2];a=Math.min(a,R),o=Math.max(o,R)}}let h;a>=-128&&o<=127?h=Int8Array:a>=-32768&&o<=32767?h=Int16Array:h=Int32Array;const d=t.length,u=xh+il*d,f=new Uint32Array(u);let g=0;f[g++]=u*Uint32Array.BYTES_PER_ELEMENT+(l-2*d)*h.BYTES_PER_ELEMENT,f[g++]=0,f[g++]=i,f[g++]=n,f[g++]=e?0:1,f[g++]=Math.max(0,Math.floor(s??0)),f[g++]=d,f[g++]=h.BYTES_PER_ELEMENT;for(const _ of t)f[g++]=_.length-2,f[g++]=_[0],f[g++]=_[1];const y=new CompressionStream("deflate-raw"),v=y.writable.getWriter();await v.ready,v.write(f);const w=h.prototype.constructor;for(const _ of t){const S=new w(_.length-2);for(let C=2,R=_.length;C<R;C++)S[C-2]=_[C]-_[C-2];v.write(S)}v.close();const A=await new Response(y.readable).arrayBuffer(),x=new Uint8Array(A);return Jp(x)}static async decompressSignature(t){try{const e=z0(t),{readable:s,writable:i}=new DecompressionStream("deflate-raw"),n=i.getWriter();await n.ready,n.write(e).then(async()=>{await n.ready,await n.close()}).catch(()=>{});let a=null,o=0;for await(const _ of s)a||(a=new Uint8Array(new Uint32Array(_.buffer,0,4)[0])),a.set(_,o),o+=_.length;const l=new Uint32Array(a.buffer,0,a.length>>2),h=l[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const d=l[2],u=l[3],f=l[4]===0,g=l[5],y=l[6],v=l[7],w=[],A=(xh+il*y)*Uint32Array.BYTES_PER_ELEMENT;let x;switch(v){case Int8Array.BYTES_PER_ELEMENT:x=new Int8Array(a.buffer,A);break;case Int16Array.BYTES_PER_ELEMENT:x=new Int16Array(a.buffer,A);break;case Int32Array.BYTES_PER_ELEMENT:x=new Int32Array(a.buffer,A);break}o=0;for(let _=0;_<y;_++){const S=l[il*_+xh],C=new Float32Array(S+2);w.push(C);for(let R=0;R<il-1;R++)C[R]=l[il*_+xh+R+1];for(let R=0;R<S;R++)C[R+2]=C[R]+x[o++]}return{areContours:f,thickness:g,outlines:w,width:d,height:u}}catch(e){return Z(`decompressSignature: ${e}`),null}}}ca=new WeakMap,gt=new WeakSet,of=function(t,e,s,i){return s-=t,i-=e,s===0?i>0?0:4:s===1?i+6:2-i},Gs=new WeakMap,Xm=function(t,e,s,i,n,a,o){const l=b(this,gt,of).call(this,s,i,n,a);for(let h=0;h<8;h++){const d=(-h+l-o+16)%8,u=r(this,Gs)[2*d],f=r(this,Gs)[2*d+1];if(t[(s+u)*e+(i+f)]!==0)return d}return-1},Ym=function(t,e,s,i,n,a,o){const l=b(this,gt,of).call(this,s,i,n,a);for(let h=0;h<8;h++){const d=(h+l+o+16)%8,u=r(this,Gs)[2*d],f=r(this,Gs)[2*d+1];if(t[(s+u)*e+(i+f)]!==0)return d}return-1},lf=function(t,e,s,i){const n=t.length,a=new Int32Array(n);for(let d=0;d<n;d++)a[d]=t[d]<=i?1:0;for(let d=1;d<s-1;d++)a[d*e]=a[d*e+e-1]=0;for(let d=0;d<e;d++)a[d]=a[e*s-1-d]=0;let o=1,l;const h=[];for(let d=1;d<s-1;d++){l=1;for(let u=1;u<e-1;u++){const f=d*e+u,g=a[f];if(g===0)continue;let y=d,v=u;if(g===1&&a[f-1]===0)o+=1,v-=1;else if(g>=1&&a[f+1]===0)o+=1,v+=1,g>1&&(l=g);else{g!==1&&(l=Math.abs(g));continue}const w=[u,d],A=v===u+1,x={isHole:A,points:w,id:o,parent:0};h.push(x);let _;for(const N of h)if(N.id===l){_=N;break}_?_.isHole?x.parent=A?_.parent:l:x.parent=A?l:_.parent:x.parent=A?l:0;const S=b(this,gt,Xm).call(this,a,e,d,u,y,v,0);if(S===-1){a[f]=-o,a[f]!==1&&(l=Math.abs(a[f]));continue}let C=r(this,Gs)[2*S],R=r(this,Gs)[2*S+1];const T=d+C,k=u+R;y=T,v=k;let I=d,D=u;for(;;){const N=b(this,gt,Ym).call(this,a,e,I,D,y,v,1);C=r(this,Gs)[2*N],R=r(this,Gs)[2*N+1];const Y=I+C,q=D+R;w.push(q,Y);const H=I*e+D;if(a[H+1]===0?a[H]=-o:a[H]===1&&(a[H]=o),Y===d&&q===u&&I===T&&D===k){a[f]!==1&&(l=Math.abs(a[f]));break}else y=I,v=D,I=Y,D=q}}}return h},qh=function(t,e,s,i){if(s-e<=4){for(let T=e;T<s-2;T+=2)i.push(t[T],t[T+1]);return}const n=t[e],a=t[e+1],o=t[s-4]-n,l=t[s-3]-a,h=Math.hypot(o,l),d=o/h,u=l/h,f=d*a-u*n,g=l/o,y=1/h,v=Math.atan(g),w=Math.cos(v),A=Math.sin(v),x=y*(Math.abs(w)+Math.abs(A)),_=y*(1-x+x**2),S=Math.max(Math.atan(Math.abs(A+w)*_),Math.atan(Math.abs(A-w)*_));let C=0,R=e;for(let T=e+2;T<s-2;T+=2){const k=Math.abs(f-d*t[T+1]+u*t[T]);k>C&&(R=T,C=k)}C>(h*S)**2?(b(this,gt,qh).call(this,t,e,R+2,i),b(this,gt,qh).call(this,t,R,s,i)):i.push(n,a)},Km=function(t){const e=[],s=t.length;return b(this,gt,qh).call(this,t,0,s,e),e.push(t[s-2],t[s-1]),e.length<=4?null:e},Jm=function(t,e,s,i,n,a){const o=new Float32Array(a**2),l=-2*i**2,h=a>>1;for(let v=0;v<a;v++){const w=(v-h)**2;for(let A=0;A<a;A++)o[v*a+A]=Math.exp((w+(A-h)**2)/l)}const d=new Float32Array(256),u=-2*n**2;for(let v=0;v<256;v++)d[v]=Math.exp(v**2/u);const f=t.length,g=new Uint8Array(f),y=new Uint32Array(256);for(let v=0;v<s;v++)for(let w=0;w<e;w++){const A=v*e+w,x=t[A];let _=0,S=0;for(let R=0;R<a;R++){const T=v+R-h;if(!(T<0||T>=s))for(let k=0;k<a;k++){const I=w+k-h;if(I<0||I>=e)continue;const D=t[T*e+I],N=o[R*a+k]*d[Math.abs(D-x)];_+=D*N,S+=N}}const C=g[A]=Math.round(_/S);y[C]++}return[g,y]},Zm=function(t){const e=new Uint32Array(256);for(const s of t)e[s]++;return e},cf=function(t){const e=t.length,s=new Uint8ClampedArray(e>>2);let i=-1/0,n=1/0;for(let o=0,l=s.length;o<l;o++){if(t[(o<<2)+3]===0){i=s[o]=255;continue}const d=s[o]=t[o<<2];d>i&&(i=d),d<n&&(n=d)}const a=255/(i-n);for(let o=0;o<e;o++)s[o]=(s[o]-n)*a;return s},hf=function(t){let e,s=-1/0,i=-1/0;const n=t.findIndex(l=>l!==0);let a=n,o=n;for(e=n;e<256;e++){const l=t[e];l>s&&(e-a>i&&(i=e-a,o=e-1),s=l,a=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e},Qm=function(t){const e=t,{width:s,height:i}=t,{maxDim:n}=r(this,ca);let a=s,o=i;if(s>n||i>n){let f=s,g=i,y=Math.log2(Math.max(s,i)/n);const v=Math.floor(y);y=y===v?v-1:v;for(let A=0;A<y;A++){a=Math.ceil(f/2),o=Math.ceil(g/2);const x=new OffscreenCanvas(a,o);x.getContext("2d").drawImage(t,0,0,f,g,0,0,a,o),f=a,g=o,t!==e&&t.close(),t=x.transferToImageBitmap()}const w=Math.min(n/a,n/o);a=Math.round(a*w),o=Math.round(o*w)}const h=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});h.filter="grayscale(1)",h.drawImage(t,0,0,t.width,t.height,0,0,a,o);const d=h.getImageData(0,0,a,o).data;return[b(this,gt,cf).call(this,d),a,o]},m(mi,gt),m(mi,ca,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),m(mi,Gs,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Nf extends zm{constructor(){super(),super.updateProperties({fill:kt._defaultLineColor,"stroke-width":0})}clone(){const t=new Nf;return t.updateAll(this),t}}class Ff extends Md{constructor(t){super(t),super.updateProperties({stroke:kt._defaultLineColor,"stroke-width":1})}clone(){const t=new Ff(this._viewParameters);return t.updateAll(this),t}}var Hn,ui,$n,ha;const Ye=class Ye extends nd{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});m(this,Hn,!1);m(this,ui,null);m(this,$n,null);m(this,ha,null);this._willKeepAspectRatio=!0,p(this,$n,e.signatureData||null),p(this,ui,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,s){kt.initialize(e,s),this._defaultDrawingOptions=new Nf,this._defaultDrawnSignatureOptions=new Ff(s.viewParameters)}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get supportMultipleDrawings(){return!1}static get typesMap(){return it(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!r(this,ui)}}static computeTelemetryFinalData(e){const s=e.get("hasDescription");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,s;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,e=this.x,s=this.y),super.render(),this._drawId===null)if(r(this,$n)){const{lines:n,mustSmooth:a,areContours:o,description:l,uuid:h,heightInPage:d}=r(this,$n),{rawDims:{pageWidth:u,pageHeight:f},rotation:g}=this.parent.viewport,y=mi.processDrawnLines({lines:n,pageWidth:u,pageHeight:f,rotation:g,innerMargin:Ye._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(y,d,l,h)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);return i&&(this._isCopy=!0,this._moveAfterPaste(e,s)),this.div}setUuid(e){p(this,ha,e),this.addEditToolbar()}getUuid(){return r(this,ha)}get description(){return r(this,ui)}set description(e){p(this,ui,e),super.addEditToolbar().then(s=>{s==null||s.updateEditSignatureButton(e)})}getSignaturePreview(){const{newCurves:e,areContours:s,thickness:i,width:n,height:a}=r(this,$n),o=Math.max(n,a),l=mi.processDrawnLines({lines:{curves:e.map(h=>({points:h})),thickness:i,width:n,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});return{areContours:s,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,s,i,n){const{x:a,y:o}=this,{outline:l}=p(this,$n,e);p(this,Hn,l instanceof af),this.description=i,this.div.setAttribute("data-l10n-args",JSON.stringify({description:i}));let h;r(this,Hn)?h=Ye.getDefaultDrawingOptions():(h=Ye._defaultDrawnSignatureOptions.clone(),h.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:h});const[d,u]=this.parentDimensions,[,f]=this.pageDimensions;let g=s/f;g=g>=1?.5:g,this.width*=g/this.height,this.width>=1&&(g*=.9/this.width,this.width=.9),this.height=g,this.setDims(d*this.width,u*this.height),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return mi.process(e,s,i,n,Ye._INNER_MARGIN)}getFromText(e,s){const{rawDims:{pageWidth:i,pageHeight:n},rotation:a}=this.parent.viewport;return mi.extractContoursFromText(e,s,i,n,a,Ye._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return mi.processDrawnLines({lines:e,pageWidth:s,pageHeight:i,rotation:n,innerMargin:Ye._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:s}){e?this._drawingOptions=Ye.getDefaultDrawingOptions():(this._drawingOptions=Ye._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":s}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:s,points:i,rect:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":a}}=this,o={annotationType:J.SIGNATURE,isSignature:!0,areContours:r(this,Hn),color:[0,0,0],thickness:r(this,Hn)?0:a,pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?(o.paths={lines:s,points:i},o.uuid=r(this,ha),o.isCopy=!0):o.lines=s,r(this,ui)&&(o.accessibilityData={type:"Figure",alt:r(this,ui)}),o}static deserializeDraw(e,s,i,n,a,o){return o.areContours?af.deserialize(e,s,i,n,a,o):uh.deserialize(e,s,i,n,a,o)}static async deserialize(e,s,i){var a;const n=await super.deserialize(e,s,i);return p(n,Hn,e.areContours),p(n,ui,((a=e.accessibilityData)==null?void 0:a.alt)||""),p(n,ha,e.uuid),n}};Hn=new WeakMap,ui=new WeakMap,$n=new WeakMap,ha=new WeakMap,L(Ye,"_type","signature"),L(Ye,"_editorType",J.SIGNATURE),L(Ye,"_defaultDrawingOptions",null);let df=Ye;var Ft,he,zn,Yi,Gn,Ho,Ki,da,fi,ls,$o,ht,Al,xl,Xh,Yh,Kh,ff,Jh,tb;class uf extends kt{constructor(e){super({...e,name:"stampEditor"});m(this,ht);m(this,Ft,null);m(this,he,null);m(this,zn,null);m(this,Yi,null);m(this,Gn,null);m(this,Ho,"");m(this,Ki,null);m(this,da,!1);m(this,fi,null);m(this,ls,!1);m(this,$o,!1);p(this,Yi,e.bitmapUrl),p(this,Gn,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,s){kt.initialize(e,s)}static isHandlingMimeForPasting(e){return td.includes(e)}static paste(e,s){s.pasteEditor({mode:J.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){const s=e.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(e=null,s=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:n,width:a,height:o,channels:n.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const h=l.output;return await this.setGuessedAltText(h),s&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var e;r(this,he)&&(p(this,Ft,null),this._uiManager.imageManager.deleteId(r(this,he)),(e=r(this,Ki))==null||e.remove(),p(this,Ki,null),r(this,fi)&&(clearTimeout(r(this,fi)),p(this,fi,null))),super.remove()}rebuild(){if(!this.parent){r(this,he)&&b(this,ht,Xh).call(this);return}super.rebuild(),this.div!==null&&(r(this,he)&&r(this,Ki)===null&&b(this,ht,Xh).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(r(this,zn)||r(this,Ft)||r(this,Yi)||r(this,Gn)||r(this,he)||r(this,da))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,s;return this._isCopy&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.createAltText(),r(this,da)||(r(this,Ft)?b(this,ht,Yh).call(this):b(this,ht,Xh).call(this)),this._isCopy&&this._moveAfterPaste(e,s),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,s){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(e,s);s.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(p(this,he,i),n&&p(this,Ft,n),p(this,da,!1),b(this,ht,Yh).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;r(this,fi)!==null&&clearTimeout(r(this,fi)),p(this,fi,setTimeout(()=>{p(this,fi,null),b(this,ht,ff).call(this)},200))}copyCanvas(e,s,i=!1){var g;e||(e=224);const{width:n,height:a}=r(this,Ft),o=new qs;let l=r(this,Ft),h=n,d=a,u=null;if(s){if(n>s||a>s){const k=Math.min(s/n,s/a);h=Math.floor(n*k),d=Math.floor(a*k)}u=document.createElement("canvas");const y=u.width=Math.ceil(h*o.sx),v=u.height=Math.ceil(d*o.sy);r(this,ls)||(l=b(this,ht,Kh).call(this,y,v));const w=u.getContext("2d");w.filter=this._uiManager.hcmFilter;let A="white",x="#cfcfd8";this._uiManager.hcmFilter!=="none"?x="black":(g=window.matchMedia)!=null&&g.call(window,"(prefers-color-scheme: dark)").matches&&(A="#8f8f9d",x="#42414d");const _=15,S=_*o.sx,C=_*o.sy,R=new OffscreenCanvas(S*2,C*2),T=R.getContext("2d");T.fillStyle=A,T.fillRect(0,0,S*2,C*2),T.fillStyle=x,T.fillRect(0,0,S,C),T.fillRect(S,C,S,C),w.fillStyle=w.createPattern(R,"repeat"),w.fillRect(0,0,y,v),w.drawImage(l,0,0,l.width,l.height,0,0,y,v)}let f=null;if(i){let y,v;if(o.symmetric&&l.width<e&&l.height<e)y=l.width,v=l.height;else if(l=r(this,Ft),n>e||a>e){const x=Math.min(e/n,e/a);y=Math.floor(n*x),v=Math.floor(a*x),r(this,ls)||(l=b(this,ht,Kh).call(this,y,v))}const A=new OffscreenCanvas(y,v).getContext("2d",{willReadFrequently:!0});A.drawImage(l,0,0,l.width,l.height,0,0,y,v),f={width:y,height:v,data:A.getImageData(0,0,y,v).data}}return{canvas:u,width:h,height:d,imageData:f}}static async deserialize(e,s,i){var w;let n=null,a=!1;if(e instanceof gm){const{data:{rect:A,rotation:x,id:_,structParent:S,popupRef:C},container:R,parent:{page:{pageNumber:T}},canvas:k}=e;let I,D;k?(delete e.canvas,{id:I,bitmap:D}=i.imageManager.getFromCanvas(R.id,k),k.remove()):(a=!0,e._hasNoCanvas=!0);const N=((w=await s._structTree.getAriaAttributes(`${_f}${_}`))==null?void 0:w.get("aria-label"))||"";n=e={annotationType:J.STAMP,bitmapId:I,bitmap:D,pageIndex:T-1,rect:A.slice(0),rotation:x,annotationElementId:_,id:_,deleted:!1,accessibilityData:{decorative:!1,altText:N},isSvg:!1,structParent:S,popupRef:C}}const o=await super.deserialize(e,s,i),{rect:l,bitmap:h,bitmapUrl:d,bitmapId:u,isSvg:f,accessibilityData:g}=e;a?(i.addMissingCanvas(e.id,o),p(o,da,!0)):u&&i.imageManager.isValidId(u)?(p(o,he,u),h&&p(o,Ft,h)):p(o,Yi,d),p(o,ls,f);const[y,v]=o.pageDimensions;return o.width=(l[2]-l[0])/y,o.height=(l[3]-l[1])/v,g&&(o.altTextData=g),o._initialData=n,p(o,$o,!!n),o}serialize(e=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:J.STAMP,bitmapId:r(this,he),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:r(this,ls),structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=b(this,ht,Jh).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=b(this,ht,tb).call(this,i);if(l.isSame)return null;l.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}if(i.id=this.annotationElementId,s===null)return i;s.stamps||(s.stamps=new Map);const o=r(this,ls)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(r(this,he)))s.stamps.set(r(this,he),{area:o,serialized:i}),i.bitmap=b(this,ht,Jh).call(this,!1);else if(r(this,ls)){const l=s.stamps.get(r(this,he));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=b(this,ht,Jh).call(this,!1))}return i}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}}Ft=new WeakMap,he=new WeakMap,zn=new WeakMap,Yi=new WeakMap,Gn=new WeakMap,Ho=new WeakMap,Ki=new WeakMap,da=new WeakMap,fi=new WeakMap,ls=new WeakMap,$o=new WeakMap,ht=new WeakSet,Al=function(e,s=!1){if(!e){this.remove();return}p(this,Ft,e.bitmap),s||(p(this,he,e.id),p(this,ls,e.isSvg)),e.file&&p(this,Ho,e.file.name),b(this,ht,Yh).call(this)},xl=function(){if(p(this,zn,null),this._uiManager.enableWaiting(!1),!!r(this,Ki)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Ft)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Ft)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},Xh=function(){if(r(this,he)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,he)).then(i=>b(this,ht,Al).call(this,i,!0)).finally(()=>b(this,ht,xl).call(this));return}if(r(this,Yi)){const i=r(this,Yi);p(this,Yi,null),this._uiManager.enableWaiting(!0),p(this,zn,this._uiManager.imageManager.getFromUrl(i).then(n=>b(this,ht,Al).call(this,n)).finally(()=>b(this,ht,xl).call(this)));return}if(r(this,Gn)){const i=r(this,Gn);p(this,Gn,null),this._uiManager.enableWaiting(!0),p(this,zn,this._uiManager.imageManager.getFromFile(i).then(n=>b(this,ht,Al).call(this,n)).finally(()=>b(this,ht,xl).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=td.join(",");const s=this._uiManager._signal;p(this,zn,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),b(this,ht,Al).call(this,n)}i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>b(this,ht,xl).call(this))),e.click()},Yh=function(){var u;const{div:e}=this;let{width:s,height:i}=r(this,Ft);const[n,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*a;else if(s>o*n||i>o*a){const f=Math.min(o*n/s,o*a/i);s*=f,i*=f}const[l,h]=this.parentDimensions;this.setDims(s*l/n,i*h/a),this._uiManager.enableWaiting(!1);const d=p(this,Ki,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),this.width=s/n,this.height=i/a,(u=this._initialOptions)!=null&&u.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),b(this,ht,ff).call(this),r(this,$o)||(this.parent.addUndoableEditor(this),p(this,$o,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,Ho)&&this.div.setAttribute("aria-description",r(this,Ho)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},Kh=function(e,s){const{width:i,height:n}=r(this,Ft);let a=i,o=n,l=r(this,Ft);for(;a>2*e||o>2*s;){const h=a,d=o;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*s&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const u=new OffscreenCanvas(a,o);u.getContext("2d").drawImage(l,0,0,h,d,0,0,a,o),l=u.transferToImageBitmap()}return l},ff=function(){const[e,s]=this.parentDimensions,{width:i,height:n}=this,a=new qs,o=Math.ceil(i*e*a.sx),l=Math.ceil(n*s*a.sy),h=r(this,Ki);if(!h||h.width===o&&h.height===l)return;h.width=o,h.height=l;const d=r(this,ls)?r(this,Ft):b(this,ht,Kh).call(this,o,l),u=h.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(d,0,0,d.width,d.height,0,0,o,l)},Jh=function(e){if(e){if(r(this,ls)){const n=this._uiManager.imageManager.getSvgUrl(r(this,he));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=r(this,Ft),s.getContext("2d").drawImage(r(this,Ft),0,0),s.toDataURL()}if(r(this,ls)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*nn.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*nn.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,Ft),0,0,r(this,Ft).width,r(this,Ft).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,Ft))},tb=function(e){var o;const{pageIndex:s,accessibilityData:{altText:i}}=this._initialData,n=e.pageIndex===s,a=(((o=e.accessibilityData)==null?void 0:o.alt)||"")===i;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&n&&a,isSameAltText:a}},L(uf,"_type","stamp"),L(uf,"_editorType",J.STAMP);var ua,zo,pi,Vn,Ji,cs,Un,Go,fa,Vs,Zi,de,Qi,Wn,Vo,U,qn,Ot,eb,Js,pf,gf,Zh;const Ls=class Ls{constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:a,drawLayer:o,textLayer:l,viewport:h,l10n:d}){m(this,Ot);m(this,ua);m(this,zo,!1);m(this,pi,null);m(this,Vn,null);m(this,Ji,null);m(this,cs,new Map);m(this,Un,!1);m(this,Go,!1);m(this,fa,!1);m(this,Vs,null);m(this,Zi,null);m(this,de,null);m(this,Qi,null);m(this,Wn,null);m(this,Vo,-1);m(this,U);const u=[...r(Ls,qn).values()];if(!Ls._initialized){Ls._initialized=!0;for(const f of u)f.initialize(d,t)}t.registerEditorTypes(u),p(this,U,t),this.pageIndex=e,this.div=s,p(this,ua,n),p(this,pi,a),this.viewport=h,p(this,de,l),this.drawLayer=o,this._structTree=i,r(this,U).addLayer(this)}get isEmpty(){return r(this,cs).size===0}get isInvisible(){return this.isEmpty&&r(this,U).getMode()===J.NONE}updateToolbar(t){r(this,U).updateToolbar(t)}updateMode(t=r(this,U).getMode()){switch(b(this,Ot,Zh).call(this),t){case J.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case J.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case J.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const s of r(Ls,qn).values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=r(this,de))==null?void 0:e.div)}setEditingState(t){r(this,U).setEditingState(t)}addCommands(t){r(this,U).addCommands(t)}cleanUndoStack(t){r(this,U).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=r(this,pi))==null||e.div.classList.toggle("disabled",!t)}async enable(){var s;p(this,fa,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),(s=r(this,Wn))==null||s.abort(),p(this,Wn,null);const t=new Set;for(const i of r(this,cs).values())i.enableEditing(),i.show(!0),i.annotationElementId&&(r(this,U).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));if(!r(this,pi)){p(this,fa,!1);return}const e=r(this,pi).getEditableAnnotations();for(const i of e){if(i.hide(),r(this,U).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;const n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}p(this,fa,!1)}disable(){var i;if(p(this,Go,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),r(this,de)&&!r(this,Wn)){p(this,Wn,new AbortController);const n=r(this,U).combinedSignal(r(this,Wn));r(this,de).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:h,timeStamp:d}=a,u=r(this,Vo);if(d-u>500){p(this,Vo,d);return}p(this,Vo,-1);const{classList:f}=this.div;f.toggle("getElements",!0);const g=document.elementsFromPoint(l,h);if(f.toggle("getElements",!1),!this.div.contains(g[0]))return;let y;const v=new RegExp(`^${Wp}[0-9]+$`);for(const A of g)if(v.test(A.id)){y=A.id;break}if(!y)return;const w=r(this,cs).get(y);(w==null?void 0:w.annotationElementId)===null&&(a.stopPropagation(),a.preventDefault(),w.dblclick())},{signal:n,capture:!0})}const t=new Map,e=new Map;for(const n of r(this,cs).values())if(n.disableEditing(),!!n.annotationElementId){if(n.serialize()!==null){t.set(n.annotationElementId,n);continue}else e.set(n.annotationElementId,n);(i=this.getEditableAnnotation(n.annotationElementId))==null||i.show(),n.remove()}if(r(this,pi)){const n=r(this,pi).getEditableAnnotations();for(const a of n){const{id:o}=a.data;if(r(this,U).isDeletedAnnotationElement(o))continue;let l=e.get(o);if(l){l.resetAnnotationElement(a),l.show(!1),a.show();continue}l=t.get(o),l&&(r(this,U).addChangedExistingAnnotation(l),l.renderAnnotationElement(a)&&l.show(!1)),a.show()}}b(this,Ot,Zh).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of r(Ls,qn).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),p(this,Go,!1)}getEditableAnnotation(t){var e;return((e=r(this,pi))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){r(this,U).getActive()!==t&&r(this,U).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=r(this,de))!=null&&t.div&&!r(this,Qi)){p(this,Qi,new AbortController);const e=r(this,U).combinedSignal(r(this,Qi));r(this,de).div.addEventListener("pointerdown",b(this,Ot,eb).bind(this),{signal:e}),r(this,de).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=r(this,de))!=null&&t.div&&r(this,Qi)&&(r(this,Qi).abort(),p(this,Qi,null),r(this,de).div.classList.remove("highlighting"))}enableClick(){if(r(this,Vn))return;p(this,Vn,new AbortController);const t=r(this,U).combinedSignal(r(this,Vn));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;(t=r(this,Vn))==null||t.abort(),p(this,Vn,null)}attach(t){r(this,cs).set(t.id,t);const{annotationElementId:e}=t;e&&r(this,U).isDeletedAnnotationElement(e)&&r(this,U).removeDeletedAnnotationElement(t)}detach(t){var e;r(this,cs).delete(t.id),(e=r(this,ua))==null||e.removePointerInTextLayer(t.contentDiv),!r(this,Go)&&t.annotationElementId&&r(this,U).addDeletedAnnotationElement(t)}remove(t){this.detach(t),r(this,U).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(r(this,U).addDeletedAnnotationElement(t.annotationElementId),kt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),r(this,U).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!r(this,fa)),r(this,U).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!r(this,Ji)&&(t._focusEventsAllowed=!1,p(this,Ji,setTimeout(()=>{p(this,Ji,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:r(this,U)._signal}),e.focus())},0))),t._structTreeParentId=(s=r(this,ua))==null?void 0:s.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getNextId(){return r(this,U).getId()}combinedSignal(t){return r(this,U).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=r(this,Ot,Js))==null?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await r(this,U).updateMode(t.mode);const{offsetX:s,offsetY:i}=b(this,Ot,gf).call(this),n=this.getNextId(),a=b(this,Ot,pf).call(this,{parent:this,id:n,x:s,y:i,uiManager:r(this,U),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){var e;return await((e=r(Ls,qn).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,r(this,U)))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=b(this,Ot,pf).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:r(this,U),isCentered:e,...s});return n&&this.add(n),n}addNewEditor(t={}){this.createAndAddNewEditor(b(this,Ot,gf).call(this),!0,t)}setSelected(t){r(this,U).setSelected(t)}toggleSelected(t){r(this,U).toggleSelected(t)}unselect(t){r(this,U).unselect(t)}pointerup(t){var i;const{isMac:e}=ue.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!r(this,Un)||(p(this,Un,!1),(i=r(this,Ot,Js))!=null&&i.isDrawer&&r(this,Ot,Js).supportMultipleDrawings))return;if(!r(this,zo)){p(this,zo,!0);return}const s=r(this,U).getMode();if(s===J.STAMP||s===J.SIGNATURE){r(this,U).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){var i;if(r(this,U).getMode()===J.HIGHLIGHT&&this.enableTextSelection(),r(this,Un)){p(this,Un,!1);return}const{isMac:e}=ue.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(p(this,Un,!0),(i=r(this,Ot,Js))!=null&&i.isDrawer){this.startDrawingSession(t);return}const s=r(this,U).getActive();p(this,zo,!s||s.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),r(this,Vs)){r(this,Ot,Js).startDrawing(this,r(this,U),!1,t);return}r(this,U).setCurrentDrawingSession(this),p(this,Vs,new AbortController);const e=r(this,U).combinedSignal(r(this,Vs));this.div.addEventListener("blur",({relatedTarget:s})=>{s&&!this.div.contains(s)&&(p(this,Zi,null),this.commitOrRemove())},{signal:e}),r(this,Ot,Js).startDrawing(this,r(this,U),!1,t)}pause(t){if(t){const{activeElement:e}=document;this.div.contains(e)&&p(this,Zi,e);return}r(this,Zi)&&setTimeout(()=>{var e;(e=r(this,Zi))==null||e.focus(),p(this,Zi,null)},0)}endDrawingSession(t=!1){return r(this,Vs)?(r(this,U).setCurrentDrawingSession(null),r(this,Vs).abort(),p(this,Vs,null),p(this,Zi,null),r(this,Ot,Js).endDrawing(t)):null}findNewParent(t,e,s){const i=r(this,U).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return r(this,Vs)?(this.endDrawingSession(),!0):!1}onScaleChanging(){r(this,Vs)&&r(this,Ot,Js).onScaleChangingWhenDrawing(this)}destroy(){var t,e;this.commitOrRemove(),((t=r(this,U).getActive())==null?void 0:t.parent)===this&&(r(this,U).commitOrRemove(),r(this,U).setActiveEditor(null)),r(this,Ji)&&(clearTimeout(r(this,Ji)),p(this,Ji,null));for(const s of r(this,cs).values())(e=r(this,ua))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,r(this,cs).clear(),r(this,U).removeLayer(this)}render({viewport:t}){this.viewport=t,Xn(this.div,t);for(const e of r(this,U).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){r(this,U).commitOrRemove(),b(this,Ot,Zh).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,Xn(this.div,{rotation:s}),e!==s)for(const i of r(this,cs).values())i.rotate(s)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return r(this,U).viewParameters.realScale}};ua=new WeakMap,zo=new WeakMap,pi=new WeakMap,Vn=new WeakMap,Ji=new WeakMap,cs=new WeakMap,Un=new WeakMap,Go=new WeakMap,fa=new WeakMap,Vs=new WeakMap,Zi=new WeakMap,de=new WeakMap,Qi=new WeakMap,Wn=new WeakMap,Vo=new WeakMap,U=new WeakMap,qn=new WeakMap,Ot=new WeakSet,eb=function(t){r(this,U).unselectAll();const{target:e}=t;if(e===r(this,de).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&r(this,de).div.contains(e)){const{isMac:s}=ue.platform;if(t.button!==0||t.ctrlKey&&s)return;r(this,U).showAllEditors("highlight",!0,!0),r(this,de).div.classList.add("free"),this.toggleDrawing(),id.startHighlighting(this,r(this,U).direction==="ltr",{target:r(this,de).div,x:t.x,y:t.y}),r(this,de).div.addEventListener("pointerup",()=>{r(this,de).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:r(this,U)._signal}),t.preventDefault()}},Js=function(){return r(Ls,qn).get(r(this,U).getMode())},pf=function(t){const e=r(this,Ot,Js);return e?new e.prototype.constructor(t):null},gf=function(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+s),l=Math.min(window.innerHeight,e+i),h=(n+o)/2-t,d=(a+l)/2-e,[u,f]=this.viewport.rotation%180===0?[h,d]:[d,h];return{offsetX:u,offsetY:f}},Zh=function(){for(const t of r(this,cs).values())t.isEmpty()&&t.remove()},L(Ls,"_initialized",!1),m(Ls,qn,new Map([Uu,rf,uf,id,df].map(t=>[t._editorType,t])));let rd=Ls;var Us,Oe,pa,rh,Sd,sb,bi,mf,ib,bf;const ee=class ee{constructor({pageIndex:t}){m(this,bi);m(this,Us,null);m(this,Oe,new Map);m(this,pa,new Map);this.pageIndex=t}setParent(t){if(!r(this,Us)){p(this,Us,t);return}if(r(this,Us)!==t){if(r(this,Oe).size>0)for(const e of r(this,Oe).values())e.remove(),t.append(e);p(this,Us,t)}}static get _svgFactory(){return it(this,"_svgFactory",new kl)}draw(t,e=!1,s=!1){const i=Me(ee,rh)._++,n=b(this,bi,mf).call(this),a=ee._svgFactory.createElement("defs");n.append(a);const o=ee._svgFactory.createElement("path");a.append(o);const l=`path_p${this.pageIndex}_${i}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&r(this,pa).set(i,o);const h=s?b(this,bi,ib).call(this,a,l):null,d=ee._svgFactory.createElement("use");return n.append(d),d.setAttribute("href",`#${l}`),this.updateProperties(n,t),r(this,Oe).set(i,n),{id:i,clipPathId:`url(#${h})`}}drawOutline(t,e){const s=Me(ee,rh)._++,i=b(this,bi,mf).call(this),n=ee._svgFactory.createElement("defs");i.append(n);const a=ee._svgFactory.createElement("path");n.append(a);const o=`path_p${this.pageIndex}_${s}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){const u=ee._svgFactory.createElement("mask");n.append(u),l=`mask_p${this.pageIndex}_${s}`,u.setAttribute("id",l),u.setAttribute("maskUnits","objectBoundingBox");const f=ee._svgFactory.createElement("rect");u.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const g=ee._svgFactory.createElement("use");u.append(g),g.setAttribute("href",`#${o}`),g.setAttribute("stroke","none"),g.setAttribute("fill","black"),g.setAttribute("fill-rule","nonzero"),g.classList.add("mask")}const h=ee._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${o}`),l&&h.setAttribute("mask",`url(#${l})`);const d=h.cloneNode();return i.append(d),h.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(i,t),r(this,Oe).set(s,i),s}finalizeDraw(t,e){r(this,pa).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var l;if(!e)return;const{root:s,bbox:i,rootClass:n,path:a}=e,o=typeof t=="number"?r(this,Oe).get(t):t;if(o){if(s&&b(this,bi,bf).call(this,o,s),i&&b(l=ee,Sd,sb).call(l,o,i),n){const{classList:h}=o;for(const[d,u]of Object.entries(n))h.toggle(d,u)}if(a){const d=o.firstChild.firstChild;b(this,bi,bf).call(this,d,a)}}}updateParent(t,e){if(e===this)return;const s=r(this,Oe).get(t);s&&(r(e,Us).append(s),r(this,Oe).delete(t),r(e,Oe).set(t,s))}remove(t){r(this,pa).delete(t),r(this,Us)!==null&&(r(this,Oe).get(t).remove(),r(this,Oe).delete(t))}destroy(){p(this,Us,null);for(const t of r(this,Oe).values())t.remove();r(this,Oe).clear(),r(this,pa).clear()}};Us=new WeakMap,Oe=new WeakMap,pa=new WeakMap,rh=new WeakMap,Sd=new WeakSet,sb=function(t,[e,s,i,n]){const{style:a}=t;a.top=`${100*s}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*n}%`},bi=new WeakSet,mf=function(){const t=ee._svgFactory.create(1,1,!0);return r(this,Us).append(t),t.setAttribute("aria-hidden",!0),t},ib=function(t,e){const s=ee._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=ee._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i},bf=function(t,e){for(const[s,i]of Object.entries(e))i===null?t.removeAttribute(s):t.setAttribute(s,i)},m(ee,Sd),m(ee,rh,0);let ad=ee;globalThis._pdfjsTestingUtils={HighlightOutliner:qu};globalThis.pdfjsLib={AbortException:sn,AnnotationEditorLayer:rd,AnnotationEditorParamsType:rt,AnnotationEditorType:J,AnnotationEditorUIManager:Yn,AnnotationLayer:Df,AnnotationMode:gi,AnnotationType:Vt,build:im,ColorPicker:Il,createValidAbsoluteUrl:Af,DOMSVGFactory:kl,DrawLayer:ad,FeatureTest:ue,fetchData:Xo,getDocument:Pf,getFilenameFromUrl:Zp,getPdfFilenameFromUrl:Qp,getUuid:Ef,getXfaPageViewport:tg,GlobalWorkerOptions:Ss,ImageKind:_l,InvalidPDFException:Qh,isDataScheme:ch,isPdfFile:Pd,isValidExplicitDest:Dg,MathClamp:Te,noContextMenu:Rs,normalizeUnicode:Kp,OPS:Sl,OutputScale:qs,PasswordResponses:Xp,PDFDataRangeTransport:kf,PDFDateString:kd,PDFWorker:Uo,PermissionFlag:qp,PixelsPerInch:nn,RenderingCancelledException:Rd,ResponseException:Cl,setLayerDimensions:Xn,shadow:it,SignatureExtractor:mi,stopEvent:qt,SupportedImageMimeTypes:td,TextLayer:Rl,TouchManager:Tl,updateUrlHash:xf,Util:W,VerbosityLevel:ah,version:If,XfaLayer:Mf};const fv=Object.freeze(Object.defineProperty({__proto__:null,AbortException:sn,AnnotationEditorLayer:rd,AnnotationEditorParamsType:rt,AnnotationEditorType:J,AnnotationEditorUIManager:Yn,AnnotationLayer:Df,AnnotationMode:gi,AnnotationType:Vt,ColorPicker:Il,DOMSVGFactory:kl,DrawLayer:ad,FeatureTest:ue,GlobalWorkerOptions:Ss,ImageKind:_l,InvalidPDFException:Qh,MathClamp:Te,OPS:Sl,OutputScale:qs,PDFDataRangeTransport:kf,PDFDateString:kd,PDFWorker:Uo,PasswordResponses:Xp,PermissionFlag:qp,PixelsPerInch:nn,RenderingCancelledException:Rd,ResponseException:Cl,SignatureExtractor:mi,SupportedImageMimeTypes:td,TextLayer:Rl,TouchManager:Tl,Util:W,VerbosityLevel:ah,XfaLayer:Mf,build:im,createValidAbsoluteUrl:Af,fetchData:Xo,getDocument:Pf,getFilenameFromUrl:Zp,getPdfFilenameFromUrl:Qp,getUuid:Ef,getXfaPageViewport:tg,isDataScheme:ch,isPdfFile:Pd,isValidExplicitDest:Dg,noContextMenu:Rs,normalizeUnicode:Kp,setLayerDimensions:Xn,shadow:it,stopEvent:qt,updateUrlHash:xf,version:If},Symbol.toStringTag,{value:"Module"}));function nb(c){var t,e,s="";if(typeof c=="string"||typeof c=="number")s+=c;else if(typeof c=="object")if(Array.isArray(c)){var i=c.length;for(t=0;t<i;t++)c[t]&&(e=nb(c[t]))&&(s&&(s+=" "),s+=e)}else for(e in c)c[e]&&(s&&(s+=" "),s+=e);return s}function Ld(){for(var c,t,e=0,s="",i=arguments.length;e<i;e++)(c=arguments[e])&&(t=nb(c))&&(s&&(s+=" "),s+=t);return s}var Ap=Object.prototype.hasOwnProperty;function xp(c,t,e){for(e of c.keys())if(Fa(e,t))return e}function Fa(c,t){var e,s,i;if(c===t)return!0;if(c&&t&&(e=c.constructor)===t.constructor){if(e===Date)return c.getTime()===t.getTime();if(e===RegExp)return c.toString()===t.toString();if(e===Array){if((s=c.length)===t.length)for(;s--&&Fa(c[s],t[s]););return s===-1}if(e===Set){if(c.size!==t.size)return!1;for(s of c)if(i=s,i&&typeof i=="object"&&(i=xp(t,i),!i)||!t.has(i))return!1;return!0}if(e===Map){if(c.size!==t.size)return!1;for(s of c)if(i=s[0],i&&typeof i=="object"&&(i=xp(t,i),!i)||!Fa(s[1],t.get(i)))return!1;return!0}if(e===ArrayBuffer)c=new Uint8Array(c),t=new Uint8Array(t);else if(e===DataView){if((s=c.byteLength)===t.byteLength)for(;s--&&c.getInt8(s)===t.getInt8(s););return s===-1}if(ArrayBuffer.isView(c)){if((s=c.byteLength)===t.byteLength)for(;s--&&c[s]===t[s];);return s===-1}if(!e||typeof c=="object"){s=0;for(e in c)if(Ap.call(c,e)&&++s&&!Ap.call(t,e)||!(e in t)||!Fa(c[e],t[e]))return!1;return Object.keys(t).length===s}}return c!==c&&t!==t}function fh(c){let t=!1;return{promise:new Promise((s,i)=>{c.then(n=>!t&&s(n)).catch(n=>!t&&i(n))}),cancel(){t=!0}}}const pv=["onCopy","onCut","onPaste"],gv=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],mv=["onFocus","onBlur"],bv=["onInput","onInvalid","onReset","onSubmit"],yv=["onLoad","onError"],vv=["onKeyDown","onKeyPress","onKeyUp"],wv=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],Av=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],xv=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],Ev=["onSelect"],_v=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],Sv=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],Cv=["onScroll"],Tv=["onWheel"],Rv=["onAnimationStart","onAnimationEnd","onAnimationIteration"],Pv=["onTransitionEnd"],kv=["onToggle"],Iv=["onChange"],Mv=[...pv,...gv,...mv,...bv,...yv,...vv,...wv,...Av,...xv,...Ev,..._v,...Sv,...Cv,...Tv,...Rv,...Pv,...Iv,...kv];function rb(c,t){const e={};for(const s of Mv){const i=c[s];i&&(t?e[s]=n=>i(n,t(s)):e[s]=i)}return e}var Lv=process.env.NODE_ENV==="production",eu="Invariant failed";function Ct(c,t){if(!c){if(Lv)throw new Error(eu);var e=typeof t=="function"?t():t,s=e?"".concat(eu,": ").concat(e):eu;throw new Error(s)}}var Dv=process.env.NODE_ENV!=="production",ab=function(){};if(Dv){var Nv=function(t,e){var s=arguments.length;e=new Array(s>1?s-1:0);for(var i=1;i<s;i++)e[i-1]=arguments[i];var n=0,a="Warning: "+t.replace(/%s/g,function(){return e[n++]});typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}};ab=function(c,t,e){var s=arguments.length;e=new Array(s>2?s-2:0);for(var i=2;i<s;i++)e[i-2]=arguments[i];if(t===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");c||Nv.apply(null,[t].concat(e))}}var Fv=ab;const Re=jb(Fv),ob=B.createContext(null),Ov="noopener noreferrer nofollow";class Bv{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Ct(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){Ct(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise(e=>{Ct(this.pdfDocument,"PDF document not loaded."),Ct(t,"Destination is not specified."),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{Ct(Array.isArray(e),`"${e}" is not a valid destination array.`);const s=e[0];new Promise(i=>{Ct(this.pdfDocument,"PDF document not loaded."),s instanceof Object?this.pdfDocument.getPageIndex(s).then(n=>{i(n)}).catch(()=>{Ct(!1,`"${s}" is not a valid page reference.`)}):typeof s=="number"?i(s):Ct(!1,`"${s}" is not a valid destination reference.`)}).then(i=>{const n=i+1;Ct(this.pdfViewer,"PDF viewer is not initialized."),Ct(n>=1&&n<=this.pagesCount,`"${n}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:n})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;Ct(this.pdfViewer,"PDF viewer is not initialized."),Ct(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||Ov,t.target=s?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}function Oa({children:c,type:t}){return P.jsx("div",{className:`react-pdf__message react-pdf__message--${t}`,children:c})}const Ep={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function jv(c,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return c}}function Wo(){return B.useReducer(jv,{value:void 0,error:void 0})}const Dd=typeof window<"u",lb=Dd&&window.location.protocol==="file:";function Hv(c){return typeof c<"u"}function tr(c){return Hv(c)&&c!==null}function $v(c){return typeof c=="string"}function zv(c){return c instanceof ArrayBuffer}function Gv(c){return Ct(Dd,"isBlob can only be used in a browser environment"),c instanceof Blob}function yf(c){return $v(c)&&/^data:/.test(c)}function _p(c){Ct(yf(c),"Invalid data URI.");const[t="",e=""]=c.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function Vv(){return Dd&&window.devicePixelRatio||1}const cb="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Sp(){Re(!lb,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${cb}`)}function Uv(){Re(!lb,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${cb}`)}function ba(c){c!=null&&c.cancel&&c.cancel()}function vf(c,t){return Object.defineProperty(c,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(c,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(c,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(c,"originalHeight",{get(){return this.view[3]},configurable:!0}),c}function Wv(c){return c.name==="RenderingCancelledException"}function qv(c){return new Promise((t,e)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return e(new Error("Error while reading a file."));t(s.result)},s.onerror=i=>{if(!i.target)return e(new Error("Error while reading a file."));const{error:n}=i.target;if(!n)return e(new Error("Error while reading a file."));switch(n.code){case n.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case n.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case n.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},s.readAsArrayBuffer(c)})}const{PDFDataRangeTransport:Xv}=fv,Yv=(c,t)=>{switch(t){case Ep.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");c(e);break}case Ep.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");c(e);break}}};function Cp(c){return typeof c=="object"&&c!==null&&("data"in c||"range"in c||"url"in c)}const Kv=B.forwardRef(function({children:t,className:e,error:s="Failed to load PDF file.",externalLinkRel:i,externalLinkTarget:n,file:a,inputRef:o,imageResourcesPath:l,loading:h="Loading PDF…",noData:d="No PDF file specified.",onItemClick:u,onLoadError:f,onLoadProgress:g,onLoadSuccess:y,onPassword:v=Yv,onSourceError:w,onSourceSuccess:A,options:x,renderMode:_,rotate:S,scale:C,...R},T){const[k,I]=Wo(),{value:D,error:N}=k,[Y,q]=Wo(),{value:H,error:st}=Y,F=B.useRef(new Bv),O=B.useRef([]),yt=B.useRef(void 0),Tt=B.useRef(void 0);a&&a!==yt.current&&Cp(a)&&(Re(!Fa(a,yt.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),yt.current=a),x&&x!==Tt.current&&(Re(!Fa(x,Tt.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),Tt.current=x);const zt=B.useRef({scrollPageIntoView:ot=>{const{dest:Rt,pageNumber:It,pageIndex:Mt=It-1}=ot;if(u){u({dest:Rt,pageIndex:Mt,pageNumber:It});return}const yi=O.current[Mt];if(yi){yi.scrollIntoView();return}Re(!1,`An internal link leading to page ${It} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});B.useImperativeHandle(T,()=>({linkService:F,pages:O,viewer:zt}),[]);function mt(){A&&A()}function _t(){N&&(Re(!1,N.toString()),w&&w(N))}function ft(){I({type:"RESET"})}B.useEffect(ft,[a,I]);const we=B.useCallback(async()=>{if(!a)return null;if(typeof a=="string")return yf(a)?{data:_p(a)}:(Sp(),{url:a});if(a instanceof Xv)return{range:a};if(zv(a))return{data:a};if(Dd&&Gv(a))return{data:await qv(a)};if(Ct(typeof a=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),Ct(Cp(a),"Invalid parameter object: need either .data, .range or .url"),"url"in a&&typeof a.url=="string"){if(yf(a.url)){const{url:ot,...Rt}=a;return{data:_p(ot),...Rt}}Sp()}return a},[a]);B.useEffect(()=>{const ot=fh(we());return ot.promise.then(Rt=>{I({type:"RESOLVE",value:Rt})}).catch(Rt=>{I({type:"REJECT",error:Rt})}),()=>{ba(ot)}},[we,I]),B.useEffect(()=>{if(!(typeof D>"u")){if(D===!1){_t();return}mt()}},[D]);function Ae(){H&&(y&&y(H),O.current=new Array(H.numPages),F.current.setDocument(H))}function te(){st&&(Re(!1,st.toString()),f&&f(st))}B.useEffect(function(){q({type:"RESET"})},[q,D]),B.useEffect(function(){if(!D)return;const Rt=x?{...D,...x}:D,It=Pf(Rt);g&&(It.onProgress=g),v&&(It.onPassword=v);const Mt=It,yi=Mt.promise.then(an=>{q({type:"RESOLVE",value:an})}).catch(an=>{Mt.destroyed||q({type:"REJECT",error:an})});return()=>{yi.finally(()=>Mt.destroy())}},[x,q,D]),B.useEffect(()=>{if(!(typeof H>"u")){if(H===!1){te();return}Ae()}},[H]),B.useEffect(function(){F.current.setViewer(zt.current),F.current.setExternalLinkRel(i),F.current.setExternalLinkTarget(n)},[i,n]);const dt=B.useCallback((ot,Rt)=>{O.current[ot]=Rt},[]),Pe=B.useCallback(ot=>{delete O.current[ot]},[]),ke=B.useMemo(()=>({imageResourcesPath:l,linkService:F.current,onItemClick:u,pdf:H,registerPage:dt,renderMode:_,rotate:S,scale:C,unregisterPage:Pe}),[l,u,H,dt,_,S,C,Pe]),vt=B.useMemo(()=>rb(R,()=>H),[R,H]);function Ps(){function ot(It){return!!(It!=null&&It.pdf)}if(!ot(ke))throw new Error("pdf is undefined");const Rt=typeof t=="function"?t(ke):t;return P.jsx(ob.Provider,{value:ke,children:Rt})}function ps(){return a?H==null?P.jsx(Oa,{type:"loading",children:typeof h=="function"?h():h}):H===!1?P.jsx(Oa,{type:"error",children:typeof s=="function"?s():s}):Ps():P.jsx(Oa,{type:"no-data",children:typeof d=="function"?d():d})}return P.jsx("div",{className:Ld("react-pdf__Document",e),ref:o,...vt,children:ps()})});function hb(){return B.useContext(ob)}function db(){for(var c=[],t=0;t<arguments.length;t++)c[t]=arguments[t];var e=c.filter(Boolean);if(e.length<=1){var s=e[0];return s||null}return function(n){for(var a=0,o=e;a<o.length;a++){var l=o[a];typeof l=="function"?l(n):l&&(l.current=n)}}}const ub=B.createContext(null);function Nd(){return B.useContext(ub)}function Jv(){const c=hb(),t=Nd();Ct(t,"Unable to find Page context.");const e={...c,...t},{imageResourcesPath:s,linkService:i,onGetAnnotationsError:n,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:h,pdf:d,renderForms:u,rotate:f,scale:g=1}=e;Ct(d,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Ct(h,"Attempted to load page annotations, but no page was specified."),Ct(i,"Attempted to load page annotations, but no linkService was specified.");const[y,v]=Wo(),{value:w,error:A}=y,x=B.useRef(null);Re(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function _(){w&&a&&a(w)}function S(){A&&(Re(!1,A.toString()),n&&n(A))}B.useEffect(function(){v({type:"RESET"})},[v,h]),B.useEffect(function(){if(!h)return;const I=fh(h.getAnnotations()),D=I;return I.promise.then(N=>{v({type:"RESOLVE",value:N})}).catch(N=>{v({type:"REJECT",error:N})}),()=>{ba(D)}},[v,h]),B.useEffect(()=>{if(w!==void 0){if(w===!1){S();return}_()}},[w]);function C(){l&&l()}function R(k){Re(!1,`${k}`),o&&o(k)}const T=B.useMemo(()=>h.getViewport({scale:g,rotation:f}),[h,f,g]);return B.useEffect(function(){if(!d||!h||!i||!w)return;const{current:I}=x;if(!I)return;const D=T.clone({dontFlip:!0}),N={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:I,l10n:null,page:h,structTreeLayer:null,viewport:D},Y={annotations:w,annotationStorage:d.annotationStorage,div:I,imageResourcesPath:s,linkService:i,page:h,renderForms:u,viewport:D};I.innerHTML="";try{new Df(N).render(Y),C()}catch(q){R(q)}return()=>{}},[w,s,i,h,d,u,T]),P.jsx("div",{className:Ld("react-pdf__Page__annotations","annotationLayer"),ref:x})}const fb={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Zv=/^H(\d+)$/;function Qv(c){return c in fb}function Fd(c){return"children"in c}function pb(c){return Fd(c)?c.children.length===1&&0 in c.children&&"id"in c.children[0]:!1}function tw(c){const t={};if(Fd(c)){const{role:e}=c,s=e.match(Zv);if(s)t.role="heading",t["aria-level"]=Number(s[1]);else if(Qv(e)){const i=fb[e];i&&(t.role=i)}}return t}function gb(c){const t={};if(Fd(c)){if(c.alt!==void 0&&(t["aria-label"]=c.alt),c.lang!==void 0&&(t.lang=c.lang),pb(c)){const[e]=c.children;if(e){const s=gb(e);return{...t,...s}}}}else"id"in c&&(t["aria-owns"]=c.id);return t}function ew(c){return c?{...tw(c),...gb(c)}:null}function mb({className:c,node:t}){const e=B.useMemo(()=>ew(t),[t]),s=B.useMemo(()=>!Fd(t)||pb(t)?null:t.children.map((i,n)=>P.jsx(mb,{node:i},n)),[t]);return P.jsx("span",{className:c,...e,children:s})}function sw(){const c=Nd();Ct(c,"Unable to find Page context.");const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=c,[s,i]=Wo(),{value:n,error:a}=s,{customTextRenderer:o,page:l}=c;function h(){n&&e&&e(n)}function d(){a&&(Re(!1,a.toString()),t&&t(a))}return B.useEffect(function(){i({type:"RESET"})},[i,l]),B.useEffect(function(){if(o||!l)return;const f=fh(l.getStructTree()),g=f;return f.promise.then(y=>{i({type:"RESOLVE",value:y})}).catch(y=>{i({type:"REJECT",error:y})}),()=>ba(g)},[o,l,i]),B.useEffect(()=>{if(n!==void 0){if(n===!1){d();return}h()}},[n]),n?P.jsx(mb,{className:"react-pdf__Page__structTree structTree",node:n}):null}const Tp=gi;function iw(c){const t=Nd();Ct(t,"Unable to find Page context.");const e={...t,...c},{_className:s,canvasBackground:i,devicePixelRatio:n=Vv(),onRenderError:a,onRenderSuccess:o,page:l,renderForms:h,renderTextLayer:d,rotate:u,scale:f}=e,{canvasRef:g}=c;Ct(l,"Attempted to render page canvas, but no page was specified.");const y=B.useRef(null);function v(){l&&o&&o(vf(l,f))}function w(S){Wv(S)||(Re(!1,S.toString()),a&&a(S))}const A=B.useMemo(()=>l.getViewport({scale:f*n,rotation:u}),[n,l,u,f]),x=B.useMemo(()=>l.getViewport({scale:f,rotation:u}),[l,u,f]);B.useEffect(function(){if(!l)return;l.cleanup();const{current:C}=y;if(!C)return;C.width=A.width,C.height=A.height,C.style.width=`${Math.floor(x.width)}px`,C.style.height=`${Math.floor(x.height)}px`,C.style.visibility="hidden";const R={annotationMode:h?Tp.ENABLE_FORMS:Tp.ENABLE,canvasContext:C.getContext("2d",{alpha:!1}),viewport:A};i&&(R.background=i);const T=l.render(R),k=T;return T.promise.then(()=>{C.style.visibility="",v()}).catch(w),()=>ba(k)},[i,l,h,A,x]);const _=B.useCallback(()=>{const{current:S}=y;S&&(S.width=0,S.height=0)},[]);return B.useEffect(()=>_,[_]),P.jsx("canvas",{className:`${s}__canvas`,dir:"ltr",ref:db(g,y),style:{display:"block",userSelect:"none"},children:d?P.jsx(sw,{}):null})}function nw(c){return"str"in c}function rw(){const c=Nd();Ct(c,"Unable to find Page context.");const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:s,onRenderTextLayerError:i,onRenderTextLayerSuccess:n,page:a,pageIndex:o,pageNumber:l,rotate:h,scale:d}=c;Ct(a,"Attempted to load page text content, but no page was specified.");const[u,f]=Wo(),{value:g,error:y}=u,v=B.useRef(null);Re(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function w(){g&&s&&s(g)}function A(){y&&(Re(!1,y.toString()),e&&e(y))}B.useEffect(function(){f({type:"RESET"})},[a,f]),B.useEffect(function(){if(!a)return;const k=fh(a.getTextContent()),I=k;return k.promise.then(D=>{f({type:"RESOLVE",value:D})}).catch(D=>{f({type:"REJECT",error:D})}),()=>ba(I)},[a,f]),B.useEffect(()=>{if(g!==void 0){if(g===!1){A();return}w()}},[g]);const x=B.useCallback(()=>{n&&n()},[n]),_=B.useCallback(T=>{Re(!1,T.toString()),i&&i(T)},[i]);function S(){const T=v.current;T&&T.classList.add("selecting")}function C(){const T=v.current;T&&T.classList.remove("selecting")}const R=B.useMemo(()=>a.getViewport({scale:d,rotation:h}),[a,h,d]);return B.useLayoutEffect(function(){if(!a||!g)return;const{current:k}=v;if(!k)return;k.innerHTML="";const I=a.streamTextContent({includeMarkedContent:!0}),D={container:k,textContentSource:I,viewport:R},N=new Rl(D),Y=N;return N.render().then(()=>{const q=document.createElement("div");q.className="endOfContent",k.append(q);const H=k.querySelectorAll('[role="presentation"]');if(t){let st=0;g.items.forEach((F,O)=>{if(!nw(F))return;const yt=H[st];if(!yt)return;const Tt=t({pageIndex:o,pageNumber:l,itemIndex:O,...F});yt.innerHTML=Tt,st+=F.str&&F.hasEOL?2:1})}x()}).catch(_),()=>ba(Y)},[t,_,x,a,o,l,g,R]),P.jsx("div",{className:Ld("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:S,ref:v})}const Rp=1;function aw(c){const e={...hb(),...c},{_className:s="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:n,canvasRef:a,children:o,className:l,customRenderer:h,customTextRenderer:d,devicePixelRatio:u,error:f="Failed to load the page.",height:g,inputRef:y,loading:v="Loading page…",noData:w="No page specified.",onGetAnnotationsError:A,onGetAnnotationsSuccess:x,onGetStructTreeError:_,onGetStructTreeSuccess:S,onGetTextError:C,onGetTextSuccess:R,onLoadError:T,onLoadSuccess:k,onRenderAnnotationLayerError:I,onRenderAnnotationLayerSuccess:D,onRenderError:N,onRenderSuccess:Y,onRenderTextLayerError:q,onRenderTextLayerSuccess:H,pageIndex:st,pageNumber:F,pdf:O,registerPage:yt,renderAnnotationLayer:Tt=!0,renderForms:zt=!1,renderMode:mt="canvas",renderTextLayer:_t=!0,rotate:ft,scale:we=Rp,unregisterPage:Ae,width:te,...dt}=e,[Pe,ke]=Wo(),{value:vt,error:Ps}=Pe,ps=B.useRef(null);Ct(O,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const ot=tr(F)?F-1:st??null,Rt=F??(tr(st)?st+1:null),It=ft??(vt?vt.rotate:null),Mt=B.useMemo(()=>{if(!vt)return null;let ks=1;const ln=we??Rp;if(te||g){const Is=vt.getViewport({scale:1,rotation:It});te?ks=te/Is.width:g&&(ks=g/Is.height)}return ln*ks},[g,vt,It,we,te]);B.useEffect(function(){return()=>{tr(ot)&&i&&Ae&&Ae(ot)}},[i,O,ot,Ae]);function yi(){if(k){if(!vt||!Mt)return;k(vf(vt,Mt))}if(i&&yt){if(!tr(ot)||!ps.current)return;yt(ot,ps.current)}}function an(){Ps&&(Re(!1,Ps.toString()),T&&T(Ps))}B.useEffect(function(){ke({type:"RESET"})},[ke,O,ot]),B.useEffect(function(){if(!O||!Rt)return;const ln=fh(O.getPage(Rt)),Is=ln;return ln.promise.then(xa=>{ke({type:"RESOLVE",value:xa})}).catch(xa=>{ke({type:"REJECT",error:xa})}),()=>ba(Is)},[ke,O,Rt]),B.useEffect(()=>{if(vt!==void 0){if(vt===!1){an();return}yi()}},[vt,Mt]);const on=B.useMemo(()=>tr(ot)&&Rt&&tr(It)&&tr(Mt)?{_className:s,canvasBackground:n,customTextRenderer:d,devicePixelRatio:u,onGetAnnotationsError:A,onGetAnnotationsSuccess:x,onGetStructTreeError:_,onGetStructTreeSuccess:S,onGetTextError:C,onGetTextSuccess:R,onRenderAnnotationLayerError:I,onRenderAnnotationLayerSuccess:D,onRenderError:N,onRenderSuccess:Y,onRenderTextLayerError:q,onRenderTextLayerSuccess:H,page:vt,pageIndex:ot,pageNumber:Rt,renderForms:zt,renderTextLayer:_t,rotate:It,scale:Mt}:null,[s,n,d,u,A,x,_,S,C,R,I,D,N,Y,q,H,vt,ot,Rt,zt,_t,It,Mt]),Od=B.useMemo(()=>rb(dt,()=>vt&&(Mt?vf(vt,Mt):void 0)),[dt,vt,Mt]),Aa=`${ot}@${Mt}/${It}`;function Yo(){switch(mt){case"custom":return Ct(h,'renderMode was set to "custom", but no customRenderer was passed.'),P.jsx(h,{},`${Aa}_custom`);case"none":return null;case"canvas":default:return P.jsx(iw,{canvasRef:a},`${Aa}_canvas`)}}function Bd(){return _t?P.jsx(rw,{},`${Aa}_text`):null}function jd(){return Tt?P.jsx(Jv,{},`${Aa}_annotations`):null}function ph(){function ks(Is){return!!(Is!=null&&Is.page)}if(!ks(on))throw new Error("page is undefined");const ln=typeof o=="function"?o(on):o;return P.jsxs(ub.Provider,{value:on,children:[Yo(),Bd(),jd(),ln]})}function gh(){return Rt?O===null||vt===void 0||vt===null?P.jsx(Oa,{type:"loading",children:typeof v=="function"?v():v}):O===!1||vt===!1?P.jsx(Oa,{type:"error",children:typeof f=="function"?f():f}):ph():P.jsx(Oa,{type:"no-data",children:typeof w=="function"?w():w})}return P.jsx("div",{className:Ld(s,l),"data-page-number":Rt,ref:db(y,ps),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${Mt}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:n||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...Od,children:gh()})}Uv();Ss.workerSrc="pdf.worker.mjs";Ss.workerSrc=`//unpkg.com/pdfjs-dist@${If}/build/pdf.worker.min.mjs`;const ow=({onClose:c,src:t,title:e="PDF Viewer",className:s})=>{const[i,n]=zp(),[a,o]=Gp(),[{currentPage:l,totalPages:h},d]=Up(),[{pan:u,isDragging:f},g]=Vp(),y=P.jsx(lt.IconButton,{variant:"text",color:"gray",children:P.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:P.jsx($p,{className:"size-4"})})});return P.jsxs("div",{className:ga("shadow rounded-t-lg flex flex-col h-full",s),children:[P.jsx(Hp.Header,{onClose:c,right:y,children:e}),P.jsxs("div",{className:"grid grow h-full overflow-hidden",children:[P.jsx("div",{className:ga("col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8",f?"cursor-grabbing":"cursor-grab"),onMouseDown:g.handleMouseDown,onMouseMove:g.handleMouseMove,onMouseUp:g.handleMouseUp,onMouseLeave:g.handleMouseUp,style:{userSelect:"none"},children:P.jsx("div",{style:{transform:`translate(${u.x}px, ${u.y}px)`,transition:f?"none":"transform 0.1s",pointerEvents:"none"},children:P.jsx(Kv,{file:t,onLoadSuccess:({numPages:v})=>{d.setTotalPages(v)},scale:i/100,rotate:a,children:P.jsx(aw,{pageNumber:l,renderTextLayer:!0,renderAnnotationLayer:!0})})})}),P.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[P.jsxs(lt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:n.zoomOut,children:P.jsx(_s.Icon,{icon:"lucide:minus"})}),P.jsx(lt.Tooltip,{content:"Click to reset zoom and pan",children:P.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{n.reset(),g.reset()},children:[i,"%"]})}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:n.zoomIn,children:P.jsx(_s.Icon,{icon:"lucide:plus"})})]}),P.jsxs(lt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.rotateClockwise,children:P.jsx(_s.Icon,{icon:"lucide:iteration-cw"})}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.rotateCounterClockwise,children:P.jsx(_s.Icon,{icon:"lucide:iteration-ccw"})})]}),P.jsxs(lt.ButtonGroup,{className:"divide-x-0 ",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.prevPage,disabled:l===1,children:P.jsx(_s.Icon,{icon:"lucide:chevron-left"})}),P.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:l,onChange:v=>{const w=parseInt(v.target.value);isNaN(w)||d.goToPage(w)},type:"number",min:"1",max:h}),P.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",h]}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.nextPage,disabled:l===h,children:P.jsx(_s.Icon,{icon:"lucide:chevron-right"})})]})]})]})]})},lw=({...c})=>P.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...c,children:[P.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.16699 7.7334C4.91574 7.73357 6.33301 9.1516 6.33301 10.9004C6.33283 12.3905 5.30337 13.6386 3.91699 13.9756V15.25C3.91685 15.664 3.58098 15.9998 3.16699 16C2.75287 16 2.41713 15.6641 2.41699 15.25V13.9756C1.0303 13.6387 0.000177983 12.3906 0 10.9004C0 9.15149 1.41809 7.7334 3.16699 7.7334ZM3.16699 9.2334C2.24652 9.2334 1.5 9.97992 1.5 10.9004C1.50021 11.8207 2.24665 12.5664 3.16699 12.5664C4.08719 12.5662 4.8328 11.8206 4.83301 10.9004C4.83301 9.98002 4.08732 9.23357 3.16699 9.2334Z",fill:"currentColor"}),P.jsx("path",{d:"M11.8662 9.66699C12.2804 9.66699 12.6162 10.0028 12.6162 10.417V15.25C12.616 15.6641 12.2803 16 11.8662 16C11.4523 15.9998 11.1164 15.6639 11.1162 15.25V10.417C11.1162 10.0029 11.4522 9.66722 11.8662 9.66699Z",fill:"currentColor"}),P.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.8662 0C12.2804 0 12.6162 0.335786 12.6162 0.75V2.02344C14.0032 2.36025 15.0332 3.60999 15.0332 5.10059C15.0329 6.84904 13.6157 8.26633 11.8672 8.2666C10.1185 8.2666 8.70052 6.84921 8.7002 5.10059C8.7002 3.6104 9.7297 2.36066 11.1162 2.02344V0.75C11.1162 0.335929 11.4522 0.000230806 11.8662 0ZM11.8672 3.43359C10.9467 3.43359 10.2002 4.18011 10.2002 5.10059C10.2005 6.02078 10.9469 6.7666 11.8672 6.7666C12.7872 6.76633 13.5329 6.02062 13.5332 5.10059C13.5332 4.18028 12.7874 3.43387 11.8672 3.43359Z",fill:"currentColor"}),P.jsx("path",{d:"M3.16699 0C3.58107 0.000164881 3.91699 0.335888 3.91699 0.75V5.58301C3.91699 5.99712 3.58107 6.33284 3.16699 6.33301C2.75278 6.33301 2.41699 5.99722 2.41699 5.58301V0.75C2.41699 0.335786 2.75278 0 3.16699 0Z",fill:"currentColor"})]}),cw=()=>P.jsxs(lt.Tabs,{className:"w-[800px]",children:[P.jsxs(lt.TabsHeader,{children:[P.jsx(lt.Tab,{value:"chats",children:"Chats"}),P.jsx(lt.Tab,{value:"issues",children:"Issues"}),P.jsx("button",{className:"cursor-pointer mb-2 ml-auto rounded p-1 hover:bg-gray-100",children:P.jsx(lw,{className:"size-4"})})]}),P.jsxs(lt.TabsBody,{children:[P.jsx(lt.TabPanel,{value:"chats",children:"ChatsPanel"}),P.jsx(lt.TabPanel,{value:"issues",children:"IssuesPanel"})]})]});exports.HelloWorld=zb;exports.ImageViewer=M0;exports.InputPrompt=A0;exports.PdfViewer=ow;exports.Sidebar=P0;exports.TabsContainer=cw;exports.materialTheme=Bb;exports.tailwindTheme=Ob;
|
|
30
|
+
<%s key={someKey} {...props} />`,Jl,_s,Kg,_s),Un[_s+Jl]=!0}}return Q===r?Zi(Ut):mn(Ut),Ut}}function Wr(Q,Re,He){return sn(Q,Re,He,!0)}function ui(Q,Re,He){return sn(Q,Re,He,!1)}var Uc=ui,Es=Wr;Wc.Fragment=r,Wc.jsx=Uc,Wc.jsxs=Es}()),Wc}process.env.NODE_ENV==="production"?t0.exports=PE():t0.exports=RE();var ye=t0.exports;const IE=()=>ye.jsx("div",{className:"bg-red-800 text-white p-2",children:"Hello world"});function NE(){for(var i=0,e,t,r="";i<arguments.length;)(e=arguments[i++])&&(t=F2(e))&&(r&&(r+=" "),r+=t);return r}function F2(i){if(typeof i=="string")return i;for(var e,t="",r=0;r<i.length;r++)i[r]&&(e=F2(i[r]))&&(t&&(t+=" "),t+=e);return t}var Db="-";function ME(i){var e=OE(i);function t(n){var s=n.split(Db);return s[0]===""&&s.length!==1&&s.shift(),B2(s,e)||LE(n)}function r(n){return i.conflictingClassGroups[n]||[]}return{getClassGroupId:t,getConflictingClassGroupIds:r}}function B2(i,e){var a;if(i.length===0)return e.classGroupId;var t=i[0],r=e.nextPart.get(t),n=r?B2(i.slice(1),r):void 0;if(n)return n;if(e.validators.length!==0){var s=i.join(Db);return(a=e.validators.find(function(o){var l=o.validator;return l(s)}))==null?void 0:a.classGroupId}}var Gv=/^\[(.+)\]$/;function LE(i){if(Gv.test(i)){var e=Gv.exec(i)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}}function OE(i){var e=i.theme,t=i.prefix,r={nextPart:new Map,validators:[]},n=BE(Object.entries(i.classGroups),t);return n.forEach(function(s){var a=s[0],o=s[1];r0(o,r,a,e)}),r}function r0(i,e,t,r){i.forEach(function(n){if(typeof n=="string"){var s=n===""?e:qv(e,n);s.classGroupId=t;return}if(typeof n=="function"){if(FE(n)){r0(n(r),e,t,r);return}e.validators.push({validator:n,classGroupId:t});return}Object.entries(n).forEach(function(a){var o=a[0],l=a[1];r0(l,qv(e,o),t,r)})})}function qv(i,e){var t=i;return e.split(Db).forEach(function(r){t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t}function FE(i){return i.isThemeGetter}function BE(i,e){return e?i.map(function(t){var r=t[0],n=t[1],s=n.map(function(a){return typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(function(o){var l=o[0],c=o[1];return[e+l,c]})):a});return[r,s]}):i}function zE(i){if(i<1)return{get:function(){},set:function(){}};var e=0,t=new Map,r=new Map;function n(s,a){t.set(s,a),e++,e>i&&(e=0,r=t,t=new Map)}return{get:function(a){var o=t.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return n(a,o),o},set:function(a,o){t.has(a)?t.set(a,o):n(a,o)}}}var z2="!";function jE(i){var e=i.separator||":";return function(r){for(var n=0,s=[],a=0,o=0;o<r.length;o++){var l=r[o];n===0&&l===e[0]&&(e.length===1||r.slice(o,o+e.length)===e)&&(s.push(r.slice(a,o)),a=o+e.length),l==="["?n++:l==="]"&&n--}var c=s.length===0?r:r.substring(a),h=c.startsWith(z2),d=h?c.substring(1):c;return{modifiers:s,hasImportantModifier:h,baseClassName:d}}}function UE(i){if(i.length<=1)return i;var e=[],t=[];return i.forEach(function(r){var n=r[0]==="[";n?(e.push.apply(e,t.sort().concat([r])),t=[]):t.push(r)}),e.push.apply(e,t.sort()),e}function HE(i){return{cache:zE(i.cacheSize),splitModifiers:jE(i),...ME(i)}}var $E=/\s+/;function VE(i,e){var t=e.splitModifiers,r=e.getClassGroupId,n=e.getConflictingClassGroupIds,s=new Set;return i.trim().split($E).map(function(a){var o=t(a),l=o.modifiers,c=o.hasImportantModifier,h=o.baseClassName,d=r(h);if(!d)return{isTailwindClass:!1,originalClassName:a};var p=UE(l).join(":"),g=c?p+z2:p;return{isTailwindClass:!0,modifierId:g,classGroupId:d,originalClassName:a}}).reverse().filter(function(a){if(!a.isTailwindClass)return!0;var o=a.modifierId,l=a.classGroupId,c=o+l;return s.has(c)?!1:(s.add(c),n(l).forEach(function(h){return s.add(o+h)}),!0)}).reverse().map(function(a){return a.originalClassName}).join(" ")}function GE(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];var r,n,s,a=o;function o(c){var h=e[0],d=e.slice(1),p=d.reduce(function(g,y){return y(g)},h());return r=HE(p),n=r.cache.get,s=r.cache.set,a=l,l(c)}function l(c){var h=n(c);if(h)return h;var d=VE(c,r);return s(c,d),d}return function(){return a(NE.apply(null,arguments))}}function sr(i){var e=function(r){return r[i]||[]};return e.isThemeGetter=!0,e}var j2=/^\[(?:([a-z-]+):)?(.+)\]$/i,qE=/^\d+\/\d+$/,WE=new Set(["px","full","screen"]),XE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,YE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,ZE=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function Di(i){return Sh(i)||WE.has(i)||qE.test(i)||Eo(i)}function Eo(i){return Gl(i,"length",t_)}function KE(i){return Gl(i,"size",U2)}function QE(i){return Gl(i,"position",U2)}function JE(i){return Gl(i,"url",r_)}function cm(i){return Gl(i,"number",Sh)}function Sh(i){return!Number.isNaN(Number(i))}function Xc(i){return Wv(i)||Gl(i,"number",Wv)}function Sr(i){return j2.test(i)}function Yc(){return!0}function ma(i){return XE.test(i)}function e_(i){return Gl(i,"",n_)}function Gl(i,e,t){var r=j2.exec(i);return r?r[1]?r[1]===e:t(r[2]):!1}function t_(i){return YE.test(i)}function U2(){return!1}function r_(i){return i.startsWith("url(")}function Wv(i){return Number.isInteger(Number(i))}function n_(i){return ZE.test(i)}function i_(){var i=sr("colors"),e=sr("spacing"),t=sr("blur"),r=sr("brightness"),n=sr("borderColor"),s=sr("borderRadius"),a=sr("borderSpacing"),o=sr("borderWidth"),l=sr("contrast"),c=sr("grayscale"),h=sr("hueRotate"),d=sr("invert"),p=sr("gap"),g=sr("gradientColorStops"),y=sr("inset"),b=sr("margin"),w=sr("opacity"),v=sr("padding"),A=sr("saturate"),E=sr("scale"),_=sr("sepia"),C=sr("skew"),I=sr("space"),k=sr("translate"),D=function(){return["auto","contain","none"]},R=function(){return["auto","hidden","clip","visible","scroll"]},z=function(){return["auto",e]},G=function(){return["",Di]},O=function(){return["auto",Sh,Sr]},X=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},S=function(){return["solid","dashed","dotted","double","none"]},J=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},Y=function(){return["start","end","center","between","around","evenly"]},W=function(){return["","0",Sr]},fe=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},K=function(){return[Sh,cm]},be=function(){return[Sh,Sr]};return{cacheSize:500,theme:{colors:[Yc],spacing:[Di],blur:["none","",ma,Eo],brightness:K(),borderColor:[i],borderRadius:["none","","full",ma,Eo],borderSpacing:[e],borderWidth:G(),contrast:K(),grayscale:W(),hueRotate:be(),invert:W(),gap:[e],gradientColorStops:[i],inset:z(),margin:z(),opacity:K(),padding:[e],saturate:K(),scale:K(),sepia:W(),skew:be(),space:[e],translate:[e]},classGroups:{aspect:[{aspect:["auto","square","video",Sr]}],container:["container"],columns:[{columns:[ma]}],"break-after":[{"break-after":fe()}],"break-before":[{"break-before":fe()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(X(),[Sr])}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Xc]}],basis:[{basis:[e]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Sr]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",Xc]}],"grid-cols":[{"grid-cols":[Yc]}],"col-start-end":[{col:["auto",{span:[Xc]},Sr]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Yc]}],"row-start-end":[{row:["auto",{span:[Xc]},Sr]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Sr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Sr]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:Y()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(Y(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(Y(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",e]}],"min-w":[{"min-w":["min","max","fit",Di]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[ma]},ma,Eo]}],h:[{h:[e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Di]}],"max-h":[{"max-h":[e,"min","max","fit"]}],"font-size":[{text:["base",ma,Eo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",cm]}],"font-family":[{font:[Yc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Eo]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Di]}],"list-style-type":[{list:["none","disc","decimal",Sr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[i]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[i]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(S(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",Di]}],"underline-offset":[{"underline-offset":["auto",Di]}],"text-decoration-color":[{decoration:[i]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:[e]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Eo]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",Sr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(X(),[QE])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",KE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},JE]}],"bg-color":[{bg:[i]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[].concat(S(),["hidden"])}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:S()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:[""].concat(S())}],"outline-offset":[{"outline-offset":[Di]}],"outline-w":[{outline:[Di]}],"outline-color":[{outline:[i]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[i]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Di]}],"ring-offset-color":[{"ring-offset":[i]}],shadow:[{shadow:["","inner","none",ma,e_]}],"shadow-color":[{shadow:[Yc]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":J()}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ma,Sr]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[d]}],saturate:[{saturate:[A]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Sr]}],duration:[{duration:be()}],ease:[{ease:["linear","in","out","in-out",Sr]}],delay:[{delay:be()}],animate:[{animate:["none","spin","ping","pulse","bounce",Sr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Xc,Sr]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Sr]}],accent:[{accent:["auto",i]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Sr]}],"caret-color":[{caret:[i]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":[e]}],"scroll-mx":[{"scroll-mx":[e]}],"scroll-my":[{"scroll-my":[e]}],"scroll-mt":[{"scroll-mt":[e]}],"scroll-mr":[{"scroll-mr":[e]}],"scroll-mb":[{"scroll-mb":[e]}],"scroll-ml":[{"scroll-ml":[e]}],"scroll-p":[{"scroll-p":[e]}],"scroll-px":[{"scroll-px":[e]}],"scroll-py":[{"scroll-py":[e]}],"scroll-pt":[{"scroll-pt":[e]}],"scroll-pr":[{"scroll-pr":[e]}],"scroll-pb":[{"scroll-pb":[e]}],"scroll-pl":[{"scroll-pl":[e]}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Sr]}],fill:[{fill:[i,"none"]}],"stroke-w":[{stroke:[Di,cm]}],stroke:[{stroke:[i,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]}}}var s_=GE(i_);function H2(i){var e,t,r="";if(typeof i=="string"||typeof i=="number")r+=i;else if(typeof i=="object")if(Array.isArray(i))for(e=0;e<i.length;e++)i[e]&&(t=H2(i[e]))&&(r&&(r+=" "),r+=t);else for(e in i)i[e]&&(r&&(r+=" "),r+=e);return r}function a_(){for(var i,e,t=0,r="";t<arguments.length;)(i=arguments[t++])&&(e=H2(i))&&(r&&(r+=" "),r+=e);return r}function zl(...i){return s_(a_(i))}function o_({className:i="",size:e="1em"}){return ye.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:i,children:[ye.jsx("path",{d:"M12.001 7.7395C12.2367 7.73978 12.4591 7.85076 12.6006 8.03931L15.376 11.7395C15.5459 11.9666 15.5731 12.2708 15.4463 12.5247C15.3193 12.7785 15.0592 12.9395 14.7754 12.9397H12.75V17.2766C12.7499 17.6907 12.4142 18.0266 12 18.0266C11.5858 18.0266 11.2501 17.6907 11.25 17.2766V12.9397H9.22559C8.94169 12.9397 8.68182 12.7785 8.55469 12.5247C8.42778 12.2706 8.45558 11.9667 8.62598 11.7395L11.4004 8.03931L11.457 7.97192C11.5977 7.82422 11.7945 7.7395 12.001 7.7395Z",fill:"currentColor"}),ye.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.65161C17.5228 2.65161 22 7.12876 22 12.6516C22 18.1744 17.5228 22.6516 12 22.6516C6.47715 22.6516 2 18.1744 2 12.6516C2 7.12876 6.47715 2.65161 12 2.65161ZM12 4.15161C7.30558 4.15161 3.5 7.95719 3.5 12.6516C3.5 17.346 7.30558 21.1516 12 21.1516C16.6944 21.1516 20.5 17.346 20.5 12.6516C20.5 7.95719 16.6944 4.15161 12 4.15161Z",fill:"currentColor"})]})}function l_({className:i="",size:e="1em"}){return ye.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:i,children:ye.jsx("path",{d:"M12 2C10.0222 2 8.08879 2.58649 6.4443 3.6853C4.79981 4.78412 3.51809 6.3459 2.76121 8.17316C2.00433 10.0004 1.8063 12.0111 2.19215 13.9509C2.578 15.8907 3.53041 17.6725 4.92894 19.0711C6.32746 20.4696 8.10929 21.422 10.0491 21.8078C11.9889 22.1937 13.9996 21.9957 15.8268 21.2388C17.6541 20.4819 19.2159 19.2002 20.3147 17.5557C21.4135 15.9112 22 13.9778 22 12C21.9971 9.34871 20.9426 6.80684 19.0679 4.9321C17.1932 3.05736 14.6513 2.00287 12 2ZM15.7092 11.7642C15.6751 11.8349 15.6217 11.8945 15.5553 11.9363C15.4888 11.978 15.4118 12.0001 15.3333 12H12.8333V16.1667C12.8333 16.3877 12.7455 16.5996 12.5893 16.7559C12.433 16.9122 12.221 17 12 17C11.779 17 11.567 16.9122 11.4107 16.7559C11.2545 16.5996 11.1667 16.3877 11.1667 16.1667V12H8.66667C8.58819 12 8.5113 11.9779 8.44484 11.9362C8.37839 11.8945 8.32507 11.8348 8.29102 11.7641C8.25697 11.6934 8.24359 11.6145 8.2524 11.5365C8.26121 11.4586 8.29187 11.3847 8.34084 11.3233L11.6742 7.15667C11.7146 7.10991 11.7646 7.07241 11.8209 7.04671C11.8771 7.021 11.9382 7.0077 12 7.0077C12.0618 7.0077 12.1229 7.021 12.1791 7.04671C12.2354 7.07241 12.2854 7.10991 12.3258 7.15667L15.6592 11.3233C15.7082 11.3846 15.7389 11.4585 15.7477 11.5365C15.7566 11.6145 15.7432 11.6934 15.7092 11.7642Z",fill:"#1DA56A"})})}const u_=({tooltipContent:i="Send message",className:e,...t})=>{const[r,n]=Pe.useState(!1);return ye.jsx(Mt.Tooltip,{content:i,children:ye.jsx(Mt.IconButton,{variant:"text",color:"gray",className:zl(e,"hover:rounded-lg hover:bg-gray-100"),type:"submit",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),...t,children:r?ye.jsx(l_,{className:"size-6 "}):ye.jsx(o_,{className:"size-6 "})})})},$2=({onSubmit:i=()=>{},...e})=>ye.jsx(TE,{autoFocus:!0,placeholder:"Write your message here",className:"pl-1 block w-full focus:outline-none max-h-32 resize-none placeholder:text-gray-400",onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),i())},...e}),c_=({bottom:i,right:e,top:t,textArea:r=ye.jsx($2,{}),...n})=>ye.jsxs("div",{className:"border gap-2 rounded-lg bg-white shadow-[0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A] border-gray-100",...n,children:[t,ye.jsxs("div",{className:"flex gap-2 p-4 rounded-lg bg-white",children:[ye.jsxs("div",{className:"grow flex flex-col items-start justify-center",children:[r,i]}),ye.jsx("div",{className:"shrink flex items-end justify-end",children:e})]})]}),h_=Object.freeze(Object.defineProperty({__proto__:null,Container:c_,SubmitButton:u_,Textarea:$2},Symbol.toStringTag,{value:"Module"})),Ic=Pe.createContext(void 0),V2=({children:i,isCollapsed:e,onSwitchLayout:t})=>{const[r,n]=Pe.useState(!1),[s,a]=Pe.useState(!1),o=e!==void 0?e:r,l=c=>{const h=c??!o;e===void 0&&n(h),t==null||t(h)};return ye.jsx(Ic.Provider,{value:{isCollapsed:o,toggleCollapsed:l,isHovered:s,setIsHovered:a},children:i})},G2=({className:i,children:e,...t})=>{const{isCollapsed:r,isHovered:n,setIsHovered:s}=Pe.useContext(Ic);return ye.jsx("div",{className:zl(i,r&&"shadow-lg",r&&!n?"w-auto":"w-[280px]","bg-gray-50 p-2 flex flex-col justify-between items-center rounded-lg"),onMouseEnter:()=>r&&s(!0),onMouseLeave:()=>r&&s(!1),...t,children:e})},d_=({className:i,children:e,isCollapsed:t,onSwitchLayout:r,...n})=>ye.jsx(V2,{isCollapsed:t,onSwitchLayout:r,children:ye.jsx(G2,{className:i,...n,children:e})}),f_=({icon:i,children:e,...t})=>{const{isCollapsed:r,isHovered:n}=Pe.useContext(Ic);return ye.jsxs("button",{className:"flex items-center gap-2 w-full hover:bg-gray-100 text-caption-1-em text-gray-600 hover:text-gray-900 h-[38px] rounded-lg px-2",...t,children:[i," ",(!r||n)&&e]})};function p_(i){return ye.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ye.jsx("path",{d:"M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM3.75 3.5C4.16421 3.5 4.5 3.83579 4.5 4.25V11.75C4.5 12.1642 4.16421 12.5 3.75 12.5C3.33579 12.5 3 12.1642 3 11.75V4.25C3 3.83579 3.33579 3.5 3.75 3.5Z",fill:"currentColor"})})}function g_(i){return ye.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ye.jsx("path",{d:"M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM7.5 4C7.77614 4 8 4.22386 8 4.5V11.5C8 11.7761 7.77614 12 7.5 12H3.5C3.22386 12 3 11.7761 3 11.5V4.5C3 4.22386 3.22386 4 3.5 4H7.5Z",fill:"currentColor"})})}const m_=()=>{const{isCollapsed:i,isHovered:e,toggleCollapsed:t}=Pe.useContext(Ic);return i&&!e?null:ye.jsx(Mt.IconButton,{variant:"text",color:"gray",onClick:()=>t(),children:i?ye.jsx(p_,{className:"size-4"}):ye.jsx(g_,{className:"size-4"})})},b_=({children:i,className:e,icon:t,isActive:r,trailing:n,...s})=>{const{isCollapsed:a,isHovered:o}=Pe.useContext(Ic);return ye.jsxs("div",{className:zl(r?"!text-gray-900":"!text-gray-600","flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg px-2 cursor-pointer group",e),...s,children:[ye.jsxs("div",{className:"flex items-center gap-2",children:[t,(!a||o)&&i]}),(!a||o)&&n]})},v_=({children:i,className:e,isActive:t,trailing:r,icon:n,...s})=>{const{isCollapsed:a,isHovered:o}=Pe.useContext(Ic);return ye.jsxs("div",{className:zl(t?"!text-gray-900":"!text-gray-600","flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg pr-2 pl-3 cursor-pointer group text-sm",e),...s,children:[ye.jsxs("div",{className:"flex items-center gap-2 overflow-auto",children:[(!a||o)&&n," ",(!a||o)&&i]}),(!a||o)&&r]})},y_=Object.freeze(Object.defineProperty({__proto__:null,Button:f_,Container:G2,Item:b_,Layout:d_,Provider:V2,SecondaryItem:v_,ToggleCollapseButton:m_},Symbol.toStringTag,{value:"Module"})),w_=i=>ye.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ye.jsx("path",{d:"M12.7197 2.21954C13.0125 1.92683 13.4874 1.92694 13.7803 2.21954C14.073 2.51241 14.073 2.98722 13.7803 3.28008L9.05955 7.99981L13.7803 12.7205L13.832 12.7772C14.0721 13.0717 14.0548 13.5065 13.7803 13.7811C13.5057 14.0555 13.0709 14.0729 12.7764 13.8328L12.7197 13.7811L7.99901 9.06036L3.27928 13.7811C2.9864 14.0737 2.51156 14.0738 2.21873 13.7811C1.92618 13.4882 1.92616 13.0133 2.21873 12.7205L6.93846 7.99981L2.21873 3.28008C1.92615 2.98722 1.92607 2.51235 2.21873 2.21954C2.51154 1.92673 2.98637 1.92691 3.27928 2.21954L7.99901 6.93926L12.7197 2.21954Z",fill:"currentColor"})}),x_=({onClose:i,right:e,children:t})=>ye.jsxs("div",{className:"bg-gray-50 flex gap-2 items-center px-2 py-3 rounded-t-xl",children:[ye.jsx("div",{className:"grow text-subheader-em",children:t}),ye.jsxs("div",{className:"flex items-center gap-4",children:[e,ye.jsx(Mt.IconButton,{variant:"text",size:"sm",color:"gray",className:"rounded-full",onClick:i,children:ye.jsx(w_,{className:"size-4 text-gray-600"})})]})]}),q2={Header:x_},W2=i=>ye.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ye.jsx("path",{d:"M2.25 5.5C2.66421 5.5 3 5.83579 3 6.25C3 6.66421 2.66421 7 2.25 7H2C1.72386 7 1.5 7.22386 1.5 7.5V13.5C1.5 13.7761 1.72386 14 2 14H8C8.27614 14 8.5 13.7761 8.5 13.5V13.25C8.5 12.8358 8.83579 12.5 9.25 12.5C9.66421 12.5 10 12.8358 10 13.25V13.5C10 14.5357 9.21278 15.387 8.2041 15.4893L8 15.5H2L1.7959 15.4893C0.854346 15.3938 0.1062 14.6457 0.0107422 13.7041L0 13.5V7.5C0 6.39543 0.895431 5.5 2 5.5H2.25ZM13.75 0C14.7165 1.28853e-07 15.5 0.783502 15.5 1.75V9.75C15.5 10.7165 14.7165 11.5 13.75 11.5H5.75C4.7835 11.5 4 10.7165 4 9.75V1.75C4 0.783502 4.7835 8.0532e-09 5.75 0H13.75ZM5.75 1.5C5.61193 1.5 5.5 1.61193 5.5 1.75V9.75C5.5 9.88807 5.61193 10 5.75 10H13.75C13.8881 10 14 9.88807 14 9.75V1.75C14 1.61193 13.8881 1.5 13.75 1.5H5.75ZM11.75 3C11.795 3 11.839 3.00413 11.8818 3.01172C11.8874 3.0127 11.8929 3.01354 11.8984 3.01465C11.9118 3.01733 11.9244 3.02298 11.9375 3.02637C11.9707 3.03495 12.0041 3.04344 12.0361 3.05664C12.0653 3.06868 12.092 3.08512 12.1191 3.10059C12.1763 3.1331 12.2316 3.171 12.2803 3.21973C12.3287 3.26812 12.366 3.3232 12.3984 3.37988C12.414 3.40703 12.4303 3.43375 12.4424 3.46289C12.4631 3.51289 12.4779 3.56459 12.4873 3.61719C12.495 3.66035 12.5 3.70462 12.5 3.75V7.75C12.5 8.16421 12.1642 8.5 11.75 8.5C11.3358 8.5 11 8.16421 11 7.75V5.56055L8.28027 8.28027C7.98738 8.57317 7.51262 8.57317 7.21973 8.28027C6.92683 7.98738 6.92683 7.51262 7.21973 7.21973L9.93945 4.5H7.75C7.33579 4.5 7 4.16421 7 3.75C7 3.33579 7.33579 3 7.75 3H11.75Z",fill:"currentColor"})}),X2=(i=100,e=50,t=990,r=10)=>{const[n,s]=Pe.useState(i);return[n,{...{zoomIn:()=>s(l=>Math.min(l+r,t)),zoomOut:()=>s(l=>Math.max(l-r,e)),reset:()=>s(i),zoomToValue:l=>s(Math.max(e,Math.min(l,t)))},handleWheel:l=>{l.preventDefault();const c=l.deltaY>0?-r:r;s(h=>Math.max(e,Math.min(h+c,t)))}}]},Y2=()=>{const[i,e]=Pe.useState(0);return[i,{rotateClockwise:()=>e(r=>(r+90)%360),rotateCounterClockwise:()=>e(r=>(r-90+360)%360)}]},Z2=()=>{const[i,e]=Pe.useState({x:0,y:0}),[t,r]=Pe.useState(!1),[n,s]=Pe.useState({x:0,y:0});return[{pan:i,isDragging:t},{handleMouseDown:h=>{r(!0),s({x:h.clientX-i.x,y:h.clientY-i.y})},handleMouseMove:h=>{t&&e({x:h.clientX-n.x,y:h.clientY-n.y})},handleMouseUp:()=>{r(!1)},reset:()=>e({x:0,y:0})}]},K2=(i=0)=>{const[e,t]=Pe.useState(1),[r,n]=Pe.useState(i),s={nextPage:Pe.useCallback(()=>{t(a=>a<r?a+1:a)},[r]),prevPage:Pe.useCallback(()=>{t(a=>Math.max(a-1,1))},[]),goToPage:Pe.useCallback(a=>{t(()=>Math.max(1,Math.min(a,r)))},[r]),setTotalPages:Pe.useCallback(a=>{n(a),t(o=>Math.min(o,a))},[])};return[{currentPage:e,totalPages:r},s]},A_=({className:i,onClose:e,totalPages:t,getImageSrc:r,documentUrl:n,title:s="PDF Viewer"})=>{const[a,o]=X2(),[l,c]=Y2(),[{pan:h,isDragging:d},p]=Z2(),[{currentPage:g},y]=K2(t),b=ye.jsx(Mt.IconButton,{variant:"text",color:"gray",children:ye.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:ye.jsx(W2,{className:"size-4"})})});return ye.jsxs("div",{className:zl("shadow rounded-t-lg flex flex-col h-full",i),children:[ye.jsx(q2.Header,{onClose:e,right:b,children:s}),ye.jsx("div",{className:"flex-1 grid",children:ye.jsxs("div",{className:"grid relative",children:[ye.jsx("div",{className:"overflow-hidden col-start-1 row-start-1 bg-gray-200 h-full relative",onMouseMove:p.handleMouseMove,onMouseUp:p.handleMouseUp,onMouseLeave:p.handleMouseUp,onWheel:o.handleWheel,children:ye.jsx("div",{style:{transform:`translate(${h.x}px, ${h.y}px)`,cursor:d?"grabbing":"grab",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},onMouseDown:p.handleMouseDown,children:ye.jsx("div",{style:{transform:`scale(${a/100}) rotate(${l}deg)`,transformOrigin:"center",transition:d?"none":"transform 0.3s ease"},children:ye.jsx("img",{src:r(g),style:{userSelect:"none",pointerEvents:"none"}})})})}),ye.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[ye.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.zoomOut,children:ye.jsx(vi.Icon,{icon:"lucide:minus"})}),ye.jsx(Mt.Tooltip,{content:"Click to reset zoom and pan",children:ye.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{o.reset(),p.reset()},children:[a,"%"]})}),ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.zoomIn,children:ye.jsx(vi.Icon,{icon:"lucide:plus"})})]}),ye.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:c.rotateClockwise,children:ye.jsx(vi.Icon,{icon:"lucide:iteration-cw"})}),ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:c.rotateCounterClockwise,children:ye.jsx(vi.Icon,{icon:"lucide:iteration-ccw"})})]}),ye.jsxs(Mt.ButtonGroup,{className:"divide-x-0 ",children:[ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:y.prevPage,disabled:g===1,children:ye.jsx(vi.Icon,{icon:"lucide:chevron-left"})}),ye.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:g,onChange:w=>{const v=parseInt(w.target.value);isNaN(v)||y.goToPage(v)},type:"number",min:"1",max:t}),ye.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",t]}),ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:y.nextPage,disabled:g===t,children:ye.jsx(vi.Icon,{icon:"lucide:chevron-right"})})]})]})]})})]})},_n=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),n0=[.001,0,0,.001,0,0],hm=1.35,ii={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},vs={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Q2="pdfjs_internal_editor_",ot={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101},kt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},J2={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},on={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Th={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},wr={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},iu={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Cf={ERRORS:0,WARNINGS:1,INFOS:5},Ph={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,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},ep={moveTo:0,lineTo:1,curveTo:2,closePath:3},e1={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Cg=Cf.WARNINGS;function E_(i){Number.isInteger(i)&&(Cg=i)}function __(){return Cg}function Sg(i){Cg>=Cf.INFOS&&console.log(`Info: ${i}`)}function ut(i){Cg>=Cf.WARNINGS&&console.log(`Warning: ${i}`)}function Wt(i){throw new Error(i)}function Dr(i,e){i||Wt(e)}function C_(i){switch(i==null?void 0:i.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Pb(i,e=null,t=null){if(!i)return null;if(t&&typeof i=="string"){if(t.addDefaultProtocol&&i.startsWith("www.")){const n=i.match(/\./g);(n==null?void 0:n.length)>=2&&(i=`http://${i}`)}if(t.tryConvertEncoding)try{i=P_(i)}catch{}}const r=e?URL.parse(i,e):URL.parse(i);return C_(r)?r:null}function Rb(i,e,t=!1){const r=URL.parse(i);return r?(r.hash=e,r.href):t&&Pb(i,"http://example.com")?i.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Ct(i,e,t,r=!1){return Object.defineProperty(i,e,{value:t,enumerable:!r,configurable:!0,writable:!1}),t}const ql=function(){function e(t,r){this.message=t,this.name=r}return e.prototype=new Error,e.constructor=e,e}();class Xv extends ql{constructor(e,t){super(e,"PasswordException"),this.code=t}}class dm extends ql{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class Wp extends ql{constructor(e){super(e,"InvalidPDFException")}}class Rh extends ql{constructor(e,t,r){super(e,"ResponseException"),this.status=t,this.missing=r}}class S_ extends ql{constructor(e){super(e,"FormatError")}}class ha extends ql{constructor(e){super(e,"AbortException")}}function t1(i){(typeof i!="object"||(i==null?void 0:i.length)===void 0)&&Wt("Invalid argument for bytesToString");const e=i.length,t=8192;if(e<t)return String.fromCharCode.apply(null,i);const r=[];for(let n=0;n<e;n+=t){const s=Math.min(n+t,e),a=i.subarray(n,s);r.push(String.fromCharCode.apply(null,a))}return r.join("")}function Sf(i){typeof i!="string"&&Wt("Invalid argument for stringToBytes");const e=i.length,t=new Uint8Array(e);for(let r=0;r<e;++r)t[r]=i.charCodeAt(r)&255;return t}function T_(i){return String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,i&255)}function k_(){const i=new Uint8Array(4);return i[0]=1,new Uint32Array(i.buffer,0,1)[0]===1}function D_(){try{return new Function(""),!0}catch{return!1}}class qr{static get isLittleEndian(){return Ct(this,"isLittleEndian",k_())}static get isEvalSupported(){return Ct(this,"isEvalSupported",D_())}static get isOffscreenCanvasSupported(){return Ct(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Ct(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:t}=navigator;return Ct(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){var e,t;return Ct(this,"isCSSRoundSupported",(t=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:t.call(e,"width: round(1.5px, 1px)"))}}const fm=Array.from(Array(256).keys(),i=>i.toString(16).padStart(2,"0"));var ua,pp,i0;class Qe{static makeHexColor(e,t,r){return`#${fm[e]}${fm[t]}${fm[r]}`}static scaleMinMax(e,t){let r;e[0]?(e[0]<0&&(r=t[0],t[0]=t[2],t[2]=r),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(r=t[1],t[1]=t[3],t[3]=r),t[1]*=e[3],t[3]*=e[3]):(r=t[0],t[0]=t[1],t[1]=r,r=t[2],t[2]=t[3],t[3]=r,e[1]<0&&(r=t[1],t[1]=t[3],t[3]=r),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(r=t[0],t[0]=t[2],t[2]=r),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t,r=0){const n=e[r],s=e[r+1];e[r]=n*t[0]+s*t[2]+t[4],e[r+1]=n*t[1]+s*t[3]+t[5]}static applyTransformToBezier(e,t,r=0){const n=t[0],s=t[1],a=t[2],o=t[3],l=t[4],c=t[5];for(let h=0;h<6;h+=2){const d=e[r+h],p=e[r+h+1];e[r+h]=d*n+p*a+l,e[r+h+1]=d*s+p*o+c}}static applyInverseTransform(e,t){const r=e[0],n=e[1],s=t[0]*t[3]-t[1]*t[2];e[0]=(r*t[3]-n*t[2]+t[2]*t[5]-t[4]*t[3])/s,e[1]=(-r*t[1]+n*t[0]+t[4]*t[1]-t[5]*t[0])/s}static axialAlignedBoundingBox(e,t,r){const n=t[0],s=t[1],a=t[2],o=t[3],l=t[4],c=t[5],h=e[0],d=e[1],p=e[2],g=e[3];let y=n*h+l,b=y,w=n*p+l,v=w,A=o*d+c,E=A,_=o*g+c,C=_;if(s!==0||a!==0){const I=s*h,k=s*p,D=a*d,R=a*g;y+=D,v+=D,w+=R,b+=R,A+=I,C+=I,_+=k,E+=k}r[0]=Math.min(r[0],y,w,b,v),r[1]=Math.min(r[1],A,_,E,C),r[2]=Math.max(r[2],y,w,b,v),r[3]=Math.max(r[3],A,_,E,C)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const r=e[0],n=e[1],s=e[2],a=e[3],o=r**2+n**2,l=r*s+n*a,c=s**2+a**2,h=(o+c)/2,d=Math.sqrt(h**2-(o*c-l**2));t[0]=Math.sqrt(h+d||1),t[1]=Math.sqrt(h-d||1)}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const r=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(r>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>a?null:[r,s,n,a]}static pointBoundingBox(e,t,r){r[0]=Math.min(r[0],e),r[1]=Math.min(r[1],t),r[2]=Math.max(r[2],e),r[3]=Math.max(r[3],t)}static rectBoundingBox(e,t,r,n,s){s[0]=Math.min(s[0],e,r),s[1]=Math.min(s[1],t,n),s[2]=Math.max(s[2],e,r),s[3]=Math.max(s[3],t,n)}static bezierBoundingBox(e,t,r,n,s,a,o,l,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,l),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,l),L(this,ua,i0).call(this,e,r,s,o,t,n,a,l,3*(-e+3*(r-s)+o),6*(e-2*r+s),3*(r-e),c),L(this,ua,i0).call(this,e,r,s,o,t,n,a,l,3*(-t+3*(n-a)+l),6*(t-2*n+a),3*(n-t),c)}}ua=new WeakSet,pp=function(e,t,r,n,s,a,o,l,c,h){if(c<=0||c>=1)return;const d=1-c,p=c*c,g=p*c,y=d*(d*(d*e+3*c*t)+3*p*r)+g*n,b=d*(d*(d*s+3*c*a)+3*p*o)+g*l;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],b),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],b)},i0=function(e,t,r,n,s,a,o,l,c,h,d,p){if(Math.abs(c)<1e-12){Math.abs(h)>=1e-12&&L(this,ua,pp).call(this,e,t,r,n,s,a,o,l,-d/h,p);return}const g=h**2-4*d*c;if(g<0)return;const y=Math.sqrt(g),b=2*c;L(this,ua,pp).call(this,e,t,r,n,s,a,o,l,(-h+y)/b,p),L(this,ua,pp).call(this,e,t,r,n,s,a,o,l,(-h-y)/b,p)},N(Qe,ua);function P_(i){return decodeURIComponent(escape(i))}let pm=null,Yv=null;function r1(i){return pm||(pm=/([\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,Yv=new Map([["ſt","ſt"]])),i.replaceAll(pm,(e,t,r)=>t?t.normalize("NFKC"):Yv.get(r))}function Ib(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const i=new Uint8Array(32);return crypto.getRandomValues(i),t1(i)}const Nb="pdfjs_internal_id_";function R_(i,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[r,n,...s]=t;if(!i(r)&&!Number.isInteger(r)||!e(n))return!1;const a=s.length;let o=!0;switch(n.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of s)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function dn(i,e,t){return Math.min(Math.max(i,e),t)}function n1(i){return Uint8Array.prototype.toBase64?i.toBase64():btoa(t1(i))}function I_(i){return Uint8Array.fromBase64?Uint8Array.fromBase64(i):Sf(atob(i))}typeof Promise.try!="function"&&(Promise.try=function(i,...e){return new Promise(t=>{t(i(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(i){return i.reduce((e,t)=>e+t,0)});const Ts="http://www.w3.org/2000/svg",To=class To{};Ie(To,"CSS",96),Ie(To,"PDF",72),Ie(To,"PDF_TO_CSS_UNITS",To.CSS/To.PDF);let da=To;async function Nc(i,e="text"){if(ah(i,document.baseURI)){const t=await fetch(i);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,r)=>{const n=new XMLHttpRequest;n.open("GET",i,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(e){case"arraybuffer":case"blob":case"json":t(n.response);return}t(n.responseText);return}r(new Error(n.statusText))}},n.send(null)})}class Tf{constructor({viewBox:e,userUnit:t,scale:r,rotation:n,offsetX:s=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=r,this.rotation=n,this.offsetX=s,this.offsetY=a,r*=t;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let h,d,p,g;switch(n%=360,n<0&&(n+=360),n){case 180:h=-1,d=0,p=0,g=1;break;case 90:h=0,d=1,p=1,g=0;break;case 270:h=0,d=-1,p=-1,g=0;break;case 0:h=1,d=0,p=0,g=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(p=-p,g=-g);let y,b,w,v;h===0?(y=Math.abs(c-e[1])*r+s,b=Math.abs(l-e[0])*r+a,w=(e[3]-e[1])*r,v=(e[2]-e[0])*r):(y=Math.abs(l-e[0])*r+s,b=Math.abs(c-e[1])*r+a,w=(e[2]-e[0])*r,v=(e[3]-e[1])*r),this.transform=[h*r,d*r,p*r,g*r,y-h*r*l-p*r*c,b-d*r*l-g*r*c],this.width=w,this.height=v}get rawDims(){const e=this.viewBox;return Ct(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:r=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new Tf({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:r,offsetY:n,dontFlip:s})}convertToViewportPoint(e,t){const r=[e,t];return Qe.applyTransform(r,this.transform),r}convertToViewportRectangle(e){const t=[e[0],e[1]];Qe.applyTransform(t,this.transform);const r=[e[2],e[3]];return Qe.applyTransform(r,this.transform),[t[0],t[1],r[0],r[1]]}convertToPdfPoint(e,t){const r=[e,t];return Qe.applyInverseTransform(r,this.transform),r}}class Tg extends ql{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function kf(i){const e=i.length;let t=0;for(;t<e&&i[t].trim()==="";)t++;return i.substring(t,t+5).toLowerCase()==="data:"}function kg(i){return typeof i=="string"&&/\.pdf$/i.test(i)}function i1(i){return[i]=i.split(/[#?]/,1),i.substring(i.lastIndexOf("/")+1)}function s1(i,e="document.pdf"){if(typeof i!="string")return e;if(kf(i))return ut('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const r=(o=>{try{return new URL(o)}catch{try{return new URL(decodeURIComponent(o))}catch{try{return new URL(o,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{return null}}}}})(i);if(!r)return e;const n=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},s=/\.pdf$/i,a=r.pathname.split("/").at(-1);if(s.test(a))return n(a);if(r.searchParams.size>0){const o=Array.from(r.searchParams.values()).reverse();for(const c of o)if(s.test(c))return n(c);const l=Array.from(r.searchParams.keys()).reverse();for(const c of l)if(s.test(c))return n(c)}if(r.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(r.hash);if(l)return n(l[0])}return e}class Zv{constructor(){Ie(this,"started",Object.create(null));Ie(this,"times",[])}time(e){e in this.started&&ut(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||ut(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:r}of this.times)t=Math.max(r.length,t);for(const{name:r,start:n,end:s}of this.times)e.push(`${r.padEnd(t)} ${s-n}ms
|
|
31
|
+
`);return e.join("")}}function ah(i,e){const t=e?URL.parse(i,e):URL.parse(i);return(t==null?void 0:t.protocol)==="http:"||(t==null?void 0:t.protocol)==="https:"}function Ei(i){i.preventDefault()}function _r(i){i.preventDefault(),i.stopPropagation()}function N_(i){console.log("Deprecated API usage: "+i)}var Zh;class Dg{static toDateObject(e){if(!e||typeof e!="string")return null;u(this,Zh)||T(this,Zh,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=u(this,Zh).exec(e);if(!t)return null;const r=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const c=t[7]||"Z";let h=parseInt(t[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(t[9],10)||0;return d=d>=0&&d<=59?d:0,c==="-"?(a+=h,o+=d):c==="+"&&(a-=h,o-=d),new Date(Date.UTC(r,n,s,a,o,l))}}Zh=new WeakMap,N(Dg,Zh);function a1(i,{scale:e=1,rotation:t=0}){const{width:r,height:n}=i.attributes.style,s=[0,0,parseInt(r),parseInt(n)];return new Tf({viewBox:s,userUnit:1,scale:e,rotation:t})}function Mb(i){if(i.startsWith("#")){const e=parseInt(i.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return i.startsWith("rgb(")?i.slice(4,-1).split(",").map(e=>parseInt(e)):i.startsWith("rgba(")?i.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(ut(`Not a valid color format: "${i}"`),[0,0,0])}function M_(i){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const t of i.keys()){e.style.color=t;const r=window.getComputedStyle(e).color;i.set(t,Mb(r))}e.remove()}function hr(i){const{a:e,b:t,c:r,d:n,e:s,f:a}=i.getTransform();return[e,t,r,n,s,a]}function Ki(i){const{a:e,b:t,c:r,d:n,e:s,f:a}=i.getTransform().invertSelf();return[e,t,r,n,s,a]}function so(i,e,t=!1,r=!0){if(e instanceof Tf){const{pageWidth:n,pageHeight:s}=e.rawDims,{style:a}=i,o=qr.isCSSRoundSupported,l=`var(--total-scale-factor) * ${n}px`,c=`var(--total-scale-factor) * ${s}px`,h=o?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,d=o?`round(down, ${c}, var(--scale-round-y))`:`calc(${c})`;!t||e.rotation%180===0?(a.width=h,a.height=d):(a.width=d,a.height=h)}r&&i.setAttribute("data-main-rotation",e.rotation)}class Wi{constructor(){const{pixelRatio:e}=Wi;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,r,n,s=-1){let a=1/0,o=1/0,l=1/0;r=Wi.capPixels(r,s),r>0&&(a=Math.sqrt(r/(e*t))),n!==-1&&(o=n/e,l=n/t);const c=Math.min(a,o,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const r=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,r):r}return e}}const Xp=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];var xa,Po,hi,Aa,Kh,wu,Qh,sg,o1,Sn,l1,u1,oh,gp;const Ps=class Ps{constructor(e){N(this,Sn);N(this,xa,null);N(this,Po,null);N(this,hi);N(this,Aa,null);N(this,Kh,null);N(this,wu,null);T(this,hi,e),u(Ps,Qh)||T(Ps,Qh,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=T(this,xa,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=u(this,hi)._uiManager._signal;e.addEventListener("contextmenu",Ei,{signal:t}),e.addEventListener("pointerdown",L(Ps,sg,o1),{signal:t});const r=T(this,Aa,document.createElement("div"));r.className="buttons",e.append(r);const n=u(this,hi).toolbarPosition;if(n){const{style:s}=e,a=u(this,hi)._uiManager.direction==="ltr"?1-n[0]:n[0];s.insetInlineEnd=`${100*a}%`,s.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return u(this,xa)}hide(){var e;u(this,xa).classList.add("hidden"),(e=u(this,Po))==null||e.hideDropdown()}show(){var e;u(this,xa).classList.remove("hidden"),(e=u(this,Kh))==null||e.shown()}addDeleteButton(){const{editorType:e,_uiManager:t}=u(this,hi),r=document.createElement("button");r.className="delete",r.tabIndex=0,r.setAttribute("data-l10n-id",u(Ps,Qh)[e]),L(this,Sn,oh).call(this,r),r.addEventListener("click",n=>{t.delete()},{signal:t._signal}),u(this,Aa).append(r)}async addAltText(e){const t=await e.render();L(this,Sn,oh).call(this,t),u(this,Aa).append(t,u(this,Sn,gp)),T(this,Kh,e)}addColorPicker(e){T(this,Po,e);const t=e.renderButton();L(this,Sn,oh).call(this,t),u(this,Aa).append(t,u(this,Sn,gp))}async addEditSignatureButton(e){const t=T(this,wu,await e.renderEditButton(u(this,hi)));L(this,Sn,oh).call(this,t),u(this,Aa).append(t,u(this,Sn,gp))}async addButton(e,t){switch(e){case"colorPicker":this.addColorPicker(t);break;case"altText":await this.addAltText(t);break;case"editSignature":await this.addEditSignatureButton(t);break;case"delete":this.addDeleteButton();break}}updateEditSignatureButton(e){u(this,wu)&&(u(this,wu).title=e)}remove(){var e;u(this,xa).remove(),(e=u(this,Po))==null||e.destroy(),T(this,Po,null)}};xa=new WeakMap,Po=new WeakMap,hi=new WeakMap,Aa=new WeakMap,Kh=new WeakMap,wu=new WeakMap,Qh=new WeakMap,sg=new WeakSet,o1=function(e){e.stopPropagation()},Sn=new WeakSet,l1=function(e){u(this,hi)._focusEventsAllowed=!1,_r(e)},u1=function(e){u(this,hi)._focusEventsAllowed=!0,_r(e)},oh=function(e){const t=u(this,hi)._uiManager._signal;e.addEventListener("focusin",L(this,Sn,l1).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",L(this,Sn,u1).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",Ei,{signal:t})},gp=function(){const e=document.createElement("div");return e.className="divider",e},N(Ps,sg),N(Ps,Qh,null);let s0=Ps;var Jh,Ro,Io,ho,c1,h1,d1;class L_{constructor(e){N(this,ho);N(this,Jh,null);N(this,Ro,null);N(this,Io);T(this,Io,e)}show(e,t,r){const[n,s]=L(this,ho,h1).call(this,t,r),{style:a}=u(this,Ro)||T(this,Ro,L(this,ho,c1).call(this));e.append(u(this,Ro)),a.insetInlineEnd=`${100*n}%`,a.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){u(this,Ro).remove()}}Jh=new WeakMap,Ro=new WeakMap,Io=new WeakMap,ho=new WeakSet,c1=function(){const e=T(this,Ro,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",Ei,{signal:u(this,Io)._signal});const t=T(this,Jh,document.createElement("div"));return t.className="buttons",e.append(t),L(this,ho,d1).call(this),e},h1=function(e,t){let r=0,n=0;for(const s of e){const a=s.y+s.height;if(a<r)continue;const o=s.x+(t?s.width:0);if(a>r){n=o,r=a;continue}t?o>n&&(n=o):o<n&&(n=o)}return[t?1-n:n,r]},d1=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const r=u(this,Io)._signal;e.addEventListener("contextmenu",Ei,{signal:r}),e.addEventListener("click",()=>{u(this,Io).highlightSelection("floating_button")},{signal:r}),u(this,Jh).append(e)};function f1(i,e,t){for(const r of t)e.addEventListener(r,i[r].bind(i))}var ag;class O_{constructor(){N(this,ag,0)}get id(){return`${Q2}${bn(this,ag)._++}`}}ag=new WeakMap;var xu,ed,un,Au,mp;const mv=class mv{constructor(){N(this,Au);N(this,xu,Ib());N(this,ed,0);N(this,un,null)}static get _isSVGFittingCanvas(){const e='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>',r=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),n=new Image;n.src=e;const s=n.decode().then(()=>(r.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(r.getImageData(0,0,1,1).data.buffer)[0]===0));return Ct(this,"_isSVGFittingCanvas",s)}async getFromFile(e){const{lastModified:t,name:r,size:n,type:s}=e;return L(this,Au,mp).call(this,`${t}_${r}_${n}_${s}`,e)}async getFromUrl(e){return L(this,Au,mp).call(this,e,e)}async getFromBlob(e,t){const r=await t;return L(this,Au,mp).call(this,e,r)}async getFromId(e){u(this,un)||T(this,un,new Map);const t=u(this,un).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:r}=t;return delete t.blobPromise,this.getFromBlob(t.id,r)}return this.getFromUrl(t.url)}getFromCanvas(e,t){u(this,un)||T(this,un,new Map);let r=u(this,un).get(e);if(r!=null&&r.bitmap)return r.refCounter+=1,r;const n=new OffscreenCanvas(t.width,t.height);return n.getContext("2d").drawImage(t,0,0),r={bitmap:n.transferToImageBitmap(),id:`image_${u(this,xu)}_${bn(this,ed)._++}`,refCounter:1,isSvg:!1},u(this,un).set(e,r),u(this,un).set(r.id,r),r}getSvgUrl(e){const t=u(this,un).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var n;u(this,un)||T(this,un,new Map);const t=u(this,un).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:r}=t;if(!t.url&&!t.file){const s=new OffscreenCanvas(r.width,r.height);s.getContext("bitmaprenderer").transferFromImageBitmap(r),t.blobPromise=s.convertToBlob()}(n=r.close)==null||n.call(r),t.bitmap=null}isValidId(e){return e.startsWith(`image_${u(this,xu)}_`)}};xu=new WeakMap,ed=new WeakMap,un=new WeakMap,Au=new WeakSet,mp=async function(e,t){u(this,un)||T(this,un,new Map);let r=u(this,un).get(e);if(r===null)return null;if(r!=null&&r.bitmap)return r.refCounter+=1,r;try{r||(r={bitmap:null,id:`image_${u(this,xu)}_${bn(this,ed)._++}`,refCounter:0,isSvg:!1});let n;if(typeof t=="string"?(r.url=t,n=await Nc(t,"blob")):t instanceof File?n=r.file=t:t instanceof Blob&&(n=t),n.type==="image/svg+xml"){const s=mv._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((c,h)=>{o.onload=()=>{r.bitmap=o,r.isSvg=!0,c()},a.onload=async()=>{const d=r.svgUrl=a.result;o.src=await s?`${d}#svgView(preserveAspectRatio(none))`:d},o.onerror=a.onerror=h});a.readAsDataURL(n),await l}else r.bitmap=await createImageBitmap(n);r.refCounter=1}catch(n){ut(n),r=null}return u(this,un).set(e,r),r&&u(this,un).set(r.id,r),r};let a0=mv;var xr,Ea,td,cr;class F_{constructor(e=128){N(this,xr,[]);N(this,Ea,!1);N(this,td);N(this,cr,-1);T(this,td,e)}add({cmd:e,undo:t,post:r,mustExec:n,type:s=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(n&&e(),u(this,Ea))return;const l={cmd:e,undo:t,post:r,type:s};if(u(this,cr)===-1){u(this,xr).length>0&&(u(this,xr).length=0),T(this,cr,0),u(this,xr).push(l);return}if(a&&u(this,xr)[u(this,cr)].type===s){o&&(l.undo=u(this,xr)[u(this,cr)].undo),u(this,xr)[u(this,cr)]=l;return}const c=u(this,cr)+1;c===u(this,td)?u(this,xr).splice(0,1):(T(this,cr,c),c<u(this,xr).length&&u(this,xr).splice(c)),u(this,xr).push(l)}undo(){if(u(this,cr)===-1)return;T(this,Ea,!0);const{undo:e,post:t}=u(this,xr)[u(this,cr)];e(),t==null||t(),T(this,Ea,!1),T(this,cr,u(this,cr)-1)}redo(){if(u(this,cr)<u(this,xr).length-1){T(this,cr,u(this,cr)+1),T(this,Ea,!0);const{cmd:e,post:t}=u(this,xr)[u(this,cr)];e(),t==null||t(),T(this,Ea,!1)}}hasSomethingToUndo(){return u(this,cr)!==-1}hasSomethingToRedo(){return u(this,cr)<u(this,xr).length-1}cleanType(e){if(u(this,cr)!==-1){for(let t=u(this,cr);t>=0;t--)if(u(this,xr)[t].type!==e){u(this,xr).splice(t+1,u(this,cr)-t),T(this,cr,t);return}u(this,xr).length=0,T(this,cr,-1)}}destroy(){T(this,xr,null)}}xr=new WeakMap,Ea=new WeakMap,td=new WeakMap,cr=new WeakMap;var og,p1;class Df{constructor(e){N(this,og);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=qr.platform;for(const[r,n,s={}]of e)for(const a of r){const o=a.startsWith("mac+");t&&o?(this.callbacks.set(a.slice(4),{callback:n,options:s}),this.allKeys.add(a.split("+").at(-1))):!t&&!o&&(this.callbacks.set(a,{callback:n,options:s}),this.allKeys.add(a.split("+").at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;const r=this.callbacks.get(L(this,og,p1).call(this,t));if(!r)return;const{callback:n,options:{bubbles:s=!1,args:a=[],checker:o=null}}=r;o&&!o(e,t)||(n.bind(e,...a,t)(),s||_r(t))}}og=new WeakSet,p1=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t};const lg=class lg{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return M_(e),Ct(this,"_colors",e)}convert(e){const t=Mb(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[r,n]of this._colors)if(n.every((s,a)=>s===t[a]))return lg._colorsMapping.get(r);return t}getHexCode(e){const t=this._colors.get(e);return t?Qe.makeHexColor(...t):e}};Ie(lg,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let o0=lg;var Eu,Vn,Ir,Yr,_u,Is,Cu,di,_a,Ca,Su,No,ts,Ni,Mo,rd,nd,Tu,id,rs,Sa,ku,Ta,ns,ug,ka,sd,Da,Lo,Oo,Pa,ad,zr,Ht,Ns,Ra,Fo,od,ld,Ia,is,Ms,ud,cd,fi,ze,bp,l0,g1,m1,vp,b1,v1,y1,u0,w1,c0,h0,x1,yn,ks,A1,E1,d0,_1,lh,f0;const pu=class pu{constructor(e,t,r,n,s,a,o,l,c,h,d,p,g,y,b){N(this,ze);N(this,Eu,new AbortController);N(this,Vn,null);N(this,Ir,new Map);N(this,Yr,new Map);N(this,_u,null);N(this,Is,null);N(this,Cu,null);N(this,di,new F_);N(this,_a,null);N(this,Ca,null);N(this,Su,0);N(this,No,new Set);N(this,ts,null);N(this,Ni,null);N(this,Mo,new Set);Ie(this,"_editorUndoBar",null);N(this,rd,!1);N(this,nd,!1);N(this,Tu,!1);N(this,id,null);N(this,rs,null);N(this,Sa,null);N(this,ku,null);N(this,Ta,!1);N(this,ns,null);N(this,ug,new O_);N(this,ka,!1);N(this,sd,!1);N(this,Da,null);N(this,Lo,null);N(this,Oo,null);N(this,Pa,null);N(this,ad,null);N(this,zr,ot.NONE);N(this,Ht,new Set);N(this,Ns,null);N(this,Ra,null);N(this,Fo,null);N(this,od,null);N(this,ld,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});N(this,Ia,[0,0]);N(this,is,null);N(this,Ms,null);N(this,ud,null);N(this,cd,null);N(this,fi,null);const w=this._signal=u(this,Eu).signal;T(this,Ms,e),T(this,ud,t),T(this,cd,r),T(this,_u,n),T(this,Ra,s),this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:w}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:w}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:w}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:w}),a._on("setpreference",this.onSetPreference.bind(this),{signal:w}),a._on("switchannotationeditorparams",v=>this.updateParams(v.type,v.value),{signal:w}),L(this,ze,b1).call(this),L(this,ze,x1).call(this),L(this,ze,u0).call(this),T(this,Is,o.annotationStorage),T(this,id,o.filterFactory),T(this,Fo,l),T(this,ku,c||null),T(this,rd,h),T(this,nd,d),T(this,Tu,p),T(this,ad,g||null),this.viewParameters={realScale:da.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=b!==!1}static get _keyboardManager(){const e=pu.prototype,t=a=>u(a,Ms).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),r=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},n=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return Ct(this,"_keyboardManager",new Df([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:r}],[["ctrl+z","mac+meta+z"],e.undo,{checker:r}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:r}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:r}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&u(a,Ms).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&u(a,Ms).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:t}]]))}destroy(){var e,t,r,n,s,a,o,l;(e=u(this,fi))==null||e.resolve(),T(this,fi,null),(t=u(this,Eu))==null||t.abort(),T(this,Eu,null),this._signal=null;for(const c of u(this,Yr).values())c.destroy();u(this,Yr).clear(),u(this,Ir).clear(),u(this,Mo).clear(),(r=u(this,Pa))==null||r.clear(),T(this,Vn,null),u(this,Ht).clear(),u(this,di).destroy(),(n=u(this,_u))==null||n.destroy(),(s=u(this,Ra))==null||s.destroy(),(a=u(this,ns))==null||a.hide(),T(this,ns,null),(o=u(this,Oo))==null||o.destroy(),T(this,Oo,null),u(this,rs)&&(clearTimeout(u(this,rs)),T(this,rs,null)),u(this,is)&&(clearTimeout(u(this,is)),T(this,is,null)),(l=this._editorUndoBar)==null||l.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return u(this,ad)}get useNewAltTextFlow(){return u(this,nd)}get useNewAltTextWhenAddingImage(){return u(this,Tu)}get hcmFilter(){return Ct(this,"hcmFilter",u(this,Fo)?u(this,id).addHCMFilter(u(this,Fo).foreground,u(this,Fo).background):"none")}get direction(){return Ct(this,"direction",getComputedStyle(u(this,Ms)).direction)}get highlightColors(){return Ct(this,"highlightColors",u(this,ku)?new Map(u(this,ku).split(",").map(e=>(e=e.split("=").map(t=>t.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColorNames(){return Ct(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),T(this,Ca,e)}setMainHighlightColorPicker(e){T(this,Oo,e)}editAltText(e,t=!1){var r;(r=u(this,_u))==null||r.editAltText(this,e,t)}getSignature(e){var t;(t=u(this,Ra))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return u(this,Ra)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case"enableNewAltTextWhenAddingImage":T(this,Tu,t);break}}onPageChanging({pageNumber:e}){T(this,Su,e-1)}focusMainContainer(){u(this,Ms).focus()}findParent(e,t){for(const r of u(this,Yr).values()){const{x:n,y:s,width:a,height:o}=r.div.getBoundingClientRect();if(e>=n&&e<=n+a&&t>=s&&t<=s+o)return r}return null}disableUserSelect(e=!1){u(this,ud).classList.toggle("noUserSelect",e)}addShouldRescale(e){u(this,Mo).add(e)}removeShouldRescale(e){u(this,Mo).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*da.PDF_TO_CSS_UNITS;for(const r of u(this,Mo))r.onScaleChanging();(t=u(this,Ca))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:a}=t,o=t.toString(),c=L(this,ze,bp).call(this,t).closest(".textLayer"),h=this.getSelectionBoxes(c);if(!h)return;t.empty();const d=L(this,ze,l0).call(this,c),p=u(this,zr)===ot.NONE,g=()=>{d==null||d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:h,anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:a,text:o}),p&&this.showAllEditors("highlight",!0,!0)};if(p){this.switchToMode(ot.HIGHLIGHT,g);return}g()}addToAnnotationStorage(e){!e.isEmpty()&&u(this,Is)&&!u(this,Is).has(e.id)&&u(this,Is).setValue(e.id,e)}a11yAlert(e,t=null){const r=u(this,cd);r&&(r.setAttribute("data-l10n-id",e),t?r.setAttribute("data-l10n-args",JSON.stringify(t)):r.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,u(this,Ta)&&(T(this,Ta,!1),L(this,ze,vp).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of u(this,Ht))if(t.div.contains(e)){T(this,Lo,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!u(this,Lo))return;const[e,t]=u(this,Lo);T(this,Lo,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){L(this,ze,u0).call(this),L(this,ze,c0).call(this)}removeEditListeners(){L(this,ze,w1).call(this),L(this,ze,h0).call(this)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const r of u(this,Ni))if(r.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const r of u(this,Ni))if(r.isHandlingMimeForPasting(t.type)){r.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var r;if(e.preventDefault(),(r=u(this,Vn))==null||r.commitOrRemove(),!this.hasSelection)return;const t=[];for(const n of u(this,Ht)){const s=n.serialize(!0);s&&t.push(s)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const s of t.items)for(const a of u(this,Ni))if(a.isHandlingMimeForPasting(s.type)){a.paste(s,this.currentLayer);return}let r=t.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(s){ut(`paste: "${s.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const n=this.currentLayer;try{const s=[];for(const l of r){const c=await n.deserialize(l);if(!c)return;s.push(c)}const a=()=>{for(const l of s)L(this,ze,d0).call(this,l);L(this,ze,f0).call(this,s)},o=()=>{for(const l of s)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(s){ut(`paste: "${s.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),u(this,zr)!==ot.NONE&&!this.isEditorHandlingKeyboard&&pu._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,u(this,Ta)&&(T(this,Ta,!1),L(this,ze,vp).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?(L(this,ze,v1).call(this),L(this,ze,c0).call(this),L(this,ze,yn).call(this,{isEditing:u(this,zr)!==ot.NONE,isEmpty:L(this,ze,lh).call(this),hasSomethingToUndo:u(this,di).hasSomethingToUndo(),hasSomethingToRedo:u(this,di).hasSomethingToRedo(),hasSelectedEditor:!1})):(L(this,ze,y1).call(this),L(this,ze,h0).call(this),L(this,ze,yn).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!u(this,Ni)){T(this,Ni,e);for(const t of u(this,Ni))L(this,ze,ks).call(this,t.defaultPropertiesToUpdate)}}getId(){return u(this,ug).id}get currentLayer(){return u(this,Yr).get(u(this,Su))}getLayer(e){return u(this,Yr).get(e)}get currentPageIndex(){return u(this,Su)}addLayer(e){u(this,Yr).set(e.pageIndex,e),u(this,ka)?e.enable():e.disable()}removeLayer(e){u(this,Yr).delete(e.pageIndex)}async updateMode(e,t=null,r=!1,n=!1){var s,a,o;if(u(this,zr)!==e&&!(u(this,fi)&&(await u(this,fi).promise,!u(this,fi)))){if(T(this,fi,Promise.withResolvers()),(s=u(this,Ca))==null||s.commitOrRemove(),T(this,zr,e),e===ot.NONE){this.setEditingState(!1),L(this,ze,E1).call(this),(a=this._editorUndoBar)==null||a.hide(),u(this,fi).resolve();return}e===ot.SIGNATURE&&await((o=u(this,Ra))==null?void 0:o.loadSignatures()),this.setEditingState(!0),await L(this,ze,A1).call(this),this.unselectAll();for(const l of u(this,Yr).values())l.updateMode(e);if(!t){r&&this.addNewEditorFromKeyboard(),u(this,fi).resolve();return}for(const l of u(this,Ir).values())l.annotationElementId===t||l.id===t?(this.setSelected(l),n&&l.enterInEditMode()):l.unselect();u(this,fi).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==u(this,zr)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){var r;if(u(this,Ni)){switch(e){case kt.CREATE:this.currentLayer.addNewEditor(t);return;case kt.HIGHLIGHT_DEFAULT_COLOR:(r=u(this,Oo))==null||r.updateColor(t);break;case kt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(u(this,od)||T(this,od,new Map)).set(e,t),this.showAllEditors("highlight",t);break}for(const n of u(this,Ht))n.updateParams(e,t);for(const n of u(this,Ni))n.updateDefaultParams(e,t)}}showAllEditors(e,t,r=!1){var s;for(const a of u(this,Ir).values())a.editorType===e&&a.show(t);(((s=u(this,od))==null?void 0:s.get(kt.HIGHLIGHT_SHOW_ALL))??!0)!==t&&L(this,ze,ks).call(this,[[kt.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(u(this,sd)!==e){T(this,sd,e);for(const t of u(this,Yr).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}getEditors(e){const t=[];for(const r of u(this,Ir).values())r.pageIndex===e&&t.push(r);return t}getEditor(e){return u(this,Ir).get(e)}addEditor(e){u(this,Ir).set(e.id,e)}removeEditor(e){var t,r;e.div.contains(document.activeElement)&&(u(this,rs)&&clearTimeout(u(this,rs)),T(this,rs,setTimeout(()=>{this.focusMainContainer(),T(this,rs,null)},0))),u(this,Ir).delete(e.id),e.annotationElementId&&((t=u(this,Pa))==null||t.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!u(this,No).has(e.annotationElementId))&&((r=u(this,Is))==null||r.remove(e.id))}addDeletedAnnotationElement(e){u(this,No).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return u(this,No).has(e)}removeDeletedAnnotationElement(e){u(this,No).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){u(this,Vn)!==e&&(T(this,Vn,e),e&&L(this,ze,ks).call(this,e.propertiesToUpdate))}updateUI(e){u(this,ze,_1)===e&&L(this,ze,ks).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){L(this,ze,ks).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(u(this,Ht).has(e)){u(this,Ht).delete(e),e.unselect(),L(this,ze,yn).call(this,{hasSelectedEditor:this.hasSelection});return}u(this,Ht).add(e),e.select(),L(this,ze,ks).call(this,e.propertiesToUpdate),L(this,ze,yn).call(this,{hasSelectedEditor:!0})}setSelected(e){var t;this.updateToolbar({mode:e.mode,editId:e.id}),(t=u(this,Ca))==null||t.commitOrRemove();for(const r of u(this,Ht))r!==e&&r.unselect();u(this,Ht).clear(),u(this,Ht).add(e),e.select(),L(this,ze,ks).call(this,e.propertiesToUpdate),L(this,ze,yn).call(this,{hasSelectedEditor:!0})}isSelected(e){return u(this,Ht).has(e)}get firstSelectedEditor(){return u(this,Ht).values().next().value}unselect(e){e.unselect(),u(this,Ht).delete(e),L(this,ze,yn).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return u(this,Ht).size!==0}get isEnterHandled(){return u(this,Ht).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;u(this,di).undo(),L(this,ze,yn).call(this,{hasSomethingToUndo:u(this,di).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:L(this,ze,lh).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){u(this,di).redo(),L(this,ze,yn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:u(this,di).hasSomethingToRedo(),isEmpty:L(this,ze,lh).call(this)})}addCommands(e){u(this,di).add(e),L(this,ze,yn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:L(this,ze,lh).call(this)})}cleanUndoStack(e){u(this,di).cleanType(e)}delete(){var s;this.commitOrRemove();const e=(s=this.currentLayer)==null?void 0:s.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...u(this,Ht)],r=()=>{var a;(a=this._editorUndoBar)==null||a.show(n,t.length===1?t[0].editorType:t.length);for(const o of t)o.remove()},n=()=>{for(const a of t)L(this,ze,d0).call(this,a)};this.addCommands({cmd:r,undo:n,mustExec:!0})}commitOrRemove(){var e;(e=u(this,Vn))==null||e.commitOrRemove()}hasSomethingToControl(){return u(this,Vn)||this.hasSelection}selectAll(){for(const e of u(this,Ht))e.commit();L(this,ze,f0).call(this,u(this,Ir).values())}unselectAll(){var e;if(!(u(this,Vn)&&(u(this,Vn).commitOrRemove(),u(this,zr)!==ot.NONE))&&!((e=u(this,Ca))!=null&&e.commitOrRemove())&&this.hasSelection){for(const t of u(this,Ht))t.unselect();u(this,Ht).clear(),L(this,ze,yn).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;u(this,Ia)[0]+=e,u(this,Ia)[1]+=t;const[n,s]=u(this,Ia),a=[...u(this,Ht)],o=1e3;u(this,is)&&clearTimeout(u(this,is)),T(this,is,setTimeout(()=>{T(this,is,null),u(this,Ia)[0]=u(this,Ia)[1]=0,this.addCommands({cmd:()=>{for(const l of a)u(this,Ir).has(l.id)&&(l.translateInPage(n,s),l.translationDone())},undo:()=>{for(const l of a)u(this,Ir).has(l.id)&&(l.translateInPage(-n,-s),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(e,t),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),T(this,ts,new Map);for(const e of u(this,Ht))u(this,ts).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!u(this,ts))return!1;this.disableUserSelect(!1);const e=u(this,ts);T(this,ts,null);let t=!1;for(const[{x:n,y:s,pageIndex:a},o]of e)o.newX=n,o.newY=s,o.newPageIndex=a,t||(t=n!==o.savedX||s!==o.savedY||a!==o.savedPageIndex);if(!t)return!1;const r=(n,s,a,o)=>{if(u(this,Ir).has(n.id)){const l=u(this,Yr).get(o);l?n._setParentAndPosition(l,s,a):(n.pageIndex=o,n.x=s,n.y=a)}};return this.addCommands({cmd:()=>{for(const[n,{newX:s,newY:a,newPageIndex:o}]of e)r(n,s,a,o)},undo:()=>{for(const[n,{savedX:s,savedY:a,savedPageIndex:o}]of e)r(n,s,a,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(u(this,ts))for(const r of u(this,ts).keys())r.drag(e,t)}rebuild(e){if(e.parent===null){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||u(this,Ht).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return u(this,Vn)===e}getActive(){return u(this,Vn)}getMode(){return u(this,zr)}get imageManager(){return Ct(this,"imageManager",new a0)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let c=0,h=t.rangeCount;c<h;c++)if(!e.contains(t.getRangeAt(c).commonAncestorContainer))return null;const{x:r,y:n,width:s,height:a}=e.getBoundingClientRect();let o;switch(e.getAttribute("data-main-rotation")){case"90":o=(c,h,d,p)=>({x:(h-n)/a,y:1-(c+d-r)/s,width:p/a,height:d/s});break;case"180":o=(c,h,d,p)=>({x:1-(c+d-r)/s,y:1-(h+p-n)/a,width:d/s,height:p/a});break;case"270":o=(c,h,d,p)=>({x:1-(h+p-n)/a,y:(c-r)/s,width:p/a,height:d/s});break;default:o=(c,h,d,p)=>({x:(c-r)/s,y:(h-n)/a,width:d/s,height:p/a});break}const l=[];for(let c=0,h=t.rangeCount;c<h;c++){const d=t.getRangeAt(c);if(!d.collapsed)for(const{x:p,y:g,width:y,height:b}of d.getClientRects())y===0||b===0||l.push(o(p,g,y,b))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:t}){(u(this,Cu)||T(this,Cu,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=u(this,Cu))==null||t.delete(e)}renderAnnotationElement(e){var n;const t=(n=u(this,Cu))==null?void 0:n.get(e.data.id);if(!t)return;const r=u(this,Is).getRawValue(t);r&&(u(this,zr)===ot.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}setMissingCanvas(e,t,r){var s;const n=(s=u(this,Pa))==null?void 0:s.get(e);n&&(n.setCanvas(t,r),u(this,Pa).delete(e))}addMissingCanvas(e,t){(u(this,Pa)||T(this,Pa,new Map)).set(e,t)}};Eu=new WeakMap,Vn=new WeakMap,Ir=new WeakMap,Yr=new WeakMap,_u=new WeakMap,Is=new WeakMap,Cu=new WeakMap,di=new WeakMap,_a=new WeakMap,Ca=new WeakMap,Su=new WeakMap,No=new WeakMap,ts=new WeakMap,Ni=new WeakMap,Mo=new WeakMap,rd=new WeakMap,nd=new WeakMap,Tu=new WeakMap,id=new WeakMap,rs=new WeakMap,Sa=new WeakMap,ku=new WeakMap,Ta=new WeakMap,ns=new WeakMap,ug=new WeakMap,ka=new WeakMap,sd=new WeakMap,Da=new WeakMap,Lo=new WeakMap,Oo=new WeakMap,Pa=new WeakMap,ad=new WeakMap,zr=new WeakMap,Ht=new WeakMap,Ns=new WeakMap,Ra=new WeakMap,Fo=new WeakMap,od=new WeakMap,ld=new WeakMap,Ia=new WeakMap,is=new WeakMap,Ms=new WeakMap,ud=new WeakMap,cd=new WeakMap,fi=new WeakMap,ze=new WeakSet,bp=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},l0=function(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const r of u(this,Yr).values())if(r.hasTextLayer(e))return r;return null},g1=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const r=L(this,ze,bp).call(this,e).closest(".textLayer"),n=this.getSelectionBoxes(r);n&&(u(this,ns)||T(this,ns,new L_(this)),u(this,ns).show(r,n,this.direction==="ltr"))},m1=function(){var s,a,o;const e=document.getSelection();if(!e||e.isCollapsed){u(this,Ns)&&((s=u(this,ns))==null||s.hide(),T(this,Ns,null),L(this,ze,yn).call(this,{hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===u(this,Ns))return;const n=L(this,ze,bp).call(this,e).closest(".textLayer");if(!n){u(this,Ns)&&((a=u(this,ns))==null||a.hide(),T(this,Ns,null),L(this,ze,yn).call(this,{hasSelectedText:!1}));return}if((o=u(this,ns))==null||o.hide(),T(this,Ns,t),L(this,ze,yn).call(this,{hasSelectedText:!0}),!(u(this,zr)!==ot.HIGHLIGHT&&u(this,zr)!==ot.NONE)&&(u(this,zr)===ot.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),T(this,Ta,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=u(this,zr)===ot.HIGHLIGHT?L(this,ze,l0).call(this,n):null;l==null||l.toggleDrawing();const c=new AbortController,h=this.combinedSignal(c),d=p=>{p.type==="pointerup"&&p.button!==0||(c.abort(),l==null||l.toggleDrawing(!0),p.type==="pointerup"&&L(this,ze,vp).call(this,"main_toolbar"))};window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("blur",d,{signal:h})}},vp=function(e=""){u(this,zr)===ot.HIGHLIGHT?this.highlightSelection(e):u(this,rd)&&L(this,ze,g1).call(this)},b1=function(){document.addEventListener("selectionchange",L(this,ze,m1).bind(this),{signal:this._signal})},v1=function(){if(u(this,Sa))return;T(this,Sa,new AbortController);const e=this.combinedSignal(u(this,Sa));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},y1=function(){var e;(e=u(this,Sa))==null||e.abort(),T(this,Sa,null)},u0=function(){if(u(this,Da))return;T(this,Da,new AbortController);const e=this.combinedSignal(u(this,Da));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},w1=function(){var e;(e=u(this,Da))==null||e.abort(),T(this,Da,null)},c0=function(){if(u(this,_a))return;T(this,_a,new AbortController);const e=this.combinedSignal(u(this,_a));document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})},h0=function(){var e;(e=u(this,_a))==null||e.abort(),T(this,_a,null)},x1=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},yn=function(e){Object.entries(e).some(([r,n])=>u(this,ld)[r]!==n)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(u(this,ld),e)}),u(this,zr)===ot.HIGHLIGHT&&e.hasSelectedEditor===!1&&L(this,ze,ks).call(this,[[kt.HIGHLIGHT_FREE,!0]]))},ks=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},A1=async function(){if(!u(this,ka)){T(this,ka,!0);const e=[];for(const t of u(this,Yr).values())e.push(t.enable());await Promise.all(e);for(const t of u(this,Ir).values())t.enable()}},E1=function(){if(this.unselectAll(),u(this,ka)){T(this,ka,!1);for(const e of u(this,Yr).values())e.disable();for(const e of u(this,Ir).values())e.disable()}},d0=function(e){const t=u(this,Yr).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},_1=function(){let e=null;for(e of u(this,Ht));return e},lh=function(){if(u(this,Ir).size===0)return!0;if(u(this,Ir).size===1)for(const e of u(this,Ir).values())return e.isEmpty();return!1},f0=function(e){for(const t of u(this,Ht))t.unselect();u(this,Ht).clear();for(const t of e)t.isEmpty()||(u(this,Ht).add(t),t.select());L(this,ze,yn).call(this,{hasSelectedEditor:this.hasSelection})},Ie(pu,"TRANSLATE_SMALL",1),Ie(pu,"TRANSLATE_BIG",10);let ao=pu;var jr,ss,Mi,Du,as,Gn,Pu,os,Rn,Ls,Bo,ls,Na,qi,uh,yp;const wn=class wn{constructor(e){N(this,qi);N(this,jr,null);N(this,ss,!1);N(this,Mi,null);N(this,Du,null);N(this,as,null);N(this,Gn,null);N(this,Pu,!1);N(this,os,null);N(this,Rn,null);N(this,Ls,null);N(this,Bo,null);N(this,ls,!1);T(this,Rn,e),T(this,ls,e._uiManager.useNewAltTextFlow),u(wn,Na)||T(wn,Na,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(e){wn._l10n??(wn._l10n=e)}async render(){const e=T(this,Mi,document.createElement("button"));e.className="altText",e.tabIndex="0";const t=T(this,Du,document.createElement("span"));e.append(t),u(this,ls)?(e.classList.add("new"),e.setAttribute("data-l10n-id",u(wn,Na).missing),t.setAttribute("data-l10n-id",u(wn,Na)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const r=u(this,Rn)._uiManager._signal;e.addEventListener("contextmenu",Ei,{signal:r}),e.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:r});const n=s=>{s.preventDefault(),u(this,Rn)._uiManager.editAltText(u(this,Rn)),u(this,ls)&&u(this,Rn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:u(this,qi,uh)}})};return e.addEventListener("click",n,{capture:!0,signal:r}),e.addEventListener("keydown",s=>{s.target===e&&s.key==="Enter"&&(T(this,Pu,!0),n(s))},{signal:r}),await L(this,qi,yp).call(this),e}finish(){u(this,Mi)&&(u(this,Mi).focus({focusVisible:u(this,Pu)}),T(this,Pu,!1))}isEmpty(){return u(this,ls)?u(this,jr)===null:!u(this,jr)&&!u(this,ss)}hasData(){return u(this,ls)?u(this,jr)!==null||!!u(this,Ls):this.isEmpty()}get guessedText(){return u(this,Ls)}async setGuessedText(e){u(this,jr)===null&&(T(this,Ls,e),T(this,Bo,await wn._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),L(this,qi,yp).call(this))}toggleAltTextBadge(e=!1){var t;if(!u(this,ls)||u(this,jr)){(t=u(this,os))==null||t.remove(),T(this,os,null);return}if(!u(this,os)){const r=T(this,os,document.createElement("div"));r.className="noAltTextBadge",u(this,Rn).div.append(r)}u(this,os).classList.toggle("hidden",!e)}serialize(e){let t=u(this,jr);return!e&&u(this,Ls)===t&&(t=u(this,Bo)),{altText:t,decorative:u(this,ss),guessedText:u(this,Ls),textWithDisclaimer:u(this,Bo)}}get data(){return{altText:u(this,jr),decorative:u(this,ss)}}set data({altText:e,decorative:t,guessedText:r,textWithDisclaimer:n,cancel:s=!1}){r&&(T(this,Ls,r),T(this,Bo,n)),!(u(this,jr)===e&&u(this,ss)===t)&&(s||(T(this,jr,e),T(this,ss,t)),L(this,qi,yp).call(this))}toggle(e=!1){u(this,Mi)&&(!e&&u(this,Gn)&&(clearTimeout(u(this,Gn)),T(this,Gn,null)),u(this,Mi).disabled=!e)}shown(){u(this,Rn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:u(this,qi,uh)}})}destroy(){var e,t;(e=u(this,Mi))==null||e.remove(),T(this,Mi,null),T(this,Du,null),T(this,as,null),(t=u(this,os))==null||t.remove(),T(this,os,null)}};jr=new WeakMap,ss=new WeakMap,Mi=new WeakMap,Du=new WeakMap,as=new WeakMap,Gn=new WeakMap,Pu=new WeakMap,os=new WeakMap,Rn=new WeakMap,Ls=new WeakMap,Bo=new WeakMap,ls=new WeakMap,Na=new WeakMap,qi=new WeakSet,uh=function(){return u(this,jr)&&"added"||u(this,jr)===null&&this.guessedText&&"review"||"missing"},yp=async function(){var n,s,a;const e=u(this,Mi);if(!e)return;if(u(this,ls)){if(e.classList.toggle("done",!!u(this,jr)),e.setAttribute("data-l10n-id",u(wn,Na)[u(this,qi,uh)]),(n=u(this,Du))==null||n.setAttribute("data-l10n-id",u(wn,Na)[`${u(this,qi,uh)}-label`]),!u(this,jr)){(s=u(this,as))==null||s.remove();return}}else{if(!u(this,jr)&&!u(this,ss)){e.classList.remove("done"),(a=u(this,as))==null||a.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=u(this,as);if(!t){T(this,as,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${u(this,Rn).id}`;const o=100,l=u(this,Rn)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(u(this,Gn)),T(this,Gn,null)},{once:!0}),e.addEventListener("mouseenter",()=>{T(this,Gn,setTimeout(()=>{T(this,Gn,null),u(this,as).classList.add("show"),u(this,Rn)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),e.addEventListener("mouseleave",()=>{var c;u(this,Gn)&&(clearTimeout(u(this,Gn)),T(this,Gn,null)),(c=u(this,as))==null||c.classList.remove("show")},{signal:l})}u(this,ss)?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=u(this,jr)),t.parentNode||e.append(t);const r=u(this,Rn).getElementForAltText();r==null||r.setAttribute("aria-describedby",t.id)},N(wn,Na,null),Ie(wn,"_l10n",null);let Yp=wn;var Ru,zo,hd,dd,fd,pd,gd,Os,jo,Fs,Uo,Bs,fo,C1,S1,T1;const bv=class bv{constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:r=null,onPinchStart:n=null,onPinching:s=null,onPinchEnd:a=null,signal:o}){N(this,fo);N(this,Ru);N(this,zo,!1);N(this,hd,null);N(this,dd);N(this,fd);N(this,pd);N(this,gd);N(this,Os,null);N(this,jo);N(this,Fs,null);N(this,Uo);N(this,Bs,null);T(this,Ru,e),T(this,hd,r),T(this,dd,t),T(this,fd,n),T(this,pd,s),T(this,gd,a),T(this,Uo,new AbortController),T(this,jo,AbortSignal.any([o,u(this,Uo).signal])),e.addEventListener("touchstart",L(this,fo,C1).bind(this),{passive:!1,signal:u(this,jo)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Wi.pixelRatio}destroy(){var e,t;(e=u(this,Uo))==null||e.abort(),T(this,Uo,null),(t=u(this,Os))==null||t.abort(),T(this,Os,null)}};Ru=new WeakMap,zo=new WeakMap,hd=new WeakMap,dd=new WeakMap,fd=new WeakMap,pd=new WeakMap,gd=new WeakMap,Os=new WeakMap,jo=new WeakMap,Fs=new WeakMap,Uo=new WeakMap,Bs=new WeakMap,fo=new WeakSet,C1=function(e){var n,s,a;if((n=u(this,dd))!=null&&n.call(this))return;if(e.touches.length===1){if(u(this,Os))return;const o=T(this,Os,new AbortController),l=AbortSignal.any([u(this,jo),o.signal]),c=u(this,Ru),h={capture:!0,signal:l,passive:!1},d=p=>{var g;p.pointerType==="touch"&&((g=u(this,Os))==null||g.abort(),T(this,Os,null))};c.addEventListener("pointerdown",p=>{p.pointerType==="touch"&&(_r(p),d(p))},h),c.addEventListener("pointerup",d,h),c.addEventListener("pointercancel",d,h);return}if(!u(this,Bs)){T(this,Bs,new AbortController);const o=AbortSignal.any([u(this,jo),u(this,Bs).signal]),l=u(this,Ru),c={signal:o,capture:!1,passive:!1};l.addEventListener("touchmove",L(this,fo,S1).bind(this),c);const h=L(this,fo,T1).bind(this);l.addEventListener("touchend",h,c),l.addEventListener("touchcancel",h,c),c.capture=!0,l.addEventListener("pointerdown",_r,c),l.addEventListener("pointermove",_r,c),l.addEventListener("pointercancel",_r,c),l.addEventListener("pointerup",_r,c),(s=u(this,fd))==null||s.call(this)}if(_r(e),e.touches.length!==2||(a=u(this,hd))!=null&&a.call(this)){T(this,Fs,null);return}let[t,r]=e.touches;t.identifier>r.identifier&&([t,r]=[r,t]),T(this,Fs,{touch0X:t.screenX,touch0Y:t.screenY,touch1X:r.screenX,touch1Y:r.screenY})},S1=function(e){var _;if(!u(this,Fs)||e.touches.length!==2)return;_r(e);let[t,r]=e.touches;t.identifier>r.identifier&&([t,r]=[r,t]);const{screenX:n,screenY:s}=t,{screenX:a,screenY:o}=r,l=u(this,Fs),{touch0X:c,touch0Y:h,touch1X:d,touch1Y:p}=l,g=d-c,y=p-h,b=a-n,w=o-s,v=Math.hypot(b,w)||1,A=Math.hypot(g,y)||1;if(!u(this,zo)&&Math.abs(A-v)<=bv.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=n,l.touch0Y=s,l.touch1X=a,l.touch1Y=o,!u(this,zo)){T(this,zo,!0);return}const E=[(n+a)/2,(s+o)/2];(_=u(this,pd))==null||_.call(this,E,A,v)},T1=function(e){var t;e.touches.length>=2||(u(this,Bs)&&(u(this,Bs).abort(),T(this,Bs,null),(t=u(this,gd))==null||t.call(this)),u(this,Fs)&&(_r(e),T(this,Fs,null),T(this,zo,!1)))};let Ih=bv;var Ho,Li,or,Iu,Ma,md,$o,Zr,Vo,zs,La,bd,Go,qn,vd,qo,js,us,Nu,Mu,pi,Wo,yd,cg,tt,p0,wd,g0,wp,k1,D1,m0,xp,b0,P1,R1,I1,v0,N1,y0,M1,L1,O1,w0,ch;const vt=class vt{constructor(e){N(this,tt);N(this,Ho,null);N(this,Li,null);N(this,or,null);N(this,Iu,!1);N(this,Ma,null);N(this,md,"");N(this,$o,!1);N(this,Zr,null);N(this,Vo,null);N(this,zs,null);N(this,La,null);N(this,bd,"");N(this,Go,!1);N(this,qn,null);N(this,vd,!1);N(this,qo,!1);N(this,js,!1);N(this,us,null);N(this,Nu,0);N(this,Mu,0);N(this,pi,null);N(this,Wo,null);Ie(this,"isSelected",!1);Ie(this,"_isCopy",!1);Ie(this,"_editToolbar",null);Ie(this,"_initialOptions",Object.create(null));Ie(this,"_initialData",null);Ie(this,"_isVisible",!0);Ie(this,"_uiManager",null);Ie(this,"_focusEventsAllowed",!0);N(this,yd,!1);N(this,cg,vt._zIndex++);this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null;const{rotation:t,rawDims:{pageWidth:r,pageHeight:n,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,n],this.pageTranslation=[s,a];const[o,l]=this.parentDimensions;this.x=e.x/o,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=vt.prototype._resizeWithKeyboard,t=ao.TRANSLATE_SMALL,r=ao.TRANSLATE_BIG;return Ct(this,"_resizerKeyboardManager",new Df([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-r,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[r,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-r]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,r]}],[["Escape","mac+Escape"],vt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Ct(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new B_({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(vt._l10n??(vt._l10n=e),vt._l10nResizer||(vt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),vt._borderLineWidth!==-1)return;const r=getComputedStyle(document.documentElement);vt._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Wt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return u(this,yd)}set _isDraggable(e){var t;T(this,yd,e),(t=this.div)==null||t.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=u(this,cg)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):L(this,tt,ch).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(u(this,Go)?T(this,Go,!1):this.parent.setSelected(this))}focusout(e){var r;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(r=this.parent)!=null&&r.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,r,n){const[s,a]=this.parentDimensions;[r,n]=this.screenToPageTranslation(r,n),this.x=(e+r)/s,this.y=(t+n)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){const[r,n]=this.parentDimensions;this.setAt(e*r,t*n,this.width*r,this.height*n),this._onTranslated()}translate(e,t){L(this,tt,p0).call(this,this.parentDimensions,e,t)}translateInPage(e,t){u(this,qn)||T(this,qn,[this.x,this.y,this.width,this.height]),L(this,tt,p0).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){u(this,qn)||T(this,qn,[this.x,this.y,this.width,this.height]);const{div:r,parentDimensions:[n,s]}=this;if(this.x+=e/n,this.y+=t/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:d,y:p}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,p)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,c]=this.getBaseTranslation();a+=l,o+=c;const{style:h}=r;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),r.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!u(this,qn)&&(u(this,qn)[0]!==this.x||u(this,qn)[1]!==this.y)}get _hasBeenResized(){return!!u(this,qn)&&(u(this,qn)[2]!==this.width||u(this,qn)[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:r}=vt,n=r/e,s=r/t;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[r,n]}=this;let{x:s,y:a,width:o,height:l}=this;if(o*=r,l*=n,s*=r,a*=n,this._mustFixPosition)switch(e){case 0:s=dn(s,0,r-o),a=dn(a,0,n-l);break;case 90:s=dn(s,0,r-l),a=dn(a,o,n);break;case 180:s=dn(s,o,r),a=dn(a,l,n);break;case 270:s=dn(s,l,r),a=dn(a,0,n-o);break}this.x=s/=r,this.y=a/=n;const[c,h]=this.getBaseTranslation();s+=c,a+=h,t.left=`${(100*s).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var r;return L(r=vt,wd,g0).call(r,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var r;return L(r=vt,wd,g0).call(r,e,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,r]}=this;return[t*e,r*e]}setDims(e,t){const[r,n]=this.parentDimensions,{style:s}=this.div;s.width=`${(100*e/r).toFixed(2)}%`,u(this,$o)||(s.height=`${(100*t/n).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:r}=e,n=r.endsWith("%"),s=!u(this,$o)&&t.endsWith("%");if(n&&s)return;const[a,o]=this.parentDimensions;n||(e.width=`${(100*parseFloat(r)/a).toFixed(2)}%`),!u(this,$o)&&!s&&(e.height=`${(100*parseFloat(t)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=u(this,or))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||u(this,qo))return this._editToolbar;this._editToolbar=new s0(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[t,r]of e)await this._editToolbar.addButton(t,r);return this._editToolbar.addButton("delete"),this._editToolbar}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=u(this,or))==null||e.destroy())}addContainer(e){var r;const t=(r=this._editToolbar)==null?void 0:r.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return u(this,or)||(Yp.initialize(vt._l10n),T(this,or,new Yp(this)),u(this,Ho)&&(u(this,or).data=u(this,Ho),T(this,Ho,null))),u(this,or)}get altTextData(){var e;return(e=u(this,or))==null?void 0:e.data}set altTextData(e){u(this,or)&&(u(this,or).data=e)}get guessedAltText(){var e;return(e=u(this,or))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=u(this,or))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=u(this,or))==null?void 0:t.serialize(e)}hasAltText(){return!!u(this,or)&&!u(this,or).isEmpty()}hasAltTextData(){var e;return((e=u(this,or))==null?void 0:e.hasData())??!1}render(){var a;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=u(this,Iu)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),L(this,tt,y0).call(this);const[t,r]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*r/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/r).toFixed(2)}%`);const[n,s]=this.getInitialTranslation();return this.translate(n,s),f1(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(u(this,Wo)||T(this,Wo,new Ih({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:L(this,tt,P1).bind(this),onPinching:L(this,tt,R1).bind(this),onPinchEnd:L(this,tt,I1).bind(this),signal:this._uiManager._signal}))),(a=this._uiManager._editorUndoBar)==null||a.hide(),e}pointerdown(e){const{isMac:t}=qr.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(T(this,Go,!0),this._isDraggable){L(this,tt,N1).call(this,e);return}L(this,tt,v0).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){u(this,us)&&clearTimeout(u(this,us)),T(this,us,setTimeout(()=>{var e;T(this,us,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,r){e.changeParent(this),this.x=t,this.y=r,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,r=this.rotation){const n=this.parentScale,[s,a]=this.pageDimensions,[o,l]=this.pageTranslation,c=e/n,h=t/n,d=this.x*s,p=this.y*a,g=this.width*s,y=this.height*a;switch(r){case 0:return[d+c+o,a-p-h-y+l,d+c+g+o,a-p-h+l];case 90:return[d+h+o,a-p+c+l,d+h+y+o,a-p+c+g+l];case 180:return[d-c-g+o,a-p+h+l,d-c+o,a-p+h+y+l];case 270:return[d-h-y+o,a-p-c-g+l,d-h+o,a-p-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[r,n,s,a]=e,o=s-r,l=a-n;switch(this.rotation){case 0:return[r,t-a,o,l];case 90:return[r,t-n,l,o];case 180:return[s,t-n,o,l];case 270:return[s,t-a,l,o];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),T(this,qo,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),T(this,qo,!1),!0):!1}isInEditMode(){return u(this,qo)}shouldGetKeyboardEvents(){return u(this,js)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:r,right:n}=this.getClientDimensions(),{innerHeight:s,innerWidth:a}=window;return t<a&&n>0&&e<s&&r>0}rebuild(){L(this,tt,y0).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,t=null){Wt("An editor must be serializable")}static async deserialize(e,t,r){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:r,annotationElementId:e.annotationElementId});n.rotation=e.rotation,T(n,Ho,e.accessibilityData),n._isCopy=e.isCopy||!1;const[s,a]=n.pageDimensions,[o,l,c,h]=n.getRectInCurrentCoords(e.rect,a);return n.x=o/s,n.y=l/a,n.width=c/s,n.height=h/a,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,t;if((e=u(this,La))==null||e.abort(),T(this,La,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),u(this,us)&&(clearTimeout(u(this,us)),T(this,us,null)),L(this,tt,ch).call(this),this.removeEditToolbar(),u(this,pi)){for(const r of u(this,pi).values())clearTimeout(r);T(this,pi,null)}this.parent=null,(t=u(this,Wo))==null||t.destroy(),T(this,Wo,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(L(this,tt,k1).call(this),u(this,Zr).classList.remove("hidden"))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),T(this,zs,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=u(this,Zr).children;if(!u(this,Li)){T(this,Li,Array.from(t));const a=L(this,tt,M1).bind(this),o=L(this,tt,L1).bind(this),l=this._uiManager._signal;for(const c of u(this,Li)){const h=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",a,{signal:l}),c.addEventListener("blur",o,{signal:l}),c.addEventListener("focus",L(this,tt,O1).bind(this,h),{signal:l}),c.setAttribute("data-l10n-id",vt._l10nResizer[h])}}const r=u(this,Li)[0];let n=0;for(const a of t){if(a===r)break;n++}const s=(360-this.rotation+this.parentRotation)%360/90*(u(this,Li).length/4);if(s!==n){if(s<n)for(let o=0;o<n-s;o++)u(this,Zr).append(u(this,Zr).firstChild);else if(s>n)for(let o=0;o<s-n;o++)u(this,Zr).firstChild.before(u(this,Zr).lastChild);let a=0;for(const o of t){const c=u(this,Li)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",vt._l10nResizer[c])}}L(this,tt,w0).call(this,0),T(this,js,!0),u(this,Zr).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){u(this,js)&&L(this,tt,b0).call(this,u(this,bd),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){L(this,tt,ch).call(this),this.div.focus()}select(){var e,t,r;if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var n,s;(n=this.div)!=null&&n.classList.contains("selectedEditor")&&((s=this._editToolbar)==null||s.show())});return}(t=this._editToolbar)==null||t.show(),(r=u(this,or))==null||r.toggleAltTextBadge(!1)}}unselect(){var e,t,r,n,s;this.isSelected&&(this.isSelected=!1,(e=u(this,Zr))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(r=this.div)!=null&&r.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(n=this._editToolbar)==null||n.hide(),(s=u(this,or))==null||s.toggleAltTextBadge(!0))}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return u(this,vd)}set isEditing(e){T(this,vd,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){T(this,$o,!0);const r=e/t,{style:n}=this.div;n.aspectRatio=r,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){u(this,pi)||T(this,pi,new Map);const{action:r}=e;let n=u(this,pi).get(r);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(e),u(this,pi).delete(r),u(this,pi).size===0&&T(this,pi,null)},vt._telemetryTimeout),u(this,pi).set(r,n);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),T(this,Iu,!1)}disable(){this.div&&(this.div.tabIndex=-1),T(this,Iu,!0)}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){const r=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),r.before(t)}return t}resetAnnotationElement(e){const{firstChild:t}=e.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};Ho=new WeakMap,Li=new WeakMap,or=new WeakMap,Iu=new WeakMap,Ma=new WeakMap,md=new WeakMap,$o=new WeakMap,Zr=new WeakMap,Vo=new WeakMap,zs=new WeakMap,La=new WeakMap,bd=new WeakMap,Go=new WeakMap,qn=new WeakMap,vd=new WeakMap,qo=new WeakMap,js=new WeakMap,us=new WeakMap,Nu=new WeakMap,Mu=new WeakMap,pi=new WeakMap,Wo=new WeakMap,yd=new WeakMap,cg=new WeakMap,tt=new WeakSet,p0=function([e,t],r,n){[r,n]=this.screenToPageTranslation(r,n),this.x+=r/e,this.y+=n/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},wd=new WeakSet,g0=function(e,t,r){switch(r){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},wp=function(e){switch(e){case 90:{const[t,r]=this.pageDimensions;return[0,-t/r,r/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,r]=this.pageDimensions;return[0,t/r,-r/t,0]}default:return[1,0,0,1]}},k1=function(){if(u(this,Zr))return;T(this,Zr,document.createElement("div")),u(this,Zr).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const r of e){const n=document.createElement("div");u(this,Zr).append(n),n.classList.add("resizer",r),n.setAttribute("data-resizer-name",r),n.addEventListener("pointerdown",L(this,tt,D1).bind(this,r),{signal:t}),n.addEventListener("contextmenu",Ei,{signal:t}),n.tabIndex=-1}this.div.prepend(u(this,Zr))},D1=function(e,t){var h;t.preventDefault();const{isMac:r}=qr.platform;if(t.button!==0||t.ctrlKey&&r)return;(h=u(this,or))==null||h.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,T(this,Vo,[t.screenX,t.screenY]);const s=new AbortController,a=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",L(this,tt,b0).bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",_r,{passive:!1,signal:a}),window.addEventListener("contextmenu",Ei,{signal:a}),T(this,zs,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const c=()=>{var d;s.abort(),this.parent.togglePointerEvents(!0),(d=u(this,or))==null||d.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=o,this.div.style.cursor=l,L(this,tt,xp).call(this)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})},m0=function(e,t,r,n){this.width=r,this.height=n,this.x=e,this.y=t;const[s,a]=this.parentDimensions;this.setDims(s*r,a*n),this.fixAndSetPosition(),this._onResized()},xp=function(){if(!u(this,zs))return;const{savedX:e,savedY:t,savedWidth:r,savedHeight:n}=u(this,zs);T(this,zs,null);const s=this.x,a=this.y,o=this.width,l=this.height;s===e&&a===t&&o===r&&l===n||this.addCommands({cmd:L(this,tt,m0).bind(this,s,a,o,l),undo:L(this,tt,m0).bind(this,e,t,r,n),mustExec:!0})},b0=function(e,t){const[r,n]=this.parentDimensions,s=this.x,a=this.y,o=this.width,l=this.height,c=vt.MIN_SIZE/r,h=vt.MIN_SIZE/n,d=L(this,tt,wp).call(this,this.rotation),p=(Y,W)=>[d[0]*Y+d[2]*W,d[1]*Y+d[3]*W],g=L(this,tt,wp).call(this,360-this.rotation),y=(Y,W)=>[g[0]*Y+g[2]*W,g[1]*Y+g[3]*W];let b,w,v=!1,A=!1;switch(e){case"topLeft":v=!0,b=(Y,W)=>[0,0],w=(Y,W)=>[Y,W];break;case"topMiddle":b=(Y,W)=>[Y/2,0],w=(Y,W)=>[Y/2,W];break;case"topRight":v=!0,b=(Y,W)=>[Y,0],w=(Y,W)=>[0,W];break;case"middleRight":A=!0,b=(Y,W)=>[Y,W/2],w=(Y,W)=>[0,W/2];break;case"bottomRight":v=!0,b=(Y,W)=>[Y,W],w=(Y,W)=>[0,0];break;case"bottomMiddle":b=(Y,W)=>[Y/2,W],w=(Y,W)=>[Y/2,0];break;case"bottomLeft":v=!0,b=(Y,W)=>[0,W],w=(Y,W)=>[Y,0];break;case"middleLeft":A=!0,b=(Y,W)=>[0,W/2],w=(Y,W)=>[Y,W/2];break}const E=b(o,l),_=w(o,l);let C=p(..._);const I=vt._round(s+C[0]),k=vt._round(a+C[1]);let D=1,R=1,z,G;if(t.fromKeyboard)({deltaX:z,deltaY:G}=t);else{const{screenX:Y,screenY:W}=t,[fe,K]=u(this,Vo);[z,G]=this.screenToPageTranslation(Y-fe,W-K),u(this,Vo)[0]=Y,u(this,Vo)[1]=W}if([z,G]=y(z/r,G/n),v){const Y=Math.hypot(o,l);D=R=Math.max(Math.min(Math.hypot(_[0]-E[0]-z,_[1]-E[1]-G)/Y,1/o,1/l),c/o,h/l)}else A?D=dn(Math.abs(_[0]-E[0]-z),c,1)/o:R=dn(Math.abs(_[1]-E[1]-G),h,1)/l;const O=vt._round(o*D),X=vt._round(l*R);C=p(...w(O,X));const S=I-C[0],J=k-C[1];u(this,qn)||T(this,qn,[this.x,this.y,this.width,this.height]),this.width=O,this.height=X,this.x=S,this.y=J,this.setDims(r*O,n*X),this.fixAndSetPosition(),this._onResizing()},P1=function(){var e;T(this,zs,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=u(this,or))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},R1=function(e,t,r){let s=.7*(r/t)+1-.7;if(s===1)return;const a=L(this,tt,wp).call(this,this.rotation),o=(I,k)=>[a[0]*I+a[2]*k,a[1]*I+a[3]*k],[l,c]=this.parentDimensions,h=this.x,d=this.y,p=this.width,g=this.height,y=vt.MIN_SIZE/l,b=vt.MIN_SIZE/c;s=Math.max(Math.min(s,1/p,1/g),y/p,b/g);const w=vt._round(p*s),v=vt._round(g*s);if(w===p&&v===g)return;u(this,qn)||T(this,qn,[h,d,p,g]);const A=o(p/2,g/2),E=vt._round(h+A[0]),_=vt._round(d+A[1]),C=o(w/2,v/2);this.x=E-C[0],this.y=_-C[1],this.width=w,this.height=v,this.setDims(l*w,c*v),this.fixAndSetPosition(),this._onResizing()},I1=function(){var e;(e=u(this,or))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),L(this,tt,xp).call(this)},v0=function(e){const{isMac:t}=qr.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},N1=function(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let r=!1;const n=new AbortController,s=this._uiManager.combinedSignal(n),a={capture:!0,passive:!1,signal:s},o=c=>{n.abort(),T(this,Ma,null),T(this,Go,!1),this._uiManager.endDragSession()||L(this,tt,v0).call(this,c),r&&this._onStopDragging()};t&&(T(this,Nu,e.clientX),T(this,Mu,e.clientY),T(this,Ma,e.pointerId),T(this,md,e.pointerType),window.addEventListener("pointermove",c=>{r||(r=!0,this._onStartDragging());const{clientX:h,clientY:d,pointerId:p}=c;if(p!==u(this,Ma)){_r(c);return}const[g,y]=this.screenToPageTranslation(h-u(this,Nu),d-u(this,Mu));T(this,Nu,h),T(this,Mu,d),this._uiManager.dragSelectedEditors(g,y)},a),window.addEventListener("touchmove",_r,a),window.addEventListener("pointerdown",c=>{c.pointerType===u(this,md)&&(u(this,Wo)||c.isPrimary)&&o(c),_r(c)},a));const l=c=>{if(!u(this,Ma)||u(this,Ma)===c.pointerId){o(c);return}_r(c)};window.addEventListener("pointerup",l,{signal:s}),window.addEventListener("blur",l,{signal:s})},y0=function(){if(u(this,La)||!this.div)return;T(this,La,new AbortController);const e=this._uiManager.combinedSignal(u(this,La));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},M1=function(e){vt._resizerKeyboardManager.exec(this,e)},L1=function(e){var t;u(this,js)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==u(this,Zr)&&L(this,tt,ch).call(this)},O1=function(e){T(this,bd,u(this,js)?e:"")},w0=function(e){if(u(this,Li))for(const t of u(this,Li))t.tabIndex=e},ch=function(){T(this,js,!1),L(this,tt,w0).call(this,-1),L(this,tt,xp).call(this)},N(vt,wd),Ie(vt,"_l10n",null),Ie(vt,"_l10nResizer",null),Ie(vt,"_borderLineWidth",-1),Ie(vt,"_colorManager",new o0),Ie(vt,"_zIndex",1),Ie(vt,"_telemetryTimeout",1e3);let tr=vt;class B_ extends tr{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Kv=3285377520,ci=4294901760,Qi=65535;class F1{constructor(e){this.h1=e?e&4294967295:Kv,this.h2=e?e&4294967295:Kv}update(e){let t,r;if(typeof e=="string"){t=new Uint8Array(e.length*2),r=0;for(let b=0,w=e.length;b<w;b++){const v=e.charCodeAt(b);v<=255?t[r++]=v:(t[r++]=v>>>8,t[r++]=v&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),r=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const n=r>>2,s=r-n*4,a=new Uint32Array(t.buffer,0,n);let o=0,l=0,c=this.h1,h=this.h2;const d=3432918353,p=461845907,g=d&Qi,y=p&Qi;for(let b=0;b<n;b++)b&1?(o=a[b],o=o*d&ci|o*g&Qi,o=o<<15|o>>>17,o=o*p&ci|o*y&Qi,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(l=a[b],l=l*d&ci|l*g&Qi,l=l<<15|l>>>17,l=l*p&ci|l*y&Qi,h^=l,h=h<<13|h>>>19,h=h*5+3864292196);switch(o=0,s){case 3:o^=t[n*4+2]<<16;case 2:o^=t[n*4+1]<<8;case 1:o^=t[n*4],o=o*d&ci|o*g&Qi,o=o<<15|o>>>17,o=o*p&ci|o*y&Qi,n&1?c^=o:h^=o}this.h1=c,this.h2=h}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&ci|e*36045&Qi,t=t*4283543511&ci|((t<<16|e>>>16)*2950163797&ci)>>>16,e^=t>>>1,e=e*444984403&ci|e*60499&Qi,t=t*3301882366&ci|((t<<16|e>>>16)*3120437893&ci)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const x0=Object.freeze({map:null,hash:"",transfer:void 0});var Xo,Yo,Kr,hg,B1;class Lb{constructor(){N(this,hg);N(this,Xo,!1);N(this,Yo,null);N(this,Kr,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const r=u(this,Kr).get(e);return r===void 0?t:Object.assign(t,r)}getRawValue(e){return u(this,Kr).get(e)}remove(e){if(u(this,Kr).delete(e),u(this,Kr).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const t of u(this,Kr).values())if(t instanceof tr)return;this.onAnnotationEditor(null)}}setValue(e,t){const r=u(this,Kr).get(e);let n=!1;if(r!==void 0)for(const[s,a]of Object.entries(t))r[s]!==a&&(n=!0,r[s]=a);else n=!0,u(this,Kr).set(e,t);n&&L(this,hg,B1).call(this),t instanceof tr&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type)}has(e){return u(this,Kr).has(e)}get size(){return u(this,Kr).size}resetModified(){u(this,Xo)&&(T(this,Xo,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new z1(this)}get serializable(){if(u(this,Kr).size===0)return x0;const e=new Map,t=new F1,r=[],n=Object.create(null);let s=!1;for(const[a,o]of u(this,Kr)){const l=o instanceof tr?o.serialize(!1,n):o;l&&(e.set(a,l),t.update(`${a}:${JSON.stringify(l)}`),s||(s=!!l.bitmap))}if(s)for(const a of e.values())a.bitmap&&r.push(a.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:r}:x0}get editorStats(){let e=null;const t=new Map;for(const r of u(this,Kr).values()){if(!(r instanceof tr))continue;const n=r.telemetryFinalData;if(!n)continue;const{type:s}=n;t.has(s)||t.set(s,Object.getPrototypeOf(r).constructor),e||(e=Object.create(null));const a=e[s]||(e[s]=new Map);for(const[o,l]of Object.entries(n)){if(o==="type")continue;let c=a.get(o);c||(c=new Map,a.set(o,c));const h=c.get(l)??0;c.set(l,h+1)}}for(const[r,n]of t)e[r]=n.computeTelemetryFinalData(e[r]);return e}resetModifiedIds(){T(this,Yo,null)}get modifiedIds(){if(u(this,Yo))return u(this,Yo);const e=[];for(const t of u(this,Kr).values())!(t instanceof tr)||!t.annotationElementId||!t.serialize()||e.push(t.annotationElementId);return T(this,Yo,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return u(this,Kr).entries()}}Xo=new WeakMap,Yo=new WeakMap,Kr=new WeakMap,hg=new WeakSet,B1=function(){u(this,Xo)||(T(this,Xo,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var xd;class z1 extends Lb{constructor(t){super();N(this,xd);const{map:r,hash:n,transfer:s}=t.serializable,a=structuredClone(r,s?{transfer:s}:null);T(this,xd,{map:a,hash:n,transfer:s})}get print(){Wt("Should not call PrintAnnotationStorage.print")}get serializable(){return u(this,xd)}get modifiedIds(){return Ct(this,"modifiedIds",{ids:new Set,hash:""})}}xd=new WeakMap;var Lu;class z_{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){N(this,Lu,new Set);this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),u(this,Lu).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:r}){if(!(!e||u(this,Lu).has(e.loadedName))){if(Dr(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:s,style:a}=e,o=new FontFace(n,s,a);this.addNativeFontFace(o);try{await o.load(),u(this,Lu).add(n),r==null||r(e)}catch{ut(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}Wt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const r=e.createNativeFontFace();if(r){this.addNativeFontFace(r);try{await r.loaded}catch(n){throw ut(`Failed to load font '${r.family}': '${n}'.`),e.disableFontFace=!0,n}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const n=this._queueLoadingCallback(r);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return Ct(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Ct(this,"isSyncFontLoadingSupported",_n||qr.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(Dr(!n.done,"completeRequest() cannot be called twice."),n.done=!0;r.length>0&&r[0].done;){const s=r.shift();setTimeout(s.callback,0)}}const{loadingRequests:r}=this,n={done:!1,complete:t,callback:e};return r.push(n),n}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Ct(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function r(_,C){return _.charCodeAt(C)<<24|_.charCodeAt(C+1)<<16|_.charCodeAt(C+2)<<8|_.charCodeAt(C+3)&255}function n(_,C,I,k){const D=_.substring(0,C),R=_.substring(C+I);return D+k+R}let s,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let c=0;function h(_,C){if(++c>30){ut("Load test font never loaded."),C();return}if(l.font="30px "+_,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(h.bind(null,_,C))}const d=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=n(p,976,d.length,d);const y=16,b=1482184792;let w=r(p,y);for(s=0,a=d.length-3;s<a;s+=4)w=w-b+r(d,s)|0;s<d.length&&(w=w-b+r(d+"XXX",s)|0),p=n(p,y,4,T_(w));const v=`url(data:font/opentype;base64,${btoa(p)});`,A=`@font-face {font-family:"${d}";src:${v}}`;this.insertRule(A);const E=this._document.createElement("div");E.style.visibility="hidden",E.style.width=E.style.height="10px",E.style.position="absolute",E.style.top=E.style.left="0px";for(const _ of[e.loadedName,d]){const C=this._document.createElement("span");C.textContent="Hi",C.style.fontFamily=_,E.append(C)}this._document.body.append(E),h(d,()=>{E.remove(),t.complete()})}}Lu=new WeakMap;class j_{constructor(e,t=null){this.compiledGlyphs=Object.create(null);for(const r in e)this[r]=e[r];this._inspectFont=t}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var r;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${n1(this.data)});`;let t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${e}}`}return(r=this._inspectFont)==null||r.call(this,this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];const r=this.loadedName+"_path_"+t;let n;try{n=e.get(r)}catch(a){ut(`getPathGenerator - ignoring character: "${a}".`)}const s=new Path2D(n||"");return this.fontExtraProperties||e.delete(r),this.compiledGlyphs[t]=s}}function U_(i){if(i instanceof URL)return i.href;if(typeof i=="string"){if(_n)return i;const e=URL.parse(i,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function H_(i){if(_n&&typeof Buffer<"u"&&i instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength)return i;if(typeof i=="string")return Sf(i);if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)||typeof i=="object"&&!isNaN(i==null?void 0:i.length))return new Uint8Array(i);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function tp(i){if(typeof i!="string")return null;if(i.endsWith("/"))return i;throw new Error(`Invalid factory url: "${i}" must include trailing slash.`)}const A0=i=>typeof i=="object"&&Number.isInteger(i==null?void 0:i.num)&&i.num>=0&&Number.isInteger(i==null?void 0:i.gen)&&i.gen>=0,$_=i=>typeof i=="object"&&typeof(i==null?void 0:i.name)=="string",j1=R_.bind(null,A0,$_);var Us,dg;class V_{constructor(){N(this,Us,new Map);N(this,dg,Promise.resolve())}postMessage(e,t){const r={data:structuredClone(e,t?{transfer:t}:null)};u(this,dg).then(()=>{for(const[n]of u(this,Us))n.call(this,r)})}addEventListener(e,t,r=null){let n=null;if((r==null?void 0:r.signal)instanceof AbortSignal){const{signal:s}=r;if(s.aborted){ut("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(e,t);n=()=>s.removeEventListener("abort",a),s.addEventListener("abort",a)}u(this,Us).set(t,n)}removeEventListener(e,t){const r=u(this,Us).get(t);r==null||r(),u(this,Us).delete(t)}terminate(){for(const[,e]of u(this,Us))e==null||e();u(this,Us).clear()}}Us=new WeakMap,dg=new WeakMap;const rp={DATA:1,ERROR:2},Tr={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Qv(){}function Dn(i){if(i instanceof ha||i instanceof Wp||i instanceof Xv||i instanceof Rh||i instanceof dm)return i;switch(i instanceof Error||typeof i=="object"&&i!==null||Wt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),i.name){case"AbortException":return new ha(i.message);case"InvalidPDFException":return new Wp(i.message);case"PasswordException":return new Xv(i.message,i.code);case"ResponseException":return new Rh(i.message,i.status,i.missing);case"UnknownErrorException":return new dm(i.message,i.details)}return new dm(i.message,i.toString())}var Ou,Ai,U1,H1,$1,Ap;class hh{constructor(e,t,r){N(this,Ai);N(this,Ou,new AbortController);this.sourceName=e,this.targetName=t,this.comObj=r,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),r.addEventListener("message",L(this,Ai,U1).bind(this),{signal:u(this,Ou).signal})}on(e,t){const r=this.actionHandler;if(r[e])throw new Error(`There is already an actionName called "${e}"`);r[e]=t}send(e,t,r){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},r)}sendWithPromise(e,t,r){const n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:n,data:t},r)}catch(a){s.reject(a)}return s.promise}sendWithStream(e,t,r,n){const s=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:c=>{const h=Promise.withResolvers();return this.streamControllers[s]={controller:c,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:e,streamId:s,data:t,desiredSize:c.desiredSize},n),h.promise},pull:c=>{const h=Promise.withResolvers();return this.streamControllers[s].pullCall=h,l.postMessage({sourceName:a,targetName:o,stream:Tr.PULL,streamId:s,desiredSize:c.desiredSize}),h.promise},cancel:c=>{Dr(c instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[s].cancelCall=h,this.streamControllers[s].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:Tr.CANCEL,streamId:s,reason:Dn(c)}),h.promise}},r)}destroy(){var e;(e=u(this,Ou))==null||e.abort(),T(this,Ou,null)}}Ou=new WeakMap,Ai=new WeakSet,U1=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){L(this,Ai,$1).call(this,e);return}if(e.callback){const r=e.callbackId,n=this.callbackCapabilities[r];if(!n)throw new Error(`Cannot resolve callback ${r}`);if(delete this.callbackCapabilities[r],e.callback===rp.DATA)n.resolve(e.data);else if(e.callback===rp.ERROR)n.reject(Dn(e.reason));else throw new Error("Unexpected callback case");return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const r=this.sourceName,n=e.sourceName,s=this.comObj;Promise.try(t,e.data).then(function(a){s.postMessage({sourceName:r,targetName:n,callback:rp.DATA,callbackId:e.callbackId,data:a})},function(a){s.postMessage({sourceName:r,targetName:n,callback:rp.ERROR,callbackId:e.callbackId,reason:Dn(a)})});return}if(e.streamId){L(this,Ai,H1).call(this,e);return}t(e.data)},H1=function(e){const t=e.streamId,r=this.sourceName,n=e.sourceName,s=this.comObj,a=this,o=this.actionHandler[e.action],l={enqueue(c,h=1,d){if(this.isCancelled)return;const p=this.desiredSize;this.desiredSize-=h,p>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:r,targetName:n,stream:Tr.ENQUEUE,streamId:t,chunk:c},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:r,targetName:n,stream:Tr.CLOSE,streamId:t}),delete a.streamSinks[t])},error(c){Dr(c instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:r,targetName:n,stream:Tr.ERROR,streamId:t,reason:Dn(c)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[t]=l,Promise.try(o,e.data,l).then(function(){s.postMessage({sourceName:r,targetName:n,stream:Tr.START_COMPLETE,streamId:t,success:!0})},function(c){s.postMessage({sourceName:r,targetName:n,stream:Tr.START_COMPLETE,streamId:t,reason:Dn(c)})})},$1=function(e){const t=e.streamId,r=this.sourceName,n=e.sourceName,s=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case Tr.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(Dn(e.reason));break;case Tr.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(Dn(e.reason));break;case Tr.PULL:if(!o){s.postMessage({sourceName:r,targetName:n,stream:Tr.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||Qv).then(function(){s.postMessage({sourceName:r,targetName:n,stream:Tr.PULL_COMPLETE,streamId:t,success:!0})},function(c){s.postMessage({sourceName:r,targetName:n,stream:Tr.PULL_COMPLETE,streamId:t,reason:Dn(c)})});break;case Tr.ENQUEUE:if(Dr(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case Tr.CLOSE:if(Dr(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),L(this,Ai,Ap).call(this,a,t);break;case Tr.ERROR:Dr(a,"error should have stream controller"),a.controller.error(Dn(e.reason)),L(this,Ai,Ap).call(this,a,t);break;case Tr.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(Dn(e.reason)),L(this,Ai,Ap).call(this,a,t);break;case Tr.CANCEL:if(!o)break;const l=Dn(e.reason);Promise.try(o.onCancel||Qv,l).then(function(){s.postMessage({sourceName:r,targetName:n,stream:Tr.CANCEL_COMPLETE,streamId:t,success:!0})},function(c){s.postMessage({sourceName:r,targetName:n,stream:Tr.CANCEL_COMPLETE,streamId:t,reason:Dn(c)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},Ap=async function(e,t){var r,n,s;await Promise.allSettled([(r=e.startCall)==null?void 0:r.promise,(n=e.pullCall)==null?void 0:n.promise,(s=e.cancelCall)==null?void 0:s.promise]),delete this.streamControllers[t]};var Ad;class V1{constructor({enableHWA:e=!1}){N(this,Ad,!1);T(this,Ad,e)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const r=this._createCanvas(e,t);return{canvas:r,context:r.getContext("2d",{willReadFrequently:!u(this,Ad)})}}reset(e,t,r){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||r<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=r}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Wt("Abstract method `_createCanvas` called.")}}Ad=new WeakMap;class G_ extends V1{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const r=this._document.createElement("canvas");return r.width=e,r.height=t,r}}class G1{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then(r=>({cMapData:r,isCompressed:this.isCompressed})).catch(r=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}async _fetch(e){Wt("Abstract method `_fetch` called.")}}class Jv extends G1{async _fetch(e){const t=await Nc(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Sf(t)}}class q1{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,r,n,s){return"none"}destroy(e=!1){}}var Zo,Fu,Hs,$s,cn,Ko,Qo,Ge,ln,dh,su,Ep,au,W1,E0,ou,fh,ph,_0,gh;class q_ extends q1{constructor({docId:t,ownerDocument:r=globalThis.document}){super();N(this,Ge);N(this,Zo);N(this,Fu);N(this,Hs);N(this,$s);N(this,cn);N(this,Ko);N(this,Qo,0);T(this,$s,t),T(this,cn,r)}addFilter(t){if(!t)return"none";let r=u(this,Ge,ln).get(t);if(r)return r;const[n,s,a]=L(this,Ge,Ep).call(this,t),o=t.length===1?n:`${n}${s}${a}`;if(r=u(this,Ge,ln).get(o),r)return u(this,Ge,ln).set(t,r),r;const l=`g_${u(this,$s)}_transfer_map_${bn(this,Qo)._++}`,c=L(this,Ge,au).call(this,l);u(this,Ge,ln).set(t,c),u(this,Ge,ln).set(o,c);const h=L(this,Ge,ou).call(this,l);return L(this,Ge,ph).call(this,n,s,a,h),c}addHCMFilter(t,r){var y;const n=`${t}-${r}`,s="base";let a=u(this,Ge,dh).get(s);if((a==null?void 0:a.key)===n||(a?((y=a.filter)==null||y.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},u(this,Ge,dh).set(s,a)),!t||!r))return a.url;const o=L(this,Ge,gh).call(this,t);t=Qe.makeHexColor(...o);const l=L(this,Ge,gh).call(this,r);if(r=Qe.makeHexColor(...l),u(this,Ge,su).style.color="",t==="#000000"&&r==="#ffffff"||t===r)return a.url;const c=new Array(256);for(let b=0;b<=255;b++){const w=b/255;c[b]=w<=.03928?w/12.92:((w+.055)/1.055)**2.4}const h=c.join(","),d=`g_${u(this,$s)}_hcm_filter`,p=a.filter=L(this,Ge,ou).call(this,d);L(this,Ge,ph).call(this,h,h,h,p),L(this,Ge,E0).call(this,p);const g=(b,w)=>{const v=o[b]/255,A=l[b]/255,E=new Array(w+1);for(let _=0;_<=w;_++)E[_]=v+_/w*(A-v);return E.join(",")};return L(this,Ge,ph).call(this,g(0,5),g(1,5),g(2,5),p),a.url=L(this,Ge,au).call(this,d),a.url}addAlphaFilter(t){let r=u(this,Ge,ln).get(t);if(r)return r;const[n]=L(this,Ge,Ep).call(this,[t]),s=`alpha_${n}`;if(r=u(this,Ge,ln).get(s),r)return u(this,Ge,ln).set(t,r),r;const a=`g_${u(this,$s)}_alpha_map_${bn(this,Qo)._++}`,o=L(this,Ge,au).call(this,a);u(this,Ge,ln).set(t,o),u(this,Ge,ln).set(s,o);const l=L(this,Ge,ou).call(this,a);return L(this,Ge,_0).call(this,n,l),o}addLuminosityFilter(t){let r=u(this,Ge,ln).get(t||"luminosity");if(r)return r;let n,s;if(t?([n]=L(this,Ge,Ep).call(this,[t]),s=`luminosity_${n}`):s="luminosity",r=u(this,Ge,ln).get(s),r)return u(this,Ge,ln).set(t,r),r;const a=`g_${u(this,$s)}_luminosity_map_${bn(this,Qo)._++}`,o=L(this,Ge,au).call(this,a);u(this,Ge,ln).set(t,o),u(this,Ge,ln).set(s,o);const l=L(this,Ge,ou).call(this,a);return L(this,Ge,W1).call(this,l),t&&L(this,Ge,_0).call(this,n,l),o}addHighlightHCMFilter(t,r,n,s,a){var A;const o=`${r}-${n}-${s}-${a}`;let l=u(this,Ge,dh).get(t);if((l==null?void 0:l.key)===o||(l?((A=l.filter)==null||A.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},u(this,Ge,dh).set(t,l)),!r||!n))return l.url;const[c,h]=[r,n].map(L(this,Ge,gh).bind(this));let d=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),p=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[g,y]=[s,a].map(L(this,Ge,gh).bind(this));p<d&&([d,p,g,y]=[p,d,y,g]),u(this,Ge,su).style.color="";const b=(E,_,C)=>{const I=new Array(256),k=(p-d)/C,D=E/255,R=(_-E)/(255*C);let z=0;for(let G=0;G<=C;G++){const O=Math.round(d+G*k),X=D+G*R;for(let S=z;S<=O;S++)I[S]=X;z=O+1}for(let G=z;G<256;G++)I[G]=I[z-1];return I.join(",")},w=`g_${u(this,$s)}_hcm_${t}_filter`,v=l.filter=L(this,Ge,ou).call(this,w);return L(this,Ge,E0).call(this,v),L(this,Ge,ph).call(this,b(g[0],y[0],5),b(g[1],y[1],5),b(g[2],y[2],5),v),l.url=L(this,Ge,au).call(this,w),l.url}destroy(t=!1){var r,n,s,a;t&&((r=u(this,Ko))!=null&&r.size)||((n=u(this,Hs))==null||n.parentNode.parentNode.remove(),T(this,Hs,null),(s=u(this,Fu))==null||s.clear(),T(this,Fu,null),(a=u(this,Ko))==null||a.clear(),T(this,Ko,null),T(this,Qo,0))}}Zo=new WeakMap,Fu=new WeakMap,Hs=new WeakMap,$s=new WeakMap,cn=new WeakMap,Ko=new WeakMap,Qo=new WeakMap,Ge=new WeakSet,ln=function(){return u(this,Fu)||T(this,Fu,new Map)},dh=function(){return u(this,Ko)||T(this,Ko,new Map)},su=function(){if(!u(this,Hs)){const t=u(this,cn).createElement("div"),{style:r}=t;r.visibility="hidden",r.contain="strict",r.width=r.height=0,r.position="absolute",r.top=r.left=0,r.zIndex=-1;const n=u(this,cn).createElementNS(Ts,"svg");n.setAttribute("width",0),n.setAttribute("height",0),T(this,Hs,u(this,cn).createElementNS(Ts,"defs")),t.append(n),n.append(u(this,Hs)),u(this,cn).body.append(t)}return u(this,Hs)},Ep=function(t){if(t.length===1){const c=t[0],h=new Array(256);for(let p=0;p<256;p++)h[p]=c[p]/255;const d=h.join(",");return[d,d,d]}const[r,n,s]=t,a=new Array(256),o=new Array(256),l=new Array(256);for(let c=0;c<256;c++)a[c]=r[c]/255,o[c]=n[c]/255,l[c]=s[c]/255;return[a.join(","),o.join(","),l.join(",")]},au=function(t){if(u(this,Zo)===void 0){T(this,Zo,"");const r=u(this,cn).URL;r!==u(this,cn).baseURI&&(kf(r)?ut('#createUrl: ignore "data:"-URL for performance reasons.'):T(this,Zo,Rb(r,"")))}return`url(${u(this,Zo)}#${t})`},W1=function(t){const r=u(this,cn).createElementNS(Ts,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(r)},E0=function(t){const r=u(this,cn).createElementNS(Ts,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(r)},ou=function(t){const r=u(this,cn).createElementNS(Ts,"filter");return r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("id",t),u(this,Ge,su).append(r),r},fh=function(t,r,n){const s=u(this,cn).createElementNS(Ts,r);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),t.append(s)},ph=function(t,r,n,s){const a=u(this,cn).createElementNS(Ts,"feComponentTransfer");s.append(a),L(this,Ge,fh).call(this,a,"feFuncR",t),L(this,Ge,fh).call(this,a,"feFuncG",r),L(this,Ge,fh).call(this,a,"feFuncB",n)},_0=function(t,r){const n=u(this,cn).createElementNS(Ts,"feComponentTransfer");r.append(n),L(this,Ge,fh).call(this,n,"feFuncA",t)},gh=function(t){return u(this,Ge,su).style.color=t,Mb(getComputedStyle(u(this,Ge,su)).getPropertyValue("color"))};class X1{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch(r=>{throw new Error(`Unable to load font data at: ${t}`)})}async _fetch(e){Wt("Abstract method `_fetch` called.")}}class ey extends X1{async _fetch(e){const t=await Nc(e,"arraybuffer");return new Uint8Array(t)}}class Y1{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch(r=>{throw new Error(`Unable to load wasm data at: ${t}`)})}async _fetch(e){Wt("Abstract method `_fetch` called.")}}class ty extends Y1{async _fetch(e){const t=await Nc(e,"arraybuffer");return new Uint8Array(t)}}_n&&ut("Please use the `legacy` build in Node.js environments.");async function Ob(i){const t=await process.getBuiltinModule("fs").promises.readFile(i);return new Uint8Array(t)}class W_ extends q1{}class X_ extends V1{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:um&&um.tagName.toUpperCase()==="SCRIPT"&&um.src||new URL("index.cjs",document.baseURI).href)("@napi-rs/canvas").createCanvas(e,t)}}class Y_ extends G1{async _fetch(e){return Ob(e)}}class Z_ extends X1{async _fetch(e){return Ob(e)}}class K_ extends Y1{async _fetch(e){return Ob(e)}}const tn={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function C0(i,e){if(!e)return;const t=e[2]-e[0],r=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],t,r),i.clip(n)}class Fb{isModifyingCurrentTransform(){return!1}getPattern(){Wt("Abstract method `getPattern` called.")}}class Q_ extends Fb{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;this._type==="axial"?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const r of this._colorStops)t.addColorStop(r[0],r[1]);return t}getPattern(e,t,r,n){let s;if(n===tn.STROKE||n===tn.FILL){const a=t.current.getClippedPathBoundingBox(n,hr(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,c=t.cachedCanvases.getCanvas("pattern",o,l),h=c.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-a[0],-a[1]),r=Qe.transform(r,[1,0,0,1,a[0],a[1]]),h.transform(...t.baseTransform),this.matrix&&h.transform(...this.matrix),C0(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),s=e.createPattern(c.canvas,"no-repeat");const d=new DOMMatrix(r);s.setTransform(d)}else C0(e,this._bbox),s=this._createGradient(e);return s}}function gm(i,e,t,r,n,s,a,o){const l=e.coords,c=e.colors,h=i.data,d=i.width*4;let p;l[t+1]>l[r+1]&&(p=t,t=r,r=p,p=s,s=a,a=p),l[r+1]>l[n+1]&&(p=r,r=n,n=p,p=a,a=o,o=p),l[t+1]>l[r+1]&&(p=t,t=r,r=p,p=s,s=a,a=p);const g=(l[t]+e.offsetX)*e.scaleX,y=(l[t+1]+e.offsetY)*e.scaleY,b=(l[r]+e.offsetX)*e.scaleX,w=(l[r+1]+e.offsetY)*e.scaleY,v=(l[n]+e.offsetX)*e.scaleX,A=(l[n+1]+e.offsetY)*e.scaleY;if(y>=A)return;const E=c[s],_=c[s+1],C=c[s+2],I=c[a],k=c[a+1],D=c[a+2],R=c[o],z=c[o+1],G=c[o+2],O=Math.round(y),X=Math.round(A);let S,J,Y,W,fe,K,be,te;for(let j=O;j<=X;j++){if(j<w){const le=j<y?0:(y-j)/(y-w);S=g-(g-b)*le,J=E-(E-I)*le,Y=_-(_-k)*le,W=C-(C-D)*le}else{let le;j>A?le=1:w===A?le=0:le=(w-j)/(w-A),S=b-(b-v)*le,J=I-(I-R)*le,Y=k-(k-z)*le,W=D-(D-G)*le}let ie;j<y?ie=0:j>A?ie=1:ie=(y-j)/(y-A),fe=g-(g-v)*ie,K=E-(E-R)*ie,be=_-(_-z)*ie,te=C-(C-G)*ie;const ae=Math.round(Math.min(S,fe)),H=Math.round(Math.max(S,fe));let se=d*j+ae*4;for(let le=ae;le<=H;le++)ie=(S-le)/(S-fe),ie<0?ie=0:ie>1&&(ie=1),h[se++]=J-(J-K)*ie|0,h[se++]=Y-(Y-be)*ie|0,h[se++]=W-(W-te)*ie|0,h[se++]=255}}function J_(i,e,t){const r=e.coords,n=e.colors;let s,a;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(r.length/o)-1,c=o-1;for(s=0;s<l;s++){let h=s*o;for(let d=0;d<c;d++,h++)gm(i,t,r[h],r[h+1],r[h+o],n[h],n[h+1],n[h+o]),gm(i,t,r[h+o+1],r[h+1],r[h+o],n[h+o+1],n[h+1],n[h+o])}break;case"triangles":for(s=0,a=r.length;s<a;s+=3)gm(i,t,r[s],r[s+1],r[s+2],n[s],n[s+1],n[s+2]);break;default:throw new Error("illegal figure")}}class eC extends Fb{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,t,r){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,h=Math.ceil(this._bounds[3])-l,d=Math.min(Math.ceil(Math.abs(c*e[0]*1.1)),3e3),p=Math.min(Math.ceil(Math.abs(h*e[1]*1.1)),3e3),g=c/d,y=h/p,b={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/g,scaleY:1/y},w=d+2*2,v=p+2*2,A=r.getCanvas("mesh",w,v),E=A.context,_=E.createImageData(d,p);if(t){const I=_.data;for(let k=0,D=I.length;k<D;k+=4)I[k]=t[0],I[k+1]=t[1],I[k+2]=t[2],I[k+3]=255}for(const I of this._figures)J_(_,I,b);return E.putImageData(_,2,2),{canvas:A.canvas,offsetX:o-2*g,offsetY:l-2*y,scaleX:g,scaleY:y}}isModifyingCurrentTransform(){return!0}getPattern(e,t,r,n){C0(e,this._bbox);const s=new Float32Array(2);if(n===tn.SHADING)Qe.singularValueDecompose2dScale(hr(e),s);else if(this.matrix){Qe.singularValueDecompose2dScale(this.matrix,s);const[o,l]=s;Qe.singularValueDecompose2dScale(t.baseTransform,s),s[0]*=o,s[1]*=l}else Qe.singularValueDecompose2dScale(t.baseTransform,s);const a=this._createMeshCanvas(s,n===tn.SHADING?null:this._background,t.cachedCanvases);return n!==tn.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY),e.createPattern(a.canvas,"no-repeat")}}class tC extends Fb{getPattern(){return"hotpink"}}function rC(i){switch(i[0]){case"RadialAxial":return new Q_(i);case"Mesh":return new eC(i);case"Dummy":return new tC}throw new Error(`Unknown IR type: ${i[0]}`)}const ry={COLORED:1,UNCOLORED:2},fg=class fg{constructor(e,t,r,n){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.ctx=t,this.canvasGraphicsFactory=r,this.baseTransform=n}createPatternCanvas(e){const{bbox:t,operatorList:r,paintType:n,tilingType:s,color:a,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:c}=this;l=Math.abs(l),c=Math.abs(c),Sg("TilingType: "+s);const h=t[0],d=t[1],p=t[2],g=t[3],y=p-h,b=g-d,w=new Float32Array(2);Qe.singularValueDecompose2dScale(this.matrix,w);const[v,A]=w;Qe.singularValueDecompose2dScale(this.baseTransform,w);const E=v*w[0],_=A*w[1];let C=y,I=b,k=!1,D=!1;const R=Math.ceil(l*E),z=Math.ceil(c*_),G=Math.ceil(y*E),O=Math.ceil(b*_);R>=G?C=l:k=!0,z>=O?I=c:D=!0;const X=this.getSizeAndScale(C,this.ctx.canvas.width,E),S=this.getSizeAndScale(I,this.ctx.canvas.height,_),J=e.cachedCanvases.getCanvas("pattern",X.size,S.size),Y=J.context,W=o.createCanvasGraphics(Y);if(W.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(W,n,a),Y.translate(-X.scale*h,-S.scale*d),W.transform(X.scale,0,0,S.scale,0,0),Y.save(),this.clipBbox(W,h,d,p,g),W.baseTransform=hr(W.ctx),W.executeOperatorList(r),W.endDrawing(),Y.restore(),k||D){const fe=J.canvas;k&&(C=l),D&&(I=c);const K=this.getSizeAndScale(C,this.ctx.canvas.width,E),be=this.getSizeAndScale(I,this.ctx.canvas.height,_),te=K.size,j=be.size,ie=e.cachedCanvases.getCanvas("pattern-workaround",te,j),ae=ie.context,H=k?Math.floor(y/l):0,se=D?Math.floor(b/c):0;for(let le=0;le<=H;le++)for(let oe=0;oe<=se;oe++)ae.drawImage(fe,te*le,j*oe,te,j,0,0,te,j);return{canvas:ie.canvas,scaleX:K.scale,scaleY:be.scale,offsetX:h,offsetY:d}}return{canvas:J.canvas,scaleX:X.scale,scaleY:S.scale,offsetX:h,offsetY:d}}getSizeAndScale(e,t,r){const n=Math.max(fg.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*r);return s>=n?s=n:r=s/e,{scale:r,size:s}}clipBbox(e,t,r,n,s){const a=n-t,o=s-r;e.ctx.rect(t,r,a,o),Qe.axialAlignedBoundingBox([t,r,n,s],hr(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,r){const n=e.ctx,s=e.current;switch(t){case ry.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;n.fillStyle=s.fillColor=a,n.strokeStyle=s.strokeColor=o;break;case ry.UNCOLORED:n.fillStyle=n.strokeStyle=r,s.fillColor=s.strokeColor=r;break;default:throw new S_(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,r,n){let s=r;n!==tn.SHADING&&(s=Qe.transform(s,t.baseTransform),this.matrix&&(s=Qe.transform(s,this.matrix)));const a=this.createPatternCanvas(t);let o=new DOMMatrix(s);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=e.createPattern(a.canvas,"repeat");return l.setTransform(o),l}};Ie(fg,"MAX_PATTERN_SIZE",3e3);let S0=fg;function nC({src:i,srcPos:e=0,dest:t,width:r,height:n,nonBlackColor:s=4294967295,inverseDecode:a=!1}){const o=qr.isLittleEndian?4278190080:255,[l,c]=a?[s,o]:[o,s],h=r>>3,d=r&7,p=i.length;t=new Uint32Array(t.buffer);let g=0;for(let y=0;y<n;y++){for(const w=e+h;e<w;e++){const v=e<p?i[e]:255;t[g++]=v&128?c:l,t[g++]=v&64?c:l,t[g++]=v&32?c:l,t[g++]=v&16?c:l,t[g++]=v&8?c:l,t[g++]=v&4?c:l,t[g++]=v&2?c:l,t[g++]=v&1?c:l}if(d===0)continue;const b=e<p?i[e++]:255;for(let w=0;w<d;w++)t[g++]=b&1<<7-w?c:l}return{srcPos:e,destPos:g}}const ny=16,iy=100,iC=15,sy=10,Mn=16,mm=new DOMMatrix,si=new Float32Array(2),du=new Float32Array([1/0,1/0,-1/0,-1/0]);function sC(i,e){if(i._removeMirroring)throw new Error("Context is already forwarding operations.");i.__originalSave=i.save,i.__originalRestore=i.restore,i.__originalRotate=i.rotate,i.__originalScale=i.scale,i.__originalTranslate=i.translate,i.__originalTransform=i.transform,i.__originalSetTransform=i.setTransform,i.__originalResetTransform=i.resetTransform,i.__originalClip=i.clip,i.__originalMoveTo=i.moveTo,i.__originalLineTo=i.lineTo,i.__originalBezierCurveTo=i.bezierCurveTo,i.__originalRect=i.rect,i.__originalClosePath=i.closePath,i.__originalBeginPath=i.beginPath,i._removeMirroring=()=>{i.save=i.__originalSave,i.restore=i.__originalRestore,i.rotate=i.__originalRotate,i.scale=i.__originalScale,i.translate=i.__originalTranslate,i.transform=i.__originalTransform,i.setTransform=i.__originalSetTransform,i.resetTransform=i.__originalResetTransform,i.clip=i.__originalClip,i.moveTo=i.__originalMoveTo,i.lineTo=i.__originalLineTo,i.bezierCurveTo=i.__originalBezierCurveTo,i.rect=i.__originalRect,i.closePath=i.__originalClosePath,i.beginPath=i.__originalBeginPath,delete i._removeMirroring},i.save=function(){e.save(),this.__originalSave()},i.restore=function(){e.restore(),this.__originalRestore()},i.translate=function(t,r){e.translate(t,r),this.__originalTranslate(t,r)},i.scale=function(t,r){e.scale(t,r),this.__originalScale(t,r)},i.transform=function(t,r,n,s,a,o){e.transform(t,r,n,s,a,o),this.__originalTransform(t,r,n,s,a,o)},i.setTransform=function(t,r,n,s,a,o){e.setTransform(t,r,n,s,a,o),this.__originalSetTransform(t,r,n,s,a,o)},i.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},i.rotate=function(t){e.rotate(t),this.__originalRotate(t)},i.clip=function(t){e.clip(t),this.__originalClip(t)},i.moveTo=function(t,r){e.moveTo(t,r),this.__originalMoveTo(t,r)},i.lineTo=function(t,r){e.lineTo(t,r),this.__originalLineTo(t,r)},i.bezierCurveTo=function(t,r,n,s,a,o){e.bezierCurveTo(t,r,n,s,a,o),this.__originalBezierCurveTo(t,r,n,s,a,o)},i.rect=function(t,r,n,s){e.rect(t,r,n,s),this.__originalRect(t,r,n,s)},i.closePath=function(){e.closePath(),this.__originalClosePath()},i.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class aC{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,r){let n;return this.cache[e]!==void 0?(n=this.cache[e],this.canvasFactory.reset(n,t,r)):(n=this.canvasFactory.create(t,r),this.cache[e]=n),n}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function np(i,e,t,r,n,s,a,o,l,c){const[h,d,p,g,y,b]=hr(i);if(d===0&&p===0){const A=a*h+y,E=Math.round(A),_=o*g+b,C=Math.round(_),I=(a+l)*h+y,k=Math.abs(Math.round(I)-E)||1,D=(o+c)*g+b,R=Math.abs(Math.round(D)-C)||1;return i.setTransform(Math.sign(h),0,0,Math.sign(g),E,C),i.drawImage(e,t,r,n,s,0,0,k,R),i.setTransform(h,d,p,g,y,b),[k,R]}if(h===0&&g===0){const A=o*p+y,E=Math.round(A),_=a*d+b,C=Math.round(_),I=(o+c)*p+y,k=Math.abs(Math.round(I)-E)||1,D=(a+l)*d+b,R=Math.abs(Math.round(D)-C)||1;return i.setTransform(0,Math.sign(d),Math.sign(p),0,E,C),i.drawImage(e,t,r,n,s,0,0,R,k),i.setTransform(h,d,p,g,y,b),[R,k]}i.drawImage(e,t,r,n,s,a,o,l,c);const w=Math.hypot(h,d),v=Math.hypot(p,g);return[w*l,v*c]}class ay{constructor(e,t){Ie(this,"alphaIsShape",!1);Ie(this,"fontSize",0);Ie(this,"fontSizeScale",1);Ie(this,"textMatrix",null);Ie(this,"textMatrixScale",1);Ie(this,"fontMatrix",n0);Ie(this,"leading",0);Ie(this,"x",0);Ie(this,"y",0);Ie(this,"lineX",0);Ie(this,"lineY",0);Ie(this,"charSpacing",0);Ie(this,"wordSpacing",0);Ie(this,"textHScale",1);Ie(this,"textRenderingMode",on.FILL);Ie(this,"textRise",0);Ie(this,"fillColor","#000000");Ie(this,"strokeColor","#000000");Ie(this,"patternFill",!1);Ie(this,"patternStroke",!1);Ie(this,"fillAlpha",1);Ie(this,"strokeAlpha",1);Ie(this,"lineWidth",1);Ie(this,"activeSMask",null);Ie(this,"transferMaps","none");this.clipBox=new Float32Array([0,0,e,t]),this.minMax=du.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=tn.FILL,t=null){const r=this.minMax.slice();if(e===tn.STROKE){t||Wt("Stroke bounding box must include transform."),Qe.singularValueDecompose2dScale(t,si);const n=si[0]*this.lineWidth/2,s=si[1]*this.lineWidth/2;r[0]-=n,r[1]-=s,r[2]+=n,r[3]+=s}return r}updateClipFromPath(){const e=Qe.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(du,0)}getClippedPathBoundingBox(e=tn.FILL,t=null){return Qe.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function oy(i,e){if(e instanceof ImageData){i.putImageData(e,0,0);return}const t=e.height,r=e.width,n=t%Mn,s=(t-n)/Mn,a=n===0?s:s+1,o=i.createImageData(r,Mn);let l=0,c;const h=e.data,d=o.data;let p,g,y,b;if(e.kind===Th.GRAYSCALE_1BPP){const w=h.byteLength,v=new Uint32Array(d.buffer,0,d.byteLength>>2),A=v.length,E=r+7>>3,_=4294967295,C=qr.isLittleEndian?4278190080:255;for(p=0;p<a;p++){for(y=p<s?Mn:n,c=0,g=0;g<y;g++){const I=w-l;let k=0;const D=I>E?r:I*8-7,R=D&-8;let z=0,G=0;for(;k<R;k+=8)G=h[l++],v[c++]=G&128?_:C,v[c++]=G&64?_:C,v[c++]=G&32?_:C,v[c++]=G&16?_:C,v[c++]=G&8?_:C,v[c++]=G&4?_:C,v[c++]=G&2?_:C,v[c++]=G&1?_:C;for(;k<D;k++)z===0&&(G=h[l++],z=128),v[c++]=G&z?_:C,z>>=1}for(;c<A;)v[c++]=0;i.putImageData(o,0,p*Mn)}}else if(e.kind===Th.RGBA_32BPP){for(g=0,b=r*Mn*4,p=0;p<s;p++)d.set(h.subarray(l,l+b)),l+=b,i.putImageData(o,0,g),g+=Mn;p<a&&(b=r*n*4,d.set(h.subarray(l,l+b)),i.putImageData(o,0,g))}else if(e.kind===Th.RGB_24BPP)for(y=Mn,b=r*y,p=0;p<a;p++){for(p>=s&&(y=n,b=r*y),c=0,g=b;g--;)d[c++]=h[l++],d[c++]=h[l++],d[c++]=h[l++],d[c++]=255;i.putImageData(o,0,p*Mn)}else throw new Error(`bad image kind: ${e.kind}`)}function ly(i,e){if(e.bitmap){i.drawImage(e.bitmap,0,0);return}const t=e.height,r=e.width,n=t%Mn,s=(t-n)/Mn,a=n===0?s:s+1,o=i.createImageData(r,Mn);let l=0;const c=e.data,h=o.data;for(let d=0;d<a;d++){const p=d<s?Mn:n;({srcPos:l}=nC({src:c,srcPos:l,dest:h,width:r,height:p,nonBlackColor:0})),i.putImageData(o,0,d*Mn)}}function Zc(i,e){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of t)i[r]!==void 0&&(e[r]=i[r]);i.setLineDash!==void 0&&(e.setLineDash(i.getLineDash()),e.lineDashOffset=i.lineDashOffset)}function ip(i){i.strokeStyle=i.fillStyle="#000000",i.fillRule="nonzero",i.globalAlpha=1,i.lineWidth=1,i.lineCap="butt",i.lineJoin="miter",i.miterLimit=10,i.globalCompositeOperation="source-over",i.font="10px sans-serif",i.setLineDash!==void 0&&(i.setLineDash([]),i.lineDashOffset=0);const{filter:e}=i;e!=="none"&&e!==""&&(i.filter="none")}function uy(i,e){if(e)return!0;Qe.singularValueDecompose2dScale(i,si);const t=Math.fround(Wi.pixelRatio*da.PDF_TO_CSS_UNITS);return si[0]<=t&&si[1]<=t}const oC=["butt","round","square"],lC=["miter","round","bevel"],uC={},cy={};var Yi,T0,k0,D0;const vv=class vv{constructor(e,t,r,n,s,{optionalContentConfig:a,markedContentStack:o=null},l,c){N(this,Yi);this.ctx=e,this.current=new ay(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=r,this.canvasFactory=n,this.filterFactory=s,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedCanvases=new aC(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:r=!1,background:n=null}){const s=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,s,a),this.ctx.fillStyle=o,r){const l=this.cachedCanvases.getCanvas("transparent",s,a);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...hr(this.compositeCtx))}this.ctx.save(),ip(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=hr(this.ctx)}executeOperatorList(e,t,r,n){const s=e.argsArray,a=e.fnArray;let o=t||0;const l=s.length;if(l===o)return o;const c=l-o>sy&&typeof r=="function",h=c?Date.now()+iC:0;let d=0;const p=this.commonObjs,g=this.objs;let y;for(;;){if(n!==void 0&&o===n.nextBreakPoint)return n.breakIt(o,r),o;if(y=a[o],y!==Ph.dependency)this[y].apply(this,s[o]);else for(const b of s[o]){const w=b.startsWith("g_")?p:g;if(!w.has(b))return w.get(b,r),o}if(o++,o===l)return o;if(c&&++d>sy){if(Date.now()>h)return r(),o;d=0}}}endDrawing(){L(this,Yi,T0).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),L(this,Yi,k0).call(this)}_scaleImage(e,t){const r=e.width??e.displayWidth,n=e.height??e.displayHeight;let s=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=r,l=n,c="prescale1",h,d;for(;s>2&&o>1||a>2&&l>1;){let p=o,g=l;s>2&&o>1&&(p=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),s/=o/p),a>2&&l>1&&(g=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/g),h=this.cachedCanvases.getCanvas(c,p,g),d=h.context,d.clearRect(0,0,p,g),d.drawImage(e,0,0,o,l,0,0,p,g),e=h.canvas,o=p,l=g,c=c==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:o,paintHeight:l}}_createMaskCanvas(e){const t=this.ctx,{width:r,height:n}=e,s=this.current.fillColor,a=this.current.patternFill,o=hr(t);let l,c,h,d;if((e.bitmap||e.data)&&e.count>1){const R=e.bitmap||e.data.buffer;c=JSON.stringify(a?o:[o.slice(0,4),s]),l=this._cachedBitmapsMap.get(R),l||(l=new Map,this._cachedBitmapsMap.set(R,l));const z=l.get(c);if(z&&!a){const G=Math.round(Math.min(o[0],o[2])+o[4]),O=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:z,offsetX:G,offsetY:O}}h=z}h||(d=this.cachedCanvases.getCanvas("maskCanvas",r,n),ly(d.context,e));let p=Qe.transform(o,[1/r,0,0,-1/n,0,0]);p=Qe.transform(p,[1,0,0,1,0,-n]);const g=du.slice();Qe.axialAlignedBoundingBox([0,0,r,n],p,g);const[y,b,w,v]=g,A=Math.round(w-y)||1,E=Math.round(v-b)||1,_=this.cachedCanvases.getCanvas("fillCanvas",A,E),C=_.context,I=y,k=b;C.translate(-I,-k),C.transform(...p),h||(h=this._scaleImage(d.canvas,Ki(C)),h=h.img,l&&a&&l.set(c,h)),C.imageSmoothingEnabled=uy(hr(C),e.interpolate),np(C,h,0,0,h.width,h.height,0,0,r,n),C.globalCompositeOperation="source-in";const D=Qe.transform(Ki(C),[1,0,0,1,-I,-k]);return C.fillStyle=a?s.getPattern(t,this,D,tn.FILL):s,C.fillRect(0,0,r,n),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(c,_.canvas)),{canvas:_.canvas,offsetX:Math.round(I),offsetY:Math.round(k)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=oC[e]}setLineJoin(e){this.ctx.lineJoin=lC[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(e),r.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,r]of e)switch(t){case"LW":this.setLineWidth(r);break;case"LC":this.setLineCap(r);break;case"LJ":this.setLineJoin(r);break;case"ML":this.setMiterLimit(r);break;case"D":this.setDash(r[0],r[1]);break;case"RI":this.setRenderingIntent(r);break;case"FL":this.setFlatness(r);break;case"Font":this.setFont(r[0],r[1]);break;case"CA":this.current.strokeAlpha=r;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=r;break;case"BM":this.ctx.globalCompositeOperation=r;break;case"SMask":this.current.activeSMask=r?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,r="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(r,e,t);this.suspendedCtx=this.ctx;const s=this.ctx=n.context;s.setTransform(this.suspendedCtx.getTransform()),Zc(this.suspendedCtx,s),sC(s,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Zc(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,r=this.suspendedCtx;this.composeSMask(r,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,r,n){const s=n[0],a=n[1],o=n[2]-s,l=n[3]-a;o===0||l===0||(this.genericComposeSMask(t.context,r,o,l,t.subtype,t.backdrop,t.transferMap,s,a,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(r.canvas,0,0),e.restore())}genericComposeSMask(e,t,r,n,s,a,o,l,c,h,d){let p=e.canvas,g=l-h,y=c-d;if(a)if(g<0||y<0||g+r>p.width||y+n>p.height){const w=this.cachedCanvases.getCanvas("maskExtension",r,n),v=w.context;v.drawImage(p,-g,-y),v.globalCompositeOperation="destination-atop",v.fillStyle=a,v.fillRect(0,0,r,n),v.globalCompositeOperation="source-over",p=w.canvas,g=y=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const w=new Path2D;w.rect(g,y,r,n),e.clip(w),e.globalCompositeOperation="destination-atop",e.fillStyle=a,e.fillRect(g,y,r,n),e.restore()}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),s==="Alpha"&&o?t.filter=this.filterFactory.addAlphaFilter(o):s==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(o));const b=new Path2D;b.rect(l,c,r,n),t.clip(b),t.globalCompositeOperation="destination-in",t.drawImage(p,g,y,r,n,l,c,r,n),t.restore()}save(){this.inSMaskMode&&Zc(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Zc(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,r,n,s,a){this.ctx.transform(e,t,r,n,s,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,r){let[n]=t;if(!r){n||(n=t[0]=new Path2D),this[e](n);return}if(!(n instanceof Path2D)){const s=t[0]=new Path2D;for(let a=0,o=n.length;a<o;)switch(n[a++]){case ep.moveTo:s.moveTo(n[a++],n[a++]);break;case ep.lineTo:s.lineTo(n[a++],n[a++]);break;case ep.curveTo:s.bezierCurveTo(n[a++],n[a++],n[a++],n[a++],n[a++],n[a++]);break;case ep.closePath:s.closePath();break;default:ut(`Unrecognized drawing path operator: ${n[a-1]}`);break}n=s}Qe.axialAlignedBoundingBox(r,hr(this.ctx),this.current.minMax),this[e](n)}closePath(){this.ctx.closePath()}stroke(e,t=!0){const r=this.ctx,n=this.current.strokeColor;if(r.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof n=="object"&&(n!=null&&n.getPattern)){const s=n.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.strokeStyle=n.getPattern(r,this,Ki(r),tn.STROKE),s){const a=new Path2D;a.addPath(e,r.getTransform().invertSelf().multiplySelf(s)),e=a}this.rescaleAndStroke(e,!1),r.restore()}else this.rescaleAndStroke(e,!0);t&&this.consumePath(e,this.current.getClippedPathBoundingBox(tn.STROKE,hr(this.ctx))),r.globalAlpha=this.current.fillAlpha}closeStroke(e){this.stroke(e)}fill(e,t=!0){const r=this.ctx,n=this.current.fillColor,s=this.current.patternFill;let a=!1;if(s){const l=n.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.fillStyle=n.getPattern(r,this,Ki(r),tn.FILL),l){const c=new Path2D;c.addPath(e,r.getTransform().invertSelf().multiplySelf(l)),e=c}a=!0}const o=this.current.getClippedPathBoundingBox();this.contentVisible&&o!==null&&(this.pendingEOFill?(r.fill(e,"evenodd"),this.pendingEOFill=!1):r.fill(e)),a&&r.restore(),t&&this.consumePath(e,o)}eoFill(e){this.pendingEOFill=!0,this.fill(e)}fillStroke(e){this.fill(e,!1),this.stroke(e,!1),this.consumePath(e)}eoFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}closeFillStroke(e){this.fillStroke(e)}closeEOFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}endPath(e){this.consumePath(e)}rawFillPath(e){this.ctx.fill(e)}clip(){this.pendingClip=uC}eoClip(){this.pendingClip=cy}beginText(){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(e===void 0)return;const r=new Path2D,n=t.getTransform().invertSelf();for(const{transform:s,x:a,y:o,fontSize:l,path:c}of e)r.addPath(c,new DOMMatrix(s).preMultiplySelf(n).translate(a,o).scale(l,-l));t.clip(r),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){var h;const r=this.commonObjs.get(e),n=this.current;if(!r)throw new Error(`Can't find font for ${e}`);if(n.fontMatrix=r.fontMatrix||n0,(n.fontMatrix[0]===0||n.fontMatrix[3]===0)&&ut("Invalid font matrix for font "+e),t<0?(t=-t,n.fontDirection=-1):n.fontDirection=1,this.current.font=r,this.current.fontSize=t,r.isType3Font)return;const s=r.loadedName||"sans-serif",a=((h=r.systemFontInfo)==null?void 0:h.css)||`"${s}", ${r.fallbackName}`;let o="normal";r.black?o="900":r.bold&&(o="bold");const l=r.italic?"italic":"normal";let c=t;t<ny?c=ny:t>iy&&(c=iy),this.current.fontSizeScale=t/c,this.ctx.font=`${l} ${o} ${c}px ${a}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e){const{current:t}=this;t.textMatrix=e,t.textMatrixScale=Math.hypot(e[0],e[1]),t.x=t.lineX=0,t.y=t.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,r,n,s){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,h=o.fontSize/o.fontSizeScale,d=c&on.FILL_STROKE_MASK,p=!!(c&on.ADD_TO_PATH_FLAG),g=o.patternFill&&!l.missingFile,y=o.patternStroke&&!l.missingFile;let b;if((l.disableFontFace||p||g||y)&&(b=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||g||y){a.save(),a.translate(t,r),a.scale(h,-h);let w;if((d===on.FILL||d===on.FILL_STROKE)&&(n?(w=a.getTransform(),a.setTransform(...n),a.fill(L(this,Yi,D0).call(this,b,w,n))):a.fill(b)),d===on.STROKE||d===on.FILL_STROKE)if(s){w||(w=a.getTransform()),a.setTransform(...s);const{a:v,b:A,c:E,d:_}=w,C=Qe.inverseTransform(s),I=Qe.transform([v,A,E,_,0,0],C);Qe.singularValueDecompose2dScale(I,si),a.lineWidth*=Math.max(si[0],si[1])/h,a.stroke(L(this,Yi,D0).call(this,b,w,s))}else a.lineWidth/=h,a.stroke(b);a.restore()}else(d===on.FILL||d===on.FILL_STROKE)&&a.fillText(e,t,r),(d===on.STROKE||d===on.FILL_STROKE)&&a.strokeText(e,t,r);p&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:hr(a),x:t,y:r,fontSize:h,path:b})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let r=!1;for(let n=3;n<t.length;n+=4)if(t[n]>0&&t[n]<255){r=!0;break}return Ct(this,"isFontSubpixelAAEnabled",r)}showText(e){const t=this.current,r=t.font;if(r.isType3Font)return this.showType3Text(e);const n=t.fontSize;if(n===0)return;const s=this.ctx,a=t.fontSizeScale,o=t.charSpacing,l=t.wordSpacing,c=t.fontDirection,h=t.textHScale*c,d=e.length,p=r.vertical,g=p?1:-1,y=r.defaultVMetrics,b=n*t.fontMatrix[0],w=t.textRenderingMode===on.FILL&&!r.disableFontFace&&!t.patternFill;s.save(),t.textMatrix&&s.transform(...t.textMatrix),s.translate(t.x,t.y+t.textRise),c>0?s.scale(h,-1):s.scale(h,1);let v,A;if(t.patternFill){s.save();const k=t.fillColor.getPattern(s,this,Ki(s),tn.FILL);v=hr(s),s.restore(),s.fillStyle=k}if(t.patternStroke){s.save();const k=t.strokeColor.getPattern(s,this,Ki(s),tn.STROKE);A=hr(s),s.restore(),s.strokeStyle=k}let E=t.lineWidth;const _=t.textMatrixScale;if(_===0||E===0){const k=t.textRenderingMode&on.FILL_STROKE_MASK;(k===on.STROKE||k===on.FILL_STROKE)&&(E=this.getSinglePixelWidth())}else E/=_;if(a!==1&&(s.scale(a,a),E/=a),s.lineWidth=E,r.isInvalidPDFjsFont){const k=[];let D=0;for(const R of e)k.push(R.unicode),D+=R.width;s.fillText(k.join(""),0,0),t.x+=D*b*h,s.restore(),this.compose();return}let C=0,I;for(I=0;I<d;++I){const k=e[I];if(typeof k=="number"){C+=g*k*n/1e3;continue}let D=!1;const R=(k.isSpace?l:0)+o,z=k.fontChar,G=k.accent;let O,X,S=k.width;if(p){const Y=k.vmetric||y,W=-(k.vmetric?Y[1]:S*.5)*b,fe=Y[2]*b;S=Y?-Y[0]:S,O=W/a,X=(C+fe)/a}else O=C/a,X=0;if(r.remeasure&&S>0){const Y=s.measureText(z).width*1e3/n*a;if(S<Y&&this.isFontSubpixelAAEnabled){const W=S/Y;D=!0,s.save(),s.scale(W,1),O/=W}else S!==Y&&(O+=(S-Y)/2e3*n/a)}if(this.contentVisible&&(k.isInFont||r.missingFile)){if(w&&!G)s.fillText(z,O,X);else if(this.paintChar(z,O,X,v,A),G){const Y=O+n*G.offset.x/a,W=X-n*G.offset.y/a;this.paintChar(G.fontChar,Y,W,v,A)}}const J=p?S*b-R*c:S*b+R*c;C+=J,D&&s.restore()}p?t.y-=C:t.x+=C*h,s.restore(),this.compose()}showType3Text(e){const t=this.ctx,r=this.current,n=r.font,s=r.fontSize,a=r.fontDirection,o=n.vertical?1:-1,l=r.charSpacing,c=r.wordSpacing,h=r.textHScale*a,d=r.fontMatrix||n0,p=e.length,g=r.textRenderingMode===on.INVISIBLE;let y,b,w,v;if(!(g||s===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),r.textMatrix&&t.transform(...r.textMatrix),t.translate(r.x,r.y+r.textRise),t.scale(h,a),y=0;y<p;++y){if(b=e[y],typeof b=="number"){v=o*b*s/1e3,this.ctx.translate(v,0),r.x+=v*h;continue}const A=(b.isSpace?c:0)+l,E=n.charProcOperatorList[b.operatorListId];E?this.contentVisible&&(this.save(),t.scale(s,s),t.transform(...d),this.executeOperatorList(E),this.restore()):ut(`Type3 character "${b.operatorListId}" is not available.`);const _=[b.width,0];Qe.applyTransform(_,d),w=_[0]*s+A,t.translate(w,0),r.x+=w*h}t.restore()}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,r,n,s,a){const o=new Path2D;o.rect(r,n,s-r,a-n),this.ctx.clip(o),this.endPath()}getColorN_Pattern(e){let t;if(e[0]==="TilingPattern"){const r=this.baseTransform||hr(this.ctx),n={createCanvasGraphics:s=>new vv(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new S0(e,this.ctx,n,r)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e){this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e){this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let r;return this.cachedPatterns.has(e)?r=this.cachedPatterns.get(e):(r=rC(this.getObject(e)),this.cachedPatterns.set(e,r)),t&&(r.matrix=t),r}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const r=this._getPattern(e);t.fillStyle=r.getPattern(t,this,Ki(t),tn.SHADING);const n=Ki(t);if(n){const{width:s,height:a}=t.canvas,o=du.slice();Qe.axialAlignedBoundingBox([0,0,s,a],n,o);const[l,c,h,d]=o;this.ctx.fillRect(l,c,h-l,d-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Wt("Should not call beginInlineImage")}beginImageData(){Wt("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=hr(this.ctx),t)){Qe.axialAlignedBoundingBox(t,this.baseTransform,this.current.minMax);const[r,n,s,a]=t,o=new Path2D;o.rect(r,n,s-r,a-n),this.ctx.clip(o),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||Sg("TODO: Support non-isolated groups."),e.knockout&&ut("Knockout groups not supported.");const r=hr(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let n=du.slice();Qe.axialAlignedBoundingBox(e.bbox,hr(t),n);const s=[0,0,t.canvas.width,t.canvas.height];n=Qe.intersect(n,s)||[0,0,0,0];const a=Math.floor(n[0]),o=Math.floor(n[1]),l=Math.max(Math.ceil(n[2])-a,1),c=Math.max(Math.ceil(n[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,c]);let h="groupAt"+this.groupLevel;e.smask&&(h+="_smask_"+this.smaskCounter++%2);const d=this.cachedCanvases.getCanvas(h,l,c),p=d.context;p.translate(-a,-o),p.transform(...r);let g=new Path2D;const[y,b,w,v]=e.bbox;if(g.rect(y,b,w-y,v-b),e.matrix){const A=new Path2D;A.addPath(g,new DOMMatrix(e.matrix)),g=A}p.clip(g),e.smask?this.smaskStack.push({canvas:d.canvas,context:p,offsetX:a,offsetY:o,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(a,o),t.save()),Zc(t,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,r=this.groupStack.pop();if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const n=hr(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...n);const s=du.slice();Qe.axialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],n,s),this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(e,t,r,n,s){if(L(this,Yi,T0).call(this),ip(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const a=t[2]-t[0],o=t[3]-t[1];if(s&&this.annotationCanvasMap){r=r.slice(),r[4]-=t[0],r[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=a,t[3]=o,Qe.singularValueDecompose2dScale(hr(this.ctx),si);const{viewportScale:l}=this,c=Math.ceil(a*this.outputScaleX*l),h=Math.ceil(o*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(c,h);const{canvas:d,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,d),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(si[0],0,0,-si[1],0,o*si[1]),ip(this.ctx)}else{ip(this.ctx),this.endPath();const l=new Path2D;l.rect(t[0],t[1],a,o),this.ctx.clip(l)}}this.current=new ay(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...r),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),L(this,Yi,k0).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;e=this.getObject(e.data,e),e.count=t;const r=this.ctx,n=this._createMaskCanvas(e),s=n.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(s,n.offsetX,n.offsetY),r.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,r=0,n=0,s,a){if(!this.contentVisible)return;e=this.getObject(e.data,e);const o=this.ctx;o.save();const l=hr(o);o.transform(t,r,n,s,0,0);const c=this._createMaskCanvas(e);o.setTransform(1,0,0,1,c.offsetX-l[4],c.offsetY-l[5]);for(let h=0,d=a.length;h<d;h+=2){const p=Qe.transform(l,[t,r,n,s,a[h],a[h+1]]);o.drawImage(c.canvas,p[4],p[5])}o.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,r=this.current.fillColor,n=this.current.patternFill;for(const s of e){const{data:a,width:o,height:l,transform:c}=s,h=this.cachedCanvases.getCanvas("maskCanvas",o,l),d=h.context;d.save();const p=this.getObject(a,s);ly(d,p),d.globalCompositeOperation="source-in",d.fillStyle=n?r.getPattern(d,this,Ki(t),tn.FILL):r,d.fillRect(0,0,o,l),d.restore(),t.save(),t.transform(...c),t.scale(1,-1),np(t,h.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);if(!t){ut("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,r,n){if(!this.contentVisible)return;const s=this.getObject(e);if(!s){ut("Dependent image isn't ready yet");return}const a=s.width,o=s.height,l=[];for(let c=0,h=n.length;c<h;c+=2)l.push({transform:[t,0,0,r,n[c],n[c+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(s,l)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:t,width:r,height:n}=e,s=this.cachedCanvases.getCanvas("inlineImage",r,n),a=s.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter="none",s.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,r=e.height,n=this.ctx;this.save();const{filter:s}=n;s!=="none"&&s!==""&&(n.filter="none"),n.scale(1/t,-1/r);let a;if(e.bitmap)a=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)a=e;else{const c=this.cachedCanvases.getCanvas("inlineImage",t,r).context;oy(c,e),a=this.applyTransferMapsToCanvas(c)}const o=this._scaleImage(a,Ki(n));n.imageSmoothingEnabled=uy(hr(n),e.interpolate),np(n,o.img,0,0,o.paintWidth,o.paintHeight,0,-r,t,r),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const r=this.ctx;let n;if(e.bitmap)n=e.bitmap;else{const s=e.width,a=e.height,l=this.cachedCanvases.getCanvas("inlineImage",s,a).context;oy(l,e),n=this.applyTransferMapsToCanvas(l)}for(const s of t)r.save(),r.transform(...s.transform),r.scale(1,-1),np(r,n,s.x,s.y,s.w,s.h,0,-1,1,1),r.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e,t){const r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const n=this.ctx;this.pendingClip&&(r||(this.pendingClip===cy?n.clip(e,"evenodd"):n.clip(e)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=hr(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),r=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(r,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:t,b:r,c:n,d:s}=this.ctx.getTransform();let a,o;if(r===0&&n===0){const l=Math.abs(t),c=Math.abs(s);if(l===c)if(e===0)a=o=1/l;else{const h=l*e;a=o=h<1?1/h:1}else if(e===0)a=1/l,o=1/c;else{const h=l*e,d=c*e;a=h<1?1/h:1,o=d<1?1/d:1}}else{const l=Math.abs(t*s-r*n),c=Math.hypot(t,r),h=Math.hypot(n,s);if(e===0)a=h/l,o=c/l;else{const d=e*l;a=h>d?h/d:1,o=c>d?c/d:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:r,current:{lineWidth:n}}=this,[s,a]=this.getScaleForStroking();if(s===a){r.lineWidth=(n||1)*s,r.stroke(e);return}const o=r.getLineDash();t&&r.save(),r.scale(s,a),mm.a=1/s,mm.d=1/a;const l=new Path2D;if(l.addPath(e,mm),o.length>0){const c=Math.max(s,a);r.setLineDash(o.map(h=>h/c)),r.lineDashOffset/=c}r.lineWidth=n||1,r.stroke(l),t&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Yi=new WeakSet,T0=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,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)},k0=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}},D0=function(e,t,r){const n=new Path2D;return n.addPath(e,new DOMMatrix(r).invertSelf().multiplySelf(t)),n};let mu=vv;for(const i in Ph)mu.prototype[i]!==void 0&&(mu.prototype[Ph[i]]=mu.prototype[i]);var Ed,_d;class yi{static get workerPort(){return u(this,Ed)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");T(this,Ed,e)}static get workerSrc(){return u(this,_d)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");T(this,_d,e)}}Ed=new WeakMap,_d=new WeakMap,N(yi,Ed,null),N(yi,_d,"");var Bu,Cd;class cC{constructor({parsedData:e,rawData:t}){N(this,Bu);N(this,Cd);T(this,Bu,e),T(this,Cd,t)}getRaw(){return u(this,Cd)}get(e){return u(this,Bu).get(e)??null}[Symbol.iterator](){return u(this,Bu).entries()}}Bu=new WeakMap,Cd=new WeakMap;const lu=Symbol("INTERNAL");var Sd,Td,kd,zu;class hC{constructor(e,{name:t,intent:r,usage:n,rbGroups:s}){N(this,Sd,!1);N(this,Td,!1);N(this,kd,!1);N(this,zu,!0);T(this,Sd,!!(e&ii.DISPLAY)),T(this,Td,!!(e&ii.PRINT)),this.name=t,this.intent=r,this.usage=n,this.rbGroups=s}get visible(){if(u(this,kd))return u(this,zu);if(!u(this,zu))return!1;const{print:e,view:t}=this.usage;return u(this,Sd)?(t==null?void 0:t.viewState)!=="OFF":u(this,Td)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,r=!1){e!==lu&&Wt("Internal method `_setVisible` called."),T(this,kd,r),T(this,zu,t)}}Sd=new WeakMap,Td=new WeakMap,kd=new WeakMap,zu=new WeakMap;var Oa,Gt,ju,Uu,Dd,P0;class dC{constructor(e,t=ii.DISPLAY){N(this,Dd);N(this,Oa,null);N(this,Gt,new Map);N(this,ju,null);N(this,Uu,null);if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,T(this,Uu,e.order);for(const r of e.groups)u(this,Gt).set(r.id,new hC(t,r));if(e.baseState==="OFF")for(const r of u(this,Gt).values())r._setVisible(lu,!1);for(const r of e.on)u(this,Gt).get(r)._setVisible(lu,!0);for(const r of e.off)u(this,Gt).get(r)._setVisible(lu,!1);T(this,ju,this.getHash())}}isVisible(e){if(u(this,Gt).size===0)return!0;if(!e)return Sg("Optional content group not defined."),!0;if(e.type==="OCG")return u(this,Gt).has(e.id)?u(this,Gt).get(e.id).visible:(ut(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return L(this,Dd,P0).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!u(this,Gt).has(t))return ut(`Optional content group not found: ${t}`),!0;if(u(this,Gt).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!u(this,Gt).has(t))return ut(`Optional content group not found: ${t}`),!0;if(!u(this,Gt).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!u(this,Gt).has(t))return ut(`Optional content group not found: ${t}`),!0;if(!u(this,Gt).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!u(this,Gt).has(t))return ut(`Optional content group not found: ${t}`),!0;if(u(this,Gt).get(t).visible)return!1}return!0}return ut(`Unknown optional content policy ${e.policy}.`),!0}return ut(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,r=!0){var s;const n=u(this,Gt).get(e);if(!n){ut(`Optional content group not found: ${e}`);return}if(r&&t&&n.rbGroups.length)for(const a of n.rbGroups)for(const o of a)o!==e&&((s=u(this,Gt).get(o))==null||s._setVisible(lu,!1,!0));n._setVisible(lu,!!t,!0),T(this,Oa,null)}setOCGState({state:e,preserveRB:t}){let r;for(const n of e){switch(n){case"ON":case"OFF":case"Toggle":r=n;continue}const s=u(this,Gt).get(n);if(s)switch(r){case"ON":this.setVisibility(n,!0,t);break;case"OFF":this.setVisibility(n,!1,t);break;case"Toggle":this.setVisibility(n,!s.visible,t);break}}T(this,Oa,null)}get hasInitialVisibility(){return u(this,ju)===null||this.getHash()===u(this,ju)}getOrder(){return u(this,Gt).size?u(this,Uu)?u(this,Uu).slice():[...u(this,Gt).keys()]:null}getGroup(e){return u(this,Gt).get(e)||null}getHash(){if(u(this,Oa)!==null)return u(this,Oa);const e=new F1;for(const[t,r]of u(this,Gt))e.update(`${t}:${r.visible}`);return T(this,Oa,e.hexdigest())}[Symbol.iterator](){return u(this,Gt).entries()}}Oa=new WeakMap,Gt=new WeakMap,ju=new WeakMap,Uu=new WeakMap,Dd=new WeakSet,P0=function(e){const t=e.length;if(t<2)return!0;const r=e[0];for(let n=1;n<t;n++){const s=e[n];let a;if(Array.isArray(s))a=L(this,Dd,P0).call(this,s);else if(u(this,Gt).has(s))a=u(this,Gt).get(s).visible;else return ut(`Optional content group not found: ${s}`),!0;switch(r){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return r==="And"};class fC{constructor(e,{disableRange:t=!1,disableStream:r=!1}){Dr(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:s,progressiveDone:a,contentDispositionFilename:o}=e;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(s==null?void 0:s.length)>0){const l=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!r,this._isRangeSupported=!t,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((l,c)=>{this._onReceiveData({begin:l,chunk:c})}),e.addProgressListener((l,c)=>{this._onProgress({loaded:l,total:c})}),e.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const r=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{const n=this._rangeReaders.some(function(s){return s._begin!==e?!1:(s._enqueue(r),!0)});Dr(n,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var t,r,n,s;e.total===void 0?(r=(t=this._rangeReaders[0])==null?void 0:t.onProgress)==null||r.call(t,{loaded:e.loaded}):(s=(n=this._fullRequestReader)==null?void 0:n.onProgress)==null||s.call(n,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){Dr(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new pC(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new gC(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeReaders.slice(0))r.cancel(e);this._pdfDataRangeTransport.abort()}}class pC{constructor(e,t,r=!1,n=null){this._stream=e,this._done=r||!1,this._filename=kg(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.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 e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class gC{constructor(e,t,r){this._stream=e,this._begin=t,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function mC(i){let e=!0,t=r("filename\\*","i").exec(i);if(t){t=t[1];let h=o(t);return h=unescape(h),h=l(h),h=c(h),s(h)}if(t=a(i),t){const h=c(t);return s(h)}if(t=r("filename","i").exec(i),t){t=t[1];let h=o(t);return h=c(h),s(h)}function r(h,d){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function n(h,d){if(h){if(!/^[\x00-\xFF]+$/.test(d))return d;try{const p=new TextDecoder(h,{fatal:!0}),g=Sf(d);d=p.decode(g),e=!1}catch{}}return d}function s(h){return e&&/[\x80-\xff]/.test(h)&&(h=n("utf-8",h),e&&(h=n("iso-8859-1",h))),h}function a(h){const d=[];let p;const g=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(p=g.exec(h))!==null;){let[,b,w,v]=p;if(b=parseInt(b,10),b in d){if(b===0)break;continue}d[b]=[w,v]}const y=[];for(let b=0;b<d.length&&b in d;++b){let[w,v]=d[b];v=o(v),w&&(v=unescape(v),b===0&&(v=l(v))),y.push(v)}return y.join("")}function o(h){if(h.startsWith('"')){const d=h.slice(1).split('\\"');for(let p=0;p<d.length;++p){const g=d[p].indexOf('"');g!==-1&&(d[p]=d[p].slice(0,g),d.length=p+1),d[p]=d[p].replaceAll(/\\(.)/g,"$1")}h=d.join('"')}return h}function l(h){const d=h.indexOf("'");if(d===-1)return h;const p=h.slice(0,d),y=h.slice(d+1).replace(/^[^']*'/,"");return n(p,y)}function c(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,p,g,y){if(g==="q"||g==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(b,w){return String.fromCharCode(parseInt(w,16))}),n(p,y);try{y=atob(y)}catch{}return n(p,y)})}return""}function Z1(i,e){const t=new Headers;if(!i||!e||typeof e!="object")return t;for(const r in e){const n=e[r];n!==void 0&&t.append(r,n)}return t}function Pg(i){var e;return((e=URL.parse(i))==null?void 0:e.origin)??null}function K1({responseHeaders:i,isHttp:e,rangeChunkSize:t,disableRange:r}){const n={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(i.get("Content-Length"),10);return!Number.isInteger(s)||(n.suggestedLength=s,s<=2*t)||r||!e||i.get("Accept-Ranges")!=="bytes"||(i.get("Content-Encoding")||"identity")!=="identity"||(n.allowRangeRequests=!0),n}function Q1(i){const e=i.get("Content-Disposition");if(e){let t=mC(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(kg(t))return t}return null}function Pf(i,e){return new Rh(`Unexpected server response (${i}) while retrieving PDF "${e}".`,i,i===404||i===0&&e.startsWith("file:"))}function J1(i){return i===200||i===206}function ew(i,e,t){return{method:"GET",headers:i,signal:t.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function tw(i){return i instanceof Uint8Array?i.buffer:i instanceof ArrayBuffer?i:(ut(`getArrayBuffer - unexpected data format: ${i}`),new Uint8Array(i).buffer)}class bC{constructor(e){Ie(this,"_responseOrigin",null);this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Z1(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return Dr(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new vC(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new yC(this,e,t);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class vC{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const r=new Headers(e.headers),n=t.url;fetch(n,ew(r,this._withCredentials,this._abortController)).then(s=>{if(e._responseOrigin=Pg(s.url),!J1(s.status))throw Pf(s.status,n);this._reader=s.body.getReader(),this._headersCapability.resolve();const a=s.headers,{allowRangeRequests:o,suggestedLength:l}=K1({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=Q1(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ha("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 r;await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:tw(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}class yC{constructor(e,t,r){this._stream=e,this._reader=null,this._loaded=0;const n=e.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const s=new Headers(e.headers);s.append("Range",`bytes=${t}-${r-1}`);const a=n.url;fetch(a,ew(s,this._withCredentials,this._abortController)).then(o=>{const l=Pg(o.url);if(l!==e._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${e._responseOrigin}".`);if(!J1(o.status))throw Pf(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:tw(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}const bm=200,vm=206;function wC(i){const e=i.response;return typeof e!="string"?e:Sf(e).buffer}class xC{constructor({url:e,httpHeaders:t,withCredentials:r}){Ie(this,"_responseOrigin",null);this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Z1(this.isHttp,t),this.withCredentials=r||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const t=new XMLHttpRequest,r=this.currXhrId++,n=this.pendingRequests[r]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[s,a]of this.headers)t.setRequestHeader(s,a);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=vm):n.expectedStatus=bm,t.responseType="arraybuffer",Dr(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{e.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,r),t.onprogress=this.onProgress.bind(this,r),n.onHeadersReceived=e.onHeadersReceived,n.onDone=e.onDone,n.onError=e.onError,n.onProgress=e.onProgress,t.send(null),r}onProgress(e,t){var n;const r=this.pendingRequests[e];r&&((n=r.onProgress)==null||n.call(r,t))}onStateChange(e,t){const r=this.pendingRequests[e];if(!r)return;const n=r.xhr;if(n.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),n.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],n.status===0&&this.isHttp){r.onError(n.status);return}const s=n.status||bm;if(!(s===bm&&r.expectedStatus===vm)&&s!==r.expectedStatus){r.onError(n.status);return}const o=wC(n);if(s===vm){const l=n.getResponseHeader("Content-Range"),c=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);c?r.onDone({begin:parseInt(c[1],10),chunk:o}):(ut('Missing or invalid "Content-Range" header.'),r.onError(0))}else o?r.onDone({begin:0,chunk:o}):r.onError(n.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class AC{constructor(e){this._source=e,this._manager=new xC(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return Dr(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new EC(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const r=new _C(this._manager,e,t);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class EC{constructor(e,t){this._manager=e,this._url=t.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.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 e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=Pg(t.responseURL);const r=t.getAllResponseHeaders(),n=new Headers(r?r.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{const[l,...c]=o.split(": ");return[l,c.join(": ")]}):[]),{allowRangeRequests:s,suggestedLength:a}=K1({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=Q1(n),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Pf(e,this._url),this._headersCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var t;(t=this.onProgress)==null||t.call(this,{loaded:e.loaded,total:e.lengthComputable?e.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._headersCapability.promise}async read(){if(await this._headersCapability.promise,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 e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class _C{constructor(e,t,r){this._manager=e,this._url=e.url,this._requestId=e.request({begin:t,end:r,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var t;const e=Pg((t=this._manager.getRequestXhr(this._requestId))==null?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??(this._storedError=Pf(e,this._url));for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var t;this.isStreamingSupported||(t=this.onProgress)==null||t.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const CC=/^[a-z][a-z0-9\-+.]+:/i;function SC(i){if(CC.test(i))return new URL(i);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(i))}class TC{constructor(e){this.source=e,this.url=SC(e.url),Dr(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return Dr(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new kC(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new DC(this,e,t);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class kC{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const r=process.getBuiltinModule("fs");r.promises.lstat(this._url).then(n=>{this._contentLength=n.size,this._setReadableStream(r.createReadStream(this._url)),this._headersCapability.resolve()},n=>{n.code==="ENOENT"&&(n=Pf(0,this._url.href)),this._storedError=n,this._headersCapability.reject(n)})}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 r;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ha("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class DC{constructor(e,t,r){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=e.source;this._isStreamingSupported=!n.disableStream;const s=process.getBuiltinModule("fs");this._setReadableStream(s.createReadStream(this._url,{start:t,end:r-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const Kc=Symbol("INITIAL_DATA");var Wn,Pd,R0;class rw{constructor(){N(this,Pd);N(this,Wn,Object.create(null))}get(e,t=null){if(t){const n=L(this,Pd,R0).call(this,e);return n.promise.then(()=>t(n.data)),null}const r=u(this,Wn)[e];if(!r||r.data===Kc)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const t=u(this,Wn)[e];return!!t&&t.data!==Kc}delete(e){const t=u(this,Wn)[e];return!t||t.data===Kc?!1:(delete u(this,Wn)[e],!0)}resolve(e,t=null){const r=L(this,Pd,R0).call(this,e);r.data=t,r.resolve()}clear(){var e;for(const t in u(this,Wn)){const{data:r}=u(this,Wn)[t];(e=r==null?void 0:r.bitmap)==null||e.close()}T(this,Wn,Object.create(null))}*[Symbol.iterator](){for(const e in u(this,Wn)){const{data:t}=u(this,Wn)[e];t!==Kc&&(yield[e,t])}}}Wn=new WeakMap,Pd=new WeakSet,R0=function(e){var t;return(t=u(this,Wn))[e]||(t[e]={...Promise.withResolvers(),data:Kc})};const PC=1e5,hy=30;var L2,Fa,In,Rd,Id,Jo,Vs,Nd,Md,el,Hu,$u,Ba,Vu,Ld,Gu,tl,Od,Fd,mr,qu,rl,Bd,za,Wu,fa,nw,iw,I0,oi,_p,N0,sw,aw;let Nh=(mr=class{constructor({textContentSource:e,container:t,viewport:r}){N(this,fa);N(this,Fa,Promise.withResolvers());N(this,In,null);N(this,Rd,!1);N(this,Id,!!((L2=globalThis.FontInspector)!=null&&L2.enabled));N(this,Jo,null);N(this,Vs,null);N(this,Nd,0);N(this,Md,0);N(this,el,null);N(this,Hu,null);N(this,$u,0);N(this,Ba,0);N(this,Vu,Object.create(null));N(this,Ld,[]);N(this,Gu,null);N(this,tl,[]);N(this,Od,new WeakMap);N(this,Fd,null);var l;if(e instanceof ReadableStream)T(this,Gu,e);else if(typeof e=="object")T(this,Gu,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');T(this,In,T(this,Hu,t)),T(this,Ba,r.scale*Wi.pixelRatio),T(this,$u,r.rotation),T(this,Vs,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:s,pageX:a,pageY:o}=r.rawDims;T(this,Fd,[1,0,0,-1,-a,o+s]),T(this,Md,n),T(this,Nd,s),L(l=mr,oi,sw).call(l),so(t,r),u(this,Fa).promise.finally(()=>{u(mr,Wu).delete(this),T(this,Vs,null),T(this,Vu,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=qr.platform;return Ct(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{u(this,el).read().then(({value:t,done:r})=>{if(r){u(this,Fa).resolve();return}u(this,Jo)??T(this,Jo,t.lang),Object.assign(u(this,Vu),t.styles),L(this,fa,nw).call(this,t.items),e()},u(this,Fa).reject)};return T(this,el,u(this,Gu).getReader()),u(mr,Wu).add(this),e(),u(this,Fa).promise}update({viewport:e,onBefore:t=null}){var s;const r=e.scale*Wi.pixelRatio,n=e.rotation;if(n!==u(this,$u)&&(t==null||t(),T(this,$u,n),so(u(this,Hu),{rotation:n})),r!==u(this,Ba)){t==null||t(),T(this,Ba,r);const a={div:null,properties:null,ctx:L(s=mr,oi,_p).call(s,u(this,Jo))};for(const o of u(this,tl))a.properties=u(this,Od).get(o),a.div=o,L(this,fa,I0).call(this,a)}}cancel(){var t;const e=new ha("TextLayer task cancelled.");(t=u(this,el))==null||t.cancel(e).catch(()=>{}),T(this,el,null),u(this,Fa).reject(e)}get textDivs(){return u(this,tl)}get textContentItemsStr(){return u(this,Ld)}static cleanup(){if(!(u(this,Wu).size>0)){u(this,qu).clear();for(const{canvas:e}of u(this,rl).values())e.remove();u(this,rl).clear()}}},Fa=new WeakMap,In=new WeakMap,Rd=new WeakMap,Id=new WeakMap,Jo=new WeakMap,Vs=new WeakMap,Nd=new WeakMap,Md=new WeakMap,el=new WeakMap,Hu=new WeakMap,$u=new WeakMap,Ba=new WeakMap,Vu=new WeakMap,Ld=new WeakMap,Gu=new WeakMap,tl=new WeakMap,Od=new WeakMap,Fd=new WeakMap,qu=new WeakMap,rl=new WeakMap,Bd=new WeakMap,za=new WeakMap,Wu=new WeakMap,fa=new WeakSet,nw=function(e){var n,s;if(u(this,Rd))return;(s=u(this,Vs)).ctx??(s.ctx=L(n=mr,oi,_p).call(n,u(this,Jo)));const t=u(this,tl),r=u(this,Ld);for(const a of e){if(t.length>PC){ut("Ignoring additional textDivs for performance reasons."),T(this,Rd,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=u(this,In);T(this,In,document.createElement("span")),u(this,In).classList.add("markedContent"),a.id!==null&&u(this,In).setAttribute("id",`${a.id}`),o.append(u(this,In))}else a.type==="endMarkedContent"&&T(this,In,u(this,In).parentNode);continue}r.push(a.str),L(this,fa,iw).call(this,a)}},iw=function(e){var b;const t=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};u(this,tl).push(t);const n=Qe.transform(u(this,Fd),e.transform);let s=Math.atan2(n[1],n[0]);const a=u(this,Vu)[e.fontName];a.vertical&&(s+=Math.PI/2);let o=u(this,Id)&&a.fontSubstitution||a.fontFamily;o=mr.fontFamilyMap.get(o)||o;const l=Math.hypot(n[2],n[3]),c=l*L(b=mr,oi,aw).call(b,o,a,u(this,Jo));let h,d;s===0?(h=n[4],d=n[5]-c):(h=n[4]+c*Math.sin(s),d=n[5]-c*Math.cos(s));const p="calc(var(--total-scale-factor) *",g=t.style;u(this,In)===u(this,Hu)?(g.left=`${(100*h/u(this,Md)).toFixed(2)}%`,g.top=`${(100*d/u(this,Nd)).toFixed(2)}%`):(g.left=`${p}${h.toFixed(2)}px)`,g.top=`${p}${d.toFixed(2)}px)`),g.fontSize=`${p}${(u(mr,za)*l).toFixed(2)}px)`,g.fontFamily=o,r.fontSize=l,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,u(this,Id)&&(t.dataset.fontName=a.fontSubstitutionLoadedName||e.fontName),s!==0&&(r.angle=s*(180/Math.PI));let y=!1;if(e.str.length>1)y=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const w=Math.abs(e.transform[0]),v=Math.abs(e.transform[3]);w!==v&&Math.max(w,v)/Math.min(w,v)>1.5&&(y=!0)}if(y&&(r.canvasWidth=a.vertical?e.height:e.width),u(this,Od).set(t,r),u(this,Vs).div=t,u(this,Vs).properties=r,L(this,fa,I0).call(this,u(this,Vs)),r.hasText&&u(this,In).append(t),r.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),u(this,In).append(w)}},I0=function(e){var o;const{div:t,properties:r,ctx:n}=e,{style:s}=t;let a="";if(u(mr,za)>1&&(a=`scale(${1/u(mr,za)})`),r.canvasWidth!==0&&r.hasText){const{fontFamily:l}=s,{canvasWidth:c,fontSize:h}=r;L(o=mr,oi,N0).call(o,n,h*u(this,Ba),l);const{width:d}=n.measureText(t.textContent);d>0&&(a=`scaleX(${c*u(this,Ba)/d}) ${a}`)}r.angle!==0&&(a=`rotate(${r.angle}deg) ${a}`),a.length>0&&(s.transform=a)},oi=new WeakSet,_p=function(e=null){let t=u(this,rl).get(e||(e=""));if(!t){const r=document.createElement("canvas");r.className="hiddenCanvasElement",r.lang=e,document.body.append(r),t=r.getContext("2d",{alpha:!1,willReadFrequently:!0}),u(this,rl).set(e,t),u(this,Bd).set(t,{size:0,family:""})}return t},N0=function(e,t,r){const n=u(this,Bd).get(e);t===n.size&&r===n.family||(e.font=`${t}px ${r}`,n.size=t,n.family=r)},sw=function(){if(u(this,za)!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),T(this,za,e.getBoundingClientRect().height),e.remove()},aw=function(e,t,r){const n=u(this,qu).get(e);if(n)return n;const s=L(this,oi,_p).call(this,r);s.canvas.width=s.canvas.height=hy,L(this,oi,N0).call(this,s,hy,e);const a=s.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let c=.8;return o?c=o/(o+l):(qr.platform.isFirefox&&ut("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?c=t.ascent:t.descent&&(c=1+t.descent)),u(this,qu).set(e,c),c},N(mr,oi),N(mr,qu,new Map),N(mr,rl,new Map),N(mr,Bd,new WeakMap),N(mr,za,null),N(mr,Wu,new Set),mr);class Mh{static textContent(e){const t=[],r={items:t,styles:Object.create(null)};function n(s){var l;if(!s)return;let a=null;const o=s.name;if(o==="#text")a=s.value;else if(Mh.shouldBuildText(o))(l=s==null?void 0:s.attributes)!=null&&l.textContent?a=s.attributes.textContent:s.value&&(a=s.value);else return;if(a!==null&&t.push({str:a}),!!s.children)for(const c of s.children)n(c)}return n(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const RC=100;function Bb(i={}){typeof i=="string"||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const e=new M0,{docId:t}=e,r=i.url?U_(i.url):null,n=i.data?H_(i.data):null,s=i.httpHeaders||null,a=i.withCredentials===!0,o=i.password??null,l=i.range instanceof zb?i.range:null,c=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:2**16;let h=i.worker instanceof Sc?i.worker:null;const d=i.verbosity,p=typeof i.docBaseUrl=="string"&&!kf(i.docBaseUrl)?i.docBaseUrl:null,g=tp(i.cMapUrl),y=i.cMapPacked!==!1,b=i.CMapReaderFactory||(_n?Y_:Jv),w=tp(i.iccUrl),v=tp(i.standardFontDataUrl),A=i.StandardFontDataFactory||(_n?Z_:ey),E=tp(i.wasmUrl),_=i.WasmFactory||(_n?K_:ty),C=i.stopAtErrors!==!0,I=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,k=i.isEvalSupported!==!1,D=typeof i.isOffscreenCanvasSupported=="boolean"?i.isOffscreenCanvasSupported:!_n,R=typeof i.isImageDecoderSupported=="boolean"?i.isImageDecoderSupported:!_n&&(qr.platform.isFirefox||!globalThis.chrome),z=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,G=typeof i.disableFontFace=="boolean"?i.disableFontFace:_n,O=i.fontExtraProperties===!0,X=i.enableXfa===!0,S=i.ownerDocument||globalThis.document,J=i.disableRange===!0,Y=i.disableStream===!0,W=i.disableAutoFetch===!0,fe=i.pdfBug===!0,K=i.CanvasFactory||(_n?X_:G_),be=i.FilterFactory||(_n?W_:q_),te=i.enableHWA===!0,j=i.useWasm!==!1,ie=l?l.length:i.length??NaN,ae=typeof i.useSystemFonts=="boolean"?i.useSystemFonts:!_n&&!G,H=typeof i.useWorkerFetch=="boolean"?i.useWorkerFetch:!!(b===Jv&&A===ey&&_===ty&&g&&v&&E&&ah(g,document.baseURI)&&ah(v,document.baseURI)&&ah(E,document.baseURI)),se=null;E_(d);const le={canvasFactory:new K({ownerDocument:S,enableHWA:te}),filterFactory:new be({docId:t,ownerDocument:S}),cMapReaderFactory:H?null:new b({baseUrl:g,isCompressed:y}),standardFontDataFactory:H?null:new A({baseUrl:v}),wasmFactory:H?null:new _({baseUrl:E})};h||(h=Sc.create({verbosity:d,port:yi.workerPort}),e._worker=h);const oe={docId:t,apiVersion:"5.3.93",data:n,password:o,disableAutoFetch:W,rangeChunkSize:c,length:ie,docBaseUrl:p,enableXfa:X,evaluatorOptions:{maxImageSize:I,disableFontFace:G,ignoreErrors:C,isEvalSupported:k,isOffscreenCanvasSupported:D,isImageDecoderSupported:R,canvasMaxAreaInBytes:z,fontExtraProperties:O,useSystemFonts:ae,useWasm:j,useWorkerFetch:H,cMapUrl:g,iccUrl:w,standardFontDataUrl:v,wasmUrl:E}},ce={ownerDocument:S,pdfBug:fe,styleElement:se,loadingParams:{disableAutoFetch:W,enableXfa:X}};return h.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const Ae=h.messageHandler.sendWithPromise("GetDocRequest",oe,n?[n.buffer]:null);let Se;if(l)Se=new fC(l,{disableRange:J,disableStream:Y});else if(!n){if(!r)throw new Error("getDocument - no `url` parameter provided.");const Ne=ah(r)?bC:_n?TC:AC;Se=new Ne({url:r,length:ie,httpHeaders:s,withCredentials:a,rangeChunkSize:c,disableRange:J,disableStream:Y})}return Ae.then(Ne=>{if(e.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const Te=new hh(t,Ne,h.port),x=new MC(Te,e,Se,ce,le);e._transport=x,Te.send("Ready",null)})}).catch(e._capability.reject),e}var pg;const gg=class gg{constructor(){Ie(this,"_capability",Promise.withResolvers());Ie(this,"_transport",null);Ie(this,"_worker",null);Ie(this,"docId",`d${bn(gg,pg)._++}`);Ie(this,"destroyed",!1);Ie(this,"onPassword",null);Ie(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,t,r,n;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(s){throw(r=this._worker)!=null&&r.port&&delete this._worker._pendingDestroy,s}this._transport=null,(n=this._worker)==null||n.destroy(),this._worker=null}async getData(){return this._transport.getData()}};pg=new WeakMap,N(gg,pg,0);let M0=gg;var nl,zd,jd,Ud,Hd,O2;let zb=(O2=class{constructor(e,t,r=!1,n=null){N(this,nl,Promise.withResolvers());N(this,zd,[]);N(this,jd,[]);N(this,Ud,[]);N(this,Hd,[]);this.length=e,this.initialData=t,this.progressiveDone=r,this.contentDispositionFilename=n}addRangeListener(e){u(this,Hd).push(e)}addProgressListener(e){u(this,Ud).push(e)}addProgressiveReadListener(e){u(this,jd).push(e)}addProgressiveDoneListener(e){u(this,zd).push(e)}onDataRange(e,t){for(const r of u(this,Hd))r(e,t)}onDataProgress(e,t){u(this,nl).promise.then(()=>{for(const r of u(this,Ud))r(e,t)})}onDataProgressiveRead(e){u(this,nl).promise.then(()=>{for(const t of u(this,jd))t(e)})}onDataProgressiveDone(){u(this,nl).promise.then(()=>{for(const e of u(this,zd))e()})}transportReady(){u(this,nl).resolve()}requestDataRange(e,t){Wt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},nl=new WeakMap,zd=new WeakMap,jd=new WeakMap,Ud=new WeakMap,Hd=new WeakMap,O2);class IC{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Ct(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}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({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}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(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}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()}}var Gs,il,mh;class NC{constructor(e,t,r,n=!1){N(this,il);N(this,Gs,!1);this._pageIndex=e,this._pageInfo=t,this._transport=r,this._stats=n?new Zv:null,this._pdfBug=n,this.commonObjs=r.commonObjs,this.objs=new rw,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:e,rotation:t=this.rotate,offsetX:r=0,offsetY:n=0,dontFlip:s=!1}={}){return new Tf({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:r,offsetY:n,dontFlip:s})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Ct(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,viewport:t,intent:r="display",annotationMode:n=vs.ENABLE,transform:s=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:c=null,printAnnotationStorage:h=null,isEditing:d=!1}){var _,C;(_=this._stats)==null||_.time("Overall");const p=this._transport.getRenderingIntent(r,n,h,d),{renderingIntent:g,cacheKey:y}=p;T(this,Gs,!1),o||(o=this._transport.getOptionalContentConfig(g));let b=this._intentStates.get(y);b||(b=Object.create(null),this._intentStates.set(y,b)),b.streamReaderCancelTimeout&&(clearTimeout(b.streamReaderCancelTimeout),b.streamReaderCancelTimeout=null);const w=!!(g&ii.PRINT);b.displayReadyCapability||(b.displayReadyCapability=Promise.withResolvers(),b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(C=this._stats)==null||C.time("Page Request"),this._pumpOperatorList(p));const v=I=>{var k;b.renderTasks.delete(A),w&&T(this,Gs,!0),L(this,il,mh).call(this),I?(A.capability.reject(I),this._abortOperatorList({intentState:b,reason:I instanceof Error?I:new Error(I)})):A.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(k=globalThis.Stats)!=null&&k.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},A=new L0({callback:v,params:{canvasContext:e,viewport:t,transform:s,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:c});(b.renderTasks||(b.renderTasks=new Set)).add(A);const E=A.task;return Promise.all([b.displayReadyCapability.promise,o]).then(([I,k])=>{var D;if(this.destroyed){v();return}if((D=this._stats)==null||D.time("Rendering"),!(k.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");A.initializeGraphics({transparency:I,optionalContentConfig:k}),A.operatorListChanged()}).catch(v),E}getOperatorList({intent:e="display",annotationMode:t=vs.ENABLE,printAnnotationStorage:r=null,isEditing:n=!1}={}){var c;function s(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(e,t,r,n,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=s,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(c=this._stats)==null||c.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(n){return n.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(r=>Mh.textContent(r));const t=this.streamTextContent(e);return new Promise(function(r,n){function s(){a.read().then(function({value:l,done:c}){if(c){r(o);return}o.lang??(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),s()},n)}const a=t.getReader(),o={items:[],styles:Object.create(null),lang:null};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const r of t.renderTasks)e.push(r.completed),r.cancel();return this.objs.clear(),T(this,Gs,!1),Promise.all(e)}cleanup(e=!1){T(this,Gs,!0);const t=L(this,il,mh).call(this);return e&&t&&this._stats&&(this._stats=new Zv),t}_startRenderPage(e,t){var n,s;const r=this._intentStates.get(t);r&&((n=this._stats)==null||n.timeEnd("Page Request"),(s=r.displayReadyCapability)==null||s.resolve(e))}_renderPageChunk(e,t){for(let r=0,n=e.length;r<n;r++)t.operatorList.fnArray.push(e.fnArray[r]),t.operatorList.argsArray.push(e.argsArray[r]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const r of t.renderTasks)r.operatorListChanged();e.lastChunk&&L(this,il,mh).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:r,modifiedIds:n}){const{map:s,transfer:a}=r,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:s,modifiedIds:n},a).getReader(),c=this._intentStates.get(t);c.streamReader=l;const h=()=>{l.read().then(({value:d,done:p})=>{if(p){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,c),h())},d=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const p of c.renderTasks)p.operatorListChanged();L(this,il,mh).call(this)}if(c.displayReadyCapability)c.displayReadyCapability.reject(d);else if(c.opListReadCapability)c.opListReadCapability.reject(d);else throw d}})};h()}_abortOperatorList({intentState:e,reason:t,force:r=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!r){if(e.renderTasks.size>0)return;if(t instanceof Tg){let n=RC;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},n);return}}if(e.streamReader.cancel(new ha(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[n,s]of this._intentStates)if(s===e){this._intentStates.delete(n);break}this.cleanup()}}}get stats(){return this._stats}}Gs=new WeakMap,il=new WeakSet,mh=function(){if(!u(this,Gs)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),T(this,Gs,!1),!0};var ja,Oi,qs,sl,mg,al,ol,Tn,Cp,ow,lw,bh,Xu,Sp;const ar=class ar{constructor({name:e=null,port:t=null,verbosity:r=__()}={}){N(this,Tn);N(this,ja,Promise.withResolvers());N(this,Oi,null);N(this,qs,null);N(this,sl,null);if(this.name=e,this.destroyed=!1,this.verbosity=r,t){if(u(ar,ol).has(t))throw new Error("Cannot use more than one PDFWorker per port.");u(ar,ol).set(t,this),L(this,Tn,ow).call(this,t)}else L(this,Tn,lw).call(this)}get promise(){return u(this,ja).promise}get port(){return u(this,qs)}get messageHandler(){return u(this,Oi)}destroy(){var e,t;this.destroyed=!0,(e=u(this,sl))==null||e.terminate(),T(this,sl,null),u(ar,ol).delete(u(this,qs)),T(this,qs,null),(t=u(this,Oi))==null||t.destroy(),T(this,Oi,null)}static create(e){const t=u(this,ol).get(e==null?void 0:e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new ar(e)}static get workerSrc(){if(yi.workerSrc)return yi.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Ct(this,"_setupFakeWorkerGlobal",(async()=>u(this,Xu,Sp)?u(this,Xu,Sp):(await import(this.workerSrc)).WorkerMessageHandler)())}};ja=new WeakMap,Oi=new WeakMap,qs=new WeakMap,sl=new WeakMap,mg=new WeakMap,al=new WeakMap,ol=new WeakMap,Tn=new WeakSet,Cp=function(){u(this,ja).resolve(),u(this,Oi).send("configure",{verbosity:this.verbosity})},ow=function(e){T(this,qs,e),T(this,Oi,new hh("main","worker",e)),u(this,Oi).on("ready",()=>{}),L(this,Tn,Cp).call(this)},lw=function(){if(u(ar,al)||u(ar,Xu,Sp)){L(this,Tn,bh).call(this);return}let{workerSrc:e}=ar;try{ar._isSameOrigin(window.location,e)||(e=ar._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),r=new hh("main","worker",t),n=()=>{s.abort(),r.destroy(),t.terminate(),this.destroyed?u(this,ja).reject(new Error("Worker was destroyed")):L(this,Tn,bh).call(this)},s=new AbortController;t.addEventListener("error",()=>{u(this,sl)||n()},{signal:s.signal}),r.on("test",o=>{if(s.abort(),this.destroyed||!o){n();return}T(this,Oi,r),T(this,qs,t),T(this,sl,t),L(this,Tn,Cp).call(this)}),r.on("ready",o=>{if(s.abort(),this.destroyed){n();return}try{a()}catch{L(this,Tn,bh).call(this)}});const a=()=>{const o=new Uint8Array;r.send("test",o,[o.buffer])};a();return}catch{Sg("The worker has been disabled.")}L(this,Tn,bh).call(this)},bh=function(){u(ar,al)||(ut("Setting up fake worker."),T(ar,al,!0)),ar._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){u(this,ja).reject(new Error("Worker was destroyed"));return}const t=new V_;T(this,qs,t);const r=`fake${bn(ar,mg)._++}`,n=new hh(r+"_worker",r,t);e.setup(n,t),T(this,Oi,new hh(r,r+"_worker",t)),L(this,Tn,Cp).call(this)}).catch(e=>{u(this,ja).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},Xu=new WeakSet,Sp=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},N(ar,Xu),N(ar,mg,0),N(ar,al,!1),N(ar,ol,new WeakMap),_n&&(T(ar,al,!0),yi.workerSrc||(yi.workerSrc="./pdf.worker.mjs")),ar._isSameOrigin=(e,t)=>{const r=URL.parse(e);if(!(r!=null&&r.origin)||r.origin==="null")return!1;const n=new URL(t,r);return r.origin===n.origin},ar._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},ar.fromPort=e=>{if(N_("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return ar.create(e)};let Sc=ar;var Ws,cs,Yu,Zu,Xs,ll,vh;class MC{constructor(e,t,r,n,s){N(this,ll);N(this,Ws,new Map);N(this,cs,new Map);N(this,Yu,new Map);N(this,Zu,new Map);N(this,Xs,null);this.messageHandler=e,this.loadingTask=t,this.commonObjs=new rw,this.fontLoader=new z_({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.wasmFactory=s.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return Ct(this,"annotationStorage",new Lb)}getRenderingIntent(e,t=vs.ENABLE,r=null,n=!1,s=!1){let a=ii.DISPLAY,o=x0;switch(e){case"any":a=ii.ANY;break;case"display":break;case"print":a=ii.PRINT;break;default:ut(`getRenderingIntent - invalid intent: ${e}`)}const l=a&ii.PRINT&&r instanceof z1?r:this.annotationStorage;switch(t){case vs.DISABLE:a+=ii.ANNOTATIONS_DISABLE;break;case vs.ENABLE:break;case vs.ENABLE_FORMS:a+=ii.ANNOTATIONS_FORMS;break;case vs.ENABLE_STORAGE:a+=ii.ANNOTATIONS_STORAGE,o=l.serializable;break;default:ut(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(a+=ii.IS_EDITING),s&&(a+=ii.OPLIST);const{ids:c,hash:h}=l.modifiedIds,d=[a,o.hash,h];return{renderingIntent:a,cacheKey:d.join("_"),annotationStorageSerializable:o,modifiedIds:c}}destroy(){var r;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(r=u(this,Xs))==null||r.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const n of u(this,cs).values())e.push(n._destroy());u(this,cs).clear(),u(this,Yu).clear(),u(this,Zu).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var n,s;this.commonObjs.clear(),this.fontLoader.clear(),u(this,Ws).clear(),this.filterFactory.destroy(),Nh.cleanup(),(n=this._networkStream)==null||n.cancelAllRequests(new ha("Worker was terminated.")),(s=this.messageHandler)==null||s.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(r,n)=>{Dr(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},n.onPull=()=>{this._fullReader.read().then(function({value:s,done:a}){if(a){n.close();return}Dr(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{n.error(s)})},n.onCancel=s=>{this._fullReader.cancel(s),n.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("ReaderHeadersReady",async r=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:n,isRangeSupported:s,contentLength:a}=this._fullReader;return(!n||!s)&&(this._lastProgress&&((o=t.onProgress)==null||o.call(t,this._lastProgress)),this._fullReader.onProgress=l=>{var c;(c=t.onProgress)==null||c.call(t,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:n,isRangeSupported:s,contentLength:a}}),e.on("GetRangeReader",(r,n)=>{Dr(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(r.begin,r.end);if(!s){n.close();return}n.onPull=()=>{s.read().then(function({value:a,done:o}){if(o){n.close();return}Dr(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{n.error(a)})},n.onCancel=a=>{s.cancel(a),n.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("GetDoc",({pdfInfo:r})=>{this._numPages=r.numPages,this._htmlForXfa=r.htmlForXfa,delete r.htmlForXfa,t._capability.resolve(new IC(r,this))}),e.on("DocException",r=>{t._capability.reject(Dn(r))}),e.on("PasswordRequest",r=>{T(this,Xs,Promise.withResolvers());try{if(!t.onPassword)throw Dn(r);const n=s=>{s instanceof Error?u(this,Xs).reject(s):u(this,Xs).resolve({password:s})};t.onPassword(n,r.code)}catch(n){u(this,Xs).reject(n)}return u(this,Xs).promise}),e.on("DataLoaded",r=>{var n;(n=t.onProgress)==null||n.call(t,{loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{if(this.destroyed)return;u(this,cs).get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,n,s])=>{var a;if(this.destroyed||this.commonObjs.has(r))return null;switch(n){case"Font":if("error"in s){const h=s.error;ut(`Error during font loading: ${h}`),this.commonObjs.resolve(r,h);break}const o=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(h,d)=>globalThis.FontInspector.fontAdded(h,d):null,l=new j_(s,o);this.fontLoader.bind(l).catch(()=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!l.fontExtraProperties&&l.data&&(l.data=null),this.commonObjs.resolve(r,l)});break;case"CopyLocalImage":const{imageRef:c}=s;Dr(c,"The imageRef must be defined.");for(const h of u(this,cs).values())for(const[,d]of h.objs)if((d==null?void 0:d.ref)===c)return d.dataLen?(this.commonObjs.resolve(r,structuredClone(d)),d.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,s);break;default:throw new Error(`Got unknown common object type ${n}`)}return null}),e.on("obj",([r,n,s,a])=>{var l;if(this.destroyed)return;const o=u(this,cs).get(n);if(!o.objs.has(r)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(s){case"Image":case"Pattern":o.objs.resolve(r,a);break;default:throw new Error(`Got unknown object type ${s}`)}}}),e.on("DocProgress",r=>{var n;this.destroyed||(n=t.onProgress)==null||n.call(t,{loaded:r.loaded,total:r.total})}),e.on("FetchBinaryData",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");const n=this[r.type];if(!n)throw new Error(`${r.type} not initialized, see the \`useWorkerFetch\` parameter.`);return n.fetch(r)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var r;this.annotationStorage.size<=0&&ut("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((r=this._fullReader)==null?void 0:r.filename)??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,r=u(this,Yu).get(t);if(r)return r;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&u(this,Zu).set(s.refStr,e);const a=new NC(t,s,this,this._params.pdfBug);return u(this,cs).set(t,a),a});return u(this,Yu).set(t,n),n}getPageIndex(e){return A0(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return L(this,ll,vh).call(this,"GetFieldObjects")}hasJSActions(){return L(this,ll,vh).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}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 L(this,ll,vh).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return L(this,ll,vh).call(this,"GetOptionalContentConfig").then(t=>new dC(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=u(this,Ws).get(e);if(t)return t;const r=this.messageHandler.sendWithPromise(e,null).then(n=>{var s,a;return{info:n[0],metadata:n[1]?new cC(n[1]):null,contentDispositionFilename:((s=this._fullReader)==null?void 0:s.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return u(this,Ws).set(e,r),r}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of u(this,cs).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),u(this,Ws).clear(),this.filterFactory.destroy(!0),Nh.cleanup()}}cachedPageNumber(e){if(!A0(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return u(this,Zu).get(t)??null}}Ws=new WeakMap,cs=new WeakMap,Yu=new WeakMap,Zu=new WeakMap,Xs=new WeakMap,ll=new WeakSet,vh=function(e,t=null){const r=u(this,Ws).get(e);if(r)return r;const n=this.messageHandler.sendWithPromise(e,t);return u(this,Ws).set(e,n),n};var Ua;class LC{constructor(e){N(this,Ua,null);Ie(this,"onContinue",null);Ie(this,"onError",null);T(this,Ua,e)}get promise(){return u(this,Ua).capability.promise}cancel(e=0){u(this,Ua).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=u(this,Ua).operatorList;if(!e)return!1;const{annotationCanvasMap:t}=u(this,Ua);return e.form||e.canvas&&(t==null?void 0:t.size)>0}}Ua=new WeakMap;var Ha,ul;const ko=class ko{constructor({callback:e,params:t,objs:r,commonObjs:n,annotationCanvasMap:s,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:p=null}){N(this,Ha,null);this.callback=e,this.params=t,this.objs=r,this.commonObjs=n,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=d,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new LC(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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var o,l;if(this.cancelled)return;if(this._canvas){if(u(ko,ul).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.");u(ko,ul).add(this._canvas)}this._pdfBug&&((o=globalThis.StepperManager)!=null&&o.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:r,viewport:n,transform:s,background:a}=this.params;this.gfx=new mu(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(l=this.graphicsReadyCallback)==null||l.call(this)}cancel(e=null,t=0){var r,n,s;this.running=!1,this.cancelled=!0,(r=this.gfx)==null||r.endDrawing(),u(this,Ha)&&(window.cancelAnimationFrame(u(this,Ha)),T(this,Ha,null)),u(ko,ul).delete(this._canvas),e||(e=new Tg(`Rendering cancelled, page ${this._pageIndex+1}`,t)),this.callback(e),(s=(n=this.task).onError)==null||s.call(n,e)}operatorListChanged(){var e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.stepper)==null||e.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?T(this,Ha,window.requestAnimationFrame(()=>{T(this,Ha,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),u(ko,ul).delete(this._canvas),this.callback())))}};Ha=new WeakMap,ul=new WeakMap,N(ko,ul,new WeakSet);let L0=ko;const jb="5.3.93",uw="cbeef3233";function dy(i){return Math.floor(Math.max(0,Math.min(1,i))*255).toString(16).padStart(2,"0")}function Qc(i){return Math.max(0,Math.min(255,255*i))}class fy{static CMYK_G([e,t,r,n]){return["G",1-Math.min(1,.3*e+.59*r+.11*t+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=Qc(e),[e,e,e]}static G_HTML([e]){const t=dy(e);return`#${t}${t}${t}`}static RGB_G([e,t,r]){return["G",.3*e+.59*t+.11*r]}static RGB_rgb(e){return e.map(Qc)}static RGB_HTML(e){return`#${e.map(dy).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,r,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,r+n),1-Math.min(1,t+n)]}static CMYK_rgb([e,t,r,n]){return[Qc(1-Math.min(1,e+n)),Qc(1-Math.min(1,r+n)),Qc(1-Math.min(1,t+n))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,r]){const n=1-e,s=1-t,a=1-r,o=Math.min(n,s,a);return["CMYK",n,s,a,o]}}class OC{create(e,t,r=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),r||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${t}`),n}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Wt("Abstract method `_createSVG` called.")}}class Lh extends OC{_createSVG(e){return document.createElementNS(Ts,e)}}class Ub{static setupStorage(e,t,r,n,s){const a=n.getValue(t,{value:null});switch(r.name){case"textarea":if(a.value!==null&&(e.textContent=a.value),s==="print")break;e.addEventListener("input",o=>{n.setValue(t,{value:o.target.value})});break;case"input":if(r.attributes.type==="radio"||r.attributes.type==="checkbox"){if(a.value===r.attributes.xfaOn?e.setAttribute("checked",!0):a.value===r.attributes.xfaOff&&e.removeAttribute("checked"),s==="print")break;e.addEventListener("change",o=>{n.setValue(t,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&e.setAttribute("value",a.value),s==="print")break;e.addEventListener("input",o=>{n.setValue(t,{value:o.target.value})})}break;case"select":if(a.value!==null){e.setAttribute("value",a.value);for(const o of r.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{const l=o.target.options,c=l.selectedIndex===-1?"":l[l.selectedIndex].value;n.setValue(t,{value:c})});break}}static setAttributes({html:e,element:t,storage:r=null,intent:n,linkService:s}){const{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${n}`);for(const[l,c]of Object.entries(a))if(c!=null)switch(l){case"class":c.length&&e.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!o||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,c)}o&&s.addLinkAttributes(e,a.href,a.newWindow),r&&a.dataId&&this.setupStorage(e,a.dataId,t,r)}static render(e){var d,p;const t=e.annotationStorage,r=e.linkService,n=e.xfaHtml,s=e.intent||"display",a=document.createElement(n.name);n.attributes&&this.setAttributes({html:a,element:n,intent:s,linkService:r});const o=s!=="richText",l=e.div;if(l.append(a),e.viewport){const g=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=g}o&&l.setAttribute("class","xfaLayer xfaFont");const c=[];if(n.children.length===0){if(n.value){const g=document.createTextNode(n.value);a.append(g),o&&Mh.shouldBuildText(n.name)&&c.push(g)}return{textDivs:c}}const h=[[n,-1,a]];for(;h.length>0;){const[g,y,b]=h.at(-1);if(y+1===g.children.length){h.pop();continue}const w=g.children[++h.at(-1)[1]];if(w===null)continue;const{name:v}=w;if(v==="#text"){const E=document.createTextNode(w.value);c.push(E),b.append(E);continue}const A=(d=w==null?void 0:w.attributes)!=null&&d.xmlns?document.createElementNS(w.attributes.xmlns,v):document.createElement(v);if(b.append(A),w.attributes&&this.setAttributes({html:A,element:w,storage:t,intent:s,linkService:r}),((p=w.children)==null?void 0:p.length)>0)h.push([w,-1,A]);else if(w.value){const E=document.createTextNode(w.value);o&&Mh.shouldBuildText(v)&&c.push(E),A.append(E)}}for(const g of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const FC=9,jl=new WeakSet;class py{static create(e){switch(e.data.annotationType){case wr.LINK:return new cw(e);case wr.TEXT:return new BC(e);case wr.WIDGET:switch(e.data.fieldType){case"Tx":return new zC(e);case"Btn":return e.data.radioButton?new fw(e):e.data.checkBox?new UC(e):new HC(e);case"Ch":return new $C(e);case"Sig":return new jC(e)}return new Wl(e);case wr.POPUP:return new F0(e);case wr.FREETEXT:return new vw(e);case wr.LINE:return new GC(e);case wr.SQUARE:return new qC(e);case wr.CIRCLE:return new WC(e);case wr.POLYLINE:return new yw(e);case wr.CARET:return new YC(e);case wr.INK:return new Hb(e);case wr.POLYGON:return new XC(e);case wr.HIGHLIGHT:return new ww(e);case wr.UNDERLINE:return new ZC(e);case wr.SQUIGGLY:return new KC(e);case wr.STRIKEOUT:return new QC(e);case wr.STAMP:return new xw(e);case wr.FILEATTACHMENT:return new JC(e);default:return new Cr(e)}}}var cl,Ku,Qu,$d,O0;const yv=class yv{constructor(e,{isRenderable:t=!1,ignoreBorder:r=!1,createQuadrilaterals:n=!1}={}){N(this,$d);N(this,cl,null);N(this,Ku,!1);N(this,Qu,null);this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(r)),n&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e!=null&&e.str||t!=null&&t.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return yv._hasPopupData(this.data)}updateEdited(e){var r;if(!this.container)return;u(this,cl)||T(this,cl,{rect:this.data.rect.slice(0)});const{rect:t}=e;t&&L(this,$d,O0).call(this,t),(r=u(this,Qu))==null||r.popup.updateEdited(e)}resetEdited(){var e;u(this,cl)&&(L(this,$d,O0).call(this,u(this,cl).rect),(e=u(this,Qu))==null||e.popup.resetEdited(),T(this,cl,null))}_createContainer(e){const{data:t,parent:{page:r,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",t.id),this instanceof Wl||(s.tabIndex=0);const{style:a}=s;if(a.zIndex=this.parent.zIndex++,t.alternativeText&&(s.title=t.alternativeText),t.noRotate&&s.classList.add("norotate"),!t.rect||this instanceof F0){const{rotation:b}=t;return!t.hasOwnCanvas&&b!==0&&this.setRotation(b,s),s}const{width:o,height:l}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;const b=t.borderStyle.horizontalCornerRadius,w=t.borderStyle.verticalCornerRadius;if(b>0||w>0){const A=`calc(${b}px * var(--total-scale-factor)) / calc(${w}px * var(--total-scale-factor))`;a.borderRadius=A}else if(this instanceof fw){const A=`calc(${o}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;a.borderRadius=A}switch(t.borderStyle.style){case iu.SOLID:a.borderStyle="solid";break;case iu.DASHED:a.borderStyle="dashed";break;case iu.BEVELED:ut("Unimplemented border style: beveled");break;case iu.INSET:ut("Unimplemented border style: inset");break;case iu.UNDERLINE:a.borderBottomStyle="solid";break}const v=t.borderColor||null;v?(T(this,Ku,!0),a.borderColor=Qe.makeHexColor(v[0]|0,v[1]|0,v[2]|0)):a.borderWidth=0}const c=Qe.normalizeRect([t.rect[0],r.view[3]-t.rect[1]+r.view[1],t.rect[2],r.view[3]-t.rect[3]+r.view[1]]),{pageWidth:h,pageHeight:d,pageX:p,pageY:g}=n.rawDims;a.left=`${100*(c[0]-p)/h}%`,a.top=`${100*(c[1]-g)/d}%`;const{rotation:y}=t;return t.hasOwnCanvas||y===0?(a.width=`${100*o/h}%`,a.height=`${100*l/d}%`):this.setRotation(y,s),s}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:n}=this.parent.viewport.rawDims;let{width:s,height:a}=this;e%180!==0&&([s,a]=[a,s]),t.style.width=`${100*s/r}%`,t.style.height=`${100*a/n}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,r,n)=>{const s=n.detail[t],a=s[0],o=s.slice(1);n.target.style[r]=fy[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[r]:fy[`${a}_rgb`](o)})};return Ct(this,"_commonActions",{display:t=>{const{display:r}=t.detail,n=r%2===1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:r===1||r===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:r}=t.detail;this.container.style.visibility=r?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:r,noView:r})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{const r=t.detail.rotation;this.setRotation(r),this.annotationStorage.setValue(this.data.id,{rotation:r})}})}_dispatchEventFromSandbox(e,t){const r=this._commonActions;for(const n of Object.keys(t.detail)){const s=e[n]||r[n];s==null||s(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const r=this._commonActions;for(const[n,s]of Object.entries(t)){const a=r[n];if(a){const o={detail:{[n]:s},target:e};a(o),delete t[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,r,n,s]=this.data.rect.map(b=>Math.fround(b));if(e.length===8){const[b,w,v,A]=e.subarray(2,6);if(n===b&&s===w&&t===v&&r===A)return}const{style:a}=this.container;let o;if(u(this,Ku)){const{borderColor:b,borderWidth:w}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${b}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const l=n-t,c=s-r,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";const p=h.createElement("defs");d.append(p);const g=h.createElement("clipPath"),y=`clippath_${this.data.id}`;g.setAttribute("id",y),g.setAttribute("clipPathUnits","objectBoundingBox"),p.append(g);for(let b=2,w=e.length;b<w;b+=8){const v=e[b],A=e[b+1],E=e[b+2],_=e[b+3],C=h.createElement("rect"),I=(E-t)/l,k=(s-A)/c,D=(v-E)/l,R=(A-_)/c;C.setAttribute("x",I),C.setAttribute("y",k),C.setAttribute("width",D),C.setAttribute("height",R),g.append(C),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${I}" y="${k}" width="${D}" height="${R}"/>`)}u(this,Ku)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(d),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{data:e}=this,t=T(this,Qu,new F0({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},parent:this.parent,elements:[this]}));this.parent.div.append(t.render())}render(){Wt("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const r=[];if(this._fieldObjects){const n=this._fieldObjects[e];if(n)for(const{page:s,id:a,exportValues:o}of n){if(s===-1||a===t)continue;const l=typeof o=="string"?o:null,c=document.querySelector(`[data-element-id="${a}"]`);if(c&&!jl.has(c)){ut(`_getElementsByName - element not allowed: ${a}`);continue}r.push({id:a,exportValue:l,domElement:c})}return r}for(const n of document.getElementsByName(e)){const{exportValue:s}=n,a=n.getAttribute("data-element-id");a!==t&&jl.has(n)&&r.push({id:a,exportValue:s,domElement:n})}return r}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var r;(r=this.linkService.eventBus)==null||r.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};cl=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,$d=new WeakSet,O0=function(e){const{container:{style:t},data:{rect:r,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:a,pageX:o,pageY:l}}}}=this;r==null||r.splice(0,4,...e),t.left=`${100*(e[0]-o)/s}%`,t.top=`${100*(a-e[3]+l)/a}%`,n===0?(t.width=`${100*(e[2]-e[0])/s}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(n)};let Cr=yv;var ai,_o,hw,dw;class cw extends Cr{constructor(t,r=null){super(t,{isRenderable:!0,ignoreBorder:!!(r!=null&&r.ignoreBorder),createQuadrilaterals:!0});N(this,ai);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:r}=this,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let s=!1;return t.url?(r.addLinkAttributes(n,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(n,t.action),s=!0):t.attachment?(L(this,ai,hw).call(this,n,t.attachment,t.attachmentDest),s=!0):t.setOCGState?(L(this,ai,dw).call(this,n,t.setOCGState),s=!0):t.dest?(this._bindLink(n,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,t),s=!0),t.resetForm?(this._bindResetFormAction(n,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(n,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&this.container.append(n),this.container}_bindLink(t,r){t.href=this.linkService.getDestinationHash(r),t.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&L(this,ai,_o).call(this)}_bindNamedAction(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(r),!1),L(this,ai,_o).call(this)}_bindJSAction(t,r){t.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const s of Object.keys(r.actions)){const a=n.get(s);a&&(t[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:s}}),!1})}t.onclick||(t.onclick=()=>!1),L(this,ai,_o).call(this)}_bindResetFormAction(t,r){const n=t.onclick;if(n||(t.href=this.linkService.getAnchorUrl("")),L(this,ai,_o).call(this),!this._fieldObjects){ut('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(t.onclick=()=>!1);return}t.onclick=()=>{var d;n==null||n();const{fields:s,refs:a,include:o}=r,l=[];if(s.length!==0||a.length!==0){const p=new Set(a);for(const g of s){const y=this._fieldObjects[g]||[];for(const{id:b}of y)p.add(b)}for(const g of Object.values(this._fieldObjects))for(const y of g)p.has(y.id)===o&&l.push(y)}else for(const p of Object.values(this._fieldObjects))l.push(...p);const c=this.annotationStorage,h=[];for(const p of l){const{id:g}=p;switch(h.push(g),p.type){case"text":{const b=p.defaultValue||"";c.setValue(g,{value:b});break}case"checkbox":case"radiobutton":{const b=p.defaultValue===p.exportValues;c.setValue(g,{value:b});break}case"combobox":case"listbox":{const b=p.defaultValue||"";c.setValue(g,{value:b});break}default:continue}const y=document.querySelector(`[data-element-id="${g}"]`);if(y){if(!jl.has(y)){ut(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;y.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}ai=new WeakSet,_o=function(){this.container.setAttribute("data-internal-link","")},hw=function(t,r,n=null){t.href=this.linkService.getAnchorUrl(""),r.description&&(t.title=r.description),t.onclick=()=>{var s;return(s=this.downloadManager)==null||s.openOrDownloadData(r.content,r.filename,n),!1},L(this,ai,_o).call(this)},dw=function(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(r),!1),L(this,ai,_o).call(this)};class BC extends Cr{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class Wl extends Cr{render(){return this.container}showElementAndHideCanvas(e){var t;this.data.hasOwnCanvas&&(((t=e.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return qr.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,r,n,s){r.includes("mouse")?e.addEventListener(r,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):e.addEventListener(r,a=>{var o;if(r==="blur"){if(!t.focused||!a.relatedTarget)return;t.focused=!1}else if(r==="focus"){if(t.focused)return;t.focused=!0}s&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(a)}}))})}_setEventListeners(e,t,r,n){var s,a,o;for(const[l,c]of r)(c==="Action"||(s=this.data.actions)!=null&&s[c])&&((c==="Focus"||c==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,l,c,n),c==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(e,t,"blur","Blur",null):c==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(e,t,"focus","Focus",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":Qe.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||FC,s=e.style;let a;const o=2,l=c=>Math.round(10*c)/10;if(this.data.multiLine){const c=Math.abs(this.data.rect[3]-this.data.rect[1]-o),h=Math.round(c/(hm*n))||1,d=c/h;a=Math.min(n,l(d/hm))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(n,l(c/hm))}s.fontSize=`calc(${a}px * var(--total-scale-factor))`,s.color=Qe.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(s.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class zC extends Wl{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,r,n){const s=this.annotationStorage;for(const a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=r),s.setValue(a.id,{[n]:r})}render(){var n,s;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let r=null;if(this.renderForms){const a=e.getValue(t,{value:this.data.fieldValue});let o=a.value||"";const l=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let c=a.formattedValue||((n=this.data.textContent)==null?void 0:n.join(`
|
|
32
|
+
`))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const h={userValue:o,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(r=document.createElement("textarea"),r.textContent=c??o,this.data.doNotScroll&&(r.style.overflowY="hidden")):(r=document.createElement("input"),r.type=this.data.password?"password":"text",r.setAttribute("value",c??o),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),jl.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=0;const d=this.data.dateFormat||this.data.timeFormat;d&&(r.title=d),this._setRequired(r,this.data.required),l&&(r.maxLength=l),r.addEventListener("input",g=>{e.setValue(t,{value:g.target.value}),this.setPropertyOnSiblings(r,"value",g.target.value,"value"),h.formattedValue=null}),r.addEventListener("resetform",g=>{const y=this.data.defaultFieldValue??"";r.value=h.userValue=y,h.formattedValue=null});let p=g=>{const{formattedValue:y}=h;y!=null&&(g.target.value=y),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){r.addEventListener("focus",y=>{var w;if(h.focused)return;const{target:b}=y;h.userValue&&(b.value=h.userValue),h.lastCommittedValue=b.value,h.commitKey=1,(w=this.data.actions)!=null&&w.Focus||(h.focused=!0)}),r.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);const b={value(w){h.userValue=w.detail.value??"",e.setValue(t,{value:h.userValue.toString()}),w.target.value=h.userValue},formattedValue(w){const{formattedValue:v}=w.detail;h.formattedValue=v,v!=null&&w.target!==document.activeElement&&(w.target.value=v),e.setValue(t,{formattedValue:v})},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{var _;const{charLimit:v}=w.detail,{target:A}=w;if(v===0){A.removeAttribute("maxLength");return}A.setAttribute("maxLength",v);let E=h.userValue;!E||E.length<=v||(E=E.slice(0,v),A.value=h.userValue=E,e.setValue(t,{value:E}),(_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:E,willCommit:!0,commitKey:1,selStart:A.selectionStart,selEnd:A.selectionEnd}}))}};this._dispatchEventFromSandbox(b,y)}),r.addEventListener("keydown",y=>{var v;h.commitKey=1;let b=-1;if(y.key==="Escape"?b=0:y.key==="Enter"&&!this.data.multiLine?b=2:y.key==="Tab"&&(h.commitKey=3),b===-1)return;const{value:w}=y.target;h.lastCommittedValue!==w&&(h.lastCommittedValue=w,h.userValue=w,(v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:w,willCommit:!0,commitKey:b,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const g=p;p=null,r.addEventListener("blur",y=>{var w,v;if(!h.focused||!y.relatedTarget)return;(w=this.data.actions)!=null&&w.Blur||(h.focused=!1);const{value:b}=y.target;h.userValue=b,h.lastCommittedValue!==b&&((v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:b,willCommit:!0,commitKey:h.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),g(y)}),(s=this.data.actions)!=null&&s.Keystroke&&r.addEventListener("beforeinput",y=>{var I;h.lastCommittedValue=null;const{data:b,target:w}=y,{value:v,selectionStart:A,selectionEnd:E}=w;let _=A,C=E;switch(y.inputType){case"deleteWordBackward":{const k=v.substring(0,A).match(/\w*[^\w]*$/);k&&(_-=k[0].length);break}case"deleteWordForward":{const k=v.substring(A).match(/^[^\w]*\w*/);k&&(C+=k[0].length);break}case"deleteContentBackward":A===E&&(_-=1);break;case"deleteContentForward":A===E&&(C+=1);break}y.preventDefault(),(I=this.linkService.eventBus)==null||I.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:v,change:b||"",willCommit:!1,selStart:_,selEnd:C}})}),this._setEventListeners(r,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(p&&r.addEventListener("blur",p),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/l;r.classList.add("comb"),r.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else r=document.createElement("div"),r.textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell",this.data.hasOwnCanvas&&(r.hidden=!0);return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class jC extends Wl{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class UC extends Wl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,r=t.id;let n=e.getValue(r,{value:t.exportValue===t.fieldValue}).value;typeof n=="string"&&(n=n!=="Off",e.setValue(r,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return jl.add(s),s.setAttribute("data-element-id",r),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",t.exportValue),s.tabIndex=0,s.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const c of this._getElementsByName(o,r)){const h=l&&c.exportValue===t.exportValue;c.domElement&&(c.domElement.checked=h),e.setValue(c.id,{value:h})}e.setValue(r,{value:l})}),s.addEventListener("resetform",a=>{const o=t.defaultFieldValue||"Off";a.target.checked=o===t.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(r,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class fw extends Wl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,r=t.id;let n=e.getValue(r,{value:t.fieldValue===t.buttonValue}).value;if(typeof n=="string"&&(n=n!==t.buttonValue,e.setValue(r,{value:n})),n)for(const a of this._getElementsByName(t.fieldName,r))e.setValue(a.id,{value:!1});const s=document.createElement("input");if(jl.add(s),s.setAttribute("data-element-id",r),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const c of this._getElementsByName(o,r))e.setValue(c.id,{value:!1});e.setValue(r,{value:l})}),s.addEventListener("resetform",a=>{const o=t.defaultFieldValue;a.target.checked=o!=null&&o===t.buttonValue}),this.enableScripting&&this.hasJSActions){const a=t.buttonValue;s.addEventListener("updatefromsandbox",o=>{const l={value:c=>{const h=a===c.detail.value;for(const d of this._getElementsByName(c.target.name)){const p=h&&d.id===r;d.domElement&&(d.domElement.checked=p),e.setValue(d.id,{value:p})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class HC extends cw{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",r=>{this._dispatchEventFromSandbox({},r)})),e}}class $C extends Wl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,r=e.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");jl.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",h=>{const d=this.data.defaultFieldValue;for(const p of n.options)p.selected=p.value===d});for(const h of this.data.options){const d=document.createElement("option");d.textContent=h.displayValue,d.value=h.exportValue,r.value.includes(h.exportValue)&&(d.setAttribute("selected",!0),s=!1),n.append(d)}let a=null;if(s){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),n.prepend(h),a=()=>{h.remove(),n.removeEventListener("input",a),a=null},n.addEventListener("input",a)}const o=h=>{const d=h?"value":"textContent",{options:p,multiple:g}=n;return g?Array.prototype.filter.call(p,y=>y.selected).map(y=>y[d]):p.selectedIndex===-1?null:p[p.selectedIndex][d]};let l=o(!1);const c=h=>{const d=h.target.options;return Array.prototype.map.call(d,p=>({displayValue:p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",h=>{const d={value(p){a==null||a();const g=p.detail.value,y=new Set(Array.isArray(g)?g:[g]);for(const b of n.options)b.selected=y.has(b.value);e.setValue(t,{value:o(!0)}),l=o(!1)},multipleSelection(p){n.multiple=!0},remove(p){const g=n.options,y=p.detail.remove;g[y].selected=!1,n.remove(y),g.length>0&&Array.prototype.findIndex.call(g,w=>w.selected)===-1&&(g[0].selected=!0),e.setValue(t,{value:o(!0),items:c(p)}),l=o(!1)},clear(p){for(;n.length!==0;)n.remove(0);e.setValue(t,{value:null,items:[]}),l=o(!1)},insert(p){const{index:g,displayValue:y,exportValue:b}=p.detail.insert,w=n.children[g],v=document.createElement("option");v.textContent=y,v.value=b,w?w.before(v):n.append(v),e.setValue(t,{value:o(!0),items:c(p)}),l=o(!1)},items(p){const{items:g}=p.detail;for(;n.length!==0;)n.remove(0);for(const y of g){const{displayValue:b,exportValue:w}=y,v=document.createElement("option");v.textContent=b,v.value=w,n.append(v)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(t,{value:o(!0),items:c(p)}),l=o(!1)},indices(p){const g=new Set(p.detail.indices);for(const y of p.target.options)y.selected=g.has(y.index);e.setValue(t,{value:o(!0)}),l=o(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(d,h)}),n.addEventListener("input",h=>{var g;const d=o(!0),p=o(!1);e.setValue(t,{value:d}),h.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:l,change:p,changeEx:d,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):n.addEventListener("input",function(h){e.setValue(t,{value:o(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class F0 extends Cr{constructor(e){const{data:t,elements:r}=e;super(e,{isRenderable:Cr._hasPopupData(t)}),this.elements=r,this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const t=this.popup=new VC({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),r=[];for(const n of this.elements)n.popup=t,n.container.ariaHasPopup="dialog",r.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",r.map(n=>`${Nb}${n}`).join(",")),this.container}}var Ju,bg,vg,ec,tc,pr,Ys,hl,Vd,Gd,rc,Zs,Fi,Ks,qd,Qs,Wd,dl,fl,Xt,Tp,B0,pw,gw,mw,bw,kp,Dp,z0;class VC{constructor({container:e,color:t,elements:r,titleObj:n,modificationDate:s,contentsObj:a,richText:o,parent:l,rect:c,parentRect:h,open:d}){N(this,Xt);N(this,Ju,L(this,Xt,mw).bind(this));N(this,bg,L(this,Xt,z0).bind(this));N(this,vg,L(this,Xt,Dp).bind(this));N(this,ec,L(this,Xt,kp).bind(this));N(this,tc,null);N(this,pr,null);N(this,Ys,null);N(this,hl,null);N(this,Vd,null);N(this,Gd,null);N(this,rc,null);N(this,Zs,!1);N(this,Fi,null);N(this,Ks,null);N(this,qd,null);N(this,Qs,null);N(this,Wd,null);N(this,dl,null);N(this,fl,!1);var p;T(this,pr,e),T(this,Wd,n),T(this,Ys,a),T(this,Qs,o),T(this,Gd,l),T(this,tc,t),T(this,qd,c),T(this,rc,h),T(this,Vd,r),T(this,hl,Dg.toDateObject(s)),this.trigger=r.flatMap(g=>g.getElementsToTriggerPopup());for(const g of this.trigger)g.addEventListener("click",u(this,ec)),g.addEventListener("mouseenter",u(this,vg)),g.addEventListener("mouseleave",u(this,bg)),g.classList.add("popupTriggerArea");for(const g of r)(p=g.container)==null||p.addEventListener("keydown",u(this,Ju));u(this,pr).hidden=!0,d&&L(this,Xt,kp).call(this)}render(){if(u(this,Fi))return;const e=T(this,Fi,document.createElement("div"));if(e.className="popup",u(this,tc)){const s=e.style.outlineColor=Qe.makeHexColor(...u(this,tc));e.style.backgroundColor=`color-mix(in srgb, ${s} 30%, white)`}const t=document.createElement("span");t.className="header";const r=document.createElement("h1");if(t.append(r),{dir:r.dir,str:r.textContent}=u(this,Wd),e.append(t),u(this,hl)){const s=document.createElement("time");s.classList.add("popupDate"),s.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),s.setAttribute("data-l10n-args",JSON.stringify({dateObj:u(this,hl).valueOf()})),s.dateTime=u(this,hl).toISOString(),t.append(s)}const n=u(this,Xt,Tp);if(n)Ub.render({xfaHtml:n,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const s=this._formatContents(u(this,Ys));e.append(s)}u(this,pr).append(e)}_formatContents({str:e,dir:t}){const r=document.createElement("p");r.classList.add("popupContent"),r.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let s=0,a=n.length;s<a;++s){const o=n[s];r.append(document.createTextNode(o)),s<a-1&&r.append(document.createElement("br"))}return r}updateEdited({rect:e,popupContent:t}){var r;u(this,dl)||T(this,dl,{contentsObj:u(this,Ys),richText:u(this,Qs)}),e&&T(this,Ks,null),t&&(T(this,Qs,L(this,Xt,gw).call(this,t)),T(this,Ys,null)),(r=u(this,Fi))==null||r.remove(),T(this,Fi,null)}resetEdited(){var e;u(this,dl)&&({contentsObj:bn(this,Ys)._,richText:bn(this,Qs)._}=u(this,dl),T(this,dl,null),(e=u(this,Fi))==null||e.remove(),T(this,Fi,null),T(this,Ks,null))}forceHide(){T(this,fl,this.isVisible),u(this,fl)&&(u(this,pr).hidden=!0)}maybeShow(){u(this,fl)&&(u(this,Fi)||L(this,Xt,Dp).call(this),T(this,fl,!1),u(this,pr).hidden=!1)}get isVisible(){return u(this,pr).hidden===!1}}Ju=new WeakMap,bg=new WeakMap,vg=new WeakMap,ec=new WeakMap,tc=new WeakMap,pr=new WeakMap,Ys=new WeakMap,hl=new WeakMap,Vd=new WeakMap,Gd=new WeakMap,rc=new WeakMap,Zs=new WeakMap,Fi=new WeakMap,Ks=new WeakMap,qd=new WeakMap,Qs=new WeakMap,Wd=new WeakMap,dl=new WeakMap,fl=new WeakMap,Xt=new WeakSet,Tp=function(){const e=u(this,Qs),t=u(this,Ys);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&u(this,Qs).html||null},B0=function(){var e,t,r;return((r=(t=(e=u(this,Xt,Tp))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:r.fontSize)||0},pw=function(){var e,t,r;return((r=(t=(e=u(this,Xt,Tp))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:r.color)||null},gw=function(e){const t=[],r={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},n={style:{color:u(this,Xt,pw),fontSize:u(this,Xt,B0)?`calc(${u(this,Xt,B0)}px * var(--total-scale-factor))`:""}};for(const s of e.split(`
|
|
33
|
+
`))t.push({name:"span",value:s,attributes:n});return r},mw=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&u(this,Zs))&&L(this,Xt,kp).call(this)},bw=function(){if(u(this,Ks)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:r,pageX:n,pageY:s}}}=u(this,Gd);let a=!!u(this,rc),o=a?u(this,rc):u(this,qd);for(const y of u(this,Vd))if(!o||Qe.intersect(y.data.rect,o)!==null){o=y.data.rect,a=!0;break}const l=Qe.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),h=a?o[2]-o[0]+5:0,d=l[0]+h,p=l[1];T(this,Ks,[100*(d-n)/t,100*(p-s)/r]);const{style:g}=u(this,pr);g.left=`${u(this,Ks)[0]}%`,g.top=`${u(this,Ks)[1]}%`},kp=function(){T(this,Zs,!u(this,Zs)),u(this,Zs)?(L(this,Xt,Dp).call(this),u(this,pr).addEventListener("click",u(this,ec)),u(this,pr).addEventListener("keydown",u(this,Ju))):(L(this,Xt,z0).call(this),u(this,pr).removeEventListener("click",u(this,ec)),u(this,pr).removeEventListener("keydown",u(this,Ju)))},Dp=function(){u(this,Fi)||this.render(),this.isVisible?u(this,Zs)&&u(this,pr).classList.add("focused"):(L(this,Xt,bw).call(this),u(this,pr).hidden=!1,u(this,pr).style.zIndex=parseInt(u(this,pr).style.zIndex)+1e3)},z0=function(){u(this,pr).classList.remove("focused"),!(u(this,Zs)||!this.isVisible)&&(u(this,pr).hidden=!0,u(this,pr).style.zIndex=parseInt(u(this,pr).style.zIndex)-1e3)};class vw extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=ot.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const r=document.createElement("span");r.textContent=t,e.append(r)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Xd;class GC extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Xd,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:r,height:n}=this,s=this.svgFactory.create(r,n,!0),a=T(this,Xd,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return u(this,Xd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Xd=new WeakMap;var Yd;class qC extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Yd,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:r,height:n}=this,s=this.svgFactory.create(r,n,!0),a=t.borderStyle.width,o=T(this,Yd,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",r-a),o.setAttribute("height",n-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),s.append(o),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return u(this,Yd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Yd=new WeakMap;var Zd;class WC extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Zd,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:r,height:n}=this,s=this.svgFactory.create(r,n,!0),a=t.borderStyle.width,o=T(this,Zd,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",r/2),o.setAttribute("cy",n/2),o.setAttribute("rx",r/2-a/2),o.setAttribute("ry",n/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),s.append(o),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return u(this,Zd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Zd=new WeakMap;var Kd;class yw extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Kd,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:r,borderStyle:n,popupRef:s},width:a,height:o}=this;if(!r)return this.container;const l=this.svgFactory.create(a,o,!0);let c=[];for(let d=0,p=r.length;d<p;d+=2){const g=r[d]-t[0],y=t[3]-r[d+1];c.push(`${g},${y}`)}c=c.join(" ");const h=T(this,Kd,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",c),h.setAttribute("stroke-width",n.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),l.append(h),this.container.append(l),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return u(this,Kd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Kd=new WeakMap;class XC extends yw{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class YC extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Qd,pl,Jd,j0;class Hb extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Jd);N(this,Qd,null);N(this,pl,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?ot.HIGHLIGHT:ot.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:r,inkLists:n,borderStyle:s,popupRef:a}}=this,{transform:o,width:l,height:c}=L(this,Jd,j0).call(this,r,t),h=this.svgFactory.create(l,c,!0),d=T(this,Qd,this.svgFactory.createElement("svg:g"));h.append(d),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",o);for(let p=0,g=n.length;p<g;p++){const y=this.svgFactory.createElement(this.svgElementName);u(this,pl).push(y),y.setAttribute("points",n[p].join(",")),d.append(y)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:r,points:n,rect:s}=t,a=u(this,Qd);if(r>=0&&a.setAttribute("stroke-width",r||1),n)for(let o=0,l=u(this,pl).length;o<l;o++)u(this,pl)[o].setAttribute("points",n[o].join(","));if(s){const{transform:o,width:l,height:c}=L(this,Jd,j0).call(this,this.data.rotation,s);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${c}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return u(this,pl)}addHighlightArea(){this.container.classList.add("highlightArea")}}Qd=new WeakMap,pl=new WeakMap,Jd=new WeakSet,j0=function(t,r){switch(t){case 90:return{transform:`rotate(90) translate(${-r[0]},${r[1]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};case 180:return{transform:`rotate(180) translate(${-r[2]},${r[1]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]};case 270:return{transform:`rotate(270) translate(${-r[2]},${r[3]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};default:return{transform:`translate(${-r[0]},${r[3]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]}}};class ww extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=ot.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){const r=document.createElement("mark");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class ZC extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),e){const r=document.createElement("u");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class KC extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),e){const r=document.createElement("u");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class QC extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),e){const r=document.createElement("s");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class xw extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=ot.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var ef,tf,U0;class JC extends Cr{constructor(t){var n;super(t,{isRenderable:!0});N(this,tf);N(this,ef,null);const{file:r}=this.data;this.filename=r.filename,this.content=r.content,(n=this.linkService.eventBus)==null||n.dispatch("fileattachmentannotation",{source:this,...r})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:r}=this;let n;r.hasAppearance||r.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(r.name)?"paperclip":"pushpin"}.svg`,r.fillAlpha&&r.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(r.fillAlpha*100)}%);`)),n.addEventListener("dblclick",L(this,tf,U0).bind(this)),T(this,ef,n);const{isMac:s}=qr.platform;return t.addEventListener("keydown",a=>{a.key==="Enter"&&(s?a.metaKey:a.ctrlKey)&&L(this,tf,U0).call(this)}),!r.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),t.append(n),t}getElementsToTriggerPopup(){return u(this,ef)}addHighlightArea(){this.container.classList.add("highlightArea")}}ef=new WeakMap,tf=new WeakSet,U0=function(){var t;(t=this.downloadManager)==null||t.openOrDownloadData(this.content,this.filename)};var rf,gl,$a,nf,po,H0,$0,nc;let $b=(nc=class{constructor({div:e,accessibilityManager:t,annotationCanvasMap:r,annotationEditorUIManager:n,page:s,viewport:a,structTreeLayer:o}){N(this,po);N(this,rf,null);N(this,gl,null);N(this,$a,new Map);N(this,nf,null);this.div=e,T(this,rf,t),T(this,gl,r),T(this,nf,o||null),this.page=s,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return u(this,$a).size>0}async render(e){var a;const{annotations:t}=e,r=this.div;so(r,this.viewport);const n=new Map,s={data:null,layer:r,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new Lh,annotationStorage:e.annotationStorage||new Lb,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const o of t){if(o.noHTML)continue;const l=o.annotationType===wr.POPUP;if(l){const d=n.get(o.id);if(!d)continue;s.elements=d}else if(o.rect[2]===o.rect[0]||o.rect[3]===o.rect[1])continue;s.data=o;const c=py.create(s);if(!c.isRenderable)continue;if(!l&&o.popupRef){const d=n.get(o.popupRef);d?d.push(c):n.set(o.popupRef,[c])}const h=c.render();o.hidden&&(h.style.visibility="hidden"),await L(this,po,H0).call(this,h,o.id,s.elements),c._isEditable&&(u(this,$a).set(c.data.id,c),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(c))}L(this,po,$0).call(this)}async addLinkAnnotations(e,t){const r={data:null,layer:this.div,linkService:t,svgFactory:new Lh,parent:this};for(const n of e){n.borderStyle||(n.borderStyle=nc._defaultBorderStyle),r.data=n;const s=py.create(r);if(!s.isRenderable)continue;const a=s.render();await L(this,po,H0).call(this,a,n.id,null)}}update({viewport:e}){const t=this.div;this.viewport=e,so(t,{rotation:e.rotation}),L(this,po,$0).call(this),t.hidden=!1}getEditableAnnotations(){return Array.from(u(this,$a).values())}getEditableAnnotation(e){return u(this,$a).get(e)}static get _defaultBorderStyle(){return Ct(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:iu.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},rf=new WeakMap,gl=new WeakMap,$a=new WeakMap,nf=new WeakMap,po=new WeakSet,H0=async function(e,t,r){var o,l;const n=e.firstChild||e,s=n.id=`${Nb}${t}`,a=await((o=u(this,nf))==null?void 0:o.getAriaAttributes(s));if(a)for(const[c,h]of a)n.setAttribute(c,h);r?r.at(-1).container.after(e):(this.div.append(e),(l=u(this,rf))==null||l.moveElementInDOM(this.div,e,n,!1))},$0=function(){var t;if(!u(this,gl))return;const e=this.div;for(const[r,n]of u(this,gl)){const s=e.querySelector(`[data-annotation-id="${r}"]`);if(!s)continue;n.className="annotationContent";const{firstChild:a}=s;a?a.nodeName==="CANVAS"?a.replaceWith(n):a.classList.contains("annotationContent")?a.after(n):a.before(n):s.append(n);const o=u(this,$a).get(r);o&&(o._hasNoCanvas?((t=this._annotationEditorUIManager)==null||t.setMissingCanvas(r,s.id,n),o._hasNoCanvas=!1):o.canvas=n)}u(this,gl).clear()},nc);const sp=/\r\n?|\n/g;var Bi,Xn,sf,ml,Yn,Pr,Aw,Ew,_w,Pp,ca,Rp,Ip,Cw,G0,Sw;const Jt=class Jt extends tr{constructor(t){super({...t,name:"freeTextEditor"});N(this,Pr);N(this,Bi);N(this,Xn,"");N(this,sf,`${this.id}-editor`);N(this,ml,null);N(this,Yn);T(this,Bi,t.color||Jt._defaultColor||tr._defaultLineColor),T(this,Yn,t.fontSize||Jt._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const t=Jt.prototype,r=a=>a.isEmpty(),n=ao.TRANSLATE_SMALL,s=ao.TRANSLATE_BIG;return Ct(this,"_keyboardManager",new Df([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[n,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:r}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,n],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:r}]]))}static initialize(t,r){tr.initialize(t,r);const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,r){switch(t){case kt.FREETEXT_SIZE:Jt._defaultFontSize=r;break;case kt.FREETEXT_COLOR:Jt._defaultColor=r;break}}updateParams(t,r){switch(t){case kt.FREETEXT_SIZE:L(this,Pr,Aw).call(this,r);break;case kt.FREETEXT_COLOR:L(this,Pr,Ew).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[kt.FREETEXT_SIZE,Jt._defaultFontSize],[kt.FREETEXT_COLOR,Jt._defaultColor||tr._defaultLineColor]]}get propertiesToUpdate(){return[[kt.FREETEXT_SIZE,u(this,Yn)],[kt.FREETEXT_COLOR,u(this,Bi)]]}_translateEmpty(t,r){this._uiManager.translateSelectedEditors(t,r,!0)}getInitialTranslation(){const t=this.parentScale;return[-Jt._internalPadding*t,-(Jt._internalPadding+u(this,Yn))*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),T(this,ml,new AbortController);const t=this._uiManager.combinedSignal(u(this,ml));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",u(this,sf)),this._isDraggable=!0,(t=u(this,ml))==null||t.abort(),T(this,ml,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var r;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(r=this._initialOptions)!=null&&r.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 t=u(this,Xn),r=T(this,Xn,L(this,Pr,_w).call(this).trimEnd());if(t===r)return;const n=s=>{if(T(this,Xn,s),!s){this.remove();return}L(this,Pr,Ip).call(this),this._uiManager.rebuild(this),L(this,Pr,Pp).call(this)};this.addCommands({cmd:()=>{n(r)},undo:()=>{n(t)},mustExec:!1}),L(this,Pr,Pp).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Jt._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let t,r;(this._isCopy||this.annotationElementId)&&(t=this.x,r=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",u(this,sf)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;if(n.fontSize=`calc(${u(this,Yn)}px * var(--total-scale-factor))`,n.color=u(this,Bi),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[s,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,c]=this.getInitialTranslation();[l,c]=this.pageTranslationToScreen(l,c);const[h,d]=this.pageDimensions,[p,g]=this.pageTranslation;let y,b;switch(this.rotation){case 0:y=t+(o[0]-p)/h,b=r+this.height-(o[1]-g)/d;break;case 90:y=t+(o[0]-p)/h,b=r-(o[1]-g)/d,[l,c]=[c,-l];break;case 180:y=t-this.width+(o[0]-p)/h,b=r-(o[1]-g)/d,[l,c]=[-l,-c];break;case 270:y=t+(o[0]-p-this.height*d)/h,b=r+(o[1]-g-this.width*h)/d,[l,c]=[-c,l];break}this.setAt(y*s,b*a,l,c)}else this._moveAfterPaste(t,r);L(this,Pr,Ip).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var y,b,w;const r=t.clipboardData||window.clipboardData,{types:n}=r;if(n.length===1&&n[0]==="text/plain")return;t.preventDefault();const s=L(y=Jt,ca,G0).call(y,r.getData("text")||"").replaceAll(sp,`
|
|
34
|
+
`);if(!s)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!s.includes(`
|
|
35
|
+
`)){o.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:c}=o,h=[],d=[];if(l.nodeType===Node.TEXT_NODE){const v=l.parentElement;if(d.push(l.nodeValue.slice(c).replaceAll(sp,"")),v!==this.editorDiv){let A=h;for(const E of this.editorDiv.childNodes){if(E===v){A=d;continue}A.push(L(b=Jt,ca,Rp).call(b,E))}}h.push(l.nodeValue.slice(0,c).replaceAll(sp,""))}else if(l===this.editorDiv){let v=h,A=0;for(const E of this.editorDiv.childNodes)A++===c&&(v=d),v.push(L(w=Jt,ca,Rp).call(w,E))}T(this,Xn,`${h.join(`
|
|
36
|
+
`)}${s}${d.join(`
|
|
37
|
+
`)}`),L(this,Pr,Ip).call(this);const p=new Range;let g=Math.sumPrecise(h.map(v=>v.length));for(const{firstChild:v}of this.editorDiv.childNodes)if(v.nodeType===Node.TEXT_NODE){const A=v.nodeValue.length;if(g<=A){p.setStart(v,g),p.setEnd(v,g);break}g-=A}a.removeAllRanges(),a.addRange(p)}get contentDiv(){return this.editorDiv}static async deserialize(t,r,n){var o;let s=null;if(t instanceof vw){const{data:{defaultAppearanceData:{fontSize:l,fontColor:c},rect:h,rotation:d,id:p,popupRef:g},textContent:y,textPosition:b,parent:{page:{pageNumber:w}}}=t;if(!y||y.length===0)return null;s=t={annotationType:ot.FREETEXT,color:Array.from(c),fontSize:l,value:y.join(`
|
|
38
|
+
`),position:b,pageIndex:w-1,rect:h.slice(0),rotation:d,annotationElementId:p,id:p,deleted:!1,popupRef:g}}const a=await super.deserialize(t,r,n);return T(a,Yn,t.fontSize),T(a,Bi,Qe.makeHexColor(...t.color)),T(a,Xn,L(o=Jt,ca,G0).call(o,t.value)),a._initialData=s,a}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const r=Jt._internalPadding*this.parentScale,n=this.getRect(r,r),s=tr._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:u(this,Bi)),a={annotationType:ot.FREETEXT,color:s,fontSize:u(this,Yn),value:L(this,Pr,Cw).call(this),pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?(a.isCopy=!0,a):this.annotationElementId&&!L(this,Pr,Sw).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(t){const r=super.renderAnnotationElement(t);if(this.deleted)return r;const{style:n}=r;n.fontSize=`calc(${u(this,Yn)}px * var(--total-scale-factor))`,n.color=u(this,Bi),r.replaceChildren();for(const a of u(this,Xn).split(`
|
|
39
|
+
`)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),r.append(o)}const s=Jt._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:u(this,Xn)}),r}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};Bi=new WeakMap,Xn=new WeakMap,sf=new WeakMap,ml=new WeakMap,Yn=new WeakMap,Pr=new WeakSet,Aw=function(t){const r=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-u(this,Yn))*this.parentScale),T(this,Yn,s),L(this,Pr,Pp).call(this)},n=u(this,Yn);this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},Ew=function(t){const r=s=>{T(this,Bi,this.editorDiv.style.color=s)},n=u(this,Bi);this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},_w=function(){var n;const t=[];this.editorDiv.normalize();let r=null;for(const s of this.editorDiv.childNodes)(r==null?void 0:r.nodeType)===Node.TEXT_NODE&&s.nodeName==="BR"||(t.push(L(n=Jt,ca,Rp).call(n,s)),r=s);return t.join(`
|
|
40
|
+
`)},Pp=function(){const[t,r]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:s,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",s.div.append(this.div),n=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=n.width/t,this.height=n.height/r):(this.width=n.height/t,this.height=n.width/r),this.fixAndSetPosition()},ca=new WeakSet,Rp=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(sp,"")},Ip=function(){if(this.editorDiv.replaceChildren(),!!u(this,Xn))for(const t of u(this,Xn).split(`
|
|
41
|
+
`)){const r=document.createElement("div");r.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(r)}},Cw=function(){return u(this,Xn).replaceAll(" "," ")},G0=function(t){return t.replaceAll(" "," ")},Sw=function(t){const{value:r,fontSize:n,color:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||t.value!==r||t.fontSize!==n||t.color.some((o,l)=>o!==s[l])||t.pageIndex!==a},N(Jt,ca),Ie(Jt,"_freeTextDefaultContent",""),Ie(Jt,"_internalPadding",0),Ie(Jt,"_defaultColor",null),Ie(Jt,"_defaultFontSize",10),Ie(Jt,"_type","freetext"),Ie(Jt,"_editorType",ot.FREETEXT);let V0=Jt;class qe{toSVGPath(){Wt("Abstract method `toSVGPath` must be implemented.")}get box(){Wt("Abstract getter `box` must be implemented.")}serialize(e,t){Wt("Abstract method `serialize` must be implemented.")}static _rescale(e,t,r,n,s,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o]*n,a[o+1]=r+e[o+1]*s;return a}static _rescaleAndSwap(e,t,r,n,s,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o+1]*n,a[o+1]=r+e[o]*s;return a}static _translate(e,t,r,n){n||(n=new Float32Array(e.length));for(let s=0,a=e.length;s<a;s+=2)n[s]=t+e[s],n[s+1]=r+e[s+1];return n}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,r,n,s){switch(s){case 90:return[1-t/r,e/n];case 180:return[1-e/r,1-t/n];case 270:return[t/r,1-e/n];default:return[e/r,t/n]}}static _normalizePagePoint(e,t,r){switch(r){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,r,n,s,a){return[(e+5*r)/6,(t+5*n)/6,(5*r+s)/6,(5*n+a)/6,(r+s)/2,(n+a)/2]}}Ie(qe,"PRECISION",1e-4);var Zn,zi,ic,sc,hs,xt,bl,vl,af,of,ac,oc,Va,lf,yg,wg,Lr,yh,Tw,kw,Dw,Pw,Rw,Iw;const Rs=class Rs{constructor({x:e,y:t},r,n,s,a,o=0){N(this,Lr);N(this,Zn);N(this,zi,[]);N(this,ic);N(this,sc);N(this,hs,[]);N(this,xt,new Float32Array(18));N(this,bl);N(this,vl);N(this,af);N(this,of);N(this,ac);N(this,oc);N(this,Va,[]);T(this,Zn,r),T(this,oc,s*n),T(this,sc,a),u(this,xt).set([NaN,NaN,NaN,NaN,e,t],6),T(this,ic,o),T(this,of,u(Rs,lf)*n),T(this,af,u(Rs,wg)*n),T(this,ac,n),u(this,Va).push(e,t)}isEmpty(){return isNaN(u(this,xt)[8])}add({x:e,y:t}){var R;T(this,bl,e),T(this,vl,t);const[r,n,s,a]=u(this,Zn);let[o,l,c,h]=u(this,xt).subarray(8,12);const d=e-c,p=t-h,g=Math.hypot(d,p);if(g<u(this,af))return!1;const y=g-u(this,of),b=y/g,w=b*d,v=b*p;let A=o,E=l;o=c,l=h,c+=w,h+=v,(R=u(this,Va))==null||R.push(e,t);const _=-v/y,C=w/y,I=_*u(this,oc),k=C*u(this,oc);return u(this,xt).set(u(this,xt).subarray(2,8),0),u(this,xt).set([c+I,h+k],4),u(this,xt).set(u(this,xt).subarray(14,18),12),u(this,xt).set([c-I,h-k],16),isNaN(u(this,xt)[6])?(u(this,hs).length===0&&(u(this,xt).set([o+I,l+k],2),u(this,hs).push(NaN,NaN,NaN,NaN,(o+I-r)/s,(l+k-n)/a),u(this,xt).set([o-I,l-k],14),u(this,zi).push(NaN,NaN,NaN,NaN,(o-I-r)/s,(l-k-n)/a)),u(this,xt).set([A,E,o,l,c,h],6),!this.isEmpty()):(u(this,xt).set([A,E,o,l,c,h],6),Math.abs(Math.atan2(E-l,A-o)-Math.atan2(v,w))<Math.PI/2?([o,l,c,h]=u(this,xt).subarray(2,6),u(this,hs).push(NaN,NaN,NaN,NaN,((o+c)/2-r)/s,((l+h)/2-n)/a),[o,l,A,E]=u(this,xt).subarray(14,18),u(this,zi).push(NaN,NaN,NaN,NaN,((A+o)/2-r)/s,((E+l)/2-n)/a),!0):([A,E,o,l,c,h]=u(this,xt).subarray(0,6),u(this,hs).push(((A+5*o)/6-r)/s,((E+5*l)/6-n)/a,((5*o+c)/6-r)/s,((5*l+h)/6-n)/a,((o+c)/2-r)/s,((l+h)/2-n)/a),[c,h,o,l,A,E]=u(this,xt).subarray(12,18),u(this,zi).push(((A+5*o)/6-r)/s,((E+5*l)/6-n)/a,((5*o+c)/6-r)/s,((5*l+h)/6-n)/a,((o+c)/2-r)/s,((l+h)/2-n)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const e=u(this,hs),t=u(this,zi);if(isNaN(u(this,xt)[6])&&!this.isEmpty())return L(this,Lr,Tw).call(this);const r=[];r.push(`M${e[4]} ${e[5]}`);for(let n=6;n<e.length;n+=6)isNaN(e[n])?r.push(`L${e[n+4]} ${e[n+5]}`):r.push(`C${e[n]} ${e[n+1]} ${e[n+2]} ${e[n+3]} ${e[n+4]} ${e[n+5]}`);L(this,Lr,Dw).call(this,r);for(let n=t.length-6;n>=6;n-=6)isNaN(t[n])?r.push(`L${t[n+4]} ${t[n+5]}`):r.push(`C${t[n]} ${t[n+1]} ${t[n+2]} ${t[n+3]} ${t[n+4]} ${t[n+5]}`);return L(this,Lr,kw).call(this,r),r.join(" ")}newFreeDrawOutline(e,t,r,n,s,a){return new Nw(e,t,r,n,s,a)}getOutlines(){var d;const e=u(this,hs),t=u(this,zi),r=u(this,xt),[n,s,a,o]=u(this,Zn),l=new Float32Array((((d=u(this,Va))==null?void 0:d.length)??0)+2);for(let p=0,g=l.length-2;p<g;p+=2)l[p]=(u(this,Va)[p]-n)/a,l[p+1]=(u(this,Va)[p+1]-s)/o;if(l[l.length-2]=(u(this,bl)-n)/a,l[l.length-1]=(u(this,vl)-s)/o,isNaN(r[6])&&!this.isEmpty())return L(this,Lr,Pw).call(this,l);const c=new Float32Array(u(this,hs).length+24+u(this,zi).length);let h=e.length;for(let p=0;p<h;p+=2){if(isNaN(e[p])){c[p]=c[p+1]=NaN;continue}c[p]=e[p],c[p+1]=e[p+1]}h=L(this,Lr,Iw).call(this,c,h);for(let p=t.length-6;p>=6;p-=6)for(let g=0;g<6;g+=2){if(isNaN(t[p+g])){c[h]=c[h+1]=NaN,h+=2;continue}c[h]=t[p+g],c[h+1]=t[p+g+1],h+=2}return L(this,Lr,Rw).call(this,c,h),this.newFreeDrawOutline(c,l,u(this,Zn),u(this,ac),u(this,ic),u(this,sc))}};Zn=new WeakMap,zi=new WeakMap,ic=new WeakMap,sc=new WeakMap,hs=new WeakMap,xt=new WeakMap,bl=new WeakMap,vl=new WeakMap,af=new WeakMap,of=new WeakMap,ac=new WeakMap,oc=new WeakMap,Va=new WeakMap,lf=new WeakMap,yg=new WeakMap,wg=new WeakMap,Lr=new WeakSet,yh=function(){const e=u(this,xt).subarray(4,6),t=u(this,xt).subarray(16,18),[r,n,s,a]=u(this,Zn);return[(u(this,bl)+(e[0]-t[0])/2-r)/s,(u(this,vl)+(e[1]-t[1])/2-n)/a,(u(this,bl)+(t[0]-e[0])/2-r)/s,(u(this,vl)+(t[1]-e[1])/2-n)/a]},Tw=function(){const[e,t,r,n]=u(this,Zn),[s,a,o,l]=L(this,Lr,yh).call(this);return`M${(u(this,xt)[2]-e)/r} ${(u(this,xt)[3]-t)/n} L${(u(this,xt)[4]-e)/r} ${(u(this,xt)[5]-t)/n} L${s} ${a} L${o} ${l} L${(u(this,xt)[16]-e)/r} ${(u(this,xt)[17]-t)/n} L${(u(this,xt)[14]-e)/r} ${(u(this,xt)[15]-t)/n} Z`},kw=function(e){const t=u(this,zi);e.push(`L${t[4]} ${t[5]} Z`)},Dw=function(e){const[t,r,n,s]=u(this,Zn),a=u(this,xt).subarray(4,6),o=u(this,xt).subarray(16,18),[l,c,h,d]=L(this,Lr,yh).call(this);e.push(`L${(a[0]-t)/n} ${(a[1]-r)/s} L${l} ${c} L${h} ${d} L${(o[0]-t)/n} ${(o[1]-r)/s}`)},Pw=function(e){const t=u(this,xt),[r,n,s,a]=u(this,Zn),[o,l,c,h]=L(this,Lr,yh).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(t[2]-r)/s,(t[3]-n)/a,NaN,NaN,NaN,NaN,(t[4]-r)/s,(t[5]-n)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,(t[16]-r)/s,(t[17]-n)/a,NaN,NaN,NaN,NaN,(t[14]-r)/s,(t[15]-n)/a],0),this.newFreeDrawOutline(d,e,u(this,Zn),u(this,ac),u(this,ic),u(this,sc))},Rw=function(e,t){const r=u(this,zi);return e.set([NaN,NaN,NaN,NaN,r[4],r[5]],t),t+=6},Iw=function(e,t){const r=u(this,xt).subarray(4,6),n=u(this,xt).subarray(16,18),[s,a,o,l]=u(this,Zn),[c,h,d,p]=L(this,Lr,yh).call(this);return e.set([NaN,NaN,NaN,NaN,(r[0]-s)/o,(r[1]-a)/l,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,d,p,NaN,NaN,NaN,NaN,(n[0]-s)/o,(n[1]-a)/l],t),t+=24},N(Rs,lf,8),N(Rs,yg,2),N(Rs,wg,u(Rs,lf)+u(Rs,yg));let Zp=Rs;var lc,yl,Js,uf,Kn,cf,Ar,xg,Mw;class Nw extends qe{constructor(t,r,n,s,a,o){super();N(this,xg);N(this,lc);N(this,yl,new Float32Array(4));N(this,Js);N(this,uf);N(this,Kn);N(this,cf);N(this,Ar);T(this,Ar,t),T(this,Kn,r),T(this,lc,n),T(this,cf,s),T(this,Js,a),T(this,uf,o),this.lastPoint=[NaN,NaN],L(this,xg,Mw).call(this,o);const[l,c,h,d]=u(this,yl);for(let p=0,g=t.length;p<g;p+=2)t[p]=(t[p]-l)/h,t[p+1]=(t[p+1]-c)/d;for(let p=0,g=r.length;p<g;p+=2)r[p]=(r[p]-l)/h,r[p+1]=(r[p+1]-c)/d}toSVGPath(){const t=[`M${u(this,Ar)[4]} ${u(this,Ar)[5]}`];for(let r=6,n=u(this,Ar).length;r<n;r+=6){if(isNaN(u(this,Ar)[r])){t.push(`L${u(this,Ar)[r+4]} ${u(this,Ar)[r+5]}`);continue}t.push(`C${u(this,Ar)[r]} ${u(this,Ar)[r+1]} ${u(this,Ar)[r+2]} ${u(this,Ar)[r+3]} ${u(this,Ar)[r+4]} ${u(this,Ar)[r+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,r,n,s],a){const o=n-t,l=s-r;let c,h;switch(a){case 0:c=qe._rescale(u(this,Ar),t,s,o,-l),h=qe._rescale(u(this,Kn),t,s,o,-l);break;case 90:c=qe._rescaleAndSwap(u(this,Ar),t,r,o,l),h=qe._rescaleAndSwap(u(this,Kn),t,r,o,l);break;case 180:c=qe._rescale(u(this,Ar),n,r,-o,l),h=qe._rescale(u(this,Kn),n,r,-o,l);break;case 270:c=qe._rescaleAndSwap(u(this,Ar),n,s,-o,-l),h=qe._rescaleAndSwap(u(this,Kn),n,s,-o,-l);break}return{outline:Array.from(c),points:[Array.from(h)]}}get box(){return u(this,yl)}newOutliner(t,r,n,s,a,o=0){return new Zp(t,r,n,s,a,o)}getNewOutline(t,r){const[n,s,a,o]=u(this,yl),[l,c,h,d]=u(this,lc),p=a*h,g=o*d,y=n*h+l,b=s*d+c,w=this.newOutliner({x:u(this,Kn)[0]*p+y,y:u(this,Kn)[1]*g+b},u(this,lc),u(this,cf),t,u(this,uf),r??u(this,Js));for(let v=2;v<u(this,Kn).length;v+=2)w.add({x:u(this,Kn)[v]*p+y,y:u(this,Kn)[v+1]*g+b});return w.getOutlines()}}lc=new WeakMap,yl=new WeakMap,Js=new WeakMap,uf=new WeakMap,Kn=new WeakMap,cf=new WeakMap,Ar=new WeakMap,xg=new WeakSet,Mw=function(t){const r=u(this,Ar);let n=r[4],s=r[5];const a=[n,s,n,s];let o=n,l=s;const c=t?Math.max:Math.min;for(let d=6,p=r.length;d<p;d+=6){const g=r[d+4],y=r[d+5];if(isNaN(r[d]))Qe.pointBoundingBox(g,y,a),l<y?(o=g,l=y):l===y&&(o=c(o,g));else{const b=[1/0,1/0,-1/0,-1/0];Qe.bezierBoundingBox(n,s,...r.slice(d,d+6),b),Qe.rectBoundingBox(...b,a),l<b[3]?(o=b[2],l=b[3]):l===b[3]&&(o=c(o,b[2]))}n=g,s=y}const h=u(this,yl);h[0]=a[0]-u(this,Js),h[1]=a[1]-u(this,Js),h[2]=a[2]-a[0]+2*u(this,Js),h[3]=a[3]-a[1]+2*u(this,Js),this.lastPoint=[o,l]};var hf,df,Ga,ji,kn,Lw,Np,Ow,Fw,W0;class q0{constructor(e,t=0,r=0,n=!0){N(this,kn);N(this,hf);N(this,df);N(this,Ga,[]);N(this,ji,[]);const s=[1/0,1/0,-1/0,-1/0],a=10**-4;for(const{x:g,y,width:b,height:w}of e){const v=Math.floor((g-t)/a)*a,A=Math.ceil((g+b+t)/a)*a,E=Math.floor((y-t)/a)*a,_=Math.ceil((y+w+t)/a)*a,C=[v,E,_,!0],I=[A,E,_,!1];u(this,Ga).push(C,I),Qe.rectBoundingBox(v,E,A,_,s)}const o=s[2]-s[0]+2*r,l=s[3]-s[1]+2*r,c=s[0]-r,h=s[1]-r,d=u(this,Ga).at(n?-1:-2),p=[d[0],d[2]];for(const g of u(this,Ga)){const[y,b,w]=g;g[0]=(y-c)/o,g[1]=(b-h)/l,g[2]=(w-h)/l}T(this,hf,new Float32Array([c,h,o,l])),T(this,df,p)}getOutlines(){u(this,Ga).sort((t,r)=>t[0]-r[0]||t[1]-r[1]||t[2]-r[2]);const e=[];for(const t of u(this,Ga))t[3]?(e.push(...L(this,kn,W0).call(this,t)),L(this,kn,Ow).call(this,t)):(L(this,kn,Fw).call(this,t),e.push(...L(this,kn,W0).call(this,t)));return L(this,kn,Lw).call(this,e)}}hf=new WeakMap,df=new WeakMap,Ga=new WeakMap,ji=new WeakMap,kn=new WeakSet,Lw=function(e){const t=[],r=new Set;for(const a of e){const[o,l,c]=a;t.push([o,l,a],[o,c,a])}t.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=t.length;a<o;a+=2){const l=t[a][2],c=t[a+1][2];l.push(c),c.push(l),r.add(l),r.add(c)}const n=[];let s;for(;r.size>0;){const a=r.values().next().value;let[o,l,c,h,d]=a;r.delete(a);let p=o,g=l;for(s=[o,c],n.push(s);;){let y;if(r.has(h))y=h;else if(r.has(d))y=d;else break;r.delete(y),[o,l,c,h,d]=y,p!==o&&(s.push(p,g,o,g===l?l:c),p=o),g=g===l?c:l}s.push(p,g)}return new eS(n,u(this,hf),u(this,df))},Np=function(e){const t=u(this,ji);let r=0,n=t.length-1;for(;r<=n;){const s=r+n>>1,a=t[s][0];if(a===e)return s;a<e?r=s+1:n=s-1}return n+1},Ow=function([,e,t]){const r=L(this,kn,Np).call(this,e);u(this,ji).splice(r,0,[e,t])},Fw=function([,e,t]){const r=L(this,kn,Np).call(this,e);for(let n=r;n<u(this,ji).length;n++){const[s,a]=u(this,ji)[n];if(s!==e)break;if(s===e&&a===t){u(this,ji).splice(n,1);return}}for(let n=r-1;n>=0;n--){const[s,a]=u(this,ji)[n];if(s!==e)break;if(s===e&&a===t){u(this,ji).splice(n,1);return}}},W0=function(e){const[t,r,n]=e,s=[[t,r,n]],a=L(this,kn,Np).call(this,n);for(let o=0;o<a;o++){const[l,c]=u(this,ji)[o];for(let h=0,d=s.length;h<d;h++){const[,p,g]=s[h];if(!(c<=p||g<=l)){if(p>=l){if(g>c)s[h][1]=c;else{if(d===1)return[];s.splice(h,1),h--,d--}continue}s[h][2]=l,g>c&&s.push([t,c,g])}}}return s};var ff,uc;class eS extends qe{constructor(t,r,n){super();N(this,ff);N(this,uc);T(this,uc,t),T(this,ff,r),this.lastPoint=n}toSVGPath(){const t=[];for(const r of u(this,uc)){let[n,s]=r;t.push(`M${n} ${s}`);for(let a=2;a<r.length;a+=2){const o=r[a],l=r[a+1];o===n?(t.push(`V${l}`),s=l):l===s&&(t.push(`H${o}`),n=o)}t.push("Z")}return t.join(" ")}serialize([t,r,n,s],a){const o=[],l=n-t,c=s-r;for(const h of u(this,uc)){const d=new Array(h.length);for(let p=0;p<h.length;p+=2)d[p]=t+h[p]*l,d[p+1]=s-h[p+1]*c;o.push(d)}return o}get box(){return u(this,ff)}get classNamesForOutlining(){return["highlightOutline"]}}ff=new WeakMap,uc=new WeakMap;class X0 extends Zp{newFreeDrawOutline(e,t,r,n,s,a){return new tS(e,t,r,n,s,a)}}class tS extends Nw{newOutliner(e,t,r,n,s,a=0){return new X0(e,t,r,n,s,a)}}var Qn,wl,cc,Nr,pf,hc,ea,gf,qa,Ui,dc,mf,qt,Y0,Z0,K0,Co,Bw,ya;const Pn=class Pn{constructor({editor:e=null,uiManager:t=null}){N(this,qt);N(this,Qn,null);N(this,wl,null);N(this,cc);N(this,Nr,null);N(this,pf,!1);N(this,hc,!1);N(this,ea,null);N(this,gf);N(this,qa,null);N(this,Ui,null);N(this,dc);var r,n;e?(T(this,hc,!1),T(this,dc,kt.HIGHLIGHT_COLOR),T(this,ea,e)):(T(this,hc,!0),T(this,dc,kt.HIGHLIGHT_DEFAULT_COLOR)),T(this,Ui,(e==null?void 0:e._uiManager)||t),T(this,gf,u(this,Ui)._eventBus),T(this,cc,((r=e==null?void 0:e.color)==null?void 0:r.toUpperCase())||((n=u(this,Ui))==null?void 0:n.highlightColors.values().next().value)||"#FFFF98"),u(Pn,mf)||T(Pn,mf,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Ct(this,"_keyboardManager",new Df([[["Escape","mac+Escape"],Pn.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Pn.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Pn.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Pn.prototype._moveToPrevious],[["Home","mac+Home"],Pn.prototype._moveToBeginning],[["End","mac+End"],Pn.prototype._moveToEnd]]))}renderButton(){const e=T(this,Qn,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",u(this,ea)&&(e.ariaControls=`${u(this,ea).id}_colorpicker_dropdown`);const t=u(this,Ui)._signal;e.addEventListener("click",L(this,qt,Co).bind(this),{signal:t}),e.addEventListener("keydown",L(this,qt,K0).bind(this),{signal:t});const r=T(this,wl,document.createElement("span"));return r.className="swatch",r.ariaHidden="true",r.style.backgroundColor=u(this,cc),e.append(r),e}renderMainDropdown(){const e=T(this,Nr,L(this,qt,Y0).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===u(this,Qn)){L(this,qt,Co).call(this,e);return}const t=e.target.getAttribute("data-color");t&&L(this,qt,Z0).call(this,t,e)}_moveToNext(e){var t,r;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}if(e.target===u(this,Qn)){(t=u(this,Nr).firstChild)==null||t.focus();return}(r=e.target.nextSibling)==null||r.focus()}_moveToPrevious(e){var t,r;if(e.target===((t=u(this,Nr))==null?void 0:t.firstChild)||e.target===u(this,Qn)){u(this,qt,ya)&&this._hideDropdownFromKeyboard();return}u(this,qt,ya)||L(this,qt,Co).call(this,e),(r=e.target.previousSibling)==null||r.focus()}_moveToBeginning(e){var t;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}(t=u(this,Nr).firstChild)==null||t.focus()}_moveToEnd(e){var t;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}(t=u(this,Nr).lastChild)==null||t.focus()}hideDropdown(){var e,t;(e=u(this,Nr))==null||e.classList.add("hidden"),u(this,Qn).ariaExpanded="false",(t=u(this,qa))==null||t.abort(),T(this,qa,null)}_hideDropdownFromKeyboard(){var e;if(!u(this,hc)){if(!u(this,qt,ya)){(e=u(this,ea))==null||e.unselect();return}this.hideDropdown(),u(this,Qn).focus({preventScroll:!0,focusVisible:u(this,pf)})}}updateColor(e){if(u(this,wl)&&(u(this,wl).style.backgroundColor=e),!u(this,Nr))return;const t=u(this,Ui).highlightColors.values();for(const r of u(this,Nr).children)r.ariaSelected=t.next().value===e.toUpperCase()}destroy(){var e,t;(e=u(this,Qn))==null||e.remove(),T(this,Qn,null),T(this,wl,null),(t=u(this,Nr))==null||t.remove(),T(this,Nr,null)}};Qn=new WeakMap,wl=new WeakMap,cc=new WeakMap,Nr=new WeakMap,pf=new WeakMap,hc=new WeakMap,ea=new WeakMap,gf=new WeakMap,qa=new WeakMap,Ui=new WeakMap,dc=new WeakMap,mf=new WeakMap,qt=new WeakSet,Y0=function(){const e=document.createElement("div"),t=u(this,Ui)._signal;e.addEventListener("contextmenu",Ei,{signal:t}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),u(this,ea)&&(e.id=`${u(this,ea).id}_colorpicker_dropdown`);for(const[r,n]of u(this,Ui).highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=r,s.setAttribute("data-l10n-id",u(Pn,mf)[r]);const a=document.createElement("span");s.append(a),a.className="swatch",a.style.backgroundColor=n,s.ariaSelected=n===u(this,cc),s.addEventListener("click",L(this,qt,Z0).bind(this,n),{signal:t}),e.append(s)}return e.addEventListener("keydown",L(this,qt,K0).bind(this),{signal:t}),e},Z0=function(e,t){t.stopPropagation(),u(this,gf).dispatch("switchannotationeditorparams",{source:this,type:u(this,dc),value:e})},K0=function(e){Pn._keyboardManager.exec(this,e)},Co=function(e){if(u(this,qt,ya)){this.hideDropdown();return}if(T(this,pf,e.detail===0),u(this,qa)||(T(this,qa,new AbortController),window.addEventListener("pointerdown",L(this,qt,Bw).bind(this),{signal:u(this,Ui).combinedSignal(u(this,qa))})),u(this,Qn).ariaExpanded="true",u(this,Nr)){u(this,Nr).classList.remove("hidden");return}const t=T(this,Nr,L(this,qt,Y0).call(this));u(this,Qn).append(t)},Bw=function(e){var t;(t=u(this,Nr))!=null&&t.contains(e.target)||this.hideDropdown()},ya=function(){return u(this,Nr)&&!u(this,Nr).classList.contains("hidden")},N(Pn,mf,null);let Oh=Pn;var fc,bf,ta,xl,vf,Nn,yf,wf,Al,gi,Jn,Qr,pc,ra,hn,gc,mi,xf,ft,Q0,Mp,zw,jw,Uw,J0,So,wi,uu,Hw,Lp,wh,$w,Vw,Gw,qw,Ww;const Bt=class Bt extends tr{constructor(t){super({...t,name:"highlightEditor"});N(this,ft);N(this,fc,null);N(this,bf,0);N(this,ta);N(this,xl,null);N(this,vf,null);N(this,Nn,null);N(this,yf,null);N(this,wf,0);N(this,Al,null);N(this,gi,null);N(this,Jn,null);N(this,Qr,!1);N(this,pc,null);N(this,ra);N(this,hn,null);N(this,gc,"");N(this,mi);N(this,xf,"");this.color=t.color||Bt._defaultColor,T(this,mi,t.thickness||Bt._defaultThickness),T(this,ra,t.opacity||Bt._defaultOpacity),T(this,ta,t.boxes||null),T(this,xf,t.methodOfCreation||""),T(this,gc,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(T(this,Qr,!0),L(this,ft,Mp).call(this,t),L(this,ft,So).call(this)):u(this,ta)&&(T(this,fc,t.anchorNode),T(this,bf,t.anchorOffset),T(this,yf,t.focusNode),T(this,wf,t.focusOffset),L(this,ft,Q0).call(this),L(this,ft,So).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const t=Bt.prototype;return Ct(this,"_keyboardManager",new Df([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:u(this,Qr)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:u(this,mi),methodOfCreation:u(this,xf)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,r){var n;tr.initialize(t,r),Bt._defaultColor||(Bt._defaultColor=((n=r.highlightColors)==null?void 0:n.values().next().value)||"#fff066")}static updateDefaultParams(t,r){switch(t){case kt.HIGHLIGHT_DEFAULT_COLOR:Bt._defaultColor=r;break;case kt.HIGHLIGHT_THICKNESS:Bt._defaultThickness=r;break}}translateInPage(t,r){}get toolbarPosition(){return u(this,pc)}updateParams(t,r){switch(t){case kt.HIGHLIGHT_COLOR:L(this,ft,zw).call(this,r);break;case kt.HIGHLIGHT_THICKNESS:L(this,ft,jw).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[kt.HIGHLIGHT_DEFAULT_COLOR,Bt._defaultColor],[kt.HIGHLIGHT_THICKNESS,Bt._defaultThickness]]}get propertiesToUpdate(){return[[kt.HIGHLIGHT_COLOR,this.color||Bt._defaultColor],[kt.HIGHLIGHT_THICKNESS,u(this,mi)||Bt._defaultThickness],[kt.HIGHLIGHT_FREE,u(this,Qr)]]}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",T(this,vf,new Oh({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(L(this,ft,wh).call(this))}getBaseTranslation(){return[0,0]}getRect(t,r){return super.getRect(t,r,L(this,ft,wh).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){L(this,ft,J0).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(L(this,ft,So).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var n;let r=!1;this.parent&&!t?L(this,ft,J0).call(this):t&&(L(this,ft,So).call(this,t),r=!this.parent&&((n=this.div)==null?void 0:n.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),r&&this.select()}rotate(t){var s,a,o;const{drawLayer:r}=this.parent;let n;u(this,Qr)?(t=(t-this.rotation+360)%360,n=L(s=Bt,wi,uu).call(s,u(this,gi).box,t)):n=L(a=Bt,wi,uu).call(a,[this.x,this.y,this.width,this.height],t),r.updateProperties(u(this,Jn),{bbox:n,root:{"data-main-rotation":t}}),r.updateProperties(u(this,hn),{bbox:L(o=Bt,wi,uu).call(o,u(this,Nn).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();u(this,gc)&&(t.setAttribute("aria-label",u(this,gc)),t.setAttribute("role","mark")),u(this,Qr)?t.classList.add("free"):this.div.addEventListener("keydown",L(this,ft,Hw).bind(this),{signal:this._uiManager._signal});const r=T(this,Al,document.createElement("div"));t.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=u(this,xl);const[n,s]=this.parentDimensions;return this.setDims(this.width*n,this.height*s),f1(this,u(this,Al),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!0}})}pointerleave(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!1}})}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:L(this,ft,Lp).call(this,!0);break;case 1:case 3:L(this,ft,Lp).call(this,!1);break}}select(){var t;super.select(),u(this,hn)&&((t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),u(this,hn)&&((t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{selected:!1}}),u(this,Qr)||L(this,ft,Lp).call(this,!1))}get _mustFixPosition(){return!u(this,Qr)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(u(this,Jn),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(u(this,hn),{rootClass:{hidden:!t}}))}static startHighlighting(t,r,{target:n,x:s,y:a}){const{x:o,y:l,width:c,height:h}=n.getBoundingClientRect(),d=new AbortController,p=t.combinedSignal(d),g=y=>{d.abort(),L(this,wi,qw).call(this,t,y)};window.addEventListener("blur",g,{signal:p}),window.addEventListener("pointerup",g,{signal:p}),window.addEventListener("pointerdown",_r,{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",Ei,{signal:p}),n.addEventListener("pointermove",L(this,wi,Gw).bind(this,t),{signal:p}),this._freeHighlight=new X0({x:s,y:a},[o,l,c,h],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(t,r,n){var b,w,v,A;let s=null;if(t instanceof ww){const{data:{quadPoints:E,rect:_,rotation:C,id:I,color:k,opacity:D,popupRef:R},parent:{page:{pageNumber:z}}}=t;s=t={annotationType:ot.HIGHLIGHT,color:Array.from(k),opacity:D,quadPoints:E,boxes:null,pageIndex:z-1,rect:_.slice(0),rotation:C,annotationElementId:I,id:I,deleted:!1,popupRef:R}}else if(t instanceof Hb){const{data:{inkLists:E,rect:_,rotation:C,id:I,color:k,borderStyle:{rawWidth:D},popupRef:R},parent:{page:{pageNumber:z}}}=t;s=t={annotationType:ot.HIGHLIGHT,color:Array.from(k),thickness:D,inkLists:E,boxes:null,pageIndex:z-1,rect:_.slice(0),rotation:C,annotationElementId:I,id:I,deleted:!1,popupRef:R}}const{color:a,quadPoints:o,inkLists:l,opacity:c}=t,h=await super.deserialize(t,r,n);h.color=Qe.makeHexColor(...a),T(h,ra,c||1),l&&T(h,mi,t.thickness),h._initialData=s;const[d,p]=h.pageDimensions,[g,y]=h.pageTranslation;if(o){const E=T(h,ta,[]);for(let _=0;_<o.length;_+=8)E.push({x:(o[_]-g)/d,y:1-(o[_+1]-y)/p,width:(o[_+2]-o[_])/d,height:(o[_+1]-o[_+5])/p});L(b=h,ft,Q0).call(b),L(w=h,ft,So).call(w),h.rotate(h.rotation)}else if(l){T(h,Qr,!0);const E=l[0],_={x:E[0]-g,y:p-(E[1]-y)},C=new X0(_,[0,0,d,p],1,u(h,mi)/2,!0,.001);for(let D=0,R=E.length;D<R;D+=2)_.x=E[D]-g,_.y=p-(E[D+1]-y),C.add(_);const{id:I,clipPathId:k}=r.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:C.toSVGPath()}},!0,!0);L(v=h,ft,Mp).call(v,{highlightOutlines:C.getOutlines(),highlightId:I,clipPathId:k}),L(A=h,ft,So).call(A),h.rotate(h.parentRotation)}return h}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const r=this.getRect(0,0),n=tr._colorManager.convert(this.color),s={annotationType:ot.HIGHLIGHT,color:n,opacity:u(this,ra),thickness:u(this,mi),quadPoints:L(this,ft,$w).call(this),outlines:L(this,ft,Vw).call(this,r),pageIndex:this.pageIndex,rect:r,rotation:L(this,ft,wh).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!L(this,ft,Ww).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};fc=new WeakMap,bf=new WeakMap,ta=new WeakMap,xl=new WeakMap,vf=new WeakMap,Nn=new WeakMap,yf=new WeakMap,wf=new WeakMap,Al=new WeakMap,gi=new WeakMap,Jn=new WeakMap,Qr=new WeakMap,pc=new WeakMap,ra=new WeakMap,hn=new WeakMap,gc=new WeakMap,mi=new WeakMap,xf=new WeakMap,ft=new WeakSet,Q0=function(){const t=new q0(u(this,ta),.001);T(this,gi,t.getOutlines()),[this.x,this.y,this.width,this.height]=u(this,gi).box;const r=new q0(u(this,ta),.0025,.001,this._uiManager.direction==="ltr");T(this,Nn,r.getOutlines());const{lastPoint:n}=u(this,Nn);T(this,pc,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height])},Mp=function({highlightOutlines:t,highlightId:r,clipPathId:n}){var d,p;if(T(this,gi,t),T(this,Nn,t.getNewOutline(u(this,mi)/2+1.5,.0025)),r>=0)T(this,Jn,r),T(this,xl,n),this.parent.drawLayer.finalizeDraw(r,{bbox:t.box,path:{d:t.toSVGPath()}}),T(this,hn,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:u(this,Nn).box,path:{d:u(this,Nn).toSVGPath()}},!0));else if(this.parent){const g=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(u(this,Jn),{bbox:L(d=Bt,wi,uu).call(d,u(this,gi).box,(g-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(u(this,hn),{bbox:L(p=Bt,wi,uu).call(p,u(this,Nn).box,g),path:{d:u(this,Nn).toSVGPath()}})}const[a,o,l,c]=t.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=c;break;case 90:{const[g,y]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*y/g,this.height=c*g/y;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=c;break;case 270:{const[g,y]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*y/g,this.height=c*g/y;break}}const{lastPoint:h}=u(this,Nn);T(this,pc,[(h[0]-a)/l,(h[1]-o)/c])},zw=function(t){const r=(a,o)=>{var l,c;this.color=a,T(this,ra,o),(l=this.parent)==null||l.drawLayer.updateProperties(u(this,Jn),{root:{fill:a,"fill-opacity":o}}),(c=u(this,vf))==null||c.updateColor(a)},n=this.color,s=u(this,ra);this.addCommands({cmd:r.bind(this,t,Bt._defaultOpacity),undo:r.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)},jw=function(t){const r=u(this,mi),n=s=>{T(this,mi,s),L(this,ft,Uw).call(this,s)};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},Uw=function(t){if(!u(this,Qr))return;L(this,ft,Mp).call(this,{highlightOutlines:u(this,gi).getNewOutline(t/2)}),this.fixAndSetPosition();const[r,n]=this.parentDimensions;this.setDims(this.width*r,this.height*n)},J0=function(){u(this,Jn)===null||!this.parent||(this.parent.drawLayer.remove(u(this,Jn)),T(this,Jn,null),this.parent.drawLayer.remove(u(this,hn)),T(this,hn,null))},So=function(t=this.parent){u(this,Jn)===null&&({id:bn(this,Jn)._,clipPathId:bn(this,xl)._}=t.drawLayer.draw({bbox:u(this,gi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":u(this,ra)},rootClass:{highlight:!0,free:u(this,Qr)},path:{d:u(this,gi).toSVGPath()}},!1,!0),T(this,hn,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:u(this,Qr)},bbox:u(this,Nn).box,path:{d:u(this,Nn).toSVGPath()}},u(this,Qr))),u(this,Al)&&(u(this,Al).style.clipPath=u(this,xl)))},wi=new WeakSet,uu=function([t,r,n,s],a){switch(a){case 90:return[1-r-s,t,s,n];case 180:return[1-t-n,1-r-s,n,s];case 270:return[r,1-t-n,s,n]}return[t,r,n,s]},Hw=function(t){Bt._keyboardManager.exec(this,t)},Lp=function(t){if(!u(this,fc))return;const r=window.getSelection();t?r.setPosition(u(this,fc),u(this,bf)):r.setPosition(u(this,yf),u(this,wf))},wh=function(){return u(this,Qr)?this.rotation:0},$w=function(){if(u(this,Qr))return null;const[t,r]=this.pageDimensions,[n,s]=this.pageTranslation,a=u(this,ta),o=new Float32Array(a.length*8);let l=0;for(const{x:c,y:h,width:d,height:p}of a){const g=c*t+n,y=(1-h)*r+s;o[l]=o[l+4]=g,o[l+1]=o[l+3]=y,o[l+2]=o[l+6]=g+d*t,o[l+5]=o[l+7]=y-p*r,l+=8}return o},Vw=function(t){return u(this,gi).serialize(t,L(this,ft,wh).call(this))},Gw=function(t,r){this._freeHighlight.add(r)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},qw=function(t,r){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Ww=function(t){const{color:r}=this._initialData;return t.color.some((n,s)=>n!==r[s])},N(Bt,wi),Ie(Bt,"_defaultColor",null),Ie(Bt,"_defaultOpacity",1),Ie(Bt,"_defaultThickness",12),Ie(Bt,"_type","highlight"),Ie(Bt,"_editorType",ot.HIGHLIGHT),Ie(Bt,"_freeHighlightId",-1),Ie(Bt,"_freeHighlight",null),Ie(Bt,"_freeHighlightClipId","");let Kp=Bt;var El;class Xw{constructor(){N(this,El,Object.create(null))}updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,r]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,r)}updateSVGProperty(e,t){u(this,El)[e]=t}toSVGProperties(){const e=u(this,El);return T(this,El,Object.create(null)),{root:e}}reset(){T(this,El,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){Wt("Not implemented")}}El=new WeakMap;var ei,mc,Ur,_l,Cl,Wa,Xa,Ya,Sl,Lt,eb,tb,rb,xh,Yw,Op,Ah,cu;const We=class We extends tr{constructor(t){super(t);N(this,Lt);N(this,ei,null);N(this,mc);Ie(this,"_drawId",null);T(this,mc,t.mustBeCommitted||!1),this._addOutlines(t)}_addOutlines(t){t.drawOutlines&&(L(this,Lt,eb).call(this,t),L(this,Lt,xh).call(this))}static _mergeSVGProperties(t,r){const n=new Set(Object.keys(t));for(const[s,a]of Object.entries(r))n.has(s)?Object.assign(t[s],a):t[s]=a;return t}static getDefaultDrawingOptions(t){Wt("Not implemented")}static get typesMap(){Wt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,r){const n=this.typesMap.get(t);n&&this._defaultDrawingOptions.updateProperty(n,r),this._currentParent&&(u(We,Ur).updateProperty(n,r),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,r){const n=this.constructor.typesMap.get(t);n&&this._updateProperty(t,n,r)}static get defaultPropertiesToUpdate(){const t=[],r=this._defaultDrawingOptions;for(const[n,s]of this.typesMap)t.push([n,r[s]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:r}=this;for(const[n,s]of this.constructor.typesMap)t.push([n,r[s]]);return t}_updateProperty(t,r,n){const s=this._drawingOptions,a=s[r],o=l=>{var h;s.updateProperty(r,l);const c=u(this,ei).updateProperty(r,l);c&&L(this,Lt,Ah).call(this,c),(h=this.parent)==null||h.drawLayer.updateProperties(this._drawId,s.toSVGProperties())};this.addCommands({cmd:o.bind(this,n),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathResizingSVGProperties(L(this,Lt,Op).call(this)),{bbox:L(this,Lt,cu).call(this)}))}_onResized(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathResizedSVGProperties(L(this,Lt,Op).call(this)),{bbox:L(this,Lt,cu).call(this)}))}_onTranslating(t,r){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,{bbox:L(this,Lt,cu).call(this)})}_onTranslated(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathTranslatedSVGProperties(L(this,Lt,Op).call(this),this.parentDimensions),{bbox:L(this,Lt,cu).call(this)}))}_onStartDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,u(this,mc)&&(T(this,mc,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){L(this,Lt,rb).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(L(this,Lt,xh).call(this),L(this,Lt,Ah).call(this,u(this,ei).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var n;let r=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),L(this,Lt,rb).call(this)):t&&(this._uiManager.addShouldRescale(this),L(this,Lt,xh).call(this,t),r=!this.parent&&((n=this.div)==null?void 0:n.classList.contains("selectedEditor"))),super.setParent(t),r&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties({bbox:L(this,Lt,cu).call(this)},u(this,ei).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&L(this,Lt,Ah).call(this,u(this,ei).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,r;this._isCopy&&(t=this.x,r=this.y);const n=super.render();n.classList.add("draw");const s=document.createElement("div");n.append(s),s.setAttribute("aria-hidden","true"),s.className="internal";const[a,o]=this.parentDimensions;return this.setDims(this.width*a,this.height*o),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,r),n}static createDrawerInstance(t,r,n,s,a){Wt("Not implemented")}static startDrawing(t,r,n,s){var w;const{target:a,offsetX:o,offsetY:l,pointerId:c,pointerType:h}=s;if(u(We,Xa)&&u(We,Xa)!==h)return;const{viewport:{rotation:d}}=t,{width:p,height:g}=a.getBoundingClientRect(),y=T(We,_l,new AbortController),b=t.combinedSignal(y);if(u(We,Wa)||T(We,Wa,c),u(We,Xa)??T(We,Xa,h),window.addEventListener("pointerup",v=>{var A;u(We,Wa)===v.pointerId?this._endDraw(v):(A=u(We,Ya))==null||A.delete(v.pointerId)},{signal:b}),window.addEventListener("pointercancel",v=>{var A;u(We,Wa)===v.pointerId?this._currentParent.endDrawingSession():(A=u(We,Ya))==null||A.delete(v.pointerId)},{signal:b}),window.addEventListener("pointerdown",v=>{u(We,Xa)===v.pointerType&&((u(We,Ya)||T(We,Ya,new Set)).add(v.pointerId),u(We,Ur).isCancellable()&&(u(We,Ur).removeLastElement(),u(We,Ur).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:b}),window.addEventListener("contextmenu",Ei,{signal:b}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:b}),a.addEventListener("touchmove",v=>{v.timeStamp===u(We,Sl)&&_r(v)},{signal:b}),t.toggleDrawing(),(w=r._editorUndoBar)==null||w.hide(),u(We,Ur)){t.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).startNew(o,l,p,g,d));return}r.updateUIForDefaultProperties(this),T(We,Ur,this.createDrawerInstance(o,l,p,g,d)),T(We,Cl,this.getDefaultDrawingOptions()),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(u(We,Cl).toSVGProperties(),u(We,Ur).defaultSVGProperties),!0,!1)}static _drawMove(t){var a;if(T(We,Sl,-1),!u(We,Ur))return;const{offsetX:r,offsetY:n,pointerId:s}=t;if(u(We,Wa)===s){if(((a=u(We,Ya))==null?void 0:a.size)>=1){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).add(r,n)),T(We,Sl,t.timeStamp),_r(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,T(We,Ur,null),T(We,Cl,null),T(We,Xa,null),T(We,Sl,NaN)),u(We,_l)&&(u(We,_l).abort(),T(We,_l,null),T(We,Wa,NaN),T(We,Ya,null))}static _endDraw(t){const r=this._currentParent;if(r){if(r.toggleDrawing(!0),this._cleanup(!1),(t==null?void 0:t.target)===r.div&&r.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const n=u(We,Ur),s=this._currentDrawId,a=n.getLastElement();r.addCommands({cmd:()=>{r.drawLayer.updateProperties(s,n.setLastElement(a))},undo:()=>{r.drawLayer.updateProperties(s,n.removeLastElement())},mustExec:!1,type:kt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){const r=this._currentParent;if(!r)return null;if(r.toggleDrawing(!0),r.cleanUndoStack(kt.DRAW_STEP),!u(We,Ur).isEmpty()){const{pageDimensions:[n,s],scale:a}=r,o=r.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:u(We,Ur).getOutlines(n*a,s*a,a,this._INNER_MARGIN),drawingOptions:u(We,Cl),mustBeCommitted:!t});return this._cleanup(!0),o}return r.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,r,n,s,a,o){Wt("Not implemented")}static async deserialize(t,r,n){var d,p;const{rawDims:{pageWidth:s,pageHeight:a,pageX:o,pageY:l}}=r.viewport,c=this.deserializeDraw(o,l,s,a,this._INNER_MARGIN,t),h=await super.deserialize(t,r,n);return h.createDrawingOptions(t),L(d=h,Lt,eb).call(d,{drawOutlines:c}),L(p=h,Lt,xh).call(p),h.onScaleChanging(),h.rotate(),h}serializeDraw(t){const[r,n]=this.pageTranslation,[s,a]=this.pageDimensions;return u(this,ei).serialize([r,n,s,a],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};ei=new WeakMap,mc=new WeakMap,Ur=new WeakMap,_l=new WeakMap,Cl=new WeakMap,Wa=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,Sl=new WeakMap,Lt=new WeakSet,eb=function({drawOutlines:t,drawId:r,drawingOptions:n}){T(this,ei,t),this._drawingOptions||(this._drawingOptions=n),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),r>=0?(this._drawId=r,this.parent.drawLayer.finalizeDraw(r,t.defaultProperties)):this._drawId=L(this,Lt,tb).call(this,t,this.parent),L(this,Lt,Ah).call(this,t.box)},tb=function(t,r){const{id:n}=r.drawLayer.draw(We._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return n},rb=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},xh=function(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=L(this,Lt,tb).call(this,u(this,ei),t)}},Yw=function([t,r,n,s]){const{parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[r,1-t,n*(o/a),s*(a/o)];case 180:return[1-t,1-r,n,s];case 270:return[1-r,t,n*(o/a),s*(a/o)];default:return[t,r,n,s]}},Op=function(){const{x:t,y:r,width:n,height:s,parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[1-r,t,n*(a/o),s*(o/a)];case 180:return[1-t,1-r,n,s];case 270:return[r,1-t,n*(a/o),s*(o/a)];default:return[t,r,n,s]}},Ah=function(t){if([this.x,this.y,this.width,this.height]=L(this,Lt,Yw).call(this,t),this.div){this.fixAndSetPosition();const[r,n]=this.parentDimensions;this.setDims(this.width*r,this.height*n)}this._onResized()},cu=function(){const{x:t,y:r,width:n,height:s,rotation:a,parentRotation:o,parentDimensions:[l,c]}=this;switch((a*4+o)/90){case 1:return[1-r-s,t,s,n];case 2:return[1-t-n,1-r-s,n,s];case 3:return[r,1-t-n,s,n];case 4:return[t,r-n*(l/c),s*(c/l),n*(l/c)];case 5:return[1-r,t,n*(l/c),s*(c/l)];case 6:return[1-t-s*(c/l),1-r,s*(c/l),n*(l/c)];case 7:return[r-n*(l/c),1-t-s*(c/l),n*(l/c),s*(c/l)];case 8:return[t-n,r-s,n,s];case 9:return[1-r,t-n,s,n];case 10:return[1-t,1-r,n,s];case 11:return[r-s,1-t,s,n];case 12:return[t-s*(c/l),r,s*(c/l),n*(l/c)];case 13:return[1-r-n*(l/c),t-s*(c/l),n*(l/c),s*(c/l)];case 14:return[1-t,1-r-n*(l/c),s*(c/l),n*(l/c)];case 15:return[r,1-t,n*(l/c),s*(c/l)];default:return[t,r,n,s]}},Ie(We,"_currentDrawId",-1),Ie(We,"_currentParent",null),N(We,Ur,null),N(We,_l,null),N(We,Cl,null),N(We,Wa,NaN),N(We,Xa,null),N(We,Ya,null),N(We,Sl,NaN),Ie(We,"_INNER_MARGIN",3);let Qp=We;var ds,Hr,$r,Tl,bc,xn,Jr,bi,kl,Dl,Pl,vc,Fp;class rS{constructor(e,t,r,n,s,a){N(this,vc);N(this,ds,new Float64Array(6));N(this,Hr);N(this,$r);N(this,Tl);N(this,bc);N(this,xn);N(this,Jr,"");N(this,bi,0);N(this,kl,new Rf);N(this,Dl);N(this,Pl);T(this,Dl,r),T(this,Pl,n),T(this,Tl,s),T(this,bc,a),[e,t]=L(this,vc,Fp).call(this,e,t);const o=T(this,Hr,[NaN,NaN,NaN,NaN,e,t]);T(this,xn,[e,t]),T(this,$r,[{line:o,points:u(this,xn)}]),u(this,ds).set(o,0)}updateProperty(e,t){e==="stroke-width"&&T(this,bc,t)}isEmpty(){return!u(this,$r)||u(this,$r).length===0}isCancellable(){return u(this,xn).length<=10}add(e,t){[e,t]=L(this,vc,Fp).call(this,e,t);const[r,n,s,a]=u(this,ds).subarray(2,6),o=e-s,l=t-a;return Math.hypot(u(this,Dl)*o,u(this,Pl)*l)<=2?null:(u(this,xn).push(e,t),isNaN(r)?(u(this,ds).set([s,a,e,t],2),u(this,Hr).push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(u(this,ds)[0])&&u(this,Hr).splice(6,6),u(this,ds).set([r,n,s,a,e,t],0),u(this,Hr).push(...qe.createBezierPoints(r,n,s,a,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){const r=this.add(e,t);return r||(u(this,xn).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,r,n,s){T(this,Dl,r),T(this,Pl,n),T(this,Tl,s),[e,t]=L(this,vc,Fp).call(this,e,t);const a=T(this,Hr,[NaN,NaN,NaN,NaN,e,t]);T(this,xn,[e,t]);const o=u(this,$r).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),u(this,$r).push({line:a,points:u(this,xn)}),u(this,ds).set(a,0),T(this,bi,0),this.toSVGPath(),null}getLastElement(){return u(this,$r).at(-1)}setLastElement(e){return u(this,$r)?(u(this,$r).push(e),T(this,Hr,e.line),T(this,xn,e.points),T(this,bi,0),{path:{d:this.toSVGPath()}}):u(this,kl).setLastElement(e)}removeLastElement(){if(!u(this,$r))return u(this,kl).removeLastElement();u(this,$r).pop(),T(this,Jr,"");for(let e=0,t=u(this,$r).length;e<t;e++){const{line:r,points:n}=u(this,$r)[e];T(this,Hr,r),T(this,xn,n),T(this,bi,0),this.toSVGPath()}return{path:{d:u(this,Jr)}}}toSVGPath(){const e=qe.svgRound(u(this,Hr)[4]),t=qe.svgRound(u(this,Hr)[5]);if(u(this,xn).length===2)return T(this,Jr,`${u(this,Jr)} M ${e} ${t} Z`),u(this,Jr);if(u(this,xn).length<=6){const n=u(this,Jr).lastIndexOf("M");T(this,Jr,`${u(this,Jr).slice(0,n)} M ${e} ${t}`),T(this,bi,6)}if(u(this,xn).length===4){const n=qe.svgRound(u(this,Hr)[10]),s=qe.svgRound(u(this,Hr)[11]);return T(this,Jr,`${u(this,Jr)} L ${n} ${s}`),T(this,bi,12),u(this,Jr)}const r=[];u(this,bi)===0&&(r.push(`M ${e} ${t}`),T(this,bi,6));for(let n=u(this,bi),s=u(this,Hr).length;n<s;n+=6){const[a,o,l,c,h,d]=u(this,Hr).slice(n,n+6).map(qe.svgRound);r.push(`C${a} ${o} ${l} ${c} ${h} ${d}`)}return T(this,Jr,u(this,Jr)+r.join(" ")),T(this,bi,u(this,Hr).length),u(this,Jr)}getOutlines(e,t,r,n){const s=u(this,$r).at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),u(this,kl).build(u(this,$r),e,t,r,u(this,Tl),u(this,bc),n),T(this,ds,null),T(this,Hr,null),T(this,$r,null),T(this,Jr,null),u(this,kl)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}ds=new WeakMap,Hr=new WeakMap,$r=new WeakMap,Tl=new WeakMap,bc=new WeakMap,xn=new WeakMap,Jr=new WeakMap,bi=new WeakMap,kl=new WeakMap,Dl=new WeakMap,Pl=new WeakMap,vc=new WeakSet,Fp=function(e,t){return qe._normalizePoint(e,t,u(this,Dl),u(this,Pl),u(this,Tl))};var An,Af,Ef,ti,fs,ps,yc,wc,Rl,rn,Ds,Zw,Kw,Qw;class Rf extends qe{constructor(){super(...arguments);N(this,rn);N(this,An);N(this,Af,0);N(this,Ef);N(this,ti);N(this,fs);N(this,ps);N(this,yc);N(this,wc);N(this,Rl)}build(t,r,n,s,a,o,l){T(this,fs,r),T(this,ps,n),T(this,yc,s),T(this,wc,a),T(this,Rl,o),T(this,Ef,l??0),T(this,ti,t),L(this,rn,Kw).call(this)}get thickness(){return u(this,Rl)}setLastElement(t){return u(this,ti).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return u(this,ti).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:r}of u(this,ti)){if(t.push(`M${qe.svgRound(r[4])} ${qe.svgRound(r[5])}`),r.length===6){t.push("Z");continue}if(r.length===12&&isNaN(r[6])){t.push(`L${qe.svgRound(r[10])} ${qe.svgRound(r[11])}`);continue}for(let n=6,s=r.length;n<s;n+=6){const[a,o,l,c,h,d]=r.subarray(n,n+6).map(qe.svgRound);t.push(`C${a} ${o} ${l} ${c} ${h} ${d}`)}}return t.join("")}serialize([t,r,n,s],a){const o=[],l=[],[c,h,d,p]=L(this,rn,Zw).call(this);let g,y,b,w,v,A,E,_,C;switch(u(this,wc)){case 0:C=qe._rescale,g=t,y=r+s,b=n,w=-s,v=t+c*n,A=r+(1-h-p)*s,E=t+(c+d)*n,_=r+(1-h)*s;break;case 90:C=qe._rescaleAndSwap,g=t,y=r,b=n,w=s,v=t+h*n,A=r+c*s,E=t+(h+p)*n,_=r+(c+d)*s;break;case 180:C=qe._rescale,g=t+n,y=r,b=-n,w=s,v=t+(1-c-d)*n,A=r+h*s,E=t+(1-c)*n,_=r+(h+p)*s;break;case 270:C=qe._rescaleAndSwap,g=t+n,y=r+s,b=-n,w=-s,v=t+(1-h-p)*n,A=r+(1-c-d)*s,E=t+(1-h)*n,_=r+(1-c)*s;break}for(const{line:I,points:k}of u(this,ti))o.push(C(I,g,y,b,w,a?new Array(I.length):null)),l.push(C(k,g,y,b,w,a?new Array(k.length):null));return{lines:o,points:l,rect:[v,A,E,_]}}static deserialize(t,r,n,s,a,{paths:{lines:o,points:l},rotation:c,thickness:h}){const d=[];let p,g,y,b,w;switch(c){case 0:w=qe._rescale,p=-t/n,g=r/s+1,y=1/n,b=-1/s;break;case 90:w=qe._rescaleAndSwap,p=-r/s,g=-t/n,y=1/s,b=1/n;break;case 180:w=qe._rescale,p=t/n+1,g=-r/s,y=-1/n,b=1/s;break;case 270:w=qe._rescaleAndSwap,p=r/s+1,g=t/n+1,y=-1/s,b=-1/n;break}if(!o){o=[];for(const A of l){const E=A.length;if(E===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,A[0],A[1]]));continue}if(E===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,A[0],A[1],NaN,NaN,NaN,NaN,A[2],A[3]]));continue}const _=new Float32Array(3*(E-2));o.push(_);let[C,I,k,D]=A.subarray(0,4);_.set([NaN,NaN,NaN,NaN,C,I],0);for(let R=4;R<E;R+=2){const z=A[R],G=A[R+1];_.set(qe.createBezierPoints(C,I,k,D,z,G),(R-2)*3),[C,I,k,D]=[k,D,z,G]}}}for(let A=0,E=o.length;A<E;A++)d.push({line:w(o[A].map(_=>_??NaN),p,g,y,b),points:w(l[A].map(_=>_??NaN),p,g,y,b)});const v=new this.prototype.constructor;return v.build(d,n,s,1,c,h,a),v}get box(){return u(this,An)}updateProperty(t,r){return t==="stroke-width"?L(this,rn,Qw).call(this,r):null}updateParentDimensions([t,r],n){const[s,a]=L(this,rn,Ds).call(this);T(this,fs,t),T(this,ps,r),T(this,yc,n);const[o,l]=L(this,rn,Ds).call(this),c=o-s,h=l-a,d=u(this,An);return d[0]-=c,d[1]-=h,d[2]+=2*c,d[3]+=2*h,d}updateRotation(t){return T(this,Af,t),{path:{transform:this.rotationTransform}}}get viewBox(){return u(this,An).map(qe.svgRound).join(" ")}get defaultProperties(){const[t,r]=u(this,An);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`}}}get rotationTransform(){const[,,t,r]=u(this,An);let n=0,s=0,a=0,o=0,l=0,c=0;switch(u(this,Af)){case 90:s=r/t,a=-t/r,l=t;break;case 180:n=-1,o=-1,l=t,c=r;break;case 270:s=-r/t,a=t/r,c=r;break;default:return""}return`matrix(${n} ${s} ${a} ${o} ${qe.svgRound(l)} ${qe.svgRound(c)})`}getPathResizingSVGProperties([t,r,n,s]){const[a,o]=L(this,rn,Ds).call(this),[l,c,h,d]=u(this,An);if(Math.abs(h-a)<=qe.PRECISION||Math.abs(d-o)<=qe.PRECISION){const w=t+n/2-(l+h/2),v=r+s/2-(c+d/2);return{path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:`${this.rotationTransform} translate(${w} ${v})`}}}const p=(n-2*a)/(h-2*a),g=(s-2*o)/(d-2*o),y=h/n,b=d/s;return{path:{"transform-origin":`${qe.svgRound(l)} ${qe.svgRound(c)}`,transform:`${this.rotationTransform} scale(${y} ${b}) translate(${qe.svgRound(a)} ${qe.svgRound(o)}) scale(${p} ${g}) translate(${qe.svgRound(-a)} ${qe.svgRound(-o)})`}}}getPathResizedSVGProperties([t,r,n,s]){const[a,o]=L(this,rn,Ds).call(this),l=u(this,An),[c,h,d,p]=l;if(l[0]=t,l[1]=r,l[2]=n,l[3]=s,Math.abs(d-a)<=qe.PRECISION||Math.abs(p-o)<=qe.PRECISION){const v=t+n/2-(c+d/2),A=r+s/2-(h+p/2);for(const{line:E,points:_}of u(this,ti))qe._translate(E,v,A,E),qe._translate(_,v,A,_);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const g=(n-2*a)/(d-2*a),y=(s-2*o)/(p-2*o),b=-g*(c+a)+t+a,w=-y*(h+o)+r+o;if(g!==1||y!==1||b!==0||w!==0)for(const{line:v,points:A}of u(this,ti))qe._rescale(v,b,w,g,y,v),qe._rescale(A,b,w,g,y,A);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,r],n){const[s,a]=n,o=u(this,An),l=t-o[0],c=r-o[1];if(u(this,fs)===s&&u(this,ps)===a)for(const{line:h,points:d}of u(this,ti))qe._translate(h,l,c,h),qe._translate(d,l,c,d);else{const h=u(this,fs)/s,d=u(this,ps)/a;T(this,fs,s),T(this,ps,a);for(const{line:p,points:g}of u(this,ti))qe._rescale(p,l,c,h,d,p),qe._rescale(g,l,c,h,d,g);o[2]*=h,o[3]*=d}return o[0]=t,o[1]=r,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`}}}get defaultSVGProperties(){const t=u(this,An);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${qe.svgRound(t[0])} ${qe.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}An=new WeakMap,Af=new WeakMap,Ef=new WeakMap,ti=new WeakMap,fs=new WeakMap,ps=new WeakMap,yc=new WeakMap,wc=new WeakMap,Rl=new WeakMap,rn=new WeakSet,Ds=function(t=u(this,Rl)){const r=u(this,Ef)+t/2*u(this,yc);return u(this,wc)%180===0?[r/u(this,fs),r/u(this,ps)]:[r/u(this,ps),r/u(this,fs)]},Zw=function(){const[t,r,n,s]=u(this,An),[a,o]=L(this,rn,Ds).call(this,0);return[t+a,r+o,n-2*a,s-2*o]},Kw=function(){const t=T(this,An,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:s}of u(this,ti)){if(s.length<=12){for(let l=4,c=s.length;l<c;l+=6)Qe.pointBoundingBox(s[l],s[l+1],t);continue}let a=s[4],o=s[5];for(let l=6,c=s.length;l<c;l+=6){const[h,d,p,g,y,b]=s.subarray(l,l+6);Qe.bezierBoundingBox(a,o,h,d,p,g,y,b,t),a=y,o=b}}const[r,n]=L(this,rn,Ds).call(this);t[0]=dn(t[0]-r,0,1),t[1]=dn(t[1]-n,0,1),t[2]=dn(t[2]+r,0,1),t[3]=dn(t[3]+n,0,1),t[2]-=t[0],t[3]-=t[1]},Qw=function(t){const[r,n]=L(this,rn,Ds).call(this);T(this,Rl,t);const[s,a]=L(this,rn,Ds).call(this),[o,l]=[s-r,a-n],c=u(this,An);return c[0]-=o,c[1]-=l,c[2]+=2*o,c[3]+=2*l,c};class Rg extends Xw{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:tr._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??(t=this["stroke-width"]),t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new Rg(this._viewParameters);return e.updateAll(this),e}}var Ag,Jw;const gu=class gu extends Qp{constructor(t){super({...t,name:"inkEditor"});N(this,Ag);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,r){tr.initialize(t,r),this._defaultDrawingOptions=new Rg(r.viewParameters)}static getDefaultDrawingOptions(t){const r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!0}static get typesMap(){return Ct(this,"typesMap",new Map([[kt.INK_THICKNESS,"stroke-width"],[kt.INK_COLOR,"stroke"],[kt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,r,n,s,a){return new rS(t,r,n,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,r,n,s,a,o){return Rf.deserialize(t,r,n,s,a,o)}static async deserialize(t,r,n){let s=null;if(t instanceof Hb){const{data:{inkLists:o,rect:l,rotation:c,id:h,color:d,opacity:p,borderStyle:{rawWidth:g},popupRef:y},parent:{page:{pageNumber:b}}}=t;s=t={annotationType:ot.INK,color:Array.from(d),thickness:g,opacity:p,paths:{points:o},boxes:null,pageIndex:b-1,rect:l.slice(0),rotation:c,annotationElementId:h,id:h,deleted:!1,popupRef:y}}const a=await super.deserialize(t,r,n);return a._initialData=s,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:r,parent:n}=this;r.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(t,r.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:r,opacity:n}){this._drawingOptions=gu.getDefaultDrawingOptions({stroke:Qe.makeHexColor(...t),"stroke-width":r,"stroke-opacity":n})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:r,points:n,rect:s}=this.serializeDraw(t),{_drawingOptions:{stroke:a,"stroke-opacity":o,"stroke-width":l}}=this,c={annotationType:ot.INK,color:tr._colorManager.convert(a),opacity:o,thickness:l,paths:{lines:r,points:n},pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?(c.isCopy=!0,c):this.annotationElementId&&!L(this,Ag,Jw).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(t){const{points:r,rect:n}=this.serializeDraw(!1);return t.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:r}),null}};Ag=new WeakSet,Jw=function(t){const{color:r,thickness:n,opacity:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||t.color.some((o,l)=>o!==r[l])||t.thickness!==n||t.opacity!==s||t.pageIndex!==a},Ie(gu,"_type","ink"),Ie(gu,"_editorType",ot.INK),Ie(gu,"_defaultDrawingOptions",null);let nb=gu;class ib extends Rf{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const ap=8,Jc=3;var Il,zt,sb,Hi,ex,tx,ab,Bp,rx,nx,ix,ob,lb,sx;class ys{static extractContoursFromText(e,{fontFamily:t,fontStyle:r,fontWeight:n},s,a,o,l){let c=new OffscreenCanvas(1,1),h=c.getContext("2d",{alpha:!1});const d=200,p=h.font=`${r} ${n} ${d}px ${t}`,{actualBoundingBoxLeft:g,actualBoundingBoxRight:y,actualBoundingBoxAscent:b,actualBoundingBoxDescent:w,fontBoundingBoxAscent:v,fontBoundingBoxDescent:A,width:E}=h.measureText(e),_=1.5,C=Math.ceil(Math.max(Math.abs(g)+Math.abs(y)||0,E)*_),I=Math.ceil(Math.max(Math.abs(b)+Math.abs(w)||d,Math.abs(v)+Math.abs(A)||d)*_);c=new OffscreenCanvas(C,I),h=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=p,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,C,I),h.fillStyle="black",h.fillText(e,C*(_-1)/2,I*(3-_)/2);const k=L(this,zt,ob).call(this,h.getImageData(0,0,C,I).data),D=L(this,zt,ix).call(this,k),R=L(this,zt,lb).call(this,D),z=L(this,zt,ab).call(this,k,C,I,R);return this.processDrawnLines({lines:{curves:z,width:C,height:I},pageWidth:s,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(e,t,r,n,s){const[a,o,l]=L(this,zt,sx).call(this,e),[c,h]=L(this,zt,nx).call(this,a,o,l,Math.hypot(o,l)*u(this,Il).sigmaSFactor,u(this,Il).sigmaR,u(this,Il).kernelSize),d=L(this,zt,lb).call(this,h),p=L(this,zt,ab).call(this,c,o,l,d);return this.processDrawnLines({lines:{curves:p,width:o,height:l},pageWidth:t,pageHeight:r,rotation:n,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:r,rotation:n,innerMargin:s,mustSmooth:a,areContours:o}){n%180!==0&&([t,r]=[r,t]);const{curves:l,width:c,height:h}=e,d=e.thickness??0,p=[],g=Math.min(t/c,r/h),y=g/t,b=g/r,w=[];for(const{points:A}of l){const E=a?L(this,zt,rx).call(this,A):A;if(!E)continue;w.push(E);const _=E.length,C=new Float32Array(_),I=new Float32Array(3*(_===2?2:_-2));if(p.push({line:I,points:C}),_===2){C[0]=E[0]*y,C[1]=E[1]*b,I.set([NaN,NaN,NaN,NaN,C[0],C[1]],0);continue}let[k,D,R,z]=E;k*=y,D*=b,R*=y,z*=b,C.set([k,D,R,z],0),I.set([NaN,NaN,NaN,NaN,k,D],0);for(let G=4;G<_;G+=2){const O=C[G]=E[G]*y,X=C[G+1]=E[G+1]*b;I.set(qe.createBezierPoints(k,D,R,z,O,X),(G-2)*3),[k,D,R,z]=[R,z,O,X]}}if(p.length===0)return null;const v=o?new ib:new Rf;return v.build(p,t,r,1,n,o?0:d,s),{outline:v,newCurves:w,areContours:o,thickness:d,width:c,height:h}}static async compressSignature({outlines:e,areContours:t,thickness:r,width:n,height:s}){let a=1/0,o=-1/0,l=0;for(const E of e){l+=E.length;for(let _=2,C=E.length;_<C;_++){const I=E[_]-E[_-2];a=Math.min(a,I),o=Math.max(o,I)}}let c;a>=-128&&o<=127?c=Int8Array:a>=-32768&&o<=32767?c=Int16Array:c=Int32Array;const h=e.length,d=ap+Jc*h,p=new Uint32Array(d);let g=0;p[g++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*h)*c.BYTES_PER_ELEMENT,p[g++]=0,p[g++]=n,p[g++]=s,p[g++]=t?0:1,p[g++]=Math.max(0,Math.floor(r??0)),p[g++]=h,p[g++]=c.BYTES_PER_ELEMENT;for(const E of e)p[g++]=E.length-2,p[g++]=E[0],p[g++]=E[1];const y=new CompressionStream("deflate-raw"),b=y.writable.getWriter();await b.ready,b.write(p);const w=c.prototype.constructor;for(const E of e){const _=new w(E.length-2);for(let C=2,I=E.length;C<I;C++)_[C-2]=E[C]-E[C-2];b.write(_)}b.close();const v=await new Response(y.readable).arrayBuffer(),A=new Uint8Array(v);return n1(A)}static async decompressSignature(e){try{const t=I_(e),{readable:r,writable:n}=new DecompressionStream("deflate-raw"),s=n.getWriter();await s.ready,s.write(t).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let a=null,o=0;for await(const E of r)a||(a=new Uint8Array(new Uint32Array(E.buffer,0,4)[0])),a.set(E,o),o+=E.length;const l=new Uint32Array(a.buffer,0,a.length>>2),c=l[1];if(c!==0)throw new Error(`Invalid version: ${c}`);const h=l[2],d=l[3],p=l[4]===0,g=l[5],y=l[6],b=l[7],w=[],v=(ap+Jc*y)*Uint32Array.BYTES_PER_ELEMENT;let A;switch(b){case Int8Array.BYTES_PER_ELEMENT:A=new Int8Array(a.buffer,v);break;case Int16Array.BYTES_PER_ELEMENT:A=new Int16Array(a.buffer,v);break;case Int32Array.BYTES_PER_ELEMENT:A=new Int32Array(a.buffer,v);break}o=0;for(let E=0;E<y;E++){const _=l[Jc*E+ap],C=new Float32Array(_+2);w.push(C);for(let I=0;I<Jc-1;I++)C[I]=l[Jc*E+ap+I+1];for(let I=0;I<_;I++)C[I+2]=C[I]+A[o++]}return{areContours:p,thickness:g,outlines:w,width:h,height:d}}catch(t){return ut(`decompressSignature: ${t}`),null}}}Il=new WeakMap,zt=new WeakSet,sb=function(e,t,r,n){return r-=e,n-=t,r===0?n>0?0:4:r===1?n+6:2-n},Hi=new WeakMap,ex=function(e,t,r,n,s,a,o){const l=L(this,zt,sb).call(this,r,n,s,a);for(let c=0;c<8;c++){const h=(-c+l-o+16)%8,d=u(this,Hi)[2*h],p=u(this,Hi)[2*h+1];if(e[(r+d)*t+(n+p)]!==0)return h}return-1},tx=function(e,t,r,n,s,a,o){const l=L(this,zt,sb).call(this,r,n,s,a);for(let c=0;c<8;c++){const h=(c+l+o+16)%8,d=u(this,Hi)[2*h],p=u(this,Hi)[2*h+1];if(e[(r+d)*t+(n+p)]!==0)return h}return-1},ab=function(e,t,r,n){const s=e.length,a=new Int32Array(s);for(let h=0;h<s;h++)a[h]=e[h]<=n?1:0;for(let h=1;h<r-1;h++)a[h*t]=a[h*t+t-1]=0;for(let h=0;h<t;h++)a[h]=a[t*r-1-h]=0;let o=1,l;const c=[];for(let h=1;h<r-1;h++){l=1;for(let d=1;d<t-1;d++){const p=h*t+d,g=a[p];if(g===0)continue;let y=h,b=d;if(g===1&&a[p-1]===0)o+=1,b-=1;else if(g>=1&&a[p+1]===0)o+=1,b+=1,g>1&&(l=g);else{g!==1&&(l=Math.abs(g));continue}const w=[d,h],v=b===d+1,A={isHole:v,points:w,id:o,parent:0};c.push(A);let E;for(const G of c)if(G.id===l){E=G;break}E?E.isHole?A.parent=v?E.parent:l:A.parent=v?l:E.parent:A.parent=v?l:0;const _=L(this,zt,ex).call(this,a,t,h,d,y,b,0);if(_===-1){a[p]=-o,a[p]!==1&&(l=Math.abs(a[p]));continue}let C=u(this,Hi)[2*_],I=u(this,Hi)[2*_+1];const k=h+C,D=d+I;y=k,b=D;let R=h,z=d;for(;;){const G=L(this,zt,tx).call(this,a,t,R,z,y,b,1);C=u(this,Hi)[2*G],I=u(this,Hi)[2*G+1];const O=R+C,X=z+I;w.push(X,O);const S=R*t+z;if(a[S+1]===0?a[S]=-o:a[S]===1&&(a[S]=o),O===h&&X===d&&R===k&&z===D){a[p]!==1&&(l=Math.abs(a[p]));break}else y=R,b=z,R=O,z=X}}}return c},Bp=function(e,t,r,n){if(r-t<=4){for(let k=t;k<r-2;k+=2)n.push(e[k],e[k+1]);return}const s=e[t],a=e[t+1],o=e[r-4]-s,l=e[r-3]-a,c=Math.hypot(o,l),h=o/c,d=l/c,p=h*a-d*s,g=l/o,y=1/c,b=Math.atan(g),w=Math.cos(b),v=Math.sin(b),A=y*(Math.abs(w)+Math.abs(v)),E=y*(1-A+A**2),_=Math.max(Math.atan(Math.abs(v+w)*E),Math.atan(Math.abs(v-w)*E));let C=0,I=t;for(let k=t+2;k<r-2;k+=2){const D=Math.abs(p-h*e[k+1]+d*e[k]);D>C&&(I=k,C=D)}C>(c*_)**2?(L(this,zt,Bp).call(this,e,t,I+2,n),L(this,zt,Bp).call(this,e,I,r,n)):n.push(s,a)},rx=function(e){const t=[],r=e.length;return L(this,zt,Bp).call(this,e,0,r,t),t.push(e[r-2],e[r-1]),t.length<=4?null:t},nx=function(e,t,r,n,s,a){const o=new Float32Array(a**2),l=-2*n**2,c=a>>1;for(let b=0;b<a;b++){const w=(b-c)**2;for(let v=0;v<a;v++)o[b*a+v]=Math.exp((w+(v-c)**2)/l)}const h=new Float32Array(256),d=-2*s**2;for(let b=0;b<256;b++)h[b]=Math.exp(b**2/d);const p=e.length,g=new Uint8Array(p),y=new Uint32Array(256);for(let b=0;b<r;b++)for(let w=0;w<t;w++){const v=b*t+w,A=e[v];let E=0,_=0;for(let I=0;I<a;I++){const k=b+I-c;if(!(k<0||k>=r))for(let D=0;D<a;D++){const R=w+D-c;if(R<0||R>=t)continue;const z=e[k*t+R],G=o[I*a+D]*h[Math.abs(z-A)];E+=z*G,_+=G}}const C=g[v]=Math.round(E/_);y[C]++}return[g,y]},ix=function(e){const t=new Uint32Array(256);for(const r of e)t[r]++;return t},ob=function(e){const t=e.length,r=new Uint8ClampedArray(t>>2);let n=-1/0,s=1/0;for(let o=0,l=r.length;o<l;o++){if(e[(o<<2)+3]===0){n=r[o]=255;continue}const h=r[o]=e[o<<2];h>n&&(n=h),h<s&&(s=h)}const a=255/(n-s);for(let o=0;o<t;o++)r[o]=(r[o]-s)*a;return r},lb=function(e){let t,r=-1/0,n=-1/0;const s=e.findIndex(l=>l!==0);let a=s,o=s;for(t=s;t<256;t++){const l=e[t];l>r&&(t-a>n&&(n=t-a,o=t-1),r=l,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t},sx=function(e){const t=e,{width:r,height:n}=e,{maxDim:s}=u(this,Il);let a=r,o=n;if(r>s||n>s){let p=r,g=n,y=Math.log2(Math.max(r,n)/s);const b=Math.floor(y);y=y===b?b-1:b;for(let v=0;v<y;v++){a=Math.ceil(p/2),o=Math.ceil(g/2);const A=new OffscreenCanvas(a,o);A.getContext("2d").drawImage(e,0,0,p,g,0,0,a,o),p=a,g=o,e!==t&&e.close(),e=A.transferToImageBitmap()}const w=Math.min(s/a,s/o);a=Math.round(a*w),o=Math.round(o*w)}const c=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});c.filter="grayscale(1)",c.drawImage(e,0,0,e.width,e.height,0,0,a,o);const h=c.getImageData(0,0,a,o).data;return[L(this,zt,ob).call(this,h),a,o]},N(ys,zt),N(ys,Il,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),N(ys,Hi,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Vb extends Xw{constructor(){super(),super.updateProperties({fill:tr._defaultLineColor,"stroke-width":0})}clone(){const e=new Vb;return e.updateAll(this),e}}class Gb extends Rg{constructor(e){super(e),super.updateProperties({stroke:tr._defaultLineColor,"stroke-width":1})}clone(){const e=new Gb(this._viewParameters);return e.updateAll(this),e}}var Za,gs,Ka,Nl;const $n=class $n extends Qp{constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"});N(this,Za,!1);N(this,gs,null);N(this,Ka,null);N(this,Nl,null);this._willKeepAspectRatio=!0,T(this,Ka,t.signatureData||null),T(this,gs,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,r){tr.initialize(t,r),this._defaultDrawingOptions=new Vb,this._defaultDrawnSignatureOptions=new Gb(r.viewParameters)}static getDefaultDrawingOptions(t){const r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!1}static get typesMap(){return Ct(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!u(this,gs)}}static computeTelemetryFinalData(t){const r=t.get("hasDescription");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,r;const{_isCopy:n}=this;if(n&&(this._isCopy=!1,t=this.x,r=this.y),super.render(),this._drawId===null)if(u(this,Ka)){const{lines:s,mustSmooth:a,areContours:o,description:l,uuid:c,heightInPage:h}=u(this,Ka),{rawDims:{pageWidth:d,pageHeight:p},rotation:g}=this.parent.viewport,y=ys.processDrawnLines({lines:s,pageWidth:d,pageHeight:p,rotation:g,innerMargin:$n._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(y,h,l,c)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);return n&&(this._isCopy=!0,this._moveAfterPaste(t,r)),this.div}setUuid(t){T(this,Nl,t),this.addEditToolbar()}getUuid(){return u(this,Nl)}get description(){return u(this,gs)}set description(t){T(this,gs,t),super.addEditToolbar().then(r=>{r==null||r.updateEditSignatureButton(t)})}getSignaturePreview(){const{newCurves:t,areContours:r,thickness:n,width:s,height:a}=u(this,Ka),o=Math.max(s,a),l=ys.processDrawnLines({lines:{curves:t.map(c=>({points:c})),thickness:n,width:s,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:r});return{areContours:r,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,r,n,s){const{x:a,y:o}=this,{outline:l}=T(this,Ka,t);T(this,Za,l instanceof ib),this.description=n,this.div.setAttribute("data-l10n-args",JSON.stringify({description:n}));let c;u(this,Za)?c=$n.getDefaultDrawingOptions():(c=$n._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:c});const[h,d]=this.parentDimensions,[,p]=this.pageDimensions;let g=r/p;g=g>=1?.5:g,this.width*=g/this.height,this.width>=1&&(g*=.9/this.width,this.width=.9),this.height=g,this.setDims(h*this.width,d*this.height),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:r,pageHeight:n},rotation:s}=this.parent.viewport;return ys.process(t,r,n,s,$n._INNER_MARGIN)}getFromText(t,r){const{rawDims:{pageWidth:n,pageHeight:s},rotation:a}=this.parent.viewport;return ys.extractContoursFromText(t,r,n,s,a,$n._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:r,pageHeight:n},rotation:s}=this.parent.viewport;return ys.processDrawnLines({lines:t,pageWidth:r,pageHeight:n,rotation:s,innerMargin:$n._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:r}){t?this._drawingOptions=$n.getDefaultDrawingOptions():(this._drawingOptions=$n._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":r}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:r,points:n,rect:s}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":a}}=this,o={annotationType:ot.SIGNATURE,isSignature:!0,areContours:u(this,Za),color:[0,0,0],thickness:u(this,Za)?0:a,pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?(o.paths={lines:r,points:n},o.uuid=u(this,Nl),o.isCopy=!0):o.lines=r,u(this,gs)&&(o.accessibilityData={type:"Figure",alt:u(this,gs)}),o}static deserializeDraw(t,r,n,s,a,o){return o.areContours?ib.deserialize(t,r,n,s,a,o):Rf.deserialize(t,r,n,s,a,o)}static async deserialize(t,r,n){var a;const s=await super.deserialize(t,r,n);return T(s,Za,t.areContours),T(s,gs,((a=t.accessibilityData)==null?void 0:a.alt)||""),T(s,Nl,t.uuid),s}};Za=new WeakMap,gs=new WeakMap,Ka=new WeakMap,Nl=new WeakMap,Ie($n,"_type","signature"),Ie($n,"_editorType",ot.SIGNATURE),Ie($n,"_defaultDrawingOptions",null);let ub=$n;var lr,Vr,Qa,na,Ja,xc,ia,Ml,ms,ri,Ac,Ot,Eh,_h,zp,jp,Up,hb,Hp,ax;class cb extends tr{constructor(t){super({...t,name:"stampEditor"});N(this,Ot);N(this,lr,null);N(this,Vr,null);N(this,Qa,null);N(this,na,null);N(this,Ja,null);N(this,xc,"");N(this,ia,null);N(this,Ml,!1);N(this,ms,null);N(this,ri,!1);N(this,Ac,!1);T(this,na,t.bitmapUrl),T(this,Ja,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,r){tr.initialize(t,r)}static isHandlingMimeForPasting(t){return Xp.includes(t)}static paste(t,r){r.pasteEditor({mode:ot.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const r=t.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}async mlGuessAltText(t=null,r=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:s,width:a,height:o}=t||this.copyCanvas(null,null,!0).imageData,l=await n.guess({name:"altText",request:{data:s,width:a,height:o,channels:s.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const c=l.output;return await this.setGuessedAltText(c),r&&!this.hasAltTextData()&&(this.altTextData={alt:c,decorative:!1}),c}remove(){var t;u(this,Vr)&&(T(this,lr,null),this._uiManager.imageManager.deleteId(u(this,Vr)),(t=u(this,ia))==null||t.remove(),T(this,ia,null),u(this,ms)&&(clearTimeout(u(this,ms)),T(this,ms,null))),super.remove()}rebuild(){if(!this.parent){u(this,Vr)&&L(this,Ot,zp).call(this);return}super.rebuild(),this.div!==null&&(u(this,Vr)&&u(this,ia)===null&&L(this,Ot,zp).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(u(this,Qa)||u(this,lr)||u(this,na)||u(this,Ja)||u(this,Vr)||u(this,Ml))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,r;return this._isCopy&&(t=this.x,r=this.y),super.render(),this.div.hidden=!0,this.createAltText(),u(this,Ml)||(u(this,lr)?L(this,Ot,jp).call(this):L(this,Ot,zp).call(this)),this._isCopy&&this._moveAfterPaste(t,r),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,r){const{id:n,bitmap:s}=this._uiManager.imageManager.getFromCanvas(t,r);r.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(T(this,Vr,n),s&&T(this,lr,s),T(this,Ml,!1),L(this,Ot,jp).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;u(this,ms)!==null&&clearTimeout(u(this,ms)),T(this,ms,setTimeout(()=>{T(this,ms,null),L(this,Ot,hb).call(this)},200))}copyCanvas(t,r,n=!1){var g;t||(t=224);const{width:s,height:a}=u(this,lr),o=new Wi;let l=u(this,lr),c=s,h=a,d=null;if(r){if(s>r||a>r){const D=Math.min(r/s,r/a);c=Math.floor(s*D),h=Math.floor(a*D)}d=document.createElement("canvas");const y=d.width=Math.ceil(c*o.sx),b=d.height=Math.ceil(h*o.sy);u(this,ri)||(l=L(this,Ot,Up).call(this,y,b));const w=d.getContext("2d");w.filter=this._uiManager.hcmFilter;let v="white",A="#cfcfd8";this._uiManager.hcmFilter!=="none"?A="black":(g=window.matchMedia)!=null&&g.call(window,"(prefers-color-scheme: dark)").matches&&(v="#8f8f9d",A="#42414d");const E=15,_=E*o.sx,C=E*o.sy,I=new OffscreenCanvas(_*2,C*2),k=I.getContext("2d");k.fillStyle=v,k.fillRect(0,0,_*2,C*2),k.fillStyle=A,k.fillRect(0,0,_,C),k.fillRect(_,C,_,C),w.fillStyle=w.createPattern(I,"repeat"),w.fillRect(0,0,y,b),w.drawImage(l,0,0,l.width,l.height,0,0,y,b)}let p=null;if(n){let y,b;if(o.symmetric&&l.width<t&&l.height<t)y=l.width,b=l.height;else if(l=u(this,lr),s>t||a>t){const A=Math.min(t/s,t/a);y=Math.floor(s*A),b=Math.floor(a*A),u(this,ri)||(l=L(this,Ot,Up).call(this,y,b))}const v=new OffscreenCanvas(y,b).getContext("2d",{willReadFrequently:!0});v.drawImage(l,0,0,l.width,l.height,0,0,y,b),p={width:y,height:b,data:v.getImageData(0,0,y,b).data}}return{canvas:d,width:c,height:h,imageData:p}}static async deserialize(t,r,n){var w;let s=null,a=!1;if(t instanceof xw){const{data:{rect:v,rotation:A,id:E,structParent:_,popupRef:C},container:I,parent:{page:{pageNumber:k}},canvas:D}=t;let R,z;D?(delete t.canvas,{id:R,bitmap:z}=n.imageManager.getFromCanvas(I.id,D),D.remove()):(a=!0,t._hasNoCanvas=!0);const G=((w=await r._structTree.getAriaAttributes(`${Nb}${E}`))==null?void 0:w.get("aria-label"))||"";s=t={annotationType:ot.STAMP,bitmapId:R,bitmap:z,pageIndex:k-1,rect:v.slice(0),rotation:A,annotationElementId:E,id:E,deleted:!1,accessibilityData:{decorative:!1,altText:G},isSvg:!1,structParent:_,popupRef:C}}const o=await super.deserialize(t,r,n),{rect:l,bitmap:c,bitmapUrl:h,bitmapId:d,isSvg:p,accessibilityData:g}=t;a?(n.addMissingCanvas(t.id,o),T(o,Ml,!0)):d&&n.imageManager.isValidId(d)?(T(o,Vr,d),c&&T(o,lr,c)):T(o,na,h),T(o,ri,p);const[y,b]=o.pageDimensions;return o.width=(l[2]-l[0])/y,o.height=(l[3]-l[1])/b,g&&(o.altTextData=g),o._initialData=s,T(o,Ac,!!s),o}serialize(t=!1,r=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n={annotationType:ot.STAMP,bitmapId:u(this,Vr),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:u(this,ri),structTreeParentId:this._structTreeParentId};if(t)return n.bitmapUrl=L(this,Ot,Hp).call(this,!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;const{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=L(this,Ot,ax).call(this,n);if(l.isSame)return null;l.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1}if(n.id=this.annotationElementId,r===null)return n;r.stamps||(r.stamps=new Map);const o=u(this,ri)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!r.stamps.has(u(this,Vr)))r.stamps.set(u(this,Vr),{area:o,serialized:n}),n.bitmap=L(this,Ot,Hp).call(this,!1);else if(u(this,ri)){const l=r.stamps.get(u(this,Vr));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=L(this,Ot,Hp).call(this,!1))}return n}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}}lr=new WeakMap,Vr=new WeakMap,Qa=new WeakMap,na=new WeakMap,Ja=new WeakMap,xc=new WeakMap,ia=new WeakMap,Ml=new WeakMap,ms=new WeakMap,ri=new WeakMap,Ac=new WeakMap,Ot=new WeakSet,Eh=function(t,r=!1){if(!t){this.remove();return}T(this,lr,t.bitmap),r||(T(this,Vr,t.id),T(this,ri,t.isSvg)),t.file&&T(this,xc,t.file.name),L(this,Ot,jp).call(this)},_h=function(){if(T(this,Qa,null),this._uiManager.enableWaiting(!1),!!u(this,ia)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&u(this,lr)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&u(this,lr)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},zp=function(){if(u(this,Vr)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(u(this,Vr)).then(n=>L(this,Ot,Eh).call(this,n,!0)).finally(()=>L(this,Ot,_h).call(this));return}if(u(this,na)){const n=u(this,na);T(this,na,null),this._uiManager.enableWaiting(!0),T(this,Qa,this._uiManager.imageManager.getFromUrl(n).then(s=>L(this,Ot,Eh).call(this,s)).finally(()=>L(this,Ot,_h).call(this)));return}if(u(this,Ja)){const n=u(this,Ja);T(this,Ja,null),this._uiManager.enableWaiting(!0),T(this,Qa,this._uiManager.imageManager.getFromFile(n).then(s=>L(this,Ot,Eh).call(this,s)).finally(()=>L(this,Ot,_h).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=Xp.join(",");const r=this._uiManager._signal;T(this,Qa,new Promise(n=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const s=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),L(this,Ot,Eh).call(this,s)}n()},{signal:r}),t.addEventListener("cancel",()=>{this.remove(),n()},{signal:r})}).finally(()=>L(this,Ot,_h).call(this))),t.click()},jp=function(){var d;const{div:t}=this;let{width:r,height:n}=u(this,lr);const[s,a]=this.pageDimensions,o=.75;if(this.width)r=this.width*s,n=this.height*a;else if(r>o*s||n>o*a){const p=Math.min(o*s/r,o*a/n);r*=p,n*=p}const[l,c]=this.parentDimensions;this.setDims(r*l/s,n*c/a),this._uiManager.enableWaiting(!1);const h=T(this,ia,document.createElement("canvas"));h.setAttribute("role","img"),this.addContainer(h),this.width=r/s,this.height=n/a,(d=this._initialOptions)!=null&&d.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),L(this,Ot,hb).call(this),u(this,Ac)||(this.parent.addUndoableEditor(this),T(this,Ac,!0)),this._reportTelemetry({action:"inserted_image"}),u(this,xc)&&this.div.setAttribute("aria-description",u(this,xc)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},Up=function(t,r){const{width:n,height:s}=u(this,lr);let a=n,o=s,l=u(this,lr);for(;a>2*t||o>2*r;){const c=a,h=o;a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*r&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const d=new OffscreenCanvas(a,o);d.getContext("2d").drawImage(l,0,0,c,h,0,0,a,o),l=d.transferToImageBitmap()}return l},hb=function(){const[t,r]=this.parentDimensions,{width:n,height:s}=this,a=new Wi,o=Math.ceil(n*t*a.sx),l=Math.ceil(s*r*a.sy),c=u(this,ia);if(!c||c.width===o&&c.height===l)return;c.width=o,c.height=l;const h=u(this,ri)?u(this,lr):L(this,Ot,Up).call(this,o,l),d=c.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(h,0,0,h.width,h.height,0,0,o,l)},Hp=function(t){if(t){if(u(this,ri)){const s=this._uiManager.imageManager.getSvgUrl(u(this,Vr));if(s)return s}const r=document.createElement("canvas");return{width:r.width,height:r.height}=u(this,lr),r.getContext("2d").drawImage(u(this,lr),0,0),r.toDataURL()}if(u(this,ri)){const[r,n]=this.pageDimensions,s=Math.round(this.width*r*da.PDF_TO_CSS_UNITS),a=Math.round(this.height*n*da.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(s,a);return o.getContext("2d").drawImage(u(this,lr),0,0,u(this,lr).width,u(this,lr).height,0,0,s,a),o.transferToImageBitmap()}return structuredClone(u(this,lr))},ax=function(t){var o;const{pageIndex:r,accessibilityData:{altText:n}}=this._initialData,s=t.pageIndex===r,a=(((o=t.accessibilityData)==null?void 0:o.alt)||"")===n;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}},Ie(cb,"_type","stamp"),Ie(cb,"_editorType",ot.STAMP);var Ll,Ec,bs,eo,sa,ni,to,_c,Ol,$i,aa,Gr,oa,ro,Cc,Ze,no,ur,ox,Ji,db,fb,$p;const Ii=class Ii{constructor({uiManager:e,pageIndex:t,div:r,structTreeLayer:n,accessibilityManager:s,annotationLayer:a,drawLayer:o,textLayer:l,viewport:c,l10n:h}){N(this,ur);N(this,Ll);N(this,Ec,!1);N(this,bs,null);N(this,eo,null);N(this,sa,null);N(this,ni,new Map);N(this,to,!1);N(this,_c,!1);N(this,Ol,!1);N(this,$i,null);N(this,aa,null);N(this,Gr,null);N(this,oa,null);N(this,ro,null);N(this,Cc,-1);N(this,Ze);const d=[...u(Ii,no).values()];if(!Ii._initialized){Ii._initialized=!0;for(const p of d)p.initialize(h,e)}e.registerEditorTypes(d),T(this,Ze,e),this.pageIndex=t,this.div=r,T(this,Ll,s),T(this,bs,a),this.viewport=c,T(this,Gr,l),this.drawLayer=o,this._structTree=n,u(this,Ze).addLayer(this)}get isEmpty(){return u(this,ni).size===0}get isInvisible(){return this.isEmpty&&u(this,Ze).getMode()===ot.NONE}updateToolbar(e){u(this,Ze).updateToolbar(e)}updateMode(e=u(this,Ze).getMode()){switch(L(this,ur,$p).call(this),e){case ot.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case ot.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case ot.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const r of u(Ii,no).values())t.toggle(`${r._type}Editing`,e===r._editorType);this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=u(this,Gr))==null?void 0:t.div)}setEditingState(e){u(this,Ze).setEditingState(e)}addCommands(e){u(this,Ze).addCommands(e)}cleanUndoStack(e){u(this,Ze).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=u(this,bs))==null||t.div.classList.toggle("disabled",!e)}async enable(){var r;T(this,Ol,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),(r=u(this,ro))==null||r.abort(),T(this,ro,null);const e=new Set;for(const n of u(this,ni).values())n.enableEditing(),n.show(!0),n.annotationElementId&&(u(this,Ze).removeChangedExistingAnnotation(n),e.add(n.annotationElementId));if(!u(this,bs)){T(this,Ol,!1);return}const t=u(this,bs).getEditableAnnotations();for(const n of t){if(n.hide(),u(this,Ze).isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;const s=await this.deserialize(n);s&&(this.addOrRebuild(s),s.enableEditing())}T(this,Ol,!1)}disable(){var n;if(T(this,_c,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),u(this,Gr)&&!u(this,ro)){T(this,ro,new AbortController);const s=u(this,Ze).combinedSignal(u(this,ro));u(this,Gr).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:c,timeStamp:h}=a,d=u(this,Cc);if(h-d>500){T(this,Cc,h);return}T(this,Cc,-1);const{classList:p}=this.div;p.toggle("getElements",!0);const g=document.elementsFromPoint(l,c);if(p.toggle("getElements",!1),!this.div.contains(g[0]))return;let y;const b=new RegExp(`^${Q2}[0-9]+$`);for(const v of g)if(b.test(v.id)){y=v.id;break}if(!y)return;const w=u(this,ni).get(y);(w==null?void 0:w.annotationElementId)===null&&(a.stopPropagation(),a.preventDefault(),w.dblclick())},{signal:s,capture:!0})}const e=new Map,t=new Map;for(const s of u(this,ni).values())if(s.disableEditing(),!!s.annotationElementId){if(s.serialize()!==null){e.set(s.annotationElementId,s);continue}else t.set(s.annotationElementId,s);(n=this.getEditableAnnotation(s.annotationElementId))==null||n.show(),s.remove()}if(u(this,bs)){const s=u(this,bs).getEditableAnnotations();for(const a of s){const{id:o}=a.data;if(u(this,Ze).isDeletedAnnotationElement(o))continue;let l=t.get(o);if(l){l.resetAnnotationElement(a),l.show(!1),a.show();continue}l=e.get(o),l&&(u(this,Ze).addChangedExistingAnnotation(l),l.renderAnnotationElement(a)&&l.show(!1)),a.show()}}L(this,ur,$p).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:r}=this.div;for(const s of u(Ii,no).values())r.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),T(this,_c,!1)}getEditableAnnotation(e){var t;return((t=u(this,bs))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){u(this,Ze).getActive()!==e&&u(this,Ze).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=u(this,Gr))!=null&&e.div&&!u(this,oa)){T(this,oa,new AbortController);const t=u(this,Ze).combinedSignal(u(this,oa));u(this,Gr).div.addEventListener("pointerdown",L(this,ur,ox).bind(this),{signal:t}),u(this,Gr).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=u(this,Gr))!=null&&e.div&&u(this,oa)&&(u(this,oa).abort(),T(this,oa,null),u(this,Gr).div.classList.remove("highlighting"))}enableClick(){if(u(this,eo))return;T(this,eo,new AbortController);const e=u(this,Ze).combinedSignal(u(this,eo));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){var e;(e=u(this,eo))==null||e.abort(),T(this,eo,null)}attach(e){u(this,ni).set(e.id,e);const{annotationElementId:t}=e;t&&u(this,Ze).isDeletedAnnotationElement(t)&&u(this,Ze).removeDeletedAnnotationElement(e)}detach(e){var t;u(this,ni).delete(e.id),(t=u(this,Ll))==null||t.removePointerInTextLayer(e.contentDiv),!u(this,_c)&&e.annotationElementId&&u(this,Ze).addDeletedAnnotationElement(e)}remove(e){this.detach(e),u(this,Ze).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(u(this,Ze).addDeletedAnnotationElement(e.annotationElementId),tr.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),u(this,Ze).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!u(this,Ol)),u(this,Ze).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var r;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!u(this,sa)&&(e._focusEventsAllowed=!1,T(this,sa,setTimeout(()=>{T(this,sa,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:u(this,Ze)._signal}),t.focus())},0))),e._structTreeParentId=(r=u(this,Ll))==null?void 0:r.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),r=()=>{e.remove()};this.addCommands({cmd:t,undo:r,mustExec:!1})}getNextId(){return u(this,Ze).getId()}combinedSignal(e){return u(this,Ze).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=u(this,ur,Ji))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await u(this,Ze).updateMode(e.mode);const{offsetX:r,offsetY:n}=L(this,ur,fb).call(this),s=this.getNextId(),a=L(this,ur,db).call(this,{parent:this,id:s,x:r,y:n,uiManager:u(this,Ze),isCentered:!0,...t});a&&this.add(a)}async deserialize(e){var t;return await((t=u(Ii,no).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,u(this,Ze)))||null}createAndAddNewEditor(e,t,r={}){const n=this.getNextId(),s=L(this,ur,db).call(this,{parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:u(this,Ze),isCentered:t,...r});return s&&this.add(s),s}addNewEditor(e={}){this.createAndAddNewEditor(L(this,ur,fb).call(this),!0,e)}setSelected(e){u(this,Ze).setSelected(e)}toggleSelected(e){u(this,Ze).toggleSelected(e)}unselect(e){u(this,Ze).unselect(e)}pointerup(e){var n;const{isMac:t}=qr.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!u(this,to)||(T(this,to,!1),(n=u(this,ur,Ji))!=null&&n.isDrawer&&u(this,ur,Ji).supportMultipleDrawings))return;if(!u(this,Ec)){T(this,Ec,!0);return}const r=u(this,Ze).getMode();if(r===ot.STAMP||r===ot.SIGNATURE){u(this,Ze).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var n;if(u(this,Ze).getMode()===ot.HIGHLIGHT&&this.enableTextSelection(),u(this,to)){T(this,to,!1);return}const{isMac:t}=qr.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(T(this,to,!0),(n=u(this,ur,Ji))!=null&&n.isDrawer){this.startDrawingSession(e);return}const r=u(this,Ze).getActive();T(this,Ec,!r||r.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),u(this,$i)){u(this,ur,Ji).startDrawing(this,u(this,Ze),!1,e);return}u(this,Ze).setCurrentDrawingSession(this),T(this,$i,new AbortController);const t=u(this,Ze).combinedSignal(u(this,$i));this.div.addEventListener("blur",({relatedTarget:r})=>{r&&!this.div.contains(r)&&(T(this,aa,null),this.commitOrRemove())},{signal:t}),u(this,ur,Ji).startDrawing(this,u(this,Ze),!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&T(this,aa,t);return}u(this,aa)&&setTimeout(()=>{var t;(t=u(this,aa))==null||t.focus(),T(this,aa,null)},0)}endDrawingSession(e=!1){return u(this,$i)?(u(this,Ze).setCurrentDrawingSession(null),u(this,$i).abort(),T(this,$i,null),T(this,aa,null),u(this,ur,Ji).endDrawing(e)):null}findNewParent(e,t,r){const n=u(this,Ze).findParent(t,r);return n===null||n===this?!1:(n.changeParent(e),!0)}commitOrRemove(){return u(this,$i)?(this.endDrawingSession(),!0):!1}onScaleChanging(){u(this,$i)&&u(this,ur,Ji).onScaleChangingWhenDrawing(this)}destroy(){var e,t;this.commitOrRemove(),((e=u(this,Ze).getActive())==null?void 0:e.parent)===this&&(u(this,Ze).commitOrRemove(),u(this,Ze).setActiveEditor(null)),u(this,sa)&&(clearTimeout(u(this,sa)),T(this,sa,null));for(const r of u(this,ni).values())(t=u(this,Ll))==null||t.removePointerInTextLayer(r.contentDiv),r.setParent(null),r.isAttachedToDOM=!1,r.div.remove();this.div=null,u(this,ni).clear(),u(this,Ze).removeLayer(this)}render({viewport:e}){this.viewport=e,so(this.div,e);for(const t of u(this,Ze).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){u(this,Ze).commitOrRemove(),L(this,ur,$p).call(this);const t=this.viewport.rotation,r=e.rotation;if(this.viewport=e,so(this.div,{rotation:r}),t!==r)for(const n of u(this,ni).values())n.rotate(r)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return u(this,Ze).viewParameters.realScale}};Ll=new WeakMap,Ec=new WeakMap,bs=new WeakMap,eo=new WeakMap,sa=new WeakMap,ni=new WeakMap,to=new WeakMap,_c=new WeakMap,Ol=new WeakMap,$i=new WeakMap,aa=new WeakMap,Gr=new WeakMap,oa=new WeakMap,ro=new WeakMap,Cc=new WeakMap,Ze=new WeakMap,no=new WeakMap,ur=new WeakSet,ox=function(e){u(this,Ze).unselectAll();const{target:t}=e;if(t===u(this,Gr).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&u(this,Gr).div.contains(t)){const{isMac:r}=qr.platform;if(e.button!==0||e.ctrlKey&&r)return;u(this,Ze).showAllEditors("highlight",!0,!0),u(this,Gr).div.classList.add("free"),this.toggleDrawing(),Kp.startHighlighting(this,u(this,Ze).direction==="ltr",{target:u(this,Gr).div,x:e.x,y:e.y}),u(this,Gr).div.addEventListener("pointerup",()=>{u(this,Gr).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:u(this,Ze)._signal}),e.preventDefault()}},Ji=function(){return u(Ii,no).get(u(this,Ze).getMode())},db=function(e){const t=u(this,ur,Ji);return t?new t.prototype.constructor(e):null},fb=function(){const{x:e,y:t,width:r,height:n}=this.div.getBoundingClientRect(),s=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+r),l=Math.min(window.innerHeight,t+n),c=(s+o)/2-e,h=(a+l)/2-t,[d,p]=this.viewport.rotation%180===0?[c,h]:[h,c];return{offsetX:d,offsetY:p}},$p=function(){for(const e of u(this,ni).values())e.isEmpty()&&e.remove()},Ie(Ii,"_initialized",!1),N(Ii,no,new Map([V0,nb,cb,Kp,ub].map(e=>[e._editorType,e])));let Jp=Ii;var Vi,En,Fl,_f,Eg,lx,As,pb,ux,gb;const Rr=class Rr{constructor({pageIndex:e}){N(this,As);N(this,Vi,null);N(this,En,new Map);N(this,Fl,new Map);this.pageIndex=e}setParent(e){if(!u(this,Vi)){T(this,Vi,e);return}if(u(this,Vi)!==e){if(u(this,En).size>0)for(const t of u(this,En).values())t.remove(),e.append(t);T(this,Vi,e)}}static get _svgFactory(){return Ct(this,"_svgFactory",new Lh)}draw(e,t=!1,r=!1){const n=bn(Rr,_f)._++,s=L(this,As,pb).call(this),a=Rr._svgFactory.createElement("defs");s.append(a);const o=Rr._svgFactory.createElement("path");a.append(o);const l=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t&&u(this,Fl).set(n,o);const c=r?L(this,As,ux).call(this,a,l):null,h=Rr._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${l}`),this.updateProperties(s,e),u(this,En).set(n,s),{id:n,clipPathId:`url(#${c})`}}drawOutline(e,t){const r=bn(Rr,_f)._++,n=L(this,As,pb).call(this),s=Rr._svgFactory.createElement("defs");n.append(s);const a=Rr._svgFactory.createElement("path");s.append(a);const o=`path_p${this.pageIndex}_${r}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(t){const d=Rr._svgFactory.createElement("mask");s.append(d),l=`mask_p${this.pageIndex}_${r}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const p=Rr._svgFactory.createElement("rect");d.append(p),p.setAttribute("width","1"),p.setAttribute("height","1"),p.setAttribute("fill","white");const g=Rr._svgFactory.createElement("use");d.append(g),g.setAttribute("href",`#${o}`),g.setAttribute("stroke","none"),g.setAttribute("fill","black"),g.setAttribute("fill-rule","nonzero"),g.classList.add("mask")}const c=Rr._svgFactory.createElement("use");n.append(c),c.setAttribute("href",`#${o}`),l&&c.setAttribute("mask",`url(#${l})`);const h=c.cloneNode();return n.append(h),c.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(n,e),u(this,En).set(r,n),r}finalizeDraw(e,t){u(this,Fl).delete(e),this.updateProperties(e,t)}updateProperties(e,t){var l;if(!t)return;const{root:r,bbox:n,rootClass:s,path:a}=t,o=typeof e=="number"?u(this,En).get(e):e;if(o){if(r&&L(this,As,gb).call(this,o,r),n&&L(l=Rr,Eg,lx).call(l,o,n),s){const{classList:c}=o;for(const[h,d]of Object.entries(s))c.toggle(h,d)}if(a){const h=o.firstChild.firstChild;L(this,As,gb).call(this,h,a)}}}updateParent(e,t){if(t===this)return;const r=u(this,En).get(e);r&&(u(t,Vi).append(r),u(this,En).delete(e),u(t,En).set(e,r))}remove(e){u(this,Fl).delete(e),u(this,Vi)!==null&&(u(this,En).get(e).remove(),u(this,En).delete(e))}destroy(){T(this,Vi,null);for(const e of u(this,En).values())e.remove();u(this,En).clear(),u(this,Fl).clear()}};Vi=new WeakMap,En=new WeakMap,Fl=new WeakMap,_f=new WeakMap,Eg=new WeakSet,lx=function(e,[t,r,n,s]){const{style:a}=e;a.top=`${100*r}%`,a.left=`${100*t}%`,a.width=`${100*n}%`,a.height=`${100*s}%`},As=new WeakSet,pb=function(){const e=Rr._svgFactory.create(1,1,!0);return u(this,Vi).append(e),e.setAttribute("aria-hidden",!0),e},ux=function(e,t){const r=Rr._svgFactory.createElement("clipPath");e.append(r);const n=`clip_${t}`;r.setAttribute("id",n),r.setAttribute("clipPathUnits","objectBoundingBox");const s=Rr._svgFactory.createElement("use");return r.append(s),s.setAttribute("href",`#${t}`),s.classList.add("clip"),n},gb=function(e,t){for(const[r,n]of Object.entries(t))n===null?e.removeAttribute(r):e.setAttribute(r,n)},N(Rr,Eg),N(Rr,_f,0);let eg=Rr;globalThis._pdfjsTestingUtils={HighlightOutliner:q0};globalThis.pdfjsLib={AbortException:ha,AnnotationEditorLayer:Jp,AnnotationEditorParamsType:kt,AnnotationEditorType:ot,AnnotationEditorUIManager:ao,AnnotationLayer:$b,AnnotationMode:vs,AnnotationType:wr,build:uw,ColorPicker:Oh,createValidAbsoluteUrl:Pb,DOMSVGFactory:Lh,DrawLayer:eg,FeatureTest:qr,fetchData:Nc,getDocument:Bb,getFilenameFromUrl:i1,getPdfFilenameFromUrl:s1,getUuid:Ib,getXfaPageViewport:a1,GlobalWorkerOptions:yi,ImageKind:Th,InvalidPDFException:Wp,isDataScheme:kf,isPdfFile:kg,isValidExplicitDest:j1,MathClamp:dn,noContextMenu:Ei,normalizeUnicode:r1,OPS:Ph,OutputScale:Wi,PasswordResponses:e1,PDFDataRangeTransport:zb,PDFDateString:Dg,PDFWorker:Sc,PermissionFlag:J2,PixelsPerInch:da,RenderingCancelledException:Tg,ResponseException:Rh,setLayerDimensions:so,shadow:Ct,SignatureExtractor:ys,stopEvent:_r,SupportedImageMimeTypes:Xp,TextLayer:Nh,TouchManager:Ih,updateUrlHash:Rb,Util:Qe,VerbosityLevel:Cf,version:jb,XfaLayer:Ub};const nS=Object.freeze(Object.defineProperty({__proto__:null,AbortException:ha,AnnotationEditorLayer:Jp,AnnotationEditorParamsType:kt,AnnotationEditorType:ot,AnnotationEditorUIManager:ao,AnnotationLayer:$b,AnnotationMode:vs,AnnotationType:wr,ColorPicker:Oh,DOMSVGFactory:Lh,DrawLayer:eg,FeatureTest:qr,GlobalWorkerOptions:yi,ImageKind:Th,InvalidPDFException:Wp,MathClamp:dn,OPS:Ph,OutputScale:Wi,PDFDataRangeTransport:zb,PDFDateString:Dg,PDFWorker:Sc,PasswordResponses:e1,PermissionFlag:J2,PixelsPerInch:da,RenderingCancelledException:Tg,ResponseException:Rh,SignatureExtractor:ys,SupportedImageMimeTypes:Xp,TextLayer:Nh,TouchManager:Ih,Util:Qe,VerbosityLevel:Cf,XfaLayer:Ub,build:uw,createValidAbsoluteUrl:Pb,fetchData:Nc,getDocument:Bb,getFilenameFromUrl:i1,getPdfFilenameFromUrl:s1,getUuid:Ib,getXfaPageViewport:a1,isDataScheme:kf,isPdfFile:kg,isValidExplicitDest:j1,noContextMenu:Ei,normalizeUnicode:r1,setLayerDimensions:so,shadow:Ct,stopEvent:_r,updateUrlHash:Rb,version:jb},Symbol.toStringTag,{value:"Module"}));function cx(i){var e,t,r="";if(typeof i=="string"||typeof i=="number")r+=i;else if(typeof i=="object")if(Array.isArray(i)){var n=i.length;for(e=0;e<n;e++)i[e]&&(t=cx(i[e]))&&(r&&(r+=" "),r+=t)}else for(t in i)i[t]&&(r&&(r+=" "),r+=t);return r}function Ig(){for(var i,e,t=0,r="",n=arguments.length;t<n;t++)(i=arguments[t])&&(e=cx(i))&&(r&&(r+=" "),r+=e);return r}var gy=Object.prototype.hasOwnProperty;function my(i,e,t){for(t of i.keys())if(bu(t,e))return t}function bu(i,e){var t,r,n;if(i===e)return!0;if(i&&e&&(t=i.constructor)===e.constructor){if(t===Date)return i.getTime()===e.getTime();if(t===RegExp)return i.toString()===e.toString();if(t===Array){if((r=i.length)===e.length)for(;r--&&bu(i[r],e[r]););return r===-1}if(t===Set){if(i.size!==e.size)return!1;for(r of i)if(n=r,n&&typeof n=="object"&&(n=my(e,n),!n)||!e.has(n))return!1;return!0}if(t===Map){if(i.size!==e.size)return!1;for(r of i)if(n=r[0],n&&typeof n=="object"&&(n=my(e,n),!n)||!bu(r[1],e.get(n)))return!1;return!0}if(t===ArrayBuffer)i=new Uint8Array(i),e=new Uint8Array(e);else if(t===DataView){if((r=i.byteLength)===e.byteLength)for(;r--&&i.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(i)){if((r=i.byteLength)===e.byteLength)for(;r--&&i[r]===e[r];);return r===-1}if(!t||typeof i=="object"){r=0;for(t in i)if(gy.call(i,t)&&++r&&!gy.call(e,t)||!(t in e)||!bu(i[t],e[t]))return!1;return Object.keys(e).length===r}}return i!==i&&e!==e}function If(i){let e=!1;return{promise:new Promise((r,n)=>{i.then(s=>!e&&r(s)).catch(s=>!e&&n(s))}),cancel(){e=!0}}}const iS=["onCopy","onCut","onPaste"],sS=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],aS=["onFocus","onBlur"],oS=["onInput","onInvalid","onReset","onSubmit"],lS=["onLoad","onError"],uS=["onKeyDown","onKeyPress","onKeyUp"],cS=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],hS=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],dS=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],fS=["onSelect"],pS=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],gS=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],mS=["onScroll"],bS=["onWheel"],vS=["onAnimationStart","onAnimationEnd","onAnimationIteration"],yS=["onTransitionEnd"],wS=["onToggle"],xS=["onChange"],AS=[...iS,...sS,...aS,...oS,...lS,...uS,...cS,...hS,...dS,...fS,...pS,...gS,...mS,...bS,...vS,...yS,...xS,...wS];function hx(i,e){const t={};for(const r of AS){const n=i[r];n&&(e?t[r]=s=>n(s,e(r)):t[r]=n)}return t}var ES=process.env.NODE_ENV==="production",ym="Invariant failed";function Qt(i,e){if(!i){if(ES)throw new Error(ym);var t=typeof e=="function"?e():e,r=t?"".concat(ym,": ").concat(t):ym;throw new Error(r)}}var _S=process.env.NODE_ENV!=="production",dx=function(){};if(_S){var CS=function(e,t){var r=arguments.length;t=new Array(r>1?r-1:0);for(var n=1;n<r;n++)t[n-1]=arguments[n];var s=0,a="Warning: "+e.replace(/%s/g,function(){return t[s++]});typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}};dx=function(i,e,t){var r=arguments.length;t=new Array(r>2?r-2:0);for(var n=2;n<r;n++)t[n-2]=arguments[n];if(e===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");i||CS.apply(null,[e].concat(t))}}var SS=dx;const fn=_g(SS),fx=Pe.createContext(null),TS="noopener noreferrer nofollow";class kS{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Qt(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(e){Qt(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}goToDestination(e){return new Promise(t=>{Qt(this.pdfDocument,"PDF document not loaded."),Qt(e,"Destination is not specified."),typeof e=="string"?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)}).then(t=>{Qt(Array.isArray(t),`"${t}" is not a valid destination array.`);const r=t[0];new Promise(n=>{Qt(this.pdfDocument,"PDF document not loaded."),r instanceof Object?this.pdfDocument.getPageIndex(r).then(s=>{n(s)}).catch(()=>{Qt(!1,`"${r}" is not a valid page reference.`)}):typeof r=="number"?n(r):Qt(!1,`"${r}" is not a valid destination reference.`)}).then(n=>{const s=n+1;Qt(this.pdfViewer,"PDF viewer is not initialized."),Qt(s>=1&&s<=this.pagesCount,`"${s}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:n,pageNumber:s})})})}navigateTo(e){this.goToDestination(e)}goToPage(e){const t=e-1;Qt(this.pdfViewer,"PDF viewer is not initialized."),Qt(e>=1&&e<=this.pagesCount,`"${e}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}addLinkAttributes(e,t,r){e.href=t,e.rel=this.externalLinkRel||TS,e.target=r?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}function vu({children:i,type:e}){return ye.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:i})}const by={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function DS(i,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return i}}function Tc(){return Pe.useReducer(DS,{value:void 0,error:void 0})}const Ng=typeof window<"u",px=Ng&&window.location.protocol==="file:";function PS(i){return typeof i<"u"}function xo(i){return PS(i)&&i!==null}function RS(i){return typeof i=="string"}function IS(i){return i instanceof ArrayBuffer}function NS(i){return Qt(Ng,"isBlob can only be used in a browser environment"),i instanceof Blob}function mb(i){return RS(i)&&/^data:/.test(i)}function vy(i){Qt(mb(i),"Invalid data URI.");const[e="",t=""]=i.split(",");return e.split(";").indexOf("base64")!==-1?atob(t):unescape(t)}function MS(){return Ng&&window.devicePixelRatio||1}const gx="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function yy(){fn(!px,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${gx}`)}function LS(){fn(!px,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${gx}`)}function Ul(i){i!=null&&i.cancel&&i.cancel()}function bb(i,e){return Object.defineProperty(i,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(i,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(i,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(i,"originalHeight",{get(){return this.view[3]},configurable:!0}),i}function OS(i){return i.name==="RenderingCancelledException"}function FS(i){return new Promise((e,t)=>{const r=new FileReader;r.onload=()=>{if(!r.result)return t(new Error("Error while reading a file."));e(r.result)},r.onerror=n=>{if(!n.target)return t(new Error("Error while reading a file."));const{error:s}=n.target;if(!s)return t(new Error("Error while reading a file."));switch(s.code){case s.NOT_FOUND_ERR:return t(new Error("Error while reading a file: File not found."));case s.SECURITY_ERR:return t(new Error("Error while reading a file: Security error."));case s.ABORT_ERR:return t(new Error("Error while reading a file: Aborted."));default:return t(new Error("Error while reading a file."))}},r.readAsArrayBuffer(i)})}const{PDFDataRangeTransport:BS}=nS,zS=(i,e)=>{switch(e){case by.NEED_PASSWORD:{const t=prompt("Enter the password to open this PDF file.");i(t);break}case by.INCORRECT_PASSWORD:{const t=prompt("Invalid password. Please try again.");i(t);break}}};function wy(i){return typeof i=="object"&&i!==null&&("data"in i||"range"in i||"url"in i)}const jS=Pe.forwardRef(function({children:e,className:t,error:r="Failed to load PDF file.",externalLinkRel:n,externalLinkTarget:s,file:a,inputRef:o,imageResourcesPath:l,loading:c="Loading PDF…",noData:h="No PDF file specified.",onItemClick:d,onLoadError:p,onLoadProgress:g,onLoadSuccess:y,onPassword:b=zS,onSourceError:w,onSourceSuccess:v,options:A,renderMode:E,rotate:_,scale:C,...I},k){const[D,R]=Tc(),{value:z,error:G}=D,[O,X]=Tc(),{value:S,error:J}=O,Y=Pe.useRef(new kS),W=Pe.useRef([]),fe=Pe.useRef(void 0),K=Pe.useRef(void 0);a&&a!==fe.current&&wy(a)&&(fn(!bu(a,fe.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),fe.current=a),A&&A!==K.current&&(fn(!bu(A,K.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),K.current=A);const be=Pe.useRef({scrollPageIntoView:Te=>{const{dest:x,pageNumber:U,pageIndex:B=U-1}=Te;if(d){d({dest:x,pageIndex:B,pageNumber:U});return}const F=W.current[B];if(F){F.scrollIntoView();return}fn(!1,`An internal link leading to page ${U} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});Pe.useImperativeHandle(k,()=>({linkService:Y,pages:W,viewer:be}),[]);function te(){v&&v()}function j(){G&&(fn(!1,G.toString()),w&&w(G))}function ie(){R({type:"RESET"})}Pe.useEffect(ie,[a,R]);const ae=Pe.useCallback(async()=>{if(!a)return null;if(typeof a=="string")return mb(a)?{data:vy(a)}:(yy(),{url:a});if(a instanceof BS)return{range:a};if(IS(a))return{data:a};if(Ng&&NS(a))return{data:await FS(a)};if(Qt(typeof a=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),Qt(wy(a),"Invalid parameter object: need either .data, .range or .url"),"url"in a&&typeof a.url=="string"){if(mb(a.url)){const{url:Te,...x}=a;return{data:vy(Te),...x}}yy()}return a},[a]);Pe.useEffect(()=>{const Te=If(ae());return Te.promise.then(x=>{R({type:"RESOLVE",value:x})}).catch(x=>{R({type:"REJECT",error:x})}),()=>{Ul(Te)}},[ae,R]),Pe.useEffect(()=>{if(!(typeof z>"u")){if(z===!1){j();return}te()}},[z]);function H(){S&&(y&&y(S),W.current=new Array(S.numPages),Y.current.setDocument(S))}function se(){J&&(fn(!1,J.toString()),p&&p(J))}Pe.useEffect(function(){X({type:"RESET"})},[X,z]),Pe.useEffect(function(){if(!z)return;const x=A?{...z,...A}:z,U=Bb(x);g&&(U.onProgress=g),b&&(U.onPassword=b);const B=U,F=B.promise.then(M=>{X({type:"RESOLVE",value:M})}).catch(M=>{B.destroyed||X({type:"REJECT",error:M})});return()=>{F.finally(()=>B.destroy())}},[A,X,z]),Pe.useEffect(()=>{if(!(typeof S>"u")){if(S===!1){se();return}H()}},[S]),Pe.useEffect(function(){Y.current.setViewer(be.current),Y.current.setExternalLinkRel(n),Y.current.setExternalLinkTarget(s)},[n,s]);const le=Pe.useCallback((Te,x)=>{W.current[Te]=x},[]),oe=Pe.useCallback(Te=>{delete W.current[Te]},[]),ce=Pe.useMemo(()=>({imageResourcesPath:l,linkService:Y.current,onItemClick:d,pdf:S,registerPage:le,renderMode:E,rotate:_,scale:C,unregisterPage:oe}),[l,d,S,le,E,_,C,oe]),Ae=Pe.useMemo(()=>hx(I,()=>S),[I,S]);function Se(){function Te(U){return!!(U!=null&&U.pdf)}if(!Te(ce))throw new Error("pdf is undefined");const x=typeof e=="function"?e(ce):e;return ye.jsx(fx.Provider,{value:ce,children:x})}function Ne(){return a?S==null?ye.jsx(vu,{type:"loading",children:typeof c=="function"?c():c}):S===!1?ye.jsx(vu,{type:"error",children:typeof r=="function"?r():r}):Se():ye.jsx(vu,{type:"no-data",children:typeof h=="function"?h():h})}return ye.jsx("div",{className:Ig("react-pdf__Document",t),ref:o,...Ae,children:Ne()})});function mx(){return Pe.useContext(fx)}function bx(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];var t=i.filter(Boolean);if(t.length<=1){var r=t[0];return r||null}return function(s){for(var a=0,o=t;a<o.length;a++){var l=o[a];typeof l=="function"?l(s):l&&(l.current=s)}}}const vx=Pe.createContext(null);function Mg(){return Pe.useContext(vx)}function US(){const i=mx(),e=Mg();Qt(e,"Unable to find Page context.");const t={...i,...e},{imageResourcesPath:r,linkService:n,onGetAnnotationsError:s,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:c,pdf:h,renderForms:d,rotate:p,scale:g=1}=t;Qt(h,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Qt(c,"Attempted to load page annotations, but no page was specified."),Qt(n,"Attempted to load page annotations, but no linkService was specified.");const[y,b]=Tc(),{value:w,error:v}=y,A=Pe.useRef(null);fn(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function E(){w&&a&&a(w)}function _(){v&&(fn(!1,v.toString()),s&&s(v))}Pe.useEffect(function(){b({type:"RESET"})},[b,c]),Pe.useEffect(function(){if(!c)return;const R=If(c.getAnnotations()),z=R;return R.promise.then(G=>{b({type:"RESOLVE",value:G})}).catch(G=>{b({type:"REJECT",error:G})}),()=>{Ul(z)}},[b,c]),Pe.useEffect(()=>{if(w!==void 0){if(w===!1){_();return}E()}},[w]);function C(){l&&l()}function I(D){fn(!1,`${D}`),o&&o(D)}const k=Pe.useMemo(()=>c.getViewport({scale:g,rotation:p}),[c,p,g]);return Pe.useEffect(function(){if(!h||!c||!n||!w)return;const{current:R}=A;if(!R)return;const z=k.clone({dontFlip:!0}),G={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:R,l10n:null,page:c,structTreeLayer:null,viewport:z},O={annotations:w,annotationStorage:h.annotationStorage,div:R,imageResourcesPath:r,linkService:n,page:c,renderForms:d,viewport:z};R.innerHTML="";try{new $b(G).render(O),C()}catch(X){I(X)}return()=>{}},[w,r,n,c,h,d,k]),ye.jsx("div",{className:Ig("react-pdf__Page__annotations","annotationLayer"),ref:A})}const yx={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},HS=/^H(\d+)$/;function $S(i){return i in yx}function Lg(i){return"children"in i}function wx(i){return Lg(i)?i.children.length===1&&0 in i.children&&"id"in i.children[0]:!1}function VS(i){const e={};if(Lg(i)){const{role:t}=i,r=t.match(HS);if(r)e.role="heading",e["aria-level"]=Number(r[1]);else if($S(t)){const n=yx[t];n&&(e.role=n)}}return e}function xx(i){const e={};if(Lg(i)){if(i.alt!==void 0&&(e["aria-label"]=i.alt),i.lang!==void 0&&(e.lang=i.lang),wx(i)){const[t]=i.children;if(t){const r=xx(t);return{...e,...r}}}}else"id"in i&&(e["aria-owns"]=i.id);return e}function GS(i){return i?{...VS(i),...xx(i)}:null}function Ax({className:i,node:e}){const t=Pe.useMemo(()=>GS(e),[e]),r=Pe.useMemo(()=>!Lg(e)||wx(e)?null:e.children.map((n,s)=>ye.jsx(Ax,{node:n},s)),[e]);return ye.jsx("span",{className:i,...t,children:r})}function qS(){const i=Mg();Qt(i,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:t}=i,[r,n]=Tc(),{value:s,error:a}=r,{customTextRenderer:o,page:l}=i;function c(){s&&t&&t(s)}function h(){a&&(fn(!1,a.toString()),e&&e(a))}return Pe.useEffect(function(){n({type:"RESET"})},[n,l]),Pe.useEffect(function(){if(o||!l)return;const p=If(l.getStructTree()),g=p;return p.promise.then(y=>{n({type:"RESOLVE",value:y})}).catch(y=>{n({type:"REJECT",error:y})}),()=>Ul(g)},[o,l,n]),Pe.useEffect(()=>{if(s!==void 0){if(s===!1){h();return}c()}},[s]),s?ye.jsx(Ax,{className:"react-pdf__Page__structTree structTree",node:s}):null}const xy=vs;function WS(i){const e=Mg();Qt(e,"Unable to find Page context.");const t={...e,...i},{_className:r,canvasBackground:n,devicePixelRatio:s=MS(),onRenderError:a,onRenderSuccess:o,page:l,renderForms:c,renderTextLayer:h,rotate:d,scale:p}=t,{canvasRef:g}=i;Qt(l,"Attempted to render page canvas, but no page was specified.");const y=Pe.useRef(null);function b(){l&&o&&o(bb(l,p))}function w(_){OS(_)||(fn(!1,_.toString()),a&&a(_))}const v=Pe.useMemo(()=>l.getViewport({scale:p*s,rotation:d}),[s,l,d,p]),A=Pe.useMemo(()=>l.getViewport({scale:p,rotation:d}),[l,d,p]);Pe.useEffect(function(){if(!l)return;l.cleanup();const{current:C}=y;if(!C)return;C.width=v.width,C.height=v.height,C.style.width=`${Math.floor(A.width)}px`,C.style.height=`${Math.floor(A.height)}px`,C.style.visibility="hidden";const I={annotationMode:c?xy.ENABLE_FORMS:xy.ENABLE,canvasContext:C.getContext("2d",{alpha:!1}),viewport:v};n&&(I.background=n);const k=l.render(I),D=k;return k.promise.then(()=>{C.style.visibility="",b()}).catch(w),()=>Ul(D)},[n,l,c,v,A]);const E=Pe.useCallback(()=>{const{current:_}=y;_&&(_.width=0,_.height=0)},[]);return Pe.useEffect(()=>E,[E]),ye.jsx("canvas",{className:`${r}__canvas`,dir:"ltr",ref:bx(g,y),style:{display:"block",userSelect:"none"},children:h?ye.jsx(qS,{}):null})}function XS(i){return"str"in i}function YS(){const i=Mg();Qt(i,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:t,onGetTextSuccess:r,onRenderTextLayerError:n,onRenderTextLayerSuccess:s,page:a,pageIndex:o,pageNumber:l,rotate:c,scale:h}=i;Qt(a,"Attempted to load page text content, but no page was specified.");const[d,p]=Tc(),{value:g,error:y}=d,b=Pe.useRef(null);fn(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function w(){g&&r&&r(g)}function v(){y&&(fn(!1,y.toString()),t&&t(y))}Pe.useEffect(function(){p({type:"RESET"})},[a,p]),Pe.useEffect(function(){if(!a)return;const D=If(a.getTextContent()),R=D;return D.promise.then(z=>{p({type:"RESOLVE",value:z})}).catch(z=>{p({type:"REJECT",error:z})}),()=>Ul(R)},[a,p]),Pe.useEffect(()=>{if(g!==void 0){if(g===!1){v();return}w()}},[g]);const A=Pe.useCallback(()=>{s&&s()},[s]),E=Pe.useCallback(k=>{fn(!1,k.toString()),n&&n(k)},[n]);function _(){const k=b.current;k&&k.classList.add("selecting")}function C(){const k=b.current;k&&k.classList.remove("selecting")}const I=Pe.useMemo(()=>a.getViewport({scale:h,rotation:c}),[a,c,h]);return Pe.useLayoutEffect(function(){if(!a||!g)return;const{current:D}=b;if(!D)return;D.innerHTML="";const R=a.streamTextContent({includeMarkedContent:!0}),z={container:D,textContentSource:R,viewport:I},G=new Nh(z),O=G;return G.render().then(()=>{const X=document.createElement("div");X.className="endOfContent",D.append(X);const S=D.querySelectorAll('[role="presentation"]');if(e){let J=0;g.items.forEach((Y,W)=>{if(!XS(Y))return;const fe=S[J];if(!fe)return;const K=e({pageIndex:o,pageNumber:l,itemIndex:W,...Y});fe.innerHTML=K,J+=Y.str&&Y.hasEOL?2:1})}A()}).catch(E),()=>Ul(O)},[e,E,A,a,o,l,g,I]),ye.jsx("div",{className:Ig("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:_,ref:b})}const Ay=1;function ZS(i){const t={...mx(),...i},{_className:r="react-pdf__Page",_enableRegisterUnregisterPage:n=!0,canvasBackground:s,canvasRef:a,children:o,className:l,customRenderer:c,customTextRenderer:h,devicePixelRatio:d,error:p="Failed to load the page.",height:g,inputRef:y,loading:b="Loading page…",noData:w="No page specified.",onGetAnnotationsError:v,onGetAnnotationsSuccess:A,onGetStructTreeError:E,onGetStructTreeSuccess:_,onGetTextError:C,onGetTextSuccess:I,onLoadError:k,onLoadSuccess:D,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:z,onRenderError:G,onRenderSuccess:O,onRenderTextLayerError:X,onRenderTextLayerSuccess:S,pageIndex:J,pageNumber:Y,pdf:W,registerPage:fe,renderAnnotationLayer:K=!0,renderForms:be=!1,renderMode:te="canvas",renderTextLayer:j=!0,rotate:ie,scale:ae=Ay,unregisterPage:H,width:se,...le}=t,[oe,ce]=Tc(),{value:Ae,error:Se}=oe,Ne=Pe.useRef(null);Qt(W,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const Te=xo(Y)?Y-1:J??null,x=Y??(xo(J)?J+1:null),U=ie??(Ae?Ae.rotate:null),B=Pe.useMemo(()=>{if(!Ae)return null;let $e=1;const Xe=ae??Ay;if(se||g){const Tt=Ae.getViewport({scale:1,rotation:U});se?$e=se/Tt.width:g&&($e=g/Tt.height)}return Xe*$e},[g,Ae,U,ae,se]);Pe.useEffect(function(){return()=>{xo(Te)&&n&&H&&H(Te)}},[n,W,Te,H]);function F(){if(D){if(!Ae||!B)return;D(bb(Ae,B))}if(n&&fe){if(!xo(Te)||!Ne.current)return;fe(Te,Ne.current)}}function M(){Se&&(fn(!1,Se.toString()),k&&k(Se))}Pe.useEffect(function(){ce({type:"RESET"})},[ce,W,Te]),Pe.useEffect(function(){if(!W||!x)return;const Xe=If(W.getPage(x)),Tt=Xe;return Xe.promise.then(nr=>{ce({type:"RESOLVE",value:nr})}).catch(nr=>{ce({type:"REJECT",error:nr})}),()=>Ul(Tt)},[ce,W,x]),Pe.useEffect(()=>{if(Ae!==void 0){if(Ae===!1){M();return}F()}},[Ae,B]);const q=Pe.useMemo(()=>xo(Te)&&x&&xo(U)&&xo(B)?{_className:r,canvasBackground:s,customTextRenderer:h,devicePixelRatio:d,onGetAnnotationsError:v,onGetAnnotationsSuccess:A,onGetStructTreeError:E,onGetStructTreeSuccess:_,onGetTextError:C,onGetTextSuccess:I,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:z,onRenderError:G,onRenderSuccess:O,onRenderTextLayerError:X,onRenderTextLayerSuccess:S,page:Ae,pageIndex:Te,pageNumber:x,renderForms:be,renderTextLayer:j,rotate:U,scale:B}:null,[r,s,h,d,v,A,E,_,C,I,R,z,G,O,X,S,Ae,Te,x,be,j,U,B]),de=Pe.useMemo(()=>hx(le,()=>Ae&&(B?bb(Ae,B):void 0)),[le,Ae,B]),we=`${Te}@${B}/${U}`;function ee(){switch(te){case"custom":return Qt(c,'renderMode was set to "custom", but no customRenderer was passed.'),ye.jsx(c,{},`${we}_custom`);case"none":return null;case"canvas":default:return ye.jsx(WS,{canvasRef:a},`${we}_canvas`)}}function Ee(){return j?ye.jsx(YS,{},`${we}_text`):null}function De(){return K?ye.jsx(US,{},`${we}_annotations`):null}function Ce(){function $e(Tt){return!!(Tt!=null&&Tt.page)}if(!$e(q))throw new Error("page is undefined");const Xe=typeof o=="function"?o(q):o;return ye.jsxs(vx.Provider,{value:q,children:[ee(),Ee(),De(),Xe]})}function Me(){return x?W===null||Ae===void 0||Ae===null?ye.jsx(vu,{type:"loading",children:typeof b=="function"?b():b}):W===!1||Ae===!1?ye.jsx(vu,{type:"error",children:typeof p=="function"?p():p}):Ce():ye.jsx(vu,{type:"no-data",children:typeof w=="function"?w():w})}return ye.jsx("div",{className:Ig(r,l),"data-page-number":x,ref:bx(y,Ne),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${B}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:s||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...de,children:Me()})}LS();yi.workerSrc="pdf.worker.mjs";yi.workerSrc=`//unpkg.com/pdfjs-dist@${jb}/build/pdf.worker.min.mjs`;const KS=({onClose:i,src:e,title:t="PDF Viewer",className:r,onOpen:n})=>{const[s,a]=X2(),[o,l]=Y2(),[{currentPage:c,totalPages:h},d]=K2(),[{pan:p,isDragging:g},y]=Z2(),b=v=>{n==null||n(v),!v.defaultPrevented&&(e||v.preventDefault())},w=ye.jsx(Mt.IconButton,{variant:"text",color:"gray",children:ye.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:b,children:ye.jsx(W2,{className:"size-4"})})});return ye.jsxs("div",{className:zl("shadow rounded-t-lg flex flex-col h-full",r),children:[ye.jsx(q2.Header,{onClose:i,right:w,children:t}),ye.jsxs("div",{className:"grid grow h-full overflow-hidden",children:[ye.jsx("div",{className:zl("col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8",g?"cursor-grabbing":"cursor-grab"),onMouseDown:y.handleMouseDown,onMouseMove:y.handleMouseMove,onMouseUp:y.handleMouseUp,onMouseLeave:y.handleMouseUp,style:{userSelect:"none"},children:ye.jsx("div",{style:{transform:`translate(${p.x}px, ${p.y}px)`,transition:g?"none":"transform 0.1s",pointerEvents:"none"},children:ye.jsx(jS,{file:e,onLoadSuccess:({numPages:v})=>{d.setTotalPages(v)},scale:s/100,rotate:o,children:ye.jsx(ZS,{pageNumber:c,renderTextLayer:!0,renderAnnotationLayer:!0})})})}),ye.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[ye.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:a.zoomOut,children:ye.jsx(vi.Icon,{icon:"lucide:minus"})}),ye.jsx(Mt.Tooltip,{content:"Click to reset zoom and pan",children:ye.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{a.reset(),y.reset()},children:[s,"%"]})}),ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:a.zoomIn,children:ye.jsx(vi.Icon,{icon:"lucide:plus"})})]}),ye.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.rotateClockwise,children:ye.jsx(vi.Icon,{icon:"lucide:iteration-cw"})}),ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.rotateCounterClockwise,children:ye.jsx(vi.Icon,{icon:"lucide:iteration-ccw"})})]}),ye.jsxs(Mt.ButtonGroup,{className:"divide-x-0 ",children:[ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.prevPage,disabled:c===1,children:ye.jsx(vi.Icon,{icon:"lucide:chevron-left"})}),ye.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:c,onChange:v=>{const A=parseInt(v.target.value);isNaN(A)||d.goToPage(A)},type:"number",min:"1",max:h}),ye.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",h]}),ye.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.nextPage,disabled:c===h,children:ye.jsx(vi.Icon,{icon:"lucide:chevron-right"})})]})]})]})]})},QS=({...i})=>ye.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...i,children:[ye.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.16699 7.7334C4.91574 7.73357 6.33301 9.1516 6.33301 10.9004C6.33283 12.3905 5.30337 13.6386 3.91699 13.9756V15.25C3.91685 15.664 3.58098 15.9998 3.16699 16C2.75287 16 2.41713 15.6641 2.41699 15.25V13.9756C1.0303 13.6387 0.000177983 12.3906 0 10.9004C0 9.15149 1.41809 7.7334 3.16699 7.7334ZM3.16699 9.2334C2.24652 9.2334 1.5 9.97992 1.5 10.9004C1.50021 11.8207 2.24665 12.5664 3.16699 12.5664C4.08719 12.5662 4.8328 11.8206 4.83301 10.9004C4.83301 9.98002 4.08732 9.23357 3.16699 9.2334Z",fill:"currentColor"}),ye.jsx("path",{d:"M11.8662 9.66699C12.2804 9.66699 12.6162 10.0028 12.6162 10.417V15.25C12.616 15.6641 12.2803 16 11.8662 16C11.4523 15.9998 11.1164 15.6639 11.1162 15.25V10.417C11.1162 10.0029 11.4522 9.66722 11.8662 9.66699Z",fill:"currentColor"}),ye.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.8662 0C12.2804 0 12.6162 0.335786 12.6162 0.75V2.02344C14.0032 2.36025 15.0332 3.60999 15.0332 5.10059C15.0329 6.84904 13.6157 8.26633 11.8672 8.2666C10.1185 8.2666 8.70052 6.84921 8.7002 5.10059C8.7002 3.6104 9.7297 2.36066 11.1162 2.02344V0.75C11.1162 0.335929 11.4522 0.000230806 11.8662 0ZM11.8672 3.43359C10.9467 3.43359 10.2002 4.18011 10.2002 5.10059C10.2005 6.02078 10.9469 6.7666 11.8672 6.7666C12.7872 6.76633 13.5329 6.02062 13.5332 5.10059C13.5332 4.18028 12.7874 3.43387 11.8672 3.43359Z",fill:"currentColor"}),ye.jsx("path",{d:"M3.16699 0C3.58107 0.000164881 3.91699 0.335888 3.91699 0.75V5.58301C3.91699 5.99712 3.58107 6.33284 3.16699 6.33301C2.75278 6.33301 2.41699 5.99722 2.41699 5.58301V0.75C2.41699 0.335786 2.75278 0 3.16699 0Z",fill:"currentColor"})]}),JS=()=>ye.jsxs(Mt.Tabs,{className:"w-[800px]",children:[ye.jsxs(Mt.TabsHeader,{children:[ye.jsx(Mt.Tab,{value:"chats",children:"Chats"}),ye.jsx(Mt.Tab,{value:"issues",children:"Issues"}),ye.jsx("button",{className:"cursor-pointer mb-2 ml-auto rounded p-1 hover:bg-gray-100",children:ye.jsx(QS,{className:"size-4"})})]}),ye.jsxs(Mt.TabsBody,{children:[ye.jsx(Mt.TabPanel,{value:"chats",children:"ChatsPanel"}),ye.jsx(Mt.TabPanel,{value:"issues",children:"IssuesPanel"})]})]});var Ex={exports:{}},Nt={},br={};function eT(i,e,t){if(t===void 0&&(t=Array.prototype),i&&typeof t.find=="function")return t.find.call(i,e);for(var r=0;r<i.length;r++)if(Xl(i,r)){var n=i[r];if(e.call(void 0,n,r,i))return n}}function Mc(i,e){return e===void 0&&(e=Object),e&&typeof e.getOwnPropertyDescriptors=="function"&&(i=e.create(null,e.getOwnPropertyDescriptors(i))),e&&typeof e.freeze=="function"?e.freeze(i):i}function Xl(i,e){return Object.prototype.hasOwnProperty.call(i,e)}function tT(i,e){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var t in e)Xl(e,t)&&(i[t]=e[t]);return i}var _x=Mc({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function rT(i){return Xl(_x,i.toLowerCase())}var Cx=Mc({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nT(i){return Xl(Cx,i.toLowerCase())}var Fh=Mc({script:!1,style:!1,textarea:!0,title:!0});function iT(i){var e=i.toLowerCase();return Xl(Fh,e)&&!Fh[e]}function sT(i){var e=i.toLowerCase();return Xl(Fh,e)&&Fh[e]}function Sx(i){return i===Bh.HTML}function aT(i){return Sx(i)||i===Bh.XML_XHTML_APPLICATION}var Bh=Mc({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),oT=Object.keys(Bh).map(function(i){return Bh[i]});function lT(i){return oT.indexOf(i)>-1}var uT=Mc({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});br.assign=tT;br.find=eT;br.freeze=Mc;br.HTML_BOOLEAN_ATTRIBUTES=_x;br.HTML_RAW_TEXT_ELEMENTS=Fh;br.HTML_VOID_ELEMENTS=Cx;br.hasDefaultHTMLNamespace=aT;br.hasOwn=Xl;br.isHTMLBooleanAttribute=rT;br.isHTMLRawTextElement=iT;br.isHTMLEscapableRawTextElement=sT;br.isHTMLMimeType=Sx;br.isHTMLVoidElement=nT;br.isValidMimeType=lT;br.MIME_TYPE=Bh;br.NAMESPACE=uT;var go={},cT=br;function Tx(i,e){i.prototype=Object.create(Error.prototype,{constructor:{value:i},name:{value:i.name,enumerable:!0,writable:e}})}var zh=cT.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),kx=Object.keys(zh);function Dx(i){return typeof i=="number"&&i>=1&&i<=25}function hT(i){return typeof i=="string"&&i.substring(i.length-zh.Error.length)===zh.Error}function Nf(i,e){Dx(i)?(this.name=kx[i],this.message=e||""):(this.message=i,this.name=hT(e)?e:zh.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Nf)}Tx(Nf,!0);Object.defineProperties(Nf.prototype,{code:{enumerable:!0,get:function(){var i=kx.indexOf(this.name);return Dx(i)?i:0}}});var Px={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},wm=Object.entries(Px);for(var op=0;op<wm.length;op++){var dT=wm[op][0];Nf[dT]=wm[op][1]}function qb(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,qb)}Tx(qb);go.DOMException=Nf;go.DOMExceptionName=zh;go.ExceptionCode=Px;go.ParseError=qb;var vr={},gt={};function Rx(i){try{typeof i!="function"&&(i=RegExp);var e=new i("𝌆","u").exec("𝌆");return!!e&&e[0].length===2}catch{}return!1}var Mf=Rx();function Hl(i){if(i.source[0]!=="[")throw new Error(i+" can not be used with chars");return i.source.slice(1,i.source.lastIndexOf("]"))}function kc(i,e){if(i.source[0]!=="[")throw new Error("/"+i.source+"/ can not be used with chars_without");if(!e||typeof e!="string")throw new Error(JSON.stringify(e)+" is not a valid search");if(i.source.indexOf(e)===-1)throw new Error('"'+e+'" is not is /'+i.source+"/");if(e==="-"&&i.source.indexOf(e)!==1)throw new Error('"'+e+'" is not at the first postion of /'+i.source+"/");return new RegExp(i.source.replace(e,""),Mf?"u":"")}function St(i){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var r=typeof t=="string";if(r&&e===void 0&&t==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return r?t:t.source}).join(""),Mf?"mu":"m")}function it(i){if(arguments.length===0)throw new Error("no parameters provided");return St.apply(it,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var fT="�",$l=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Mf&&($l=St("[",Hl($l),"\\u{10000}-\\u{10FFFF}","]"));var Wb=/[\x20\x09\x0D\x0A]/,pT=Hl(Wb),$t=St(Wb,"+"),dr=St(Wb,"*"),jh=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Mf&&(jh=St("[",Hl(jh),"\\u{10000}-\\u{10FFFF}","]"));var gT=Hl(jh),Xb=St("[",gT,Hl(/[-.0-9\xB7]/),Hl(/[\u0300-\u036F\u203F-\u2040]/),"]"),_i=St(jh,Xb,"*"),Ey=St(Xb,"+"),mT=St("&",_i,";"),bT=it(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Uh=it(mT,"|",bT),Hh=St("%",_i,";"),Yb=it(St('"',it(/[^%&"]/,"|",Hh,"|",Uh),"*",'"'),"|",St("'",it(/[^%&']/,"|",Hh,"|",Uh),"*","'")),vT=it('"',it(/[^<&"]/,"|",Uh),"*",'"',"|","'",it(/[^<&']/,"|",Uh),"*","'"),yT=kc(jh,":"),wT=kc(Xb,":"),_y=St(yT,wT,"*"),Lf=St(_y,it(":",_y),"?"),xT=St("^",Lf,"$"),AT=St("(",Lf,")"),$h=it(/"[^"]*"|'[^']*'/),ET=St(/^<\?/,"(",_i,")",it($t,"(",$l,"*?)"),"?",/\?>/),Cy=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Og=it('"',Cy,'*"',"|","'",kc(Cy,"'"),"*'"),Ix="<!--",Nx="-->",_T=St(Ix,it(kc($l,"-"),"|",St("-",kc($l,"-"))),"*",Nx),Sy="#PCDATA",CT=it(St(/\(/,dr,Sy,it(dr,/\|/,dr,Lf),"*",dr,/\)\*/),"|",St(/\(/,dr,Sy,dr,/\)/)),ST=/[?*+]?/,TT=St(/\([^>]+\)/,ST),kT=it("EMPTY","|","ANY","|",CT,"|",TT),DT="<!ELEMENT",PT=St(DT,$t,it(Lf,"|",Hh),$t,it(kT,"|",Hh),dr,">"),RT=St("NOTATION",$t,/\(/,dr,_i,it(dr,/\|/,dr,_i),"*",dr,/\)/),IT=St(/\(/,dr,Ey,it(dr,/\|/,dr,Ey),"*",dr,/\)/),NT=it(RT,"|",IT),MT=it(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",NT),LT=it(/#REQUIRED|#IMPLIED/,"|",it(it("#FIXED",$t),"?",vT)),OT=it($t,_i,$t,MT,$t,LT),FT="<!ATTLIST",BT=St(FT,$t,_i,OT,"*",dr,">"),vb="about:legacy-compat",zT=it('"'+vb+'"',"|","'"+vb+"'"),Zb="SYSTEM",Fg="PUBLIC",Bg=it(it(Zb,$t,$h),"|",it(Fg,$t,Og,$t,$h)),jT=St("^",it(it(Zb,$t,"(?<SystemLiteralOnly>",$h,")"),"|",it(Fg,$t,"(?<PubidLiteral>",Og,")",$t,"(?<SystemLiteral>",$h,")"))),UT=it($t,"NDATA",$t,_i),HT=it(Yb,"|",it(Bg,UT,"?")),Mx="<!ENTITY",$T=St(Mx,$t,_i,$t,HT,dr,">"),VT=it(Yb,"|",Bg),GT=St(Mx,$t,"%",$t,_i,$t,VT,dr,">"),qT=it($T,"|",GT),WT=St(Fg,$t,Og),XT=St("<!NOTATION",$t,_i,$t,it(Bg,"|",WT),dr,">"),Kb=St(dr,"=",dr),Ty=/1[.]\d+/,YT=St($t,"version",Kb,it("'",Ty,"'","|",'"',Ty,'"')),ky=/[A-Za-z][-A-Za-z0-9._]*/,ZT=it($t,"encoding",Kb,it('"',ky,'"',"|","'",ky,"'")),KT=it($t,"standalone",Kb,it("'",it("yes","|","no"),"'","|",'"',it("yes","|","no"),'"')),QT=St(/^<\?xml/,YT,ZT,"?",KT,"?",dr,/\?>/),JT="<!DOCTYPE",ek="<![CDATA[",tk="]]>",rk=/<!\[CDATA\[/,nk=/\]\]>/,ik=St($l,"*?",nk),sk=St(rk,ik);gt.chars=Hl;gt.chars_without=kc;gt.detectUnicodeSupport=Rx;gt.reg=St;gt.regg=it;gt.ABOUT_LEGACY_COMPAT=vb;gt.ABOUT_LEGACY_COMPAT_SystemLiteral=zT;gt.AttlistDecl=BT;gt.CDATA_START=ek;gt.CDATA_END=tk;gt.CDSect=sk;gt.Char=$l;gt.Comment=_T;gt.COMMENT_START=Ix;gt.COMMENT_END=Nx;gt.DOCTYPE_DECL_START=JT;gt.elementdecl=PT;gt.EntityDecl=qT;gt.EntityValue=Yb;gt.ExternalID=Bg;gt.ExternalID_match=jT;gt.Name=_i;gt.NotationDecl=XT;gt.Reference=Uh;gt.PEReference=Hh;gt.PI=ET;gt.PUBLIC=Fg;gt.PubidLiteral=Og;gt.QName=Lf;gt.QName_exact=xT;gt.QName_group=AT;gt.S=$t;gt.SChar_s=pT;gt.S_OPT=dr;gt.SYSTEM=Zb;gt.SystemLiteral=$h;gt.UNICODE_REPLACEMENT_CHARACTER=fT;gt.UNICODE_SUPPORT=Mf;gt.XMLDecl=QT;var xi=br,ws=xi.find,ak=xi.hasDefaultHTMLNamespace,Dc=xi.hasOwn,ok=xi.isHTMLMimeType,lk=xi.isHTMLRawTextElement,uk=xi.isHTMLVoidElement,Ch=xi.MIME_TYPE,xs=xi.NAMESPACE,Cn=Symbol(),Lx=go,et=Lx.DOMException,ck=Lx.DOMExceptionName,es=gt;function On(i){if(i!==Cn)throw new TypeError("Illegal constructor")}function hk(i){return i!==""}function dk(i){return i?i.split(/[\t\n\f\r ]+/).filter(hk):[]}function fk(i,e){return Dc(i,e)||(i[e]=!0),i}function Dy(i){if(!i)return[];var e=dk(i);return Object.keys(e.reduce(fk,{}))}function pk(i){return function(e){return i&&i.indexOf(e)!==-1}}function Ox(i){if(!es.QName_exact.test(i))throw new et(et.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+i+'"')}function yb(i,e){Ox(e),i=i||null;var t=null,r=e;if(e.indexOf(":")>=0){var n=e.split(":");t=n[0],r=n[1]}if(t!==null&&i===null)throw new et(et.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(t==="xml"&&i!==xi.NAMESPACE.XML)throw new et(et.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((t==="xmlns"||e==="xmlns")&&i!==xi.NAMESPACE.XMLNS)throw new et(et.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(i===xi.NAMESPACE.XMLNS&&t!=="xmlns"&&e!=="xmlns")throw new et(et.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[i,t,r]}function Lc(i,e){for(var t in i)Dc(i,t)&&(e[t]=i[t])}function Fn(i,e){var t=i.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,Lc(t,r),i.prototype=t=r}t.constructor!=i&&(typeof i!="function"&&console.error("unknown Class:"+i),t.constructor=i)}var Bn={},Gi=Bn.ELEMENT_NODE=1,Pc=Bn.ATTRIBUTE_NODE=2,tg=Bn.TEXT_NODE=3,Fx=Bn.CDATA_SECTION_NODE=4,Bx=Bn.ENTITY_REFERENCE_NODE=5,gk=Bn.ENTITY_NODE=6,zx=Bn.PROCESSING_INSTRUCTION_NODE=7,jx=Bn.COMMENT_NODE=8,Vh=Bn.DOCUMENT_NODE=9,Ux=Bn.DOCUMENT_TYPE_NODE=10,oo=Bn.DOCUMENT_FRAGMENT_NODE=11,mk=Bn.NOTATION_NODE=12,fr=xi.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function Hx(i,e){if(e.length<i.length)return Hx(e,i);var t=null;for(var r in i){if(i[r]!==e[r])return t;t=i[r]}return t}function Py(i){return i.guid||(i.guid=Math.random()),i.guid}function Mr(){}Mr.prototype={length:0,item:function(i){return i>=0&&i<this.length?this[i]:null},toString:function(i){for(var e=[],t=0;t<this.length;t++)fu(this[t],e,i);return e.join("")},filter:function(i){return Array.prototype.filter.call(this,i)},indexOf:function(i){return Array.prototype.indexOf.call(this,i)}};Mr.prototype[Symbol.iterator]=function(){var i=this,e=0;return{next:function(){return e<i.length?{value:i[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Bl(i,e){this._node=i,this._refresh=e,zg(this)}function zg(i){var e=i._node._inc||i._node.ownerDocument._inc;if(i._inc!==e){var t=i._refresh(i._node);if(eA(i,"length",t.length),!i.$$length||t.length<i.$$length)for(var r=t.length;r in i;r++)Dc(i,r)&&delete i[r];Lc(t,i),i._inc=e}}Bl.prototype.item=function(i){return zg(this),this[i]||null};Fn(Bl,Mr);function Rc(){}function $x(i,e){for(var t=0;t<i.length;){if(i[t]===e)return t;t++}}function bk(i,e,t,r){if(r?e[$x(e,r)]=t:(e[e.length]=t,e.length++),i){t.ownerElement=i;var n=i.ownerDocument;n&&(r&&qx(n,i,r),vk(n,i,t))}}function Ry(i,e,t){var r=$x(e,t);if(r>=0){for(var n=e.length-1;r<=n;)e[r]=e[++r];if(e.length=n,i){var s=i.ownerDocument;s&&qx(s,i,t),t.ownerElement=null}}}Rc.prototype={length:0,item:Mr.prototype.item,getNamedItem:function(i){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase());for(var e=0;e<this.length;){var t=this[e];if(t.nodeName===i)return t;e++}return null},setNamedItem:function(i){var e=i.ownerElement;if(e&&e!==this._ownerElement)throw new et(et.INUSE_ATTRIBUTE_ERR);var t=this.getNamedItemNS(i.namespaceURI,i.localName);return t===i?i:(bk(this._ownerElement,this,i,t),t)},setNamedItemNS:function(i){return this.setNamedItem(i)},removeNamedItem:function(i){var e=this.getNamedItem(i);if(!e)throw new et(et.NOT_FOUND_ERR,i);return Ry(this._ownerElement,this,e),e},removeNamedItemNS:function(i,e){var t=this.getNamedItemNS(i,e);if(!t)throw new et(et.NOT_FOUND_ERR,i?i+" : "+e:e);return Ry(this._ownerElement,this,t),t},getNamedItemNS:function(i,e){i||(i=null);for(var t=0;t<this.length;){var r=this[t];if(r.localName===e&&r.namespaceURI===i)return r;t++}return null}};Rc.prototype[Symbol.iterator]=function(){var i=this,e=0;return{next:function(){return e<i.length?{value:i[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Vx(){}Vx.prototype={hasFeature:function(i,e){return!0},createDocument:function(i,e,t){var r=Ch.XML_APPLICATION;i===xs.HTML?r=Ch.XML_XHTML_APPLICATION:i===xs.SVG&&(r=Ch.XML_SVG_IMAGE);var n=new lo(Cn,{contentType:r});if(n.implementation=this,n.childNodes=new Mr,n.doctype=t||null,t&&n.appendChild(t),e){var s=n.createElementNS(i,e);n.appendChild(s)}return n},createDocumentType:function(i,e,t,r){Ox(i);var n=new Hg(Cn);return n.name=i,n.nodeName=i,n.publicId=e||"",n.systemId=t||"",n.internalSubset=r||"",n.childNodes=new Mr,n},createHTMLDocument:function(i){var e=new lo(Cn,{contentType:Ch.HTML});if(e.implementation=this,e.childNodes=new Mr,i!==!1){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var t=e.createElement("html");e.appendChild(t);var r=e.createElement("head");if(t.appendChild(r),typeof i=="string"){var n=e.createElement("title");n.appendChild(e.createTextNode(i)),r.appendChild(n)}t.appendChild(e.createElement("body"))}return e}};function It(i){On(i)}It.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var i=this.getRootNode();return i&&i.nodeType===i.DOCUMENT_NODE},contains:function(i){if(!i)return!1;var e=i;do{if(this===e)return!0;e=i.parentNode}while(e);return!1},getRootNode:function(i){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},isEqualNode:function(i){if(!i||this.nodeType!==i.nodeType)return!1;switch(this.nodeType){case this.DOCUMENT_TYPE_NODE:if(this.name!==i.name||this.publicId!==i.publicId||this.systemId!==i.systemId)return!1;break;case this.ELEMENT_NODE:if(this.namespaceURI!==i.namespaceURI||this.prefix!==i.prefix||this.localName!==i.localName||this.attributes.length!==i.attributes.length)return!1;for(var e=0;e<this.attributes.length;e++){var t=this.attributes.item(e);if(!t.isEqualNode(i.getAttributeNodeNS(t.namespaceURI,t.localName)))return!1}break;case this.ATTRIBUTE_NODE:if(this.namespaceURI!==i.namespaceURI||this.localName!==i.localName||this.value!==i.value)return!1;break;case this.PROCESSING_INSTRUCTION_NODE:if(this.target!==i.target||this.data!==i.data)return!1;break;case this.TEXT_NODE:case this.COMMENT_NODE:if(this.data!==i.data)return!1;break}if(this.childNodes.length!==i.childNodes.length)return!1;for(var e=0;e<this.childNodes.length;e++)if(!this.childNodes[e].isEqualNode(i.childNodes[e]))return!1;return!0},isSameNode:function(i){return this===i},insertBefore:function(i,e){return rg(this,i,e)},replaceChild:function(i,e){rg(this,i,e,Zx),e&&this.removeChild(e)},removeChild:function(i){return Xx(this,i)},appendChild:function(i){return this.insertBefore(i,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(i){return wb(this.ownerDocument||this,this,i)},normalize:function(){for(var i=this.firstChild;i;){var e=i.nextSibling;e&&e.nodeType==tg&&i.nodeType==tg?(this.removeChild(e),i.appendData(e.data)):(i.normalize(),i=e)}},isSupported:function(i,e){return this.ownerDocument.implementation.hasFeature(i,e)},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var r in t)if(Dc(t,r)&&t[r]===i)return r}e=e.nodeType==Pc?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Dc(t,i))return t[i];e=e.nodeType==Pc?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null},compareDocumentPosition:function(i){if(this===i)return 0;var e=i,t=this,r=null,n=null;if(e instanceof Vl&&(r=e,e=r.ownerElement),t instanceof Vl&&(n=t,t=n.ownerElement,r&&e&&t===e))for(var s=0,a;a=t.attributes[s];s++){if(a===r)return fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+fr.DOCUMENT_POSITION_PRECEDING;if(a===n)return fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+fr.DOCUMENT_POSITION_FOLLOWING}if(!e||!t||t.ownerDocument!==e.ownerDocument)return fr.DOCUMENT_POSITION_DISCONNECTED+fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Py(t.ownerDocument)>Py(e.ownerDocument)?fr.DOCUMENT_POSITION_FOLLOWING:fr.DOCUMENT_POSITION_PRECEDING);if(n&&e===t)return fr.DOCUMENT_POSITION_CONTAINS+fr.DOCUMENT_POSITION_PRECEDING;if(r&&e===t)return fr.DOCUMENT_POSITION_CONTAINED_BY+fr.DOCUMENT_POSITION_FOLLOWING;for(var o=[],l=e.parentNode;l;){if(!n&&l===t)return fr.DOCUMENT_POSITION_CONTAINED_BY+fr.DOCUMENT_POSITION_FOLLOWING;o.push(l),l=l.parentNode}o.reverse();for(var c=[],h=t.parentNode;h;){if(!r&&h===e)return fr.DOCUMENT_POSITION_CONTAINS+fr.DOCUMENT_POSITION_PRECEDING;c.push(h),h=h.parentNode}c.reverse();var d=Hx(o,c);for(var p in d.childNodes){var g=d.childNodes[p];if(g===t)return fr.DOCUMENT_POSITION_FOLLOWING;if(g===e)return fr.DOCUMENT_POSITION_PRECEDING;if(c.indexOf(g)>=0)return fr.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(g)>=0)return fr.DOCUMENT_POSITION_PRECEDING}return 0}};function Gx(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}Lc(Bn,It);Lc(Bn,It.prototype);Lc(fr,It);Lc(fr,It.prototype);function kh(i,e){if(e(i))return!0;if(i=i.firstChild)do if(kh(i,e))return!0;while(i=i.nextSibling)}function lo(i,e){On(i);var t=e||{};this.ownerDocument=this,this.contentType=t.contentType||Ch.XML_APPLICATION,this.type=ok(this.contentType)?"html":"xml"}function vk(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===xs.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function qx(i,e,t,r){i&&i._inc++;var n=t.namespaceURI;n===xs.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Wx(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t&&!t.nextSibling)r[r.length++]=t;else{for(var n=e.firstChild,s=0;n;)r[s++]=n,n=n.nextSibling;r.length=s,delete r[r.length]}}}function Xx(i,e){if(i!==e.parentNode)throw new et(et.NOT_FOUND_ERR,"child's parent is not parent");var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:i.firstChild=r,r?r.previousSibling=t:i.lastChild=t,Wx(i.ownerDocument,i),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function yk(i){return i&&(i.nodeType===It.DOCUMENT_NODE||i.nodeType===It.DOCUMENT_FRAGMENT_NODE||i.nodeType===It.ELEMENT_NODE)}function wk(i){return i&&(i.nodeType===It.CDATA_SECTION_NODE||i.nodeType===It.COMMENT_NODE||i.nodeType===It.DOCUMENT_FRAGMENT_NODE||i.nodeType===It.DOCUMENT_TYPE_NODE||i.nodeType===It.ELEMENT_NODE||i.nodeType===It.PROCESSING_INSTRUCTION_NODE||i.nodeType===It.TEXT_NODE)}function uo(i){return i&&i.nodeType===It.DOCUMENT_TYPE_NODE}function la(i){return i&&i.nodeType===It.ELEMENT_NODE}function Yx(i){return i&&i.nodeType===It.TEXT_NODE}function Iy(i,e){var t=i.childNodes||[];if(ws(t,la)||uo(e))return!1;var r=ws(t,uo);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function Ny(i,e){var t=i.childNodes||[];function r(s){return la(s)&&s!==e}if(ws(t,r))return!1;var n=ws(t,uo);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function xk(i,e,t){if(!yk(i))throw new et(et.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new et(et.NOT_FOUND_ERR,"child not in parent");if(!wk(e)||uo(e)&&i.nodeType!==It.DOCUMENT_NODE)throw new et(et.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function Ak(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===It.DOCUMENT_FRAGMENT_NODE){var s=n.filter(la);if(s.length>1||ws(n,Yx))throw new et(et.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!Iy(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(la(e)&&!Iy(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(uo(e)){if(ws(r,uo))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ws(r,la);if(t&&r.indexOf(a)<r.indexOf(t))throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!t&&a)throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Zx(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===It.DOCUMENT_FRAGMENT_NODE){var s=n.filter(la);if(s.length>1||ws(n,Yx))throw new et(et.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!Ny(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(la(e)&&!Ny(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(uo(e)){if(ws(r,function(l){return uo(l)&&l!==t}))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ws(r,la);if(t&&r.indexOf(a)<r.indexOf(t))throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function rg(i,e,t,r){xk(i,e,t),i.nodeType===It.DOCUMENT_NODE&&(r||Ak)(i,e,t);var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===oo){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var o=t?t.previousSibling:i.lastChild;s.previousSibling=o,a.nextSibling=t,o?o.nextSibling=s:i.firstChild=s,t==null?i.lastChild=a:t.previousSibling=a;do s.parentNode=i;while(s!==a&&(s=s.nextSibling));return Wx(i.ownerDocument||i,i,e),e.nodeType==oo&&(e.firstChild=e.lastChild=null),e}lo.prototype={implementation:null,nodeName:"#document",nodeType:Vh,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType===oo){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return rg(this,i,e),i.ownerDocument=this,this.documentElement===null&&i.nodeType===Gi&&(this.documentElement=i),i},removeChild:function(i){var e=Xx(this,i);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(i,e){rg(this,i,e,Zx),i.ownerDocument=this,e&&this.removeChild(e),la(i)&&(this.documentElement=i)},importNode:function(i,e){return Jx(this,i,e)},getElementById:function(i){var e=null;return kh(this.documentElement,function(t){if(t.nodeType==Gi&&t.getAttribute("id")==i)return e=t,!0}),e},createElement:function(i){var e=new co(Cn);e.ownerDocument=this,this.type==="html"&&(i=i.toLowerCase()),ak(this.contentType)&&(e.namespaceURI=xs.HTML),e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new Mr;var t=e.attributes=new Rc;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Ff(Cn);return i.ownerDocument=this,i.childNodes=new Mr,i},createTextNode:function(i){var e=new Of(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createComment:function(i){var e=new jg(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createCDATASection:function(i){var e=new Ug(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Vg(Cn);return t.ownerDocument=this,t.childNodes=new Mr,t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){if(!es.QName_exact.test(i))throw new et(et.INVALID_CHARACTER_ERR,'invalid character in name "'+i+'"');return this.type==="html"&&(i=i.toLowerCase()),this._createAttribute(i)},_createAttribute:function(i){var e=new Vl(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){if(!es.Name.test(i))throw new et(et.INVALID_CHARACTER_ERR,'not a valid xml name "'+i+'"');if(this.type==="html")throw new et("document is an html document",ck.NotSupportedError);var e=new $g(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.nodeName=i,e},createElementNS:function(i,e){var t=yb(i,e),r=new co(Cn),n=r.attributes=new Rc;return r.childNodes=new Mr,r.ownerDocument=this,r.nodeName=e,r.tagName=e,r.namespaceURI=t[0],r.prefix=t[1],r.localName=t[2],n._ownerElement=r,r},createAttributeNS:function(i,e){var t=yb(i,e),r=new Vl(Cn);return r.ownerDocument=this,r.childNodes=new Mr,r.nodeName=e,r.name=e,r.specified=!0,r.namespaceURI=t[0],r.prefix=t[1],r.localName=t[2],r}};Fn(lo,It);function co(i){On(i),this._nsMap=Object.create(null)}co.prototype={nodeType:Gi,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===xs.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(i){return!!this.getAttributeNode(i)},getAttribute:function(i){var e=this.getAttributeNode(i);return e?e.value:null},getAttributeNode:function(i){return this._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase()),this.attributes.getNamedItem(i)},setAttribute:function(i,e){this._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase());var t=this.getAttributeNode(i);t?t.value=t.nodeValue=""+e:(t=this.ownerDocument._createAttribute(i),t.value=t.nodeValue=""+e,this.setAttributeNode(t))},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t?t.value:null},setAttributeNS:function(i,e,t){var r=yb(i,e),n=r[2],s=this.getAttributeNodeNS(i,n);s?s.value=s.nodeValue=""+t:(s=this.ownerDocument.createAttributeNS(i,e),s.value=s.nodeValue=""+t,this.setAttributeNode(s))},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByClassName:function(i){var e=Dy(i);return new Bl(this,function(t){var r=[];return e.length>0&&kh(t,function(n){if(n!==t&&n.nodeType===Gi){var s=n.getAttribute("class");if(s){var a=i===s;if(!a){var o=Dy(s);a=e.every(pk(o))}a&&r.push(n)}}}),r})},getElementsByTagName:function(i){var e=(this.nodeType===Vh?this:this.ownerDocument).type==="html",t=i.toLowerCase();return new Bl(this,function(r){var n=[];return kh(r,function(s){if(!(s===r||s.nodeType!==Gi))if(i==="*")n.push(s);else{var a=s.getQualifiedName(),o=e&&s.namespaceURI===xs.HTML?t:i;a===o&&n.push(s)}}),n})},getElementsByTagNameNS:function(i,e){return new Bl(this,function(t){var r=[];return kh(t,function(n){n!==t&&n.nodeType===Gi&&(i==="*"||n.namespaceURI===i)&&(e==="*"||n.localName==e)&&r.push(n)}),r})}};lo.prototype.getElementsByClassName=co.prototype.getElementsByClassName;lo.prototype.getElementsByTagName=co.prototype.getElementsByTagName;lo.prototype.getElementsByTagNameNS=co.prototype.getElementsByTagNameNS;Fn(co,It);function Vl(i){On(i),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}Vl.prototype.nodeType=Pc;Fn(Vl,It);function Oc(i){On(i)}Oc.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),n=this.data.substring(i+e);t=r+t+n,this.nodeValue=this.data=t,this.length=t.length}};Fn(Oc,It);function Of(i){On(i)}Of.prototype={nodeName:"#text",nodeType:tg,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};Fn(Of,Oc);function jg(i){On(i)}jg.prototype={nodeName:"#comment",nodeType:jx};Fn(jg,Oc);function Ug(i){On(i)}Ug.prototype={nodeName:"#cdata-section",nodeType:Fx};Fn(Ug,Of);function Hg(i){On(i)}Hg.prototype.nodeType=Ux;Fn(Hg,It);function Qb(i){On(i)}Qb.prototype.nodeType=mk;Fn(Qb,It);function Jb(i){On(i)}Jb.prototype.nodeType=gk;Fn(Jb,It);function $g(i){On(i)}$g.prototype.nodeType=Bx;Fn($g,It);function Ff(i){On(i)}Ff.prototype.nodeName="#document-fragment";Ff.prototype.nodeType=oo;Fn(Ff,It);function Vg(i){On(i)}Vg.prototype.nodeType=zx;Fn(Vg,Oc);function Kx(){}Kx.prototype.serializeToString=function(i,e){return Qx.call(i,e)};It.prototype.toString=Qx;function Qx(i){var e=[],t=this.nodeType===Vh&&this.documentElement||this,r=t.prefix,n=t.namespaceURI;if(n&&r==null){var r=t.lookupPrefix(n);if(r==null)var s=[{namespace:n,prefix:null}]}return fu(this,e,i,s),e.join("")}function My(i,e,t){var r=i.prefix||"",n=i.namespaceURI;if(!n||r==="xml"&&n===xs.XML||n===xs.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===r)return a.namespace!==n}return!0}function xm(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Gx),'"')}function fu(i,e,t,r){r||(r=[]);var n=i.nodeType===Vh?i:i.ownerDocument,s=n.type==="html";if(t)if(i=t(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Gi:var a=i.attributes,o=a.length,E=i.firstChild,l=i.tagName,c=l;if(!s&&!i.prefix&&i.namespaceURI){for(var h,d=0;d<a.length;d++)if(a.item(d).name==="xmlns"){h=a.item(d).value;break}if(!h)for(var p=r.length-1;p>=0;p--){var g=r[p];if(g.prefix===""&&g.namespace===i.namespaceURI){h=g.namespace;break}}if(h!==i.namespaceURI)for(var p=r.length-1;p>=0;p--){var g=r[p];if(g.namespace===i.namespaceURI){g.prefix&&(c=g.prefix+":"+l);break}}}e.push("<",c);for(var y=0;y<o;y++){var b=a.item(y);b.prefix=="xmlns"?r.push({prefix:b.localName,namespace:b.value}):b.nodeName=="xmlns"&&r.push({prefix:"",namespace:b.value})}for(var y=0;y<o;y++){var b=a.item(y);if(My(b,s,r)){var w=b.prefix||"",v=b.namespaceURI;xm(e,w?"xmlns:"+w:"xmlns",v),r.push({prefix:w,namespace:v})}fu(b,e,t,r)}if(l===c&&My(i,s,r)){var w=i.prefix||"",v=i.namespaceURI;xm(e,w?"xmlns:"+w:"xmlns",v),r.push({prefix:w,namespace:v})}var A=!E;if(A&&(s||i.namespaceURI===xs.HTML)&&(A=uk(l)),A)e.push("/>");else{if(e.push(">"),s&&lk(l))for(;E;)E.data?e.push(E.data):fu(E,e,t,r.slice()),E=E.nextSibling;else for(;E;)fu(E,e,t,r.slice()),E=E.nextSibling;e.push("</",c,">")}return;case Vh:case oo:for(var E=i.firstChild;E;)fu(E,e,t,r.slice()),E=E.nextSibling;return;case Pc:return xm(e,i.name,i.value);case tg:return e.push(i.data.replace(/[<&>]/g,Gx));case Fx:return e.push(es.CDATA_START,i.data,es.CDATA_END);case jx:return e.push(es.COMMENT_START,i.data,es.COMMENT_END);case Ux:var _=i.publicId,C=i.systemId;e.push(es.DOCTYPE_DECL_START," ",i.name),_?(e.push(" ",es.PUBLIC," ",_),C&&C!=="."&&e.push(" ",C)):C&&C!=="."&&e.push(" ",es.SYSTEM," ",C),i.internalSubset&&e.push(" [",i.internalSubset,"]"),e.push(">");return;case zx:return e.push("<?",i.target," ",i.data,"?>");case Bx:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function Jx(i,e,t){var r;switch(e.nodeType){case Gi:r=e.cloneNode(!1),r.ownerDocument=i;case oo:break;case Pc:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var n=e.firstChild;n;)r.appendChild(Jx(i,n,t)),n=n.nextSibling;return r}function wb(i,e,t){var r=new e.constructor(Cn);for(var n in e)if(Dc(e,n)){var s=e[n];typeof s!="object"&&s!=r[n]&&(r[n]=s)}switch(e.childNodes&&(r.childNodes=new Mr),r.ownerDocument=i,r.nodeType){case Gi:var a=e.attributes,o=r.attributes=new Rc,l=a.length;o._ownerElement=r;for(var c=0;c<l;c++)r.setAttributeNode(wb(i,a.item(c),!0));break;case Pc:t=!0}if(t)for(var h=e.firstChild;h;)r.appendChild(wb(i,h,t)),h=h.nextSibling;return r}function eA(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case Gi:case oo:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(i(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(Bl.prototype,"length",{get:function(){return zg(this),this.$$length}}),Object.defineProperty(It.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case Gi:case oo:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),eA=function(e,t,r){e["$$"+t]=r}}}catch{}vr._updateLiveList=zg;vr.Attr=Vl;vr.CDATASection=Ug;vr.CharacterData=Oc;vr.Comment=jg;vr.Document=lo;vr.DocumentFragment=Ff;vr.DocumentType=Hg;vr.DOMImplementation=Vx;vr.Element=co;vr.Entity=Jb;vr.EntityReference=$g;vr.LiveNodeList=Bl;vr.NamedNodeMap=Rc;vr.Node=It;vr.NodeList=Mr;vr.Notation=Qb;vr.Text=Of;vr.ProcessingInstruction=Vg;vr.XMLSerializer=Kx;var Fc={},tA={};(function(i){var e=br.freeze;i.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
42
|
+
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),i.entityMap=i.HTML_ENTITIES})(tA);var Gg={},Bc=br,dt=gt,rA=go,Ek=Bc.isHTMLEscapableRawTextElement,_k=Bc.isHTMLMimeType,Ck=Bc.isHTMLRawTextElement,Gh=Bc.hasOwn,Ly=Bc.NAMESPACE,Oy=rA.ParseError,Sk=rA.DOMException,eh=0,ba=1,eu=2,th=3,tu=4,ru=5,rh=6,lp=7;function nA(){}nA.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),iA(e,e=Object.create(null)),Tk(i,e,t,r,this.errorHandler),r.endDocument()}};var ev=/&#?\w+;?/g;function Tk(i,e,t,r,n){var s=_k(r.mimeType);i.indexOf(dt.UNICODE_REPLACEMENT_CHARACTER)>=0&&n.warning("Unicode replacement character detected, source encoding issues?");function a(K){if(K>65535){K-=65536;var be=55296+(K>>10),te=56320+(K&1023);return String.fromCharCode(be,te)}else return String.fromCharCode(K)}function o(K){var be=K[K.length-1]===";"?K:K+";";if(!s&&be!==K)return n.error("EntityRef: expecting ;"),K;var te=dt.Reference.exec(be);if(!te||te[0].length!==be.length)return n.error("entity not matching Reference production: "+K),K;var j=be.slice(1,-1);return Gh(t,j)?t[j]:j.charAt(0)==="#"?a(parseInt(j.substring(1).replace("x","0x"))):(n.error("entity not found:"+K),K)}function l(K){if(K>w){var be=i.substring(w,K).replace(ev,o);p&&g(w),r.characters(be,0,K-w),w=K}}var c=0,h=0,d=/\r\n?|\n|$/g,p=r.locator;function g(K,be){for(;K>=h&&(be=d.exec(i));)c=h,h=be.index+be[0].length,p.lineNumber++;p.columnNumber=K-c+1}for(var y=[{currentNSMap:e}],b=[],w=0;;){try{var v=i.indexOf("<",w);if(v<0){if(!s&&b.length>0)return n.fatalError("unclosed xml tag(s): "+b.join(", "));if(!i.substring(w).match(/^\s*$/)){var A=r.doc,E=A.createTextNode(i.substring(w));if(A.documentElement)return n.error("Extra content at the end of the document");A.appendChild(E),r.currentElement=E}return}if(v>w){var _=i.substring(w,v);!s&&b.length===0&&(_=_.replace(new RegExp(dt.S_OPT.source,"g"),""),_&&n.error("Unexpected content outside root element: '"+_+"'")),l(v)}switch(i.charAt(v+1)){case"/":var S=i.indexOf(">",v+2),C=i.substring(v+2,S>0?S:void 0);if(!C)return n.fatalError("end tag name missing");var I=S>0&&dt.reg("^",dt.QName_group,dt.S_OPT,"$").exec(C);if(!I)return n.fatalError('end tag name contains invalid characters: "'+C+'"');if(!r.currentElement&&!r.doc.documentElement)return;var k=b[b.length-1]||r.currentElement.tagName||r.doc.documentElement.tagName||"";if(k!==I[1]){var D=I[1].toLowerCase();if(!s||k.toLowerCase()!==D)return n.fatalError('Opening and ending tag mismatch: "'+k+'" != "'+C+'"')}var R=y.pop();b.pop();var z=R.localNSMap;if(r.endElement(R.uri,R.localName,k),z)for(var G in z)Gh(z,G)&&r.endPrefixMapping(G);S++;break;case"?":p&&g(v),S=Rk(i,v,r,n);break;case"!":p&&g(v),S=aA(i,v,r,n,s);break;default:p&&g(v);var O=new oA,X=y[y.length-1].currentNSMap,S=kk(i,v,O,X,o,n,s),J=O.length;if(O.closed||(s&&Bc.isHTMLVoidElement(O.tagName)?O.closed=!0:b.push(O.tagName)),p&&J){for(var Y=Fy(p,{}),W=0;W<J;W++){var fe=O[W];g(fe.offset),fe.locator=Fy(p,{})}r.locator=Y,By(O,r,X)&&y.push(O),r.locator=p}else By(O,r,X)&&y.push(O);s&&!O.closed?S=Dk(i,S,O.tagName,o,r):S++}}catch(K){if(K instanceof Oy)throw K;if(K instanceof Sk)throw new Oy(K.name+": "+K.message,r.locator,K);n.error("element parse error: "+K),S=-1}S>w?w=S:l(Math.max(v,w)+1)}}function Fy(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function kk(i,e,t,r,n,s,a){function o(g,y,b){if(Gh(t.attributeNames,g))return s.fatalError("Attribute "+g+" redefined");if(!a&&y.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");t.addValue(g,y.replace(/[\t\n\r]/g," ").replace(ev,n),b)}for(var l,c,h=++e,d=eh;;){var p=i.charAt(h);switch(p){case"=":if(d===ba)l=i.slice(e,h),d=th;else if(d===eu)d=th;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===th||d===ba)if(d===ba&&(s.warning('attribute value must after "="'),l=i.slice(e,h)),e=h+1,h=i.indexOf(p,e),h>0)c=i.slice(e,h),o(l,c,e-1),d=ru;else throw new Error("attribute value no end '"+p+"' match");else if(d==tu)c=i.slice(e,h),o(l,c,e),s.warning('attribute "'+l+'" missed start quot('+p+")!!"),e=h+1,d=ru;else throw new Error('attribute value must after "="');break;case"/":switch(d){case eh:t.setTagName(i.slice(e,h));case ru:case rh:case lp:d=lp,t.closed=!0;case tu:case ba:break;case eu:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==eh&&t.setTagName(i.slice(e,h)),h;case">":switch(d){case eh:t.setTagName(i.slice(e,h));case ru:case rh:case lp:break;case tu:case ba:c=i.slice(e,h),c.slice(-1)==="/"&&(t.closed=!0,c=c.slice(0,-1));case eu:d===eu&&(c=l),d==tu?(s.warning('attribute "'+c+'" missed quot(")!'),o(l,c,e)):(a||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),o(c,c,e));break;case th:if(!a)return s.fatalError(`AttValue: ' or " expected`)}return h;case"":p=" ";default:if(p<=" ")switch(d){case eh:t.setTagName(i.slice(e,h)),d=rh;break;case ba:l=i.slice(e,h),d=eu;break;case tu:var c=i.slice(e,h);s.warning('attribute "'+c+'" missed quot(")!!'),o(l,c,e);case ru:d=rh;break}else switch(d){case eu:a||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,e),e=h,d=ba;break;case ru:s.warning('attribute space is required"'+l+'"!!');case rh:d=ba,e=h;break;case th:d=tu,e=h;break;case lp:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function By(i,e,t){for(var r=i.tagName,n=null,d=i.length;d--;){var s=i[d],a=s.qName,o=s.value,p=a.indexOf(":");if(p>0)var l=s.prefix=a.slice(0,p),c=a.slice(p+1),h=l==="xmlns"&&c;else c=a,l=null,h=a==="xmlns"&&"";s.localName=c,h!==!1&&(n==null&&(n=Object.create(null),iA(t,t=Object.create(null))),t[h]=n[h]=o,s.uri=Ly.XMLNS,e.startPrefixMapping(h,o))}for(var d=i.length;d--;)s=i[d],s.prefix&&(s.prefix==="xml"&&(s.uri=Ly.XML),s.prefix!=="xmlns"&&(s.uri=t[s.prefix]));var p=r.indexOf(":");p>0?(l=i.prefix=r.slice(0,p),c=i.localName=r.slice(p+1)):(l=null,c=i.localName=r);var g=i.uri=t[l||""];if(e.startElement(g,c,r,i),i.closed){if(e.endElement(g,c,r),n)for(l in n)Gh(n,l)&&e.endPrefixMapping(l)}else return i.currentNSMap=t,i.localNSMap=n,!0}function Dk(i,e,t,r,n){var s=Ek(t);if(s||Ck(t)){var a=i.indexOf("</"+t+">",e),o=i.substring(e+1,a);return s&&(o=o.replace(ev,r)),n.characters(o,0,o.length),a}return e+1}function iA(i,e){for(var t in i)Gh(i,t)&&(e[t]=i[t])}function sA(i,e){var t=e;function r(h){return h=h||0,i.charAt(t+h)}function n(h){h=h||1,t+=h}function s(){for(var h=0;t<i.length;){var d=r();if(d!==" "&&d!==`
|
|
43
|
+
`&&d!==" "&&d!=="\r")return h;h++,n()}return-1}function a(){return i.substring(t)}function o(h){return i.substring(t,t+h.length)===h}function l(h){return i.substring(t,t+h.length).toUpperCase()===h.toUpperCase()}function c(h){var d=dt.reg("^",h),p=d.exec(a());return p?(n(p[0].length),p[0]):null}return{char:r,getIndex:function(){return t},getMatch:c,getSource:function(){return i},skip:n,skipBlanks:s,substringFromIndex:a,substringStartsWith:o,substringStartsWithCaseInsensitive:l}}function Pk(i,e){function t(o,l){var c=dt.PI.exec(o.substringFromIndex());return c?c[1].toLowerCase()==="xml"?l.fatalError("xml declaration is only allowed at the start of the document, but found at position "+o.getIndex()):(o.skip(c[0].length),c[0]):l.fatalError("processing instruction is not well-formed at position "+o.getIndex())}var r=i.getSource();if(i.char()==="["){i.skip(1);for(var n=i.getIndex();i.getIndex()<r.length;){if(i.skipBlanks(),i.char()==="]"){var s=r.substring(n,i.getIndex());return i.skip(1),s}var a=null;if(i.char()==="<"&&i.char(1)==="!")switch(i.char(2)){case"E":i.char(3)==="L"?a=i.getMatch(dt.elementdecl):i.char(3)==="N"&&(a=i.getMatch(dt.EntityDecl));break;case"A":a=i.getMatch(dt.AttlistDecl);break;case"N":a=i.getMatch(dt.NotationDecl);break;case"-":a=i.getMatch(dt.Comment);break}else if(i.char()==="<"&&i.char(1)==="?")a=t(i,e);else if(i.char()==="%")a=i.getMatch(dt.PEReference);else return e.fatalError("Error detected in Markup declaration");if(!a)return e.fatalError("Error in internal subset at position "+i.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}function aA(i,e,t,r,n){var s=sA(i,e);switch(n?s.char(2).toUpperCase():s.char(2)){case"-":var a=s.getMatch(dt.Comment);return a?(t.comment(a,dt.COMMENT_START.length,a.length-dt.COMMENT_START.length-dt.COMMENT_END.length),s.getIndex()):r.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var o=s.getMatch(dt.CDSect);return o?!n&&!t.currentElement?r.fatalError("CDATA outside of element"):(t.startCDATA(),t.characters(o,dt.CDATA_START.length,o.length-dt.CDATA_START.length-dt.CDATA_END.length),t.endCDATA(),s.getIndex()):r.fatalError("Invalid CDATA starting at position "+e);case"D":{if(t.doc&&t.doc.documentElement)return r.fatalError("Doctype not allowed inside or after documentElement at position "+s.getIndex());if(n?!s.substringStartsWithCaseInsensitive(dt.DOCTYPE_DECL_START):!s.substringStartsWith(dt.DOCTYPE_DECL_START))return r.fatalError("Expected "+dt.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(dt.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return r.fatalError("Expected whitespace after "+dt.DOCTYPE_DECL_START+" at position "+s.getIndex());var l={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(l.name=s.getMatch(dt.Name),!l.name)return r.fatalError("doctype name missing or contains unexpected characters at position "+s.getIndex());if(n&&l.name.toLowerCase()!=="html"&&r.warning("Unexpected DOCTYPE in HTML document at position "+s.getIndex()),s.skipBlanks(),s.substringStartsWith(dt.PUBLIC)||s.substringStartsWith(dt.SYSTEM)){var c=dt.ExternalID_match.exec(s.substringFromIndex());if(!c)return r.fatalError("doctype external id is not well-formed at position "+s.getIndex());c.groups.SystemLiteralOnly!==void 0?l.systemId=c.groups.SystemLiteralOnly:(l.systemId=c.groups.SystemLiteral,l.publicId=c.groups.PubidLiteral),s.skip(c[0].length)}else if(n&&s.substringStartsWithCaseInsensitive(dt.SYSTEM)){if(s.skip(dt.SYSTEM.length),s.skipBlanks()<1)return r.fatalError("Expected whitespace after "+dt.SYSTEM+" at position "+s.getIndex());if(l.systemId=s.getMatch(dt.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return r.fatalError("Expected "+dt.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+dt.SYSTEM+" at position "+s.getIndex())}return n&&l.systemId&&!dt.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&r.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),n||(s.skipBlanks(),l.internalSubset=Pk(s,r)),s.skipBlanks(),s.char()!==">"?r.fatalError("doctype not terminated with > at position "+s.getIndex()):(s.skip(1),t.startDTD(l.name,l.publicId,l.systemId,l.internalSubset),t.endDTD(),s.getIndex())}default:return r.fatalError('Not well-formed XML starting with "<!" at position '+e)}}function Rk(i,e,t,r){var n=i.substring(e).match(dt.PI);if(!n)return r.fatalError("Invalid processing instruction starting at position "+e);if(n[1].toLowerCase()==="xml"){if(e>0)return r.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!dt.XMLDecl.test(i.substring(e)))return r.fatalError("xml declaration is not well-formed")}return t.processingInstruction(n[1],n[2]),e+n[0].length}function oA(){this.attributeNames=Object.create(null)}oA.prototype={setTagName:function(i){if(!dt.QName_exact.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!dt.QName_exact.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};Gg.XMLReader=nA;Gg.parseUtils=sA;Gg.parseDoctypeCommentOrCData=aA;var Yl=br,Ik=vr,Nk=go,zy=tA,Mk=Gg,Lk=Ik.DOMImplementation,Ok=Yl.hasDefaultHTMLNamespace,Fk=Yl.isHTMLMimeType,Bk=Yl.isValidMimeType,lA=Yl.MIME_TYPE,Am=Yl.NAMESPACE,jy=Nk.ParseError,zk=Mk.XMLReader;function uA(i){return i.replace(/\r[\n\u0085]/g,`
|
|
44
|
+
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
45
|
+
`)}function cA(i){if(i=i||{},i.locator===void 0&&(i.locator=!0),this.assign=i.assign||Yl.assign,this.domHandler=i.domHandler||qg,this.onError=i.onError||i.errorHandler,i.errorHandler&&typeof i.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");i.errorHandler&&i.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=i.normalizeLineEndings||uA,this.locator=!!i.locator,this.xmlns=this.assign(Object.create(null),i.xmlns)}cA.prototype.parseFromString=function(i,e){if(!Bk(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var t=this.assign(Object.create(null),this.xmlns),r=zy.XML_ENTITIES,n=t[""]||null;Ok(e)?(r=zy.HTML_ENTITIES,n=Am.HTML):e===lA.XML_SVG_IMAGE&&(n=Am.SVG),t[""]=n,t.xml=t.xml||Am.XML;var s=new this.domHandler({mimeType:e,defaultNamespace:n,onError:this.onError}),a=this.locator?{}:void 0;this.locator&&s.setDocumentLocator(a);var o=new zk;o.errorHandler=s,o.domBuilder=s;var l=!Yl.isHTMLMimeType(e);return l&&typeof i!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(i)),t,r),s.doc.documentElement||o.errorHandler.fatalError("missing root element"),s.doc};function qg(i){var e=i||{};this.mimeType=e.mimeType||lA.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}function nu(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}qg.prototype={startDocument:function(){var i=new Lk;this.doc=Fk(this.mimeType)?i.createHTMLDocument(!1):i.createDocument(this.defaultNamespace,"")},startElement:function(i,e,t,r){var n=this.doc,s=n.createElementNS(i,t||e),a=r.length;up(this,s),this.currentElement=s,this.locator&&nu(this.locator,s);for(var o=0;o<a;o++){var i=r.getURI(o),l=r.getValue(o),t=r.getQName(o),c=n.createAttributeNS(i,t);this.locator&&nu(r.getLocator(o),c),c.value=c.nodeValue=l,s.setAttributeNode(c)}},endElement:function(i,e,t){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(i,e){},endPrefixMapping:function(i){},processingInstruction:function(i,e){var t=this.doc.createProcessingInstruction(i,e);this.locator&&nu(this.locator,t),up(this,t)},ignorableWhitespace:function(i,e,t){},characters:function(i,e,t){if(i=Uy.apply(this,arguments),i){if(this.cdata)var r=this.doc.createCDATASection(i);else var r=this.doc.createTextNode(i);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(i)&&this.doc.appendChild(r),this.locator&&nu(this.locator,r)}},skippedEntity:function(i){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(i){i&&(i.lineNumber=0),this.locator=i},comment:function(i,e,t){i=Uy.apply(this,arguments);var r=this.doc.createComment(i);this.locator&&nu(this.locator,r),up(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(i,e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(i,e,t,r);this.locator&&nu(this.locator,s),up(this,s),this.doc.doctype=s}},reportError:function(i,e){if(typeof this.onError=="function")try{this.onError(i,e,this)}catch(t){throw new jy("Reporting "+i+' "'+e+'" caused '+t,this.locator)}else console.error("[xmldom "+i+"] "+e,jk(this.locator))},warning:function(i){this.reportError("warning",i)},error:function(i){this.reportError("error",i)},fatalError:function(i){throw this.reportError("fatalError",i),new jy(i,this.locator)}};function jk(i){if(i)return`
|
|
46
|
+
@#[line:`+i.lineNumber+",col:"+i.columnNumber+"]"}function Uy(i,e,t){return typeof i=="string"?i.substr(e,t):i.length>=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){qg.prototype[i]=function(){return null}});function up(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}function Uk(i){if(i==="error")throw"onErrorStopParsing"}function Hk(){throw"onWarningStopParsing"}Fc.__DOMHandler=qg;Fc.DOMParser=cA;Fc.normalizeLineEndings=uA;Fc.onErrorStopParsing=Uk;Fc.onWarningStopParsing=Hk;var zc=br;Nt.assign=zc.assign;Nt.hasDefaultHTMLNamespace=zc.hasDefaultHTMLNamespace;Nt.isHTMLMimeType=zc.isHTMLMimeType;Nt.isValidMimeType=zc.isValidMimeType;Nt.MIME_TYPE=zc.MIME_TYPE;Nt.NAMESPACE=zc.NAMESPACE;var Wg=go;Nt.DOMException=Wg.DOMException;Nt.DOMExceptionName=Wg.DOMExceptionName;Nt.ExceptionCode=Wg.ExceptionCode;Nt.ParseError=Wg.ParseError;var Or=vr;Nt.Attr=Or.Attr;Nt.CDATASection=Or.CDATASection;Nt.CharacterData=Or.CharacterData;Nt.Comment=Or.Comment;Nt.Document=Or.Document;Nt.DocumentFragment=Or.DocumentFragment;Nt.DocumentType=Or.DocumentType;Nt.DOMImplementation=Or.DOMImplementation;Nt.Element=Or.Element;Nt.Entity=Or.Entity;Nt.EntityReference=Or.EntityReference;Nt.LiveNodeList=Or.LiveNodeList;Nt.NamedNodeMap=Or.NamedNodeMap;Nt.Node=Or.Node;Nt.NodeList=Or.NodeList;Nt.Notation=Or.Notation;Nt.ProcessingInstruction=Or.ProcessingInstruction;Nt.Text=Or.Text;Nt.XMLSerializer=Or.XMLSerializer;var Xg=Fc;Nt.DOMParser=Xg.DOMParser;Nt.normalizeLineEndings=Xg.normalizeLineEndings;Nt.onErrorStopParsing=Xg.onErrorStopParsing;Nt.onWarningStopParsing=Xg.onWarningStopParsing;function $k(i){return i[i.length-1]}function Vk(i){return i[0]}var tv={last:$k,first:Vk};function qh(i){"@babel/helpers - typeof";return qh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qh(i)}function Hy(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,r)}return t}function Gk(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hy(Object(t),!0).forEach(function(r){qk(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Hy(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function qk(i,e,t){return(e=Wk(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Wk(i){var e=Xk(i,"string");return qh(e)=="symbol"?e:e+""}function Xk(i,e){if(qh(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e);if(qh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var hA=tv,Vp=hA.last,Do=hA.first;function Zl(i){this.name="GenericError",this.message=i,this.stack=new Error(i).stack}Zl.prototype=Error.prototype;function gn(i){this.name="TemplateError",this.message=i,this.stack=new Error(i).stack}gn.prototype=new Zl;function Wh(i){this.name="RenderingError",this.message=i,this.stack=new Error(i).stack}Wh.prototype=new Zl;function Yg(i){this.name="ScopeParserError",this.message=i,this.stack=new Error(i).stack}Yg.prototype=new Zl;function mo(i){this.name="InternalError",this.properties={explanation:"InternalError"},this.message=i,this.stack=new Error(i).stack}mo.prototype=new Zl;function rv(i){this.name="APIVersionError",this.properties={explanation:"APIVersionError"},this.message=i,this.stack=new Error(i).stack}rv.prototype=new Zl;function Yk(i,e){var t=new rv(i);throw t.properties=Gk({id:"api_version_error"},e),t}function Zk(i){var e=new gn("Multi error");throw e.properties={errors:i,id:"multi_error",explanation:"The template has multiple errors"},e}function Kk(i){var e=new gn("Unopened tag");return e.properties={xtag:Vp(i.xtag.split(" ")),id:"unopened_tag",context:i.xtag,offset:i.offset,lIndex:i.lIndex,explanation:'The tag beginning with "'.concat(i.xtag.substr(0,10),'" is unopened')},e}function Qk(i){var e=new gn("Duplicate open tag, expected one open tag");return e.properties={xtag:Do(i.xtag.split(" ")),id:"duplicate_open_tag",context:i.xtag,offset:i.offset,lIndex:i.lIndex,explanation:'The tag beginning with "'.concat(i.xtag.substr(0,10),'" has duplicate open tags')},e}function Jk(i){var e=new gn("Duplicate close tag, expected one close tag");return e.properties={xtag:Do(i.xtag.split(" ")),id:"duplicate_close_tag",context:i.xtag,offset:i.offset,lIndex:i.lIndex,explanation:'The tag ending with "'.concat(i.xtag.substr(0,10),'" has duplicate close tags')},e}function eD(i){var e=new gn("Unclosed tag");return e.properties={xtag:Do(i.xtag.split(" ")).substr(1),id:"unclosed_tag",context:i.xtag,offset:i.offset,lIndex:i.lIndex,explanation:'The tag beginning with "'.concat(i.xtag.substr(0,10),'" is unclosed')},e}function tD(i){var e=new gn('No tag "'.concat(i.element,'" was found at the ').concat(i.position)),t=i.parsed[i.index];throw e.properties={id:"no_xml_tag_found_at_".concat(i.position),explanation:'No tag "'.concat(i.element,'" was found at the ').concat(i.position),offset:t.offset,part:t,parsed:i.parsed,index:i.index,element:i.element},e}function rD(i){var e=i.tag,t=i.value,r=i.offset,n=new Wh("There are some XML corrupt characters");return n.properties={id:"invalid_xml_characters",xtag:e,value:t,offset:r,explanation:"There are some corrupt characters for the field ".concat(e)},n}function nD(i){var e=i.tag,t=i.value,r=i.offset,n=new Wh("Non string values are not allowed for rawXML tags");return n.properties={id:"invalid_raw_xml_value",xtag:e,value:t,offset:r,explanation:"The value of the raw tag : '".concat(e,"' is not a string")},n}function iD(i){var e=i.part,t=e.value,r=e.offset,n=i.id,s=n===void 0?"raw_tag_outerxml_invalid":n,a=i.message,o=a===void 0?"Raw tag not in paragraph":a,l=i.part,c=i.explanation,h=c===void 0?'The tag "'.concat(t,'" is not inside a paragraph'):c;typeof h=="function"&&(h=h(l));var d=new gn(o);throw d.properties={id:s,explanation:h,rootError:i.rootError,xtag:t,offset:r,postparsed:i.postparsed,expandTo:i.expandTo,index:i.index},d}function sD(i){var e=new gn("Raw tag should be the only text in paragraph"),t=i.part.value;throw e.properties={id:"raw_xml_tag_should_be_only_text_in_paragraph",explanation:'The raw tag "'.concat(t,'" should be the only text in this paragraph. This means that this tag should not be surrounded by any text or spaces.'),xtag:t,offset:i.part.offset,paragraphParts:i.paragraphParts},e}function aD(i){var e=i.location,t=i.offset,r=i.square,n=e==="start"?"unclosed":"unopened",s=e==="start"?"Unclosed":"Unopened",a=new gn("".concat(s," loop")),o=i.value;return a.properties={id:"".concat(n,"_loop"),explanation:'The loop with tag "'.concat(o,'" is ').concat(n),xtag:o,offset:t},r&&(a.properties.square=r),a}function oD(i,e){var t=new gn("Unbalanced loop tag"),r=e[0].part.value,n=e[1].part.value,s=i[0].part.value,a=i[1].part.value;return t.properties={id:"unbalanced_loop_tags",explanation:"Unbalanced loop tags {#".concat(r,"}{/").concat(n,"}{#").concat(s,"}{/").concat(a,"}"),offset:[e[0].part.offset,i[1].part.offset],lastPair:{left:e[0].part.value,right:e[1].part.value},pair:{left:i[0].part.value,right:i[1].part.value}},t}function lD(i){var e=i.tags,t=new gn("Closing tag does not match opening tag");return t.properties={id:"closing_tag_does_not_match_opening_tag",explanation:'The tag "'.concat(e[0].value,'" is closed by the tag "').concat(e[1].value,'"'),openingtag:Do(e).value,offset:[Do(e).offset,Vp(e).offset],closingtag:Vp(e).value},Do(e).square&&(t.properties.square=[Do(e).square,Vp(e).square]),t}function uD(i){var e=i.tag,t=i.rootError,r=i.offset,n=new Yg("Scope parser compilation failed");return n.properties={id:"scopeparser_compilation_failed",offset:r,xtag:e,explanation:'The scope parser for the tag "'.concat(e,'" failed to compile'),rootError:t},n}function cD(i){var e=i.tag,t=i.scope,r=i.error,n=i.offset,s=new Yg("Scope parser execution failed");return s.properties={id:"scopeparser_execution_failed",explanation:"The scope parser for the tag ".concat(e," failed to execute"),scope:t,offset:n,xtag:e,rootError:r},s}function hD(i){var e=i.tag,t=i.offset,r=new gn('The position of the loop tags "'.concat(e,'" would produce invalid XML'));return r.properties={xtag:e,id:"loop_position_invalid",explanation:'The tags "'.concat(e,'" are misplaced in the document, for example one of them is in a table and the other one outside the table'),offset:t},r}function dD(i,e){var t='Unimplemented tag type "'.concat(i.type,'"');i.module&&(t+=' "'.concat(i.module,'"'));var r=new gn(t);throw r.properties={part:i,index:e,id:"unimplemented_tag_type"},r}function fD(){var i=new mo("Malformed xml");throw i.properties={explanation:"The template contains malformed xml",id:"malformed_xml"},i}function pD(){var i=new mo("You must run `.compile()` before running `.resolveData()`");throw i.properties={id:"resolve_before_compile",explanation:"You must run `.compile()` before running `.resolveData()`"},i}function gD(){var i=new mo("You should not call .render on a document that had compilation errors");throw i.properties={id:"render_on_invalid_template",explanation:"You should not call .render on a document that had compilation errors"},i}function mD(){var i=new mo("You should not call .render twice on the same docxtemplater instance");throw i.properties={id:"render_twice",explanation:"You should not call .render twice on the same docxtemplater instance"},i}function bD(i){var e=Object.keys(i.files).slice(0,10),t="";e.length===0?t="Empty zip file":t="Zip file contains : ".concat(e.join(","));var r=new mo("The filetype for this file could not be identified, is this file corrupted ? ".concat(t));throw r.properties={id:"filetype_not_identified",explanation:"The filetype for this file could not be identified, is this file corrupted ? ".concat(t)},r}function vD(i,e){var t=new gn("An XML file has invalid xml");throw t.properties={id:"file_has_invalid_xml",content:i,offset:e,explanation:"The docx contains invalid XML, it is most likely corrupt"},t}function yD(i){var e=new mo('The filetype "'.concat(i,'" is not handled by docxtemplater'));throw e.properties={id:"filetype_not_handled",explanation:'The file you are trying to generate is of type "'.concat(i,'", but only docx and pptx formats are handled'),fileType:i},e}var Xi={XTError:Zl,XTTemplateError:gn,XTInternalError:mo,XTScopeParserError:Yg,XTAPIVersionError:rv,RenderingError:Wh,XTRenderingError:Wh,getClosingTagNotMatchOpeningTag:lD,getLoopPositionProducesInvalidXMLError:hD,getScopeCompilationError:uD,getScopeParserExecutionError:cD,getUnclosedTagException:eD,getUnopenedTagException:Kk,getUnmatchedLoopException:aD,getDuplicateCloseTagException:Jk,getDuplicateOpenTagException:Qk,getCorruptCharactersException:rD,getInvalidRawXMLValueException:nD,getUnbalancedLoopException:oD,throwApiVersionError:Yk,throwFileTypeNotHandled:yD,throwFileTypeNotIdentified:bD,throwMalformedXml:fD,throwMultiError:Zk,throwExpandNotFound:iD,throwRawTagShouldBeOnlyTextInParagraph:sD,throwUnimplementedTagType:dD,throwXmlTagNotFound:tD,throwXmlInvalid:vD,throwResolveBeforeCompile:pD,throwRenderInvalidTemplate:gD,throwRenderTwice:mD};function wD(i,e){return _D(i)||ED(i,e)||AD(i,e)||xD()}function xD(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
47
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AD(i,e){if(i){if(typeof i=="string")return $y(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?$y(i,e):void 0}}function $y(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=Array(e);t<e;t++)r[t]=i[t];return r}function ED(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r,n,s,a,o=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(r=s.call(t)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(h){c=!0,n=h}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw n}}return o}}function _D(i){if(Array.isArray(i))return i}var dA=Nt,CD=dA.DOMParser,SD=dA.XMLSerializer,TD=Xi,fA=TD.throwXmlTagNotFound,pA=tv,kD=pA.last,DD=pA.first;function PD(i){return/^[ \n\r\t]+$/.test(i)}function RD(i){return{get:function(t){return i==="."?t:t&&t[i]}}}var Em={};function ID(i,e,t){var r;if(Em[e]?r=Em[e]:(r=new RegExp("(<.* ".concat(e,'=")([^"]*)(".*)$')),Em[e]=r),r.test(i))return i.replace(r,"$1".concat(t,"$3"));var n=i.lastIndexOf("/>");return n===-1&&(n=i.lastIndexOf(">")),i.substr(0,n)+" ".concat(e,'="').concat(t,'"')+i.substr(n)}function ND(i,e){var t=i.indexOf(" ".concat(e,'="'));if(t===-1)return null;var r=i.substr(t).search(/["']/)+t,n=i.substr(r+1).search(/["']/)+r;return i.substr(r+1,n-r)}function MD(i,e){return i.indexOf(e,i.length-e.length)!==-1}function LD(i,e){return i.substring(0,e.length)===e}function OD(i){for(var e=[],t={},r=[],n=0,s=i.length;n<s;++n)t[i[n]]?e.push(i[n]):(t[i[n]]=!0,r.push(i[n]));return e}function FD(i){for(var e={},t=[],r=0,n=i.length;r<n;++r)e[i[r]]||(e[i[r]]=!0,t.push(i[r]));return t}function BD(i,e){for(var t=[[]],r=0;r<i.length;r++){var n=i[r],s=t[t.length-1],a=e(n);a==="start"?t.push([n]):a==="end"?(s.push(n),t.push([])):s.push(n)}for(var o=[],l=0;l<t.length;l++){var c=t[l];c.length>0&&o.push(c)}return o}function zD(){return{errorLogging:"json",stripInvalidXMLChars:!1,paragraphLoop:!1,nullGetter:function(e){return e.module?"":"undefined"},xmlFileNames:["[Content_Types].xml"],parser:RD,linebreaks:!1,fileTypeConfig:null,delimiters:{start:"{",end:"}"},syntax:{changeDelimiterPrefix:"="}}}function jD(i){return new SD().serializeToString(i).replace(/xmlns(:[a-z0-9]+)?="" ?/g,"")}function UD(i){return i.charCodeAt(0)===65279&&(i=i.substr(1)),new CD().parseFromString(i,"text/xml")}var gA=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]],Xh=gA.map(function(i){var e=wD(i,2),t=e[0],r=e[1];return{rstart:new RegExp(r,"g"),rend:new RegExp(t,"g"),start:r,end:t}});function HD(i){for(var e=Xh.length-1;e>=0;e--){var t=Xh[e];i=i.replace(t.rstart,t.end)}return i}function $D(i){var e;(e=i)!==null&&e!==void 0&&e.toString?i=i.toString():i="";for(var t,r=0,n=Xh.length;r<n;r++)t=Xh[r],i=i.replace(t.rend,t.start);return i}function VD(i){for(var e=[],t=0;t<i.length;t++)for(var r=i[t],n=0;n<r.length;n++){var s=r[n];e.push(s)}return e}function GD(i,e){if(!e)return i;for(var t=0,r=e.length;t<r;t++)i.push(e[t]);return i}var qD=new RegExp(" ","g");function WD(i){return i.replace(qD," ")}function XD(i,e){for(var t=[],r;(r=i.exec(e))!=null;)t.push({array:r,offset:r.index});return t}function nv(i,e){return i==="</"+e+">"}function iv(i,e){return i.indexOf("<"+e)===0&&[">"," ","/"].indexOf(i[e.length+1])!==-1}function YD(i,e,t){var r=mA(i,e,t);if(r!==null)return r;fA({position:"right",element:e,parsed:i,index:t})}function mA(i,e,t){typeof e=="string"&&(e=[e]);for(var r=1,n=t,s=i.length;n<s;n++)for(var a=i[n],o=0,l=e;o<l.length;o++){var c=l[o];if(nv(a.value,c)&&r--,iv(a.value,c)&&r++,r===0)return n}return null}function ZD(i,e,t){var r=bA(i,e,t);if(r!==null)return r;fA({position:"left",element:e,parsed:i,index:t})}function bA(i,e,t){typeof e=="string"&&(e=[e]);for(var r=1,n=t;n>=0;n--)for(var s=i[n],a=0,o=e;a<o.length;a++){var l=o[a];if(iv(s.value,l)&&r--,nv(s.value,l)&&r++,r===0)return n}return null}function KD(i,e){var t=e.type,r=e.tag,n=e.position;return t==="tag"&&r===i&&(n==="start"||n==="selfclosing")}function QD(i,e){var t=e.type,r=e.tag,n=e.position;return t==="tag"&&r===i&&n==="end"}function JD(i){var e=i.type,t=i.tag,r=i.position;return["w:p","a:p","text:p"].indexOf(t)!==-1&&e==="tag"&&r==="start"}function eP(i){var e=i.type,t=i.tag,r=i.position;return["w:p","a:p","text:p"].indexOf(t)!==-1&&e==="tag"&&r==="end"}function tP(i){var e=i.type,t=i.position,r=i.text;return r&&e==="tag"&&t==="start"}function rP(i){var e=i.type,t=i.position,r=i.text;return r&&e==="tag"&&t==="end"}function nP(i){var e=i.type,t=i.position;return e==="placeholder"||e==="content"&&t==="insidetag"}function iP(i,e){var t=i.module,r=i.type;return e instanceof Array||(e=[e]),r==="placeholder"&&e.indexOf(t)!==-1}var xb=/[\x00-\x08\x0B\x0C\x0E-\x1F]/g;function sP(i){return xb.lastIndex=0,xb.test(i)}function aP(i){return typeof i!="string"&&(i=String(i)),i.replace(xb,"")}function oP(i){var e={};for(var t in i){var r=i[t];e[r]||(e[r]=[]),e[r].push(t)}return e}function lP(i,e){return i.map(function(t,r){return{item:t,index:r}}).sort(function(t,r){return e(t.item,r.item)||t.index-r.index}).map(function(t){var r=t.item;return r})}var Fr={endsWith:MD,startsWith:LD,isContent:nP,isParagraphStart:JD,isParagraphEnd:eP,isTagStart:KD,isTagEnd:QD,isTextStart:tP,isTextEnd:rP,isStarting:iv,isEnding:nv,isModule:iP,uniq:FD,getDuplicates:OD,chunkBy:BD,last:kD,first:DD,xml2str:jD,str2xml:UD,getRightOrNull:mA,getRight:YD,getLeftOrNull:bA,getLeft:ZD,pregMatchAll:XD,convertSpaces:WD,charMapRegexes:Xh,hasCorruptCharacters:sP,removeCorruptCharacters:aP,getDefaults:zD,wordToUtf8:HD,utf8ToWord:$D,concatArrays:VD,pushArray:GD,invertMap:oP,charMap:gA,getSingleAttribute:ND,setSingleAttribute:ID,isWhiteSpace:PD,stableSort:lP};function uP(i,e){return fP(i)||dP(i,e)||hP(i,e)||cP()}function cP(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
48
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hP(i,e){if(i){if(typeof i=="string")return Vy(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Vy(i,e):void 0}}function Vy(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=Array(e);t<e;t++)r[t]=i[t];return r}function dP(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r,n,s,a,o=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(r=s.call(t)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(h){c=!0,n=h}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw n}}return o}}function fP(i){if(Array.isArray(i))return i}function en(i){"@babel/helpers - typeof";return en=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},en(i)}function pP(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function gP(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,bP(r.key),r)}}function mP(i,e,t){return t&&gP(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function bP(i){var e=vP(i,"string");return en(e)=="symbol"?e:e+""}function vP(i,e){if(en(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e);if(en(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var yP=function(){function i(){pP(this,i)}return mP(i,null,[{key:"createSchema",value:function(t){var r={validate:t,optional:function(){return i.createSchema(function(s){return s===void 0?{success:!0,value:s}:t(s)})},nullable:function(){return i.createSchema(function(s){return s==null?{success:!0,value:s}:t(s)})}};return r}},{key:"string",value:function(){return i.createSchema(function(t){return typeof t!="string"?{success:!1,error:"Expected string, received ".concat(en(t))}:{success:!0,value:t}})}},{key:"date",value:function(){return i.createSchema(function(t){return t instanceof Date?{success:!0,value:t}:{success:!1,error:"Expected date, received ".concat(en(t))}})}},{key:"boolean",value:function(){return i.createSchema(function(t){return typeof t!="boolean"?{success:!1,error:"Expected boolean, received ".concat(en(t))}:{success:!0,value:t}})}},{key:"number",value:function(){return i.createSchema(function(t){return typeof t!="number"?{success:!1,error:"Expected number, received ".concat(en(t))}:{success:!0,value:t}})}},{key:"function",value:function(){return i.createSchema(function(t){return typeof t!="function"?{success:!1,error:"Expected function, received ".concat(en(t))}:{success:!0,value:t}})}},{key:"array",value:function(t){return i.createSchema(function(r){if(!Array.isArray(r))return{success:!1,error:"Expected array, received ".concat(en(r))};for(var n=0;n<r.length;n++){var s=t.validate(r[n]);if(!s.success)return{success:!1,error:"".concat(s.error," at index ").concat(n)}}return{success:!0,value:r}})}},{key:"any",value:function(){return i.createSchema(function(t){return{success:!0,value:t}})}},{key:"isRegex",value:function(){return i.createSchema(function(t){return t instanceof RegExp?{success:!0,value:t}:{success:!1,error:"Expected RegExp, received ".concat(en(t))}})}},{key:"union",value:function(t){return i.createSchema(function(r){for(var n=0;n<t.length;n++){var s=t[n],a=s.validate(r);if(a.success)return a}return{success:!1,error:"Value ".concat(r," does not match any schema in union")}})}},{key:"object",value:function(t){var r=i.createSchema(function(n){if(n==null)return{success:!1,error:"Expected object, received ".concat(n)};if(en(n)!=="object")return{success:!1,error:"Expected object, received ".concat(en(n))};for(var s=0,a=Object.entries(t);s<a.length;s++){var o=uP(a[s],2),l=o[0],c=o[1],h=c.validate(n[l]);if(!h.success)return{success:!1,error:"".concat(h.error," at ").concat(l)}}return{success:!0,value:n}});return r.strict=function(){return i.createSchema(function(n){var s=r.validate(n);if(!s.success)return s;var a=Object.keys(n).filter(function(o){return!(o in t)});return a.length>0?{success:!1,error:"Unexpected properties: ".concat(a.join(", "))}:s})},r}},{key:"record",value:function(t){return i.createSchema(function(r){if(r===null)return{success:!1,error:"Expected object, received null"};if(en(r)!=="object")return{success:!1,error:"Expected object, received ".concat(en(r))};for(var n=0,s=Object.keys(r);n<s.length;n++){var a=s[n];if(typeof a!="string")return{success:!1,error:"Expected string key, received ".concat(en(a)," at ").concat(a)};var o=t.validate(r[a]);if(!o.success)return{success:!1,error:"".concat(o.error," at key ").concat(a)}}return{success:!0,value:r}})}}])}(),wP=yP,_m,Gy;function xP(){if(Gy)return _m;Gy=1;var i=Fr,e=i.str2xml,t="_rels/.rels";function r(n){for(var s=n.files[t],a=s?e(s.asText()):null,o=a?a.getElementsByTagName("Relationship"):[],l={},c=0;c<o.length;c++){var h=o[c];l[h.getAttribute("Target")]=h.getAttribute("Type")}return l}return _m={getRelsTypes:r},_m}var Cm,qy;function AP(){if(qy)return Cm;qy=1;var i=Fr,e=i.str2xml,t="[Content_Types].xml";function r(s,a,o){for(var l={},c=0;c<s.length;c++){var h=s[c],d=h.getAttribute("ContentType"),p=h.getAttribute("PartName").substr(1);l[p]=d}for(var g=function(){var w=a[y],v=w.getAttribute("ContentType"),A=w.getAttribute("Extension");o.file(/./).map(function(E){var _=E.name;_.slice(_.length-A.length)===A&&!l[_]&&_!==t&&(l[_]=v)})},y=0;y<a.length;y++)g();return l}function n(s){var a=s.files[t],o=a?e(a.asText()):null,l=o?o.getElementsByTagName("Override"):null,c=o?o.getElementsByTagName("Default"):null;return{overrides:l,defaults:c,contentTypes:a,contentTypeXml:o}}return Cm={collectContentTypes:r,getContentTypes:n},Cm}var Sm,Wy;function Kl(){if(Wy)return Sm;Wy=1;var i=Xi,e=i.XTInternalError;function t(){}function r(n){return n}return Sm=function(n){var s={set:t,matchers:function(){return[]},parse:t,render:t,getTraits:t,getFileType:t,nullGetter:t,optionsTransformer:r,postrender:r,errorsTransformer:r,getRenderedMap:r,preparse:r,postparse:r,on:t,resolve:t,preResolve:t};if(Object.keys(s).every(function(l){return!n[l]})){var a=new e("This module cannot be wrapped, because it doesn't define any of the necessary functions");throw a.properties={id:"module_cannot_be_wrapped",explanation:"This module cannot be wrapped, because it doesn't define any of the necessary functions"},a}for(var o in s)n[o]||(n[o]=s[o]);return n},Sm}var Tm,Xy;function sv(){if(Xy)return Tm;Xy=1;function i(j){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ie){return typeof ie}:function(ie){return ie&&typeof Symbol=="function"&&ie.constructor===Symbol&&ie!==Symbol.prototype?"symbol":typeof ie},i(j)}function e(j){return n(j)||r(j)||o(j)||t()}function t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
49
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r(j){if(typeof Symbol<"u"&&j[Symbol.iterator]!=null||j["@@iterator"]!=null)return Array.from(j)}function n(j){if(Array.isArray(j))return l(j)}function s(j,ie){return h(j)||c(j,ie)||o(j,ie)||a()}function a(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o(j,ie){if(j){if(typeof j=="string")return l(j,ie);var ae={}.toString.call(j).slice(8,-1);return ae==="Object"&&j.constructor&&(ae=j.constructor.name),ae==="Map"||ae==="Set"?Array.from(j):ae==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae)?l(j,ie):void 0}}function l(j,ie){(ie==null||ie>j.length)&&(ie=j.length);for(var ae=0,H=Array(ie);ae<ie;ae++)H[ae]=j[ae];return H}function c(j,ie){var ae=j==null?null:typeof Symbol<"u"&&j[Symbol.iterator]||j["@@iterator"];if(ae!=null){var H,se,le,oe,ce=[],Ae=!0,Se=!1;try{if(le=(ae=ae.call(j)).next,ie!==0)for(;!(Ae=(H=le.call(ae)).done)&&(ce.push(H.value),ce.length!==ie);Ae=!0);}catch(Ne){Se=!0,se=Ne}finally{try{if(!Ae&&ae.return!=null&&(oe=ae.return(),Object(oe)!==oe))return}finally{if(Se)throw se}}return ce}}function h(j){if(Array.isArray(j))return j}function d(j,ie){var ae=Object.keys(j);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(j);ie&&(H=H.filter(function(se){return Object.getOwnPropertyDescriptor(j,se).enumerable})),ae.push.apply(ae,H)}return ae}function p(j){for(var ie=1;ie<arguments.length;ie++){var ae=arguments[ie]!=null?arguments[ie]:{};ie%2?d(Object(ae),!0).forEach(function(H){g(j,H,ae[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties(j,Object.getOwnPropertyDescriptors(ae)):d(Object(ae)).forEach(function(H){Object.defineProperty(j,H,Object.getOwnPropertyDescriptor(ae,H))})}return j}function g(j,ie,ae){return(ie=y(ie))in j?Object.defineProperty(j,ie,{value:ae,enumerable:!0,configurable:!0,writable:!0}):j[ie]=ae,j}function y(j){var ie=b(j,"string");return i(ie)=="symbol"?ie:ie+""}function b(j,ie){if(i(j)!="object"||!j)return j;var ae=j[Symbol.toPrimitive];if(ae!==void 0){var H=ae.call(j,ie);if(i(H)!="object")return H;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ie==="string"?String:Number)(j)}var w=Fr,v=w.getRightOrNull,A=w.getRight,E=w.getLeft,_=w.getLeftOrNull,C=w.chunkBy,I=w.isTagStart,k=w.isTagEnd,D=w.isContent,R=w.last,z=w.first,G=Xi,O=G.XTTemplateError,X=G.throwExpandNotFound,S=G.getLoopPositionProducesInvalidXMLError;function J(j,ie){if(j.length===0)return!1;var ae=R(j).substr(1);return ae.indexOf(ie)===0}function Y(j){for(var ie=[],ae=0;ae<j.length;ae++){var H=j[ae],se=H.position,le=H.value,oe=H.tag;oe&&(se==="end"?J(ie,oe)?ie.pop():ie.push(le):se==="start"&&ie.push(le))}return ie}function W(j,ie){for(var ae=0;ae<ie.length;ae++){var H=ie[ae];if(H.indexOf("<".concat(j))===0)return!0}return!1}function fe(j,ie,ae){var H=j.slice(ie[0].offset,ie[1].offset),se=Y(H),le=se.filter(function(Ne){return Ne[1]==="/"}).length,oe=se.filter(function(Ne){return Ne[1]!=="/"&&Ne[Ne.length-2]!=="/"}).length;if(le!==oe)return{error:S({tag:z(ie).part.value,offset:[z(ie).part.offset,R(ie).part.offset]})};for(var ce=function(){var Te=ae[Se],x=Te.contains,U=Te.expand,B=Te.onlyTextInTag;if(W(x,se)){if(B){var F=_(j,x,ie[0].offset),M=v(j,x,ie[1].offset);if(F===null||M===null)return 0;var q=C(j.slice(F,M),function(De){return I(x,De)?"start":k(x,De)?"end":null}),de=z(q),we=R(q),ee=de.filter(D),Ee=we.filter(D);if(ee.length!==1||Ee.length!==1)return 0}return{v:{value:U}}}},Ae,Se=0;Se<ae.length;Se++)if(Ae=ce(),Ae!==0&&Ae)return Ae.v;return{}}function K(j,ie,ae,H){var se=j.expandTo||H.expandTo;if(se){var le,oe;try{oe=E(ae,se,ie),le=A(ae,se,ie)}catch(Se){var ce=p({part:j,rootError:Se,postparsed:ae,expandTo:se,index:ie},H.error);if(H.onError){var Ae=H.onError(ce);if(Ae==="ignore")return}X(ce)}return[oe,le]}}function be(j,ie,ae,H){var se=s(j,2),le=se[0],oe=se[1],ce=ae.indexOf(ie),Ae=ae.slice(le,ce),Se=ae.slice(ce+1,oe+1),Ne=H.getInner({postparse:H.postparse,index:ce,part:ie,leftParts:Ae,rightParts:Se,left:le,right:oe,postparsed:ae});return Ne.length||(Ne.expanded=[Ae,Se],Ne=[Ne]),{left:le,right:oe,inner:Ne}}function te(j,ie){var ae=[];j.errors&&(ae=j.errors,j=j.postparsed);for(var H=[],se=0,le=j.length;se<le;se++){var oe=j[se];if(oe.type==="placeholder"&&oe.module===ie.moduleName&&!oe.subparsed&&!oe.expanded)try{var ce=K(oe,se,j,ie);if(!ce)continue;var Ae=s(ce,2),Se=Ae[0],Ne=Ae[1];H.push({left:Se,right:Ne,part:oe,i:se,leftPart:j[Se],rightPart:j[Ne]})}catch(we){ae.push(we)}}H.sort(function(we,ee){return we.left===ee.left?ee.part.lIndex<we.part.lIndex?1:-1:ee.left<we.left?1:-1});for(var Te=-1,x=0,U=0,B=H.length;U<B;U++){var F,M=H[U];if(Te=Math.max(Te,U>0?H[U-1].right:0),!(M.left<Te)){var q=void 0;try{q=be([M.left+x,M.right+x],M.part,j,ie)}catch(we){if(ie.onError){var de=ie.onError(p({part:M.part,rootError:we,postparsed:j,expandOne:be},ie.errors));if(de==="ignore")continue}if(we instanceof O)ae.push(we);else throw we}q&&(x+=q.inner.length-(q.right+1-q.left),(F=j).splice.apply(F,[q.left,q.right+1-q.left].concat(e(q.inner))))}}return{postparsed:j,errors:ae}}return Tm={expandToOne:te,getExpandToDefault:fe},Tm}var km,Yy;function av(){if(Yy)return km;Yy=1;var i="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",e="application/vnd.ms-word.document.macroEnabled.main+xml",t="application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml",r="application/vnd.ms-word.template.macroEnabledTemplate.main+xml",n="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",s="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",a="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",o="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",l="application/vnd.openxmlformats-officedocument.presentationml.slide+xml",c="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml",h="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml",d="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml",p="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",g="application/vnd.ms-excel.sheet.macroEnabled.main+xml",y="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",b=[i,e,t,r],w={main:b,docx:[n].concat(b,[o,s,a]),pptx:[l,c,h,d],xlsx:[p,g,y]};return km=w,km}var Dm,Zy;function vA(){if(Zy)return Dm;Zy=1;var i="application/vnd.openxmlformats-package.core-properties+xml",e="application/vnd.openxmlformats-officedocument.extended-properties+xml",t="application/vnd.openxmlformats-officedocument.custom-properties+xml",r="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",n="application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml",s="application/vnd.ms-office.drawingml.diagramDrawing+xml";return Dm={settingsContentType:r,coreContentType:i,appContentType:e,customContentType:t,diagramDataContentType:n,diagramDrawingContentType:s},Dm}var Pm,Ky;function EP(){if(Ky)return Pm;Ky=1;function i(E){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},i(E)}function e(E,_){if(!(E instanceof _))throw new TypeError("Cannot call a class as a function")}function t(E,_){for(var C=0;C<_.length;C++){var I=_[C];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(E,n(I.key),I)}}function r(E,_,C){return _&&t(E.prototype,_),Object.defineProperty(E,"prototype",{writable:!1}),E}function n(E){var _=s(E,"string");return i(_)=="symbol"?_:_+""}function s(E,_){if(i(E)!="object"||!E)return E;var C=E[Symbol.toPrimitive];if(C!==void 0){var I=C.call(E,_);if(i(I)!="object")return I;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(E)}var a=Fr,o=a.pushArray,l=Kl(),c=av(),h=vA(),d=h.settingsContentType,p=h.coreContentType,g=h.appContentType,y=h.customContentType,b=h.diagramDataContentType,w=h.diagramDrawingContentType,v=[d,p,g,y,b,w],A=function(){function E(){e(this,E),this.name="Common"}return r(E,[{key:"getFileType",value:function(C){var I=C.doc,k=I.invertedContentTypes;if(k){for(var D=0;D<v.length;D++){var R=v[D];k[R]&&o(I.targets,k[R])}for(var z=["docx","pptx","xlsx"],G,O=0;O<z.length;O++){for(var X=z[O],S=c[X],J=0;J<S.length;J++){var Y=S[J];if(k[Y])for(var W=0,fe=k[Y];W<fe.length;W++){var K=fe[W];I.relsTypes[K]&&["http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument","http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"].indexOf(I.relsTypes[K])===-1||(G=X,(c.main.indexOf(Y)!==-1||Y===c.pptx[0])&&(I.textTarget||(I.textTarget=K)),G!=="xlsx"&&I.targets.push(K))}}if(G)return G}return G}}}])}();return Pm=function(){return l(new A)},Pm}var Rm,Qy;function _P(){if(Qy)return Rm;Qy=1;function i(w){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(v){return typeof v}:function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},i(w)}function e(w,v){if(!(w instanceof v))throw new TypeError("Cannot call a class as a function")}function t(w,v){for(var A=0;A<v.length;A++){var E=v[A];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(w,n(E.key),E)}}function r(w,v,A){return v&&t(w.prototype,v),Object.defineProperty(w,"prototype",{writable:!1}),w}function n(w){var v=s(w,"string");return i(v)=="symbol"?v:v+""}function s(w,v){if(i(w)!="object"||!w)return w;var A=w[Symbol.toPrimitive];if(A!==void 0){var E=A.call(w,v);if(i(E)!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(w)}var a=Xi,o=a.getScopeParserExecutionError,l=tv,c=l.last,h=Fr,d=h.concatArrays;function p(w,v){for(var A=w.length>>>0,E,_=0;_<A;_++)if(E=w[_],v.call(this,E,_,w))return E}function g(w,v,A){var E=this,_=this.scopeList[A];if(this.root.finishedResolving){for(var C=this.resolved,I=function(){var O=E.scopeLindex[k];C=p(C,function(X){return X.lIndex===O}),C=C.value[E.scopePathItem[k]]},k=this.resolveOffset,D=this.scopePath.length;k<D;k++)I();return p(C,function(G){return v.part.lIndex===G.lIndex}).value}var R,z;!this.cachedParsers||!v.part?z=this.parser(w,{tag:v.part,scopePath:this.scopePath}):this.cachedParsers[v.part.lIndex]?z=this.cachedParsers[v.part.lIndex]:z=this.cachedParsers[v.part.lIndex]=this.parser(w,{tag:v.part,scopePath:this.scopePath});try{R=z.get(_,this.getContext(v,A))}catch(G){throw o({tag:w,scope:_,error:G,offset:v.part.offset})}return R==null&&A>0?g.call(this,w,v,A-1):R}function y(w,v,A){var E=this,_=this.scopeList[A],C;return!this.cachedParsers||!v.part?C=this.parser(w,{tag:v.part,scopePath:this.scopePath}):this.cachedParsers[v.part.lIndex]?C=this.cachedParsers[v.part.lIndex]:C=this.cachedParsers[v.part.lIndex]=this.parser(w,{tag:v.part,scopePath:this.scopePath}),Promise.resolve().then(function(){return C.get(_,E.getContext(v,A))}).catch(function(I){throw o({tag:w,scope:_,error:I,offset:v.part.offset})}).then(function(I){return I==null&&A>0?y.call(E,w,v,A-1):I})}var b=function(){function w(v){e(this,w),this.root=v.root||this,this.resolveOffset=v.resolveOffset||0,this.scopePath=v.scopePath,this.scopePathItem=v.scopePathItem,this.scopePathLength=v.scopePathLength,this.scopeList=v.scopeList,this.scopeType="",this.scopeTypes=v.scopeTypes,this.scopeLindex=v.scopeLindex,this.parser=v.parser,this.resolved=v.resolved,this.cachedParsers=v.cachedParsers}return r(w,[{key:"loopOver",value:function(A,E,_,C){return this.loopOverValue(this.getValue(A,C),E,_)}},{key:"functorIfInverted",value:function(A,E,_,C,I){return A&&E(_,C,I),A}},{key:"isValueFalsy",value:function(A,E){return A==null||!A||E==="[object Array]"&&A.length===0}},{key:"loopOverValue",value:function(A,E,_){this.root.finishedResolving&&(_=!1);var C=Object.prototype.toString.call(A);if(this.isValueFalsy(A,C))return this.scopeType=!1,this.functorIfInverted(_,E,c(this.scopeList),0,1);if(C==="[object Array]"){this.scopeType="array";for(var I=0;I<A.length;I++)this.functorIfInverted(!_,E,A[I],I,A.length);return!0}return C==="[object Object]"?(this.scopeType="object",this.functorIfInverted(!_,E,A,0,1)):this.functorIfInverted(!_,E,c(this.scopeList),0,1)}},{key:"getValue",value:function(A,E){var _=g.call(this,A,E,this.scopeList.length-1);return typeof _=="function"?_(this.scopeList[this.scopeList.length-1],this):_}},{key:"getValueAsync",value:function(A,E){var _=this;return y.call(this,A,E,this.scopeList.length-1).then(function(C){return typeof C=="function"?C(_.scopeList[_.scopeList.length-1],_):C})}},{key:"getContext",value:function(A,E){return{num:E,meta:A,scopeList:this.scopeList,resolved:this.resolved,scopePath:this.scopePath,scopeTypes:this.scopeTypes,scopePathItem:this.scopePathItem,scopePathLength:this.scopePathLength}}},{key:"createSubScopeManager",value:function(A,E,_,C,I){return new w({root:this.root,resolveOffset:this.resolveOffset,resolved:this.resolved,parser:this.parser,cachedParsers:this.cachedParsers,scopeTypes:d([this.scopeTypes,[this.scopeType]]),scopeList:d([this.scopeList,[A]]),scopePath:d([this.scopePath,[E]]),scopePathItem:d([this.scopePathItem,[_]]),scopePathLength:d([this.scopePathLength,[I]]),scopeLindex:d([this.scopeLindex,[C.lIndex]])})}}])}();return Rm=function(w){return w.scopePath=[],w.scopePathItem=[],w.scopePathLength=[],w.scopeTypes=[],w.scopeLindex=[],w.scopeList=[w.tags],new b(w)},Rm}var Im,Jy;function yA(){if(Jy)return Im;Jy=1;function i(H){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(se){return typeof se}:function(se){return se&&typeof Symbol=="function"&&se.constructor===Symbol&&se!==Symbol.prototype?"symbol":typeof se},i(H)}function e(H,se){return a(H)||s(H,se)||r(H,se)||t()}function t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
51
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r(H,se){if(H){if(typeof H=="string")return n(H,se);var le={}.toString.call(H).slice(8,-1);return le==="Object"&&H.constructor&&(le=H.constructor.name),le==="Map"||le==="Set"?Array.from(H):le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le)?n(H,se):void 0}}function n(H,se){(se==null||se>H.length)&&(se=H.length);for(var le=0,oe=Array(se);le<se;le++)oe[le]=H[le];return oe}function s(H,se){var le=H==null?null:typeof Symbol<"u"&&H[Symbol.iterator]||H["@@iterator"];if(le!=null){var oe,ce,Ae,Se,Ne=[],Te=!0,x=!1;try{if(Ae=(le=le.call(H)).next,se!==0)for(;!(Te=(oe=Ae.call(le)).done)&&(Ne.push(oe.value),Ne.length!==se);Te=!0);}catch(U){x=!0,ce=U}finally{try{if(!Te&&le.return!=null&&(Se=le.return(),Object(Se)!==Se))return}finally{if(x)throw ce}}return Ne}}function a(H){if(Array.isArray(H))return H}function o(H,se){var le=Object.keys(H);if(Object.getOwnPropertySymbols){var oe=Object.getOwnPropertySymbols(H);se&&(oe=oe.filter(function(ce){return Object.getOwnPropertyDescriptor(H,ce).enumerable})),le.push.apply(le,oe)}return le}function l(H){for(var se=1;se<arguments.length;se++){var le=arguments[se]!=null?arguments[se]:{};se%2?o(Object(le),!0).forEach(function(oe){c(H,oe,le[oe])}):Object.getOwnPropertyDescriptors?Object.defineProperties(H,Object.getOwnPropertyDescriptors(le)):o(Object(le)).forEach(function(oe){Object.defineProperty(H,oe,Object.getOwnPropertyDescriptor(le,oe))})}return H}function c(H,se,le){return(se=h(se))in H?Object.defineProperty(H,se,{value:le,enumerable:!0,configurable:!0,writable:!0}):H[se]=le,H}function h(H){var se=d(H,"string");return i(se)=="symbol"?se:se+""}function d(H,se){if(i(H)!="object"||!H)return H;var le=H[Symbol.toPrimitive];if(le!==void 0){var oe=le.call(H,se);if(i(oe)!="object")return oe;throw new TypeError("@@toPrimitive must return a primitive value.")}return(se==="string"?String:Number)(H)}var p=Xi,g=p.getUnclosedTagException,y=p.getUnopenedTagException,b=p.getDuplicateOpenTagException,w=p.getDuplicateCloseTagException,v=p.throwMalformedXml,A=p.throwXmlInvalid,E=p.XTTemplateError,_=Fr,C=_.isTextStart,I=_.isTextEnd,k=_.wordToUtf8,D=_.pushArray,R=0,z=1,G=2,O=3;function X(H,se){return H[0]<=se.offset&&se.offset<H[1]}function S(H,se){return C(H)?(se&&v(),!0):I(H)?(se||v(),!1):se}function J(H){var se="",le=1,oe=H.indexOf(" ");return H[H.length-2]==="/"?(se="selfclosing",oe===-1&&(oe=H.length-2)):H[1]==="/"?(le=2,se="end",oe===-1&&(oe=H.length-1)):(se="start",oe===-1&&(oe=H.length-1)),{tag:H.slice(le,oe),position:se}}function Y(H,se,le){for(var oe=0,ce=H.length,Ae={},Se=0;Se<se.length;Se++){var Ne=se[Se];Ae[Ne]=!0}for(var Te=0;Te<le.length;Te++){var x=le[Te];Ae[x]=!1}for(var U=[];oe<ce&&(oe=H.indexOf("<",oe),oe!==-1);){var B=oe,F=H.indexOf("<",oe+1);oe=H.indexOf(">",oe),(oe===-1||F!==-1&&oe>F)&&A(H,B);var M=H.slice(B,oe+1),q=J(M),de=q.tag,we=q.position,ee=Ae[de];ee!=null&&U.push({type:"tag",position:we,text:ee,offset:B,value:M,tag:de})}return U}function W(H,se,le){var oe=[],ce=!1,Ae={offset:0},Se,Ne=H.reduce(function(x,U){var B=U.position,F=U.offset,M=Ae.offset,q=Ae.length;if(Se=se.substr(M,F-M),ce&&B==="start"){if(M+q===F&&(Se=se.substr(M,F-M+q+4),!le.allowUnclosedTag))return oe.push(b({xtag:Se,offset:M})),Ae=U,x.push(l(l({},U),{},{error:!0})),x;if(!le.allowUnclosedTag)return oe.push(g({xtag:k(Se),offset:M})),Ae=U,x.push(l(l({},U),{},{error:!0})),x;x.pop()}return!ce&&B==="end"?le.allowUnopenedTag?x:M+q===F?(Se=se.substr(M-4,F-M+q+4),oe.push(w({xtag:Se,offset:M})),Ae=U,x.push(l(l({},U),{},{error:!0})),x):(oe.push(y({xtag:Se,offset:F})),Ae=U,x.push(l(l({},U),{},{error:!0})),x):(ce=B==="start",Ae=U,x.push(U),x)},[]);if(ce){var Te=Ae.offset;Se=se.substr(Te,se.length-Te),le.allowUnclosedTag?Ne.pop():oe.push(g({xtag:k(Se),offset:Te}))}return{delimiterWithErrors:Ne,errors:oe}}function fe(H,se){return H===-1&&se===-1?R:H===se?z:H===-1||se===-1?se<H?G:O:H<se?G:O}function K(H){var se=H.split(" ");if(se.length!==2){var le=new E("New Delimiters cannot be parsed");throw le.properties={id:"change_delimiters_invalid",explanation:"Cannot parser delimiters"},le}var oe=e(se,2),ce=oe[0],Ae=oe[1];if(ce.length===0||Ae.length===0){var Se=new E("New Delimiters cannot be parsed");throw Se.properties={id:"change_delimiters_invalid",explanation:"Cannot parser delimiters"},Se}return[ce,Ae]}function be(H,se,le){var oe=[],ce=se.start,Ae=se.end,Se=-1,Ne=!1;if(ce==null&&Ae==null)return[];for(;;){var Te=H.indexOf(ce,Se+1),x=H.indexOf(Ae,Se+1),U=null,B=void 0,F=fe(Te,x);switch(F===z&&(F=Ne?O:G),F){case R:return oe;case O:Ne=!1,Se=x,U="end",B=Ae.length;break;case G:Ne=!0,Se=Te,U="start",B=ce.length;break}if(le.changeDelimiterPrefix&&F===G&&H[Se+ce.length]===le.changeDelimiterPrefix){oe.push({offset:Te,position:"start",length:ce.length,changedelimiter:!0});var M=H.indexOf(le.changeDelimiterPrefix,Se+ce.length+1),q=H.indexOf(Ae,M+1);oe.push({offset:q,position:"end",length:Ae.length,changedelimiter:!0});var de=H.substr(Se+ce.length+1,M-Se-ce.length-1),we=K(de),ee=e(we,2);ce=ee[0],Ae=ee[1],Se=q;continue}oe.push({offset:Se,position:U,length:B})}}function te(H,se,le){var oe=H.map(function(M){return M.value}).join(""),ce=be(oe,se,le),Ae=0,Se=H.map(function(M){return Ae+=M.value.length,{offset:Ae-M.value.length,lIndex:M.lIndex}}),Ne=W(ce,oe,le),Te=Ne.delimiterWithErrors,x=Ne.errors,U=0,B=0,F=Se.map(function(M,q){for(var de=M.offset,we=[de,de+H[q].value.length],ee=H[q].value,Ee=[];B<Te.length&&X(we,Te[B]);)Ee.push(Te[B]),B++;var De=[],Ce=0;U>0&&(Ce=U,U=0);for(var Me=0;Me<Ee.length;Me++){var $e=Ee[Me],Xe=ee.substr(Ce,$e.offset-de-Ce);if($e.changedelimiter){$e.position==="start"?Xe.length>0&&De.push({type:"content",value:Xe}):Ce=$e.offset-de+$e.length;continue}Xe.length>0&&(De.push({type:"content",value:Xe}),Ce+=Xe.length);var Tt={type:"delimiter",position:$e.position,offset:Ce+de};De.push(Tt),Ce=$e.offset-de+$e.length}U=Ce-ee.length;var nr=ee.substr(Ce);return nr.length>0&&De.push({type:"content",value:nr}),De},this);return{parsed:F,errors:x}}function j(H){return H.type==="content"&&H.position==="insidetag"}function ie(H){return H.filter(j)}function ae(H,se){for(var le=!1,oe=0;oe<H.length;oe++){var ce=H[oe];le=S(ce,le),ce.type==="content"&&(ce.position=le?"insidetag":"outsidetag"),se!=="text"&&j(ce)&&(ce.value=ce.value.replace(/>/g,">"))}}return Im={parseDelimiters:te,parse:function(se,le,oe,ce){ae(se,ce);for(var Ae=te(ie(se),le,oe),Se=Ae.parsed,Ne=Ae.errors,Te=[],x=0,U=0,B=0;B<se.length;B++){var F=se[B];if(j(F)){for(var M=0,q=Se[x];M<q.length;M++){var de=q[M];de.type==="content"&&(de.position="insidetag"),de.lIndex=U++}D(Te,Se[x]),x++}else F.lIndex=U++,Te.push(F)}return{errors:Ne,lexed:Te}},xmlparse:function(se,le){for(var oe=Y(se,le.text,le.other),ce=0,Ae=[],Se=0;Se<oe.length;Se++){var Ne=oe[Se];se.length>ce&&Ne.offset-ce>0&&Ae.push({type:"content",value:se.substr(ce,Ne.offset-ce)}),ce=Ne.offset+Ne.value.length,delete Ne.offset,Ae.push(Ne)}return se.length>ce&&Ae.push({type:"content",value:se.substr(ce)}),Ae}},Im}var Nm,e2;function CP(){if(e2)return Nm;e2=1;function i(l){return n(l)||r(l)||t(l)||e()}function e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
52
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t(l,c){if(l){if(typeof l=="string")return s(l,c);var h={}.toString.call(l).slice(8,-1);return h==="Object"&&l.constructor&&(h=l.constructor.name),h==="Map"||h==="Set"?Array.from(l):h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?s(l,c):void 0}}function r(l){if(typeof Symbol<"u"&&l[Symbol.iterator]!=null||l["@@iterator"]!=null)return Array.from(l)}function n(l){if(Array.isArray(l))return s(l)}function s(l,c){(c==null||c>l.length)&&(c=l.length);for(var h=0,d=Array(c);h<c;h++)d[h]=l[h];return d}function a(l){return l.type==="placeholder"}function o(l){var c={},h=[{items:l.filter(a),parents:[],path:[]}];function d(Y,W,fe){fe.length&&h.push({items:fe,parents:[].concat(i(W.parents),[Y]),path:Y.dataBound!==!1&&!Y.attrParsed&&Y.value&&!Y.attrParsed?[].concat(i(W.path),[Y.value]):i(W.path)})}function p(Y,W){for(var fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.length,K=Y,be=0;be<fe;be++)K=K[W[be]];return K}function g(Y,W){for(var fe=W.length,K=0;K<W.length;K++){var be=W[K],te=typeof be.lIndex=="number"?be.lIndex:parseInt(be.lIndex.split("-")[0],10);te>Y.lIndex&&fe--}return fe}for(;h.length>0;)for(var y=h.pop(),b=p(c,y.path),w=0,v=y.items;w<v.length;w++){var A,E,_=v[w];if(_.attrParsed){for(var C in _.attrParsed)d(_,y,_.attrParsed[C].filter(a));continue}if(_.subparsed){if(_.dataBound!==!1){var I,k;(I=b)[k=_.value]||(I[k]={})}d(_,y,_.subparsed.filter(a));continue}if(_.cellParsed){for(var D=0,R=_.cellPostParsed;D<R.length;D++){var z=R[D];if(z.type==="placeholder"){if(z.module==="pro-xml-templating/xls-module-loop")continue;if(z.subparsed){var G,O;(G=b)[O=z.value]||(G[O]={}),d(z,y,z.subparsed.filter(a))}else{var X,S,J=g(_,y.parents);b=p(c,y.path,J),(X=b)[S=z.value]||(X[S]={})}}}continue}_.dataBound!==!1&&((A=b)[E=_.value]||(A[E]={}))}return c}return Nm={getTags:o,isPlaceholder:a},Nm}var Mm,t2;function SP(){if(t2)return Mm;t2=1;var i=Fr,e=i.pushArray;function t(n,s){return s instanceof Error?e(Object.getOwnPropertyNames(s),["stack"]).reduce(function(a,o){return a[o]=s[o],o==="stack"&&(a[o]=s[o].toString()),a},{}):s}function r(n,s){if(console.log(JSON.stringify({error:n},t,s==="json"?2:null)),n.properties&&n.properties.errors instanceof Array){var a=n.properties.errors.map(function(o){return o.properties.explanation}).join(`
|
|
53
|
+
`);console.log("errorMessages",a)}}return Mm=r,Mm}var Lm,r2;function wA(){if(r2)return Lm;r2=1;var i=Fr,e=i.pregMatchAll;return Lm=function(r,n){var s={content:r},a=n.join("|"),o=new RegExp("(?:(<(?:".concat(a,")[^>]*>)([^<>]*)</(?:").concat(a,")>)|(<(?:").concat(a,")[^>]*/>)"),"g");return s.matches=e(o,s.content),s},Lm}var Om,n2;function TP(){if(n2)return Om;n2=1;function i(a){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},i(a)}var e=new RegExp(" ","g");function t(a){return a.replace(e," ")}function r(a,o){var l=i(a);if(l==="string")return t(o.substr(0,a.length))===a;if(a instanceof RegExp)return a.test(t(o));if(l==="function")return!!a(o)}function n(a,o){var l=i(a);if(l==="string")return t(o).substr(a.length);if(a instanceof RegExp)return t(o).match(a)[1];if(l==="function")return a(o)}function s(a,o){var l=i(a);if(l==="string")return[o,t(o).substr(a.length)];if(a instanceof RegExp)return t(o).match(a);if(l==="function")return[o,a(o)]}return Om={match:r,getValue:n,getValues:s},Om}var Fm,i2;function kP(){if(i2)return Fm;i2=1;function i(k){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},i(k)}function e(k,D){var R=Object.keys(k);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(k);D&&(z=z.filter(function(G){return Object.getOwnPropertyDescriptor(k,G).enumerable})),R.push.apply(R,z)}return R}function t(k){for(var D=1;D<arguments.length;D++){var R=arguments[D]!=null?arguments[D]:{};D%2?e(Object(R),!0).forEach(function(z){r(k,z,R[z])}):Object.getOwnPropertyDescriptors?Object.defineProperties(k,Object.getOwnPropertyDescriptors(R)):e(Object(R)).forEach(function(z){Object.defineProperty(k,z,Object.getOwnPropertyDescriptor(R,z))})}return k}function r(k,D,R){return(D=n(D))in k?Object.defineProperty(k,D,{value:R,enumerable:!0,configurable:!0,writable:!0}):k[D]=R,k}function n(k){var D=s(k,"string");return i(D)=="symbol"?D:D+""}function s(k,D){if(i(k)!="object"||!k)return k;var R=k[Symbol.toPrimitive];if(R!==void 0){var z=R.call(k,D);if(i(z)!="object")return z;throw new TypeError("@@toPrimitive must return a primitive value.")}return(D==="string"?String:Number)(k)}function a(k,D){return d(k)||h(k,D)||l(k,D)||o()}function o(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
54
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l(k,D){if(k){if(typeof k=="string")return c(k,D);var R={}.toString.call(k).slice(8,-1);return R==="Object"&&k.constructor&&(R=k.constructor.name),R==="Map"||R==="Set"?Array.from(k):R==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(R)?c(k,D):void 0}}function c(k,D){(D==null||D>k.length)&&(D=k.length);for(var R=0,z=Array(D);R<D;R++)z[R]=k[R];return z}function h(k,D){var R=k==null?null:typeof Symbol<"u"&&k[Symbol.iterator]||k["@@iterator"];if(R!=null){var z,G,O,X,S=[],J=!0,Y=!1;try{if(O=(R=R.call(k)).next,D!==0)for(;!(J=(z=O.call(R)).done)&&(S.push(z.value),S.length!==D);J=!0);}catch(W){Y=!0,G=W}finally{try{if(!J&&R.return!=null&&(X=R.return(),Object(X)!==X))return}finally{if(Y)throw G}}return S}}function d(k){if(Array.isArray(k))return k}var p=Fr,g=p.wordToUtf8,y=p.pushArray,b=TP(),w=b.match,v=b.getValue,A=b.getValues;function E(k,D){for(var R=[],z=0;z<k.length;z++){var G=k[z];if(G.matchers){var O=G.matchers(D);if(!(O instanceof Array))throw new Error("module matcher returns a non array");y(R,O)}}return R}function _(k,D,R){for(var z=[],G=0;G<k.length;G++){var O=k[G],X=a(O,2),S=X[0],J=X[1],Y=O[2]||{};if(R.match(S,D)){var W=R.getValues(S,D);if(typeof Y=="function"&&(Y=Y(W)),!Y.value){var fe=a(W,2);Y.value=fe[1]}z.push(t({type:"placeholder",prefix:S,module:J,onMatch:Y.onMatch,priority:Y.priority},Y))}}return z}function C(k,D){var R=D.modules,z=D.startOffset,G=D.lIndex,O;D.offset=z,D.match=w,D.getValue=v,D.getValues=A;var X=E(R,D),S=_(X,k,D);if(S.length>0){for(var J=null,Y=0;Y<S.length;Y++){var W=S[Y];W.priority||(W.priority=-W.value.length),(!J||W.priority>J.priority)&&(J=W)}return J.offset=z,delete J.priority,J.endLindex=G,J.lIndex=G,J.raw=k,J.onMatch&&J.onMatch(J),delete J.onMatch,delete J.prefix,J}for(var fe=0;fe<R.length;fe++){var K=R[fe];if(O=K.parse(k,D),O)return O.offset=z,O.endLindex=G,O.lIndex=G,O.raw=k,O}return{type:"placeholder",value:k,offset:z,endLindex:G,lIndex:G}}var I={preparse:function(D,R,z){function G(O,X){for(var S=0;S<R.length;S++){var J=R[S];O=J.preparse(O,X)||O}return O}return G(D,z)},parse:function(D,R,z){var G=!1,O="",X,S=[],J=z.fileTypeConfig.droppedTagsInsidePlaceholder||[];return D.reduce(function(Y,W){return W.type==="delimiter"?(G=W.position==="start",W.position==="end"&&(z.parse=function(fe){return C(fe,t(t(t({},z),W),{},{startOffset:X,modules:R}))},Y.push(z.parse(g(O))),y(Y,S),S=[]),W.position==="start"&&(S=[],X=W.offset),O="",Y):G?W.type!=="content"||W.position!=="insidetag"?(J.indexOf(W.tag)!==-1||S.push(W),Y):(O+=W.value,Y):(Y.push(W),Y)},[])},postparse:function(D,R,z){function G(S,J){return R.map(function(Y){return Y.getTraits(S,J)})}var O=[];function X(S,J){for(var Y=S,W=0;W<R.length;W++){var fe=R[W],K=fe.postparse(Y,t(t({},J),{},{postparse:function(te,j){return X(te,t(t({},J),j))},getTraits:G}));if(K!=null){if(K.errors){y(O,K.errors),Y=K.postparsed;continue}Y=K}}return Y}return{postparsed:X(D,z),errors:O}}};return Fm=I,Fm}var Bm,s2;function xA(){if(s2)return Bm;s2=1;function i(e,t){if(e.lIndex==null)return null;var r=t.scopeManager.scopePathItem;e.parentPart&&(r=r.slice(0,r.length-1));var n=t.filePath+"@"+e.lIndex.toString()+"-"+r.join("-");return n}return Bm=i,Bm}var zm,a2;function DP(){if(a2)return zm;a2=1;var i=Xi,e=i.throwUnimplementedTagType,t=i.XTScopeParserError,r=Fr,n=r.pushArray,s=xA();function a(l,c){for(var h=0,d=c.modules;h<d.length;h++){var p=d[h],g=p.render(l,c);if(g)return g}return!1}function o(l){var c=l.baseNullGetter,h=l.compiled,d=l.scopeManager;l.nullGetter=function(C,I){return c(C,I||d)};for(var p=[],g=[],y=0,b=h.length;y<b;y++){var w=h[y];l.index=y,l.resolvedId=s(w,l);var v=void 0;try{v=a(w,l)}catch(C){if(C instanceof t){p.push(C),g.push(w);continue}throw C}if(v){v.errors&&n(p,v.errors),g.push(v);continue}if(w.type==="content"||w.type==="tag"){g.push(w);continue}e(w,y)}for(var A=[],E=0;E<g.length;E++){var _=g[E].value;_ instanceof Array?n(A,_):_&&A.push(_)}return{errors:p,parts:A}}return zm=o,zm}var jm,o2;function PP(){if(o2)return jm;o2=1;function i(t){var r,n,s,a,o=0,l=t.length;for(s=0;s<l;s++)r=t.charCodeAt(s),(r&64512)===55296&&s+1<l&&(n=t.charCodeAt(s+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),s++)),o+=r<128?1:r<2048?2:r<65536?3:4;var c=new Uint8Array(o);for(a=0,s=0;a<o;s++)r=t.charCodeAt(s),(r&64512)===55296&&s+1<l&&(n=t.charCodeAt(s+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),s++)),r<128?c[a++]=r:r<2048?(c[a++]=192|r>>>6,c[a++]=128|r&63):r<65536?(c[a++]=224|r>>>12,c[a++]=128|r>>>6&63,c[a++]=128|r&63):(c[a++]=240|r>>>18,c[a++]=128|r>>>12&63,c[a++]=128|r>>>6&63,c[a++]=128|r&63);return c}function e(t,r){for(var n=0,s=r.modules;n<s.length;n++){var a=s[n];t=a.postrender(t,r)}for(var o=0,l=r.joinUncorrupt(t,r),c="",h=0,d=65536,p=[],g=0,y=l.length;g<y;g++){var b=l[g];if(b.length+h>d){var w=i(c);o+=w.length,p.push(w),c=""}c+=b,h+=b.length,delete l[g]}var v=i(c);o+=v.length,p.push(v);for(var A=new Uint8Array(o),E=0,_=0;_<p.length;_++){for(var C=p[_],I=0;I<C.length;++I)A[I+E]=C[I];E+=C.length}return A}return jm=e,jm}var Um,l2;function RP(){if(l2)return Um;l2=1;function i(d){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},i(d)}function e(d,p){var g=Object.keys(d);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(d);p&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),g.push.apply(g,y)}return g}function t(d){for(var p=1;p<arguments.length;p++){var g=arguments[p]!=null?arguments[p]:{};p%2?e(Object(g),!0).forEach(function(y){r(d,y,g[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(g)):e(Object(g)).forEach(function(y){Object.defineProperty(d,y,Object.getOwnPropertyDescriptor(g,y))})}return d}function r(d,p,g){return(p=n(p))in d?Object.defineProperty(d,p,{value:g,enumerable:!0,configurable:!0,writable:!0}):d[p]=g,d}function n(d){var p=s(d,"string");return i(p)=="symbol"?p:p+""}function s(d,p){if(i(d)!="object"||!d)return d;var g=d[Symbol.toPrimitive];if(g!==void 0){var y=g.call(d,p);if(i(y)!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(d)}var a=Fr,o=a.pushArray,l=xA();function c(d,p){for(var g=0,y=p.modules;g<y.length;g++){var b=y[g],w=b.resolve(d,p);if(w)return w}return!1}function h(d){var p=[],g=d.baseNullGetter,y=d.compiled,b=d.scopeManager;d.nullGetter=function(v,A){return g(v,A||b)},d.resolved=p;var w=[];return Promise.all(y.filter(function(v){return["content","tag"].indexOf(v.type)===-1}).reduce(function(v,A){var E=c(A,t(t({},d),{},{resolvedId:l(A,d)})),_;if(E)_=E.then(function(C){p.push({tag:A.value,lIndex:A.lIndex,value:C})});else if(A.type==="placeholder")_=b.getValueAsync(A.value,{part:A}).then(function(C){return C??d.nullGetter(A)}).then(function(C){return p.push({tag:A.value,lIndex:A.lIndex,value:C}),C});else return;return v.push(_.catch(function(C){C instanceof Array?o(w,C):w.push(C)})),v},[])).then(function(){return{errors:w,resolved:p}})}return Um=h,Um}var Hm,u2;function IP(){if(u2)return Hm;u2=1;var i=Fr,e=i.startsWith,t=i.endsWith,r=i.isStarting,n=i.isEnding,s=i.isWhiteSpace,a=av();function o(c){for(var h="",d=0,p=c.length;d<p;d++){var g=c[d];s(g)||e(g,"<w:bookmarkEnd")||(t(h,"</w:tbl>")&&!e(g,"<w:p")&&!e(g,"<w:tbl")&&!e(g,"<w:sectPr")&&!e(g,"</w:ftr>")&&!e(g,"</w:hdr>")&&(g="<w:p/>".concat(g)),h=g,c[d]=g)}return c}function l(c,h){var d=h.fileTypeConfig.tagShouldContain||[],p="",g=-1;a.docx.indexOf(h.contentType)!==-1&&(c=o(c));for(var y=-1,b=0,w=d.length;b<w;b++)for(var v=d[b],A=v.tag,E=v.shouldContain,_=v.value,C=v.drop,I=v.dropParent,k=0,D=c.length;k<D;k++){var R=c[k];if(g===b){if(n(R,A))if(g=-1,I){for(var z=-1,G=y;G>0;G--)if(r(c[G],I)){z=G;break}for(var O=z;O<=c.length;O++){if(n(c[O],I)){c[O]="";break}c[O]=""}}else{for(var X=y;X<=k;X++)c[X]="";C||(c[k]=p+_+R)}p+=R;for(var S=0,J=E.length;S<J;S++){var Y=E[S];if(r(R,Y)){g=-1;break}}}g===-1&&r(R,A)&&R.substr(1).indexOf("<")===-1&&(R[R.length-2]==="/"?c[k]="":(y=k,g=b,p=R))}return c}return Hm=l,Hm}var $m,c2;function NP(){if(c2)return $m;c2=1;function i(A){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},i(A)}function e(A,E){if(!(A instanceof E))throw new TypeError("Cannot call a class as a function")}function t(A,E){for(var _=0;_<E.length;_++){var C=E[_];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(A,n(C.key),C)}}function r(A,E,_){return E&&t(A.prototype,E),Object.defineProperty(A,"prototype",{writable:!1}),A}function n(A){var E=s(A,"string");return i(E)=="symbol"?E:E+""}function s(A,E){if(i(A)!="object"||!A)return A;var _=A[Symbol.toPrimitive];if(_!==void 0){var C=_.call(A,E);if(i(C)!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(A)}var a=Fr,o=a.pushArray,l=a.wordToUtf8,c=a.convertSpaces,h=wA(),d=yA(),p=kP(),g=DP(),y=PP(),b=RP(),w=IP();function v(A,E){var _=h(A,E),C=_.matches.map(function(I){return I.array[2]});return l(c(C.join("")))}return $m=function(){function A(E,_){e(this,A),this.cachedParsers={},this.content=E;for(var C in _)this[C]=_[C];this.setModules({inspect:{filePath:_.filePath}})}return r(A,[{key:"resolveTags",value:function(_){var C=this;this.tags=_;var I=this.getOptions(),k=this.filePath;I.scopeManager=this.scopeManager,I.resolve=b;var D=[];return Promise.all(this.modules.map(function(R){return Promise.resolve(R.preResolve(I)).catch(function(z){D.push(z)})})).then(function(){if(D.length!==0)throw D;return b(I).then(function(R){var z=R.resolved,G=R.errors;if(G=G.map(function(O){var X;return O instanceof Error||(O=new Error(O)),(X=O).properties||(X.properties={}),O.properties.file=k,O}),G.length!==0)throw G;return Promise.all(z).then(function(O){return I.scopeManager.root.finishedResolving=!0,I.scopeManager.resolved=O,C.setModules({inspect:{resolved:O,filePath:k}}),O})}).catch(function(R){throw C.errorChecker(R),R})})}},{key:"getFullText",value:function(){return v(this.content,this.fileTypeConfig.tagsXmlTextArray)}},{key:"setModules",value:function(_){for(var C=0,I=this.modules;C<I.length;C++){var k=I[C];k.set(_)}}},{key:"preparse",value:function(){this.allErrors=[],this.xmllexed=d.xmlparse(this.content,{text:this.fileTypeConfig.tagsXmlTextArray,other:this.fileTypeConfig.tagsXmlLexedArray}),this.setModules({inspect:{filePath:this.filePath,xmllexed:this.xmllexed}});var _=d.parse(this.xmllexed,this.delimiters,this.syntax,this.fileType),C=_.lexed,I=_.errors;o(this.allErrors,I),this.lexed=C,this.setModules({inspect:{filePath:this.filePath,lexed:this.lexed}});var k=this.getOptions();this.lexed=p.preparse(this.lexed,this.modules,k)}},{key:"parse",value:function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},C=_.noPostParse;this.setModules({inspect:{filePath:this.filePath}});var I=this.getOptions();return this.parsed=p.parse(this.lexed,this.modules,I),this.setModules({inspect:{filePath:this.filePath,parsed:this.parsed}}),C?this:this.postparse()}},{key:"postparse",value:function(){var _=this.getOptions(),C=p.postparse(this.parsed,this.modules,_),I=C.postparsed,k=C.errors;return this.postparsed=I,this.setModules({inspect:{filePath:this.filePath,postparsed:this.postparsed}}),o(this.allErrors,k),this.errorChecker(this.allErrors),this}},{key:"errorChecker",value:function(_){for(var C=0,I=_;C<I.length;C++){var k=I[C];k.properties||(k.properties={}),k.properties.file=this.filePath}for(var D=0,R=this.modules;D<R.length;D++){var z=R[D];_=z.errorsTransformer(_)}}},{key:"baseNullGetter",value:function(_,C){for(var I=null,k=0,D=this.modules;k<D.length;k++){var R=D[k];I==null&&(I=R.nullGetter(_,C,this))}return I??this.nullGetter(_,C)}},{key:"getOptions",value:function(){return{compiled:this.postparsed,cachedParsers:this.cachedParsers,tags:this.tags,modules:this.modules,parser:this.parser,contentType:this.contentType,relsType:this.relsType,baseNullGetter:this.baseNullGetter.bind(this),filePath:this.filePath,fileTypeConfig:this.fileTypeConfig,fileType:this.fileType,linebreaks:this.linebreaks,stripInvalidXMLChars:this.stripInvalidXMLChars}}},{key:"render",value:function(_){this.filePath=_;var C=this.getOptions();C.resolved=this.scopeManager.resolved,C.scopeManager=this.scopeManager,C.render=g,C.joinUncorrupt=w;var I=g(C),k=I.errors,D=I.parts;return k.length>0?(this.allErrors=k,this.errorChecker(k),this):(this.content=y(D,C),this.setModules({inspect:{filePath:this.filePath,content:this.content}}),this)}}])}(),$m}var Vm,h2;function MP(){if(h2)return Vm;h2=1;function i(x){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},i(x)}function e(x,U){var B=Object.keys(x);if(Object.getOwnPropertySymbols){var F=Object.getOwnPropertySymbols(x);U&&(F=F.filter(function(M){return Object.getOwnPropertyDescriptor(x,M).enumerable})),B.push.apply(B,F)}return B}function t(x){for(var U=1;U<arguments.length;U++){var B=arguments[U]!=null?arguments[U]:{};U%2?e(Object(B),!0).forEach(function(F){r(x,F,B[F])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(B)):e(Object(B)).forEach(function(F){Object.defineProperty(x,F,Object.getOwnPropertyDescriptor(B,F))})}return x}function r(x,U,B){return(U=g(U))in x?Object.defineProperty(x,U,{value:B,enumerable:!0,configurable:!0,writable:!0}):x[U]=B,x}function n(x,U){return c(x)||l(x,U)||a(x,U)||s()}function s(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
55
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(x,U){if(x){if(typeof x=="string")return o(x,U);var B={}.toString.call(x).slice(8,-1);return B==="Object"&&x.constructor&&(B=x.constructor.name),B==="Map"||B==="Set"?Array.from(x):B==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(B)?o(x,U):void 0}}function o(x,U){(U==null||U>x.length)&&(U=x.length);for(var B=0,F=Array(U);B<U;B++)F[B]=x[B];return F}function l(x,U){var B=x==null?null:typeof Symbol<"u"&&x[Symbol.iterator]||x["@@iterator"];if(B!=null){var F,M,q,de,we=[],ee=!0,Ee=!1;try{if(q=(B=B.call(x)).next,U!==0)for(;!(ee=(F=q.call(B)).done)&&(we.push(F.value),we.length!==U);ee=!0);}catch(De){Ee=!0,M=De}finally{try{if(!ee&&B.return!=null&&(de=B.return(),Object(de)!==de))return}finally{if(Ee)throw M}}return we}}function c(x){if(Array.isArray(x))return x}function h(x,U){if(!(x instanceof U))throw new TypeError("Cannot call a class as a function")}function d(x,U){for(var B=0;B<U.length;B++){var F=U[B];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(x,g(F.key),F)}}function p(x,U,B){return U&&d(x.prototype,U),Object.defineProperty(x,"prototype",{writable:!1}),x}function g(x){var U=y(x,"string");return i(U)=="symbol"?U:U+""}function y(x,U){if(i(x)!="object"||!x)return x;var B=x[Symbol.toPrimitive];if(B!==void 0){var F=B.call(x,U);if(i(F)!="object")return F;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(x)}var b=Fr,w=b.chunkBy,v=b.last,A=b.isParagraphStart,E=b.isModule,_=b.pushArray,C=b.isParagraphEnd,I=b.isContent,k=b.startsWith,D=b.isTagEnd,R=b.isTagStart,z=b.getSingleAttribute,G=b.setSingleAttribute,O=av(),X=Kl(),S="loop";function J(x){return x.some(function(U){return I(U)})}function Y(x){for(var U=0;U<x.length;U++){var B=x[U];if(B.type!=="content")return B}return null}function W(x){var U=Y(x.subparsed);return U!=null&&U.tag!=="w:t"}function fe(x){return x.hasPageBreak&&W(x)?'<w:p><w:r><w:br w:type="page"/></w:r></w:p>':""}function K(x){return x.length&&A(x[0])&&C(v(x))}function be(x){return J(x)?0:x.length}function te(x){var U=x.parts.length-1;x.parts[U]==="</w:p>"?x.parts.splice(U,0,'<w:r><w:br w:type="page"/></w:r>'):x.parts.push('<w:p><w:r><w:br w:type="page"/></w:r></w:p>')}function j(x){x.parts.unshift('<w:p><w:r><w:br w:type="page"/></w:r></w:p>')}function ie(x){return x.some(function(U){return R("w:type",U)&&U.value.indexOf("continuous")!==-1})}function ae(x){return x.some(function(U){return R("w:type",U)&&U.value.indexOf('w:val="nextPage"')!==-1})}function H(x,U){return _(["<w:p><w:pPr>".concat(U.map(function(B){var F=B.value;return F}).join(""),"</w:pPr></w:p>")],x)}function se(x){for(var U=!1,B=!1,F=[],M=0;M<x.length;M++){var q=x[M];U===!1&&k(q,"<w:sectPr")&&(B=!0),B&&(k(q,"<w:type")&&(U=!0),U===!1&&k(q,"</w:sectPr")&&F.push('<w:type w:val="continuous"/>')),F.push(q)}return F}function le(x){return x.filter(function(U){return!k(U,"<w:headerReference")&&!k(U,"<w:footerReference")})}function oe(x){return x.some(function(U){return U.tag==="w:br"&&U.value.indexOf('w:type="page"')!==-1})}function ce(x){return x.some(function(U){var B=U.tag;return B==="w:drawing"})}function Ae(x){for(var U=!1,B=[],F=0;F<x.length;F++){var M=x[F];R("w:sectPr",M)&&(B.push([]),U=!0),U&&B[B.length-1].push(M),D("w:sectPr",M)&&(U=!1)}return B}function Se(x){for(var U=!1,B=0,F=0;F<x.length;F++){var M=x[F];R("w:sectPr",M)&&(U=!0),U&&(M.tag==="w:headerReference"||M.tag==="w:footerReference")&&(B++,U=!1),D("w:sectPr",M)&&(U=!1)}return B}function Ne(x){for(var U=[],B=!1,F=x.length-1;F>=0;F--){var M=x[F];if(D("w:sectPr",M)&&(B=!0),R("w:sectPr",M)&&(U.unshift(M.value),B=!1),B&&U.unshift(M.value),A(M)){if(U.length>0)return U.join("");break}}return""}var Te=function(){function x(){h(this,x),this.name="LoopModule",this.inXfrm=!1,this.totalSectPr=0,this.prefix={start:"#",end:"/",dash:/^-([^\s]+)\s(.+)/,inverted:"^"}}return p(x,[{key:"optionsTransformer",value:function(B,F){return this.docxtemplater=F,B}},{key:"preparse",value:function(B,F){var M=F.contentType;O.main.indexOf(M)!==-1&&(this.sects=Ae(B))}},{key:"matchers",value:function(){var B=S;return[[this.prefix.start,B,{expandTo:"auto",location:"start",inverted:!1}],[this.prefix.inverted,B,{expandTo:"auto",location:"start",inverted:!0}],[this.prefix.end,B,{location:"end"}],[this.prefix.dash,B,function(F){var M=n(F,3),q=M[1],de=M[2];return{location:"start",inverted:!1,expandTo:q,value:de}}]]}},{key:"getTraits",value:function(B,F){if(B==="expandPair"){for(var M=[],q=0,de=F.length;q<de;q++){var we=F[q];E(we,S)&&we.subparsed==null&&M.push({part:we,offset:q})}return M}}},{key:"postparse",value:function(B,F){var M=F.basePart;if(M&&this.docxtemplater.fileType==="docx"&&B.length>0){M.sectPrCount=Se(B),this.totalSectPr+=M.sectPrCount;var q=this.sects;q.some(function(Me,$e){if(M.lIndex<Me[0].lIndex)return $e+1<q.length&&ie(q[$e+1])&&(M.addContinuousType=!0),!0;if(B[0].lIndex<Me[0].lIndex&&Me[0].lIndex<M.lIndex)return ae(q[$e])&&(M.addNextPage={index:$e}),!0}),M.lastParagrapSectPr=Ne(B)}if(!M||M.expandTo!=="auto"||M.module!==S||!K(B))return B;M.paragraphLoop=!0;var de=0,we=w(B,function(Me){return A(Me)&&(de++,de===1)?"start":C(Me)&&(de--,de===0)?"end":null}),ee=we[0],Ee=v(we),De=be(ee),Ce=be(Ee);return M.hasPageBreakBeginning=oe(ee),M.hasPageBreak=oe(Ee),ce(ee)&&(De=0),ce(Ee)&&(Ce=0),B.slice(De,B.length-Ce)}},{key:"resolve",value:function(B,F){if(!E(B,S))return null;var M=F.scopeManager,q=M.getValueAsync(B.value,{part:B}),de=[];function we(Ee,De,Ce){var Me=M.createSubScopeManager(Ee,B.value,De,B,Ce);de.push(F.resolve(t(t({},F),{},{compiled:B.subparsed,tags:{},scopeManager:Me})))}var ee=[];return q.then(function(Ee){return Ee??(Ee=F.nullGetter(B)),new Promise(function(De){if(Ee instanceof Promise)return Ee.then(function(Ce){Ce instanceof Array?Promise.all(Ce).then(De):De(Ce)});Ee instanceof Array?Promise.all(Ee).then(De):De(Ee)}).then(function(De){return M.loopOverValue(De,we,B.inverted),Promise.all(de).then(function(Ce){return Ce.map(function(Me){var $e=Me.resolved,Xe=Me.errors;return _(ee,Xe),$e})}).then(function(Ce){if(ee.length>0)throw ee;return Ce})})})}},{key:"render",value:function(B,F){if(B.tag==="p:xfrm"&&(this.inXfrm=B.position==="start"),B.tag==="a:ext"&&this.inXfrm)return this.lastExt=B,B;if(!E(B,S))return null;var M=[],q=[],de=0,we=this,ee=B.subparsed[0],Ee=0;(ee==null?void 0:ee.tag)==="a:tr"&&(Ee=+z(ee.value,"h")),de-=Ee;var De=0,Ce=W(B);function Me(nr,yr,rr){de+=Ee;for(var ge=F.scopeManager.createSubScopeManager(nr,B.value,yr,B,rr),ve=0,he=B.subparsed;ve<he.length;ve++){var me=he[ve];if(R("a16:rowId",me)){var Fe=+z(me.value,"val")+De;De=1,me.value=G(me.value,"val",Fe)}}var Ue=F.render(t(t({},F),{},{compiled:B.subparsed,tags:{},scopeManager:ge}));B.hasPageBreak&&yr===rr-1&&Ce&&te(Ue);var st=ge.scopePathItem.some(function(mt){return mt!==0});st?(B.sectPrCount===1&&(Ue.parts=le(Ue.parts)),B.addContinuousType&&(Ue.parts=se(Ue.parts))):B.addNextPage&&(Ue.parts=H(Ue.parts,we.sects[B.addNextPage.index])),B.addNextPage&&te(Ue),B.hasPageBreakBeginning&&Ce&&j(Ue);for(var Ye=0,ct=Ue.parts;Ye<ct.length;Ye++){var pt=ct[Ye];M.push(pt)}_(q,Ue.errors)}var $e=F.scopeManager.getValue(B.value,{part:B});$e??($e=F.nullGetter(B));var Xe=F.scopeManager.loopOverValue($e,Me,B.inverted);if(Xe===!1)return B.lastParagrapSectPr?B.paragraphLoop?{value:"<w:p><w:pPr>".concat(B.lastParagrapSectPr,"</w:pPr></w:p>")}:{value:"</w:t></w:r></w:p><w:p><w:pPr>".concat(B.lastParagrapSectPr,"</w:pPr><w:r><w:t>")}:{value:fe(B)||"",errors:q};if(de!==0){var Tt=+z(this.lastExt.value,"cy");this.lastExt.value=G(this.lastExt.value,"cy",Tt+de)}return{value:F.joinUncorrupt(M,t(t({},F),{},{basePart:B})),errors:q}}}])}();return Vm=function(){return X(new Te)},Vm}var Gm,d2;function LP(){if(d2)return Gm;d2=1;function i(C){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(I){return typeof I}:function(I){return I&&typeof Symbol=="function"&&I.constructor===Symbol&&I!==Symbol.prototype?"symbol":typeof I},i(C)}function e(C,I){if(!(C instanceof I))throw new TypeError("Cannot call a class as a function")}function t(C,I){for(var k=0;k<I.length;k++){var D=I[k];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(C,n(D.key),D)}}function r(C,I,k){return I&&t(C.prototype,I),Object.defineProperty(C,"prototype",{writable:!1}),C}function n(C){var I=s(C,"string");return i(I)=="symbol"?I:I+""}function s(C,I){if(i(C)!="object"||!C)return C;var k=C[Symbol.toPrimitive];if(k!==void 0){var D=k.call(C,I);if(i(D)!="object")return D;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(C)}var a=Kl(),o=Fr,l=o.isTextStart,c=o.isTextEnd,h=o.endsWith,d=o.startsWith,p=o.pushArray,g='<w:t xml:space="preserve">',y=g.length,b="</w:t>",w=b.length;function v(C){return l(C)&&C.tag==="w:t"}function A(C,I){var k=C[I].value;return C[I+1].value==="</w:t>"||k.indexOf('xml:space="preserve"')!==-1?k:k.substr(0,k.length-1)+' xml:space="preserve">'}function E(C,I){return C&&C.basePart&&I.length>1}var _=function(){function C(){e(this,C),this.name="SpacePreserveModule"}return r(C,[{key:"postparse",value:function(k,D){var R=[],z=!1,G=0,O=0;function X(J,Y){return J.type==="placeholder"&&Y.length>1}var S=k.reduce(function(J,Y){return v(Y)&&(z=!0,O=R.length),z?(R.push(Y),E(D,R)&&(G=D.basePart.endLindex,R[0].value=A(R,0)),X(Y,R)&&(R[O].value=A(R,O),G=Y.endLindex),c(Y)&&Y.lIndex>G&&(G!==0&&(R[O].value=A(R,O)),p(J,R),R=[],z=!1,G=0,O=0),J):(J.push(Y),J)},[]);return p(S,R),S}},{key:"postrender",value:function(k){for(var D="",R=0,z=0,G=k.length;z<G;z++){var O=k[z];O!==""&&(h(D,g)&&d(O,b)&&(k[R]=D.substr(0,D.length-y)+"<w:t/>",O=O.substr(w)),D=O,R=z,k[z]=O)}return k}}])}();return Gm=function(){return a(new _)},Gm}var qm,f2;function OP(){if(f2)return qm;f2=1;function i(w){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(v){return typeof v}:function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},i(w)}function e(w,v){if(!(w instanceof v))throw new TypeError("Cannot call a class as a function")}function t(w,v){for(var A=0;A<v.length;A++){var E=v[A];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(w,n(E.key),E)}}function r(w,v,A){return v&&t(w.prototype,v),Object.defineProperty(w,"prototype",{writable:!1}),w}function n(w){var v=s(w,"string");return i(v)=="symbol"?v:v+""}function s(w,v){if(i(w)!="object"||!w)return w;var A=w[Symbol.toPrimitive];if(A!==void 0){var E=A.call(w,v);if(i(E)!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(w)}var a=sv(),o=Fr,l=o.isContent,c=Xi,h=c.throwRawTagShouldBeOnlyTextInParagraph,d=c.getInvalidRawXMLValueException,p=Kl(),g="rawxml";function y(w){for(var v=w.part,A=w.left,E=w.right,_=w.postparsed,C=w.index,I=_.slice(A+1,E),k=0,D=I.length;k<D;k++)if(k!==C-A-1){var R=I[k];l(R)&&h({paragraphParts:I,part:v})}return v}var b=function(){function w(){e(this,w),this.name="RawXmlModule",this.prefix="@"}return r(w,[{key:"optionsTransformer",value:function(A,E){return this.fileTypeConfig=E.fileTypeConfig,A}},{key:"matchers",value:function(){return[[this.prefix,g]]}},{key:"postparse",value:function(A){return a.expandToOne(A,{moduleName:g,getInner:y,expandTo:this.fileTypeConfig.tagRawXml,error:{message:"Raw tag not in paragraph",id:"raw_tag_outerxml_invalid",explanation:function(_){return'The tag "'.concat(_.value,'" is not inside a paragraph, putting raw tags inside an inline loop is disallowed.')}}})}},{key:"render",value:function(A,E){if(A.module!==g)return null;var _,C=[];try{_=E.scopeManager.getValue(A.value,{part:A}),_??(_=E.nullGetter(A))}catch(I){return C.push(I),{errors:C}}return _=_||"",typeof _=="string"?{value:_}:{errors:[d({tag:A.value,value:_,offset:A.offset})]}}}])}();return qm=function(){return p(new b)},qm}var Wm,p2;function FP(){if(p2)return Wm;p2=1;function i(e,t){for(var r=-1,n=0,s=e.length;n<s;n++)t[n]>=e[n].length||(r===-1||e[n][t[n]].offset<e[r][t[r]].offset)&&(r=n);return r}return Wm=function(e){for(var t=0,r=0,n=e;r<n.length;r++){var s=n[r];t+=s.length}e=e.filter(function(h){return h.length>0});for(var a=new Array(t),o=e.map(function(){return 0}),l=0;l<t;l++){var c=i(e,o);a[l]=e[c][o[c]],o[c]++}return a},Wm}var Xm,g2;function BP(){if(g2)return Xm;g2=1;function i(D){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(R){return typeof R}:function(R){return R&&typeof Symbol=="function"&&R.constructor===Symbol&&R!==Symbol.prototype?"symbol":typeof R},i(D)}function e(D,R){if(!(D instanceof R))throw new TypeError("Cannot call a class as a function")}function t(D,R){for(var z=0;z<R.length;z++){var G=R[z];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(D,n(G.key),G)}}function r(D,R,z){return R&&t(D.prototype,R),Object.defineProperty(D,"prototype",{writable:!1}),D}function n(D){var R=s(D,"string");return i(R)=="symbol"?R:R+""}function s(D,R){if(i(D)!="object"||!D)return D;var z=D[Symbol.toPrimitive];if(z!==void 0){var G=z.call(D,R);if(i(G)!="object")return G;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(D)}var a="expandPair",o=FP(),l=Fr,c=l.getLeft,h=l.getRight,d=l.pushArray,p=Kl(),g=sv(),y=g.getExpandToDefault,b=Xi,w=b.getUnmatchedLoopException,v=b.getClosingTagNotMatchOpeningTag,A=b.getUnbalancedLoopException;function E(D){switch(D.location){case"start":return 1;case"end":return-1}}function _(D,R){return D!=null&&R!=null&&(D.part.location==="start"&&R.part.location==="end"&&D.part.value===R.part.value||R.part.value==="")}function C(D){for(var R=0,z=[];R<D.length;){var G=D[R].part;if(G.location==="end"){if(R===0)return D.splice(0,1),z.push(w(G)),{traits:D,errors:z};var O=R,X=R-1,S=1;if(_(D[X],D[O]))return D.splice(O,1),D.splice(X,1),{errors:z,traits:D};for(;S<50;){var J=D[X-S],Y=D[O+S];if(_(J,D[O]))return D.splice(O,1),D.splice(X-S,1),{errors:z,traits:D};if(_(D[X],Y))return D.splice(O+S,1),D.splice(X,1),{errors:z,traits:D};S++}return z.push(v({tags:[D[X].part,D[O].part]})),D.splice(O,1),D.splice(X,1),{traits:D,errors:z}}R++}for(var W=0;W<D.length;W++){var fe=D[W].part;z.push(w(fe))}return{traits:[],errors:z}}function I(D){var R={},z=[],G=[],O=[];for(d(O,D);O.length>0;){var X=C(O);d(z,X.errors),O=X.traits}if(z.length>0)return{pairs:G,errors:z};for(var S=0,J=0;J<D.length;J++){var Y=D[J],W=Y.part,fe=E(W);if(S+=fe,fe===1)R[S]=Y;else{var K=R[S+1];S===0&&G.push([K,Y])}S=S>=0?S:0}return{pairs:G,errors:z}}var k=function(){function D(){e(this,D),this.name="ExpandPairTrait"}return r(D,[{key:"optionsTransformer",value:function(z,G){return G.options.paragraphLoop&&d(G.fileTypeConfig.expandTags,G.fileTypeConfig.onParagraphLoop),this.expandTags=G.fileTypeConfig.expandTags,z}},{key:"postparse",value:function(z,G){var O=this,X=G.getTraits,S=G.postparse,J=G.fileType,Y=X(a,z);Y=Y.map(function(se){return se||[]}),Y=o(Y);var W=I(Y),fe=W.pairs,K=W.errors,be=0,te=null,j=fe.map(function(se){var le=se[0].part.expandTo;if(le==="auto"&&J!=="text"){var oe=y(z,se,O.expandTags);oe.error&&K.push(oe.error),le=oe.value}if(!le||J==="text"){var ce=se[0].offset,Ae=se[1].offset;return ce<be&&!O.docxtemplater.options.syntax.allowUnbalancedLoops&&K.push(A(se,te)),te=se,be=Ae,[ce,Ae]}var Se,Ne;try{Se=c(z,le,se[0].offset)}catch(Te){K.push(Te)}try{Ne=h(z,le,se[1].offset)}catch(Te){K.push(Te)}return Se<be&&!O.docxtemplater.options.syntax.allowUnbalancedLoops&&K.push(A(se,te)),be=Ne,te=se,[Se,Ne]});if(K.length>0)return{postparsed:z,errors:K};var ie=0,ae,H=z.reduce(function(se,le,oe){var ce=ie<fe.length&&j[ie][0]<=oe&&oe<=j[ie][1],Ae=fe[ie],Se=j[ie];if(!ce)return se.push(le),se;if(Se[0]===oe&&(ae=[]),Ae[0].offset!==oe&&Ae[1].offset!==oe&&ae.push(le),Se[1]===oe){var Ne=z[Ae[0].offset];Ne.subparsed=S(ae,{basePart:Ne}),Ne.endLindex=Ae[1].part.lIndex,delete Ne.location,delete Ne.expandTo,se.push(Ne),ie++;for(var Te=j[ie];Te&&Te[0]<oe;)ie++,Te=j[ie]}return se},[]);return{postparsed:H,errors:K}}}])}();return Xm=function(){return p(new k)},Xm}var Ym,m2;function zP(){if(m2)return Ym;m2=1;function i(I){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},i(I)}function e(I,k){if(!(I instanceof k))throw new TypeError("Cannot call a class as a function")}function t(I,k){for(var D=0;D<k.length;D++){var R=k[D];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(I,n(R.key),R)}}function r(I,k,D){return k&&t(I.prototype,k),Object.defineProperty(I,"prototype",{writable:!1}),I}function n(I){var k=s(I,"string");return i(k)=="symbol"?k:k+""}function s(I,k){if(i(I)!="object"||!I)return I;var D=I[Symbol.toPrimitive];if(D!==void 0){var R=D.call(I,k);if(i(R)!="object")return R;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(I)}var a=Kl(),o=Xi,l=o.getScopeCompilationError,c=o.getCorruptCharactersException,h=Fr,d=h.utf8ToWord,p=h.hasCorruptCharacters,g=h.removeCorruptCharacters,y=vA(),b=y.settingsContentType,w=y.coreContentType,v=y.appContentType,A=y.customContentType,E=[b,w,v,A],_={docx:"w",pptx:"a"},C=function(){function I(){e(this,I),this.name="Render",this.recordRun=!1,this.recordedRun=[]}return r(I,[{key:"optionsTransformer",value:function(D,R){return this.docxtemplater=R,this.brTag=R.fileType==="docx"?"<w:r><w:br/></w:r>":"<a:br/>",this.prefix=_[R.fileType],this.runStartTag="".concat(this.prefix,":r"),this.runPropsStartTag="".concat(this.prefix,":rPr"),D}},{key:"set",value:function(D){D.compiled&&(this.compiled=D.compiled),D.data!=null&&(this.data=D.data)}},{key:"getRenderedMap",value:function(D){for(var R in this.compiled)D[R]={from:R,data:this.data};return D}},{key:"postparse",value:function(D,R){for(var z=[],G=0;G<D.length;G++){var O=D[G];if(O.type==="placeholder"){var X=O.value;try{R.cachedParsers[O.lIndex]=this.docxtemplater.parser(X,{tag:O})}catch(S){z.push(l({tag:X,rootError:S,offset:O.offset}))}}}return{postparsed:D,errors:z}}},{key:"render",value:function(D,R){var z=R.contentType,G=R.scopeManager,O=R.linebreaks,X=R.nullGetter,S=R.fileType,J=R.stripInvalidXMLChars;if(E.indexOf(z)!==-1&&(O=!1),O&&this.recordRuns(D),!(D.type!=="placeholder"||D.module)){var Y;try{Y=G.getValue(D.value,{part:D})}catch(W){return{errors:[W]}}if(Y??(Y=X(D)),typeof Y=="string"){if(J)Y=g(Y);else if(["docx","pptx","xlsx"].indexOf(S)!==-1&&p(Y))return{errors:[c({tag:D.value,value:Y,offset:D.offset})]}}return S==="text"?{value:Y}:{value:O&&typeof Y=="string"?this.renderLineBreaks(Y):d(Y)}}}},{key:"recordRuns",value:function(D){D.tag===this.runStartTag?this.recordedRun="":D.tag===this.runPropsStartTag?(D.position==="start"&&(this.recordRun=!0,this.recordedRun+=D.value),(D.position==="end"||D.position==="selfclosing")&&(this.recordedRun+=D.value,this.recordRun=!1)):this.recordRun&&(this.recordedRun+=D.value)}},{key:"renderLineBreaks",value:function(D){for(var R=[],z=D.split(`
|
|
56
|
+
`),G=0,O=z.length;G<O;G++)R.push(d(z[G])),G<z.length-1&&R.push("</".concat(this.prefix,":t></").concat(this.prefix,":r>").concat(this.brTag,"<").concat(this.prefix,":r>").concat(this.recordedRun,"<").concat(this.prefix,":t").concat(this.docxtemplater.fileType==="docx"?' xml:space="preserve"':"",">"));return R}}])}();return Ym=function(){return a(new C)},Ym}var Zm,b2;function jP(){if(b2)return Zm;b2=1;var i=MP(),e=LP(),t=OP(),r=BP(),n=zP();function s(){return{getTemplatedFiles:function(){return[]},textPath:function(l){return l.textTarget},tagsXmlTextArray:["Company","HyperlinkBase","Manager","cp:category","cp:keywords","dc:creator","dc:description","dc:subject","dc:title","cp:contentStatus","w:t","a:t","m:t","vt:lpstr","vt:lpwstr"],tagsXmlLexedArray:["w:proofState","w:tc","w:tr","w:tbl","w:ftr","w:hdr","w:body","w:document","w:p","w:r","w:br","w:rPr","w:pPr","w:spacing","w:sdtContent","w:sdt","w:drawing","w:sectPr","w:type","w:headerReference","w:footerReference","w:bookmarkStart","w:bookmarkEnd","w:commentRangeStart","w:commentRangeEnd","w:commentReference"],droppedTagsInsidePlaceholder:["w:p","w:br","w:bookmarkStart","w:bookmarkEnd"],expandTags:[{contains:"w:tc",expand:"w:tr"}],onParagraphLoop:[{contains:"w:p",expand:"w:p",onlyTextInTag:!0}],tagRawXml:"w:p",baseModules:[i,e,r,t,n],tagShouldContain:[{tag:"w:sdtContent",shouldContain:["w:p","w:r","w:commentRangeStart","w:sdt"],value:"<w:p></w:p>"},{tag:"w:tc",shouldContain:["w:p"],value:"<w:p></w:p>"},{tag:"w:tr",shouldContain:["w:tc"],drop:!0},{tag:"w:tbl",shouldContain:["w:tr"],drop:!0}]}}function a(){return{getTemplatedFiles:function(){return[]},textPath:function(l){return l.textTarget},tagsXmlTextArray:["Company","HyperlinkBase","Manager","cp:category","cp:keywords","dc:creator","dc:description","dc:subject","dc:title","a:t","m:t","vt:lpstr","vt:lpwstr"],tagsXmlLexedArray:["p:sp","a:tc","a:tr","a:tbl","a:graphicData","a:p","a:r","a:rPr","p:txBody","a:txBody","a:off","a:ext","p:graphicFrame","p:xfrm","a16:rowId","a:endParaRPr"],droppedTagsInsidePlaceholder:["a:p","a:endParaRPr"],expandTags:[{contains:"a:tc",expand:"a:tr"}],onParagraphLoop:[{contains:"a:p",expand:"a:p",onlyTextInTag:!0}],tagRawXml:"p:sp",baseModules:[i,r,t,n],tagShouldContain:[{tag:"a:tbl",shouldContain:["a:tr"],dropParent:"p:graphicFrame"},{tag:"p:txBody",shouldContain:["a:p"],value:"<a:p></a:p>"},{tag:"a:txBody",shouldContain:["a:p"],value:"<a:p></a:p>"}]}}return Zm={docx:s,pptx:a},Zm}(function(i){var e=["modules"];function t(ge,ve){var he=Object.keys(ge);if(Object.getOwnPropertySymbols){var me=Object.getOwnPropertySymbols(ge);ve&&(me=me.filter(function(Fe){return Object.getOwnPropertyDescriptor(ge,Fe).enumerable})),he.push.apply(he,me)}return he}function r(ge){for(var ve=1;ve<arguments.length;ve++){var he=arguments[ve]!=null?arguments[ve]:{};ve%2?t(Object(he),!0).forEach(function(me){n(ge,me,he[me])}):Object.getOwnPropertyDescriptors?Object.defineProperties(ge,Object.getOwnPropertyDescriptors(he)):t(Object(he)).forEach(function(me){Object.defineProperty(ge,me,Object.getOwnPropertyDescriptor(he,me))})}return ge}function n(ge,ve,he){return(ve=v(ve))in ge?Object.defineProperty(ge,ve,{value:he,enumerable:!0,configurable:!0,writable:!0}):ge[ve]=he,ge}function s(ge,ve){return h(ge)||c(ge,ve)||o(ge,ve)||a()}function a(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
57
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o(ge,ve){if(ge){if(typeof ge=="string")return l(ge,ve);var he={}.toString.call(ge).slice(8,-1);return he==="Object"&&ge.constructor&&(he=ge.constructor.name),he==="Map"||he==="Set"?Array.from(ge):he==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(he)?l(ge,ve):void 0}}function l(ge,ve){(ve==null||ve>ge.length)&&(ve=ge.length);for(var he=0,me=Array(ve);he<ve;he++)me[he]=ge[he];return me}function c(ge,ve){var he=ge==null?null:typeof Symbol<"u"&&ge[Symbol.iterator]||ge["@@iterator"];if(he!=null){var me,Fe,Ue,st,Ye=[],ct=!0,pt=!1;try{if(Ue=(he=he.call(ge)).next,ve===0){if(Object(he)!==he)return;ct=!1}else for(;!(ct=(me=Ue.call(he)).done)&&(Ye.push(me.value),Ye.length!==ve);ct=!0);}catch(mt){pt=!0,Fe=mt}finally{try{if(!ct&&he.return!=null&&(st=he.return(),Object(st)!==st))return}finally{if(pt)throw Fe}}return Ye}}function h(ge){if(Array.isArray(ge))return ge}function d(ge){"@babel/helpers - typeof";return d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ve){return typeof ve}:function(ve){return ve&&typeof Symbol=="function"&&ve.constructor===Symbol&&ve!==Symbol.prototype?"symbol":typeof ve},d(ge)}function p(ge,ve){if(ge==null)return{};var he,me,Fe=g(ge,ve);if(Object.getOwnPropertySymbols){var Ue=Object.getOwnPropertySymbols(ge);for(me=0;me<Ue.length;me++)he=Ue[me],ve.indexOf(he)===-1&&{}.propertyIsEnumerable.call(ge,he)&&(Fe[he]=ge[he])}return Fe}function g(ge,ve){if(ge==null)return{};var he={};for(var me in ge)if({}.hasOwnProperty.call(ge,me)){if(ve.indexOf(me)!==-1)continue;he[me]=ge[me]}return he}function y(ge,ve){if(!(ge instanceof ve))throw new TypeError("Cannot call a class as a function")}function b(ge,ve){for(var he=0;he<ve.length;he++){var me=ve[he];me.enumerable=me.enumerable||!1,me.configurable=!0,"value"in me&&(me.writable=!0),Object.defineProperty(ge,v(me.key),me)}}function w(ge,ve,he){return ve&&b(ge.prototype,ve),Object.defineProperty(ge,"prototype",{writable:!1}),ge}function v(ge){var ve=A(ge,"string");return d(ve)=="symbol"?ve:ve+""}function A(ge,ve){if(d(ge)!="object"||!ge)return ge;var he=ge[Symbol.toPrimitive];if(he!==void 0){var me=he.call(ge,ve);if(d(me)!="object")return me;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(ge)}var E=Fr,_=wP,C=_.object({allowUnopenedTag:_.boolean().optional(),allowUnclosedTag:_.boolean().optional(),allowUnbalancedLoops:_.boolean().optional(),changeDelimiterPrefix:_.string().optional().nullable()}),I=_.object({delimiters:_.object({start:_.string().nullable(),end:_.string().nullable()}).strict().optional(),fileTypeConfig:_.object({}).optional(),paragraphLoop:_.boolean().optional(),parser:_.function().optional(),errorLogging:_.union([_.boolean(),_.string()]).optional(),linebreaks:_.boolean().optional(),nullGetter:_.function().optional(),syntax:C.optional(),stripInvalidXMLChars:_.boolean().optional()}).strict(),k=xP(),D=k.getRelsTypes,R=AP(),z=R.collectContentTypes,G=R.getContentTypes,O=Kl(),X=sv(),S=EP(),J=_P(),Y=yA(),W=CP(),fe=W.getTags,K=SP(),be=Xi,te=be.throwMultiError,j=be.throwResolveBeforeCompile,ie=be.throwRenderInvalidTemplate,ae=be.throwRenderTwice,H=be.XTInternalError,se=be.XTTemplateError,le=be.throwFileTypeNotIdentified,oe=be.throwFileTypeNotHandled,ce=be.throwApiVersionError;E.getRelsTypes=D,E.traits=X,E.moduleWrapper=O,E.collectContentTypes=z,E.getContentTypes=G;var Ae=E.getDefaults,Se=E.str2xml,Ne=E.xml2str,Te=E.concatArrays,x=E.uniq,U=E.getDuplicates,B=E.stableSort,F=E.pushArray,M=E.utf8ToWord,q=E.invertMap,de="[Content_Types].xml",we="_rels/.rels",ee=[3,47,2];function Ee(ge){var ve=U(ge.map(function(he){var me=he.name;return me}));if(ve.length>0)throw new H('Detected duplicate module "'.concat(ve[0],'"'))}function De(ge){for(var ve=0,he=ge.modules;ve<he.length;ve++)for(var me=he[ve],Fe=0,Ue=me.xmlContentTypes||[];Fe<Ue.length;Fe++)for(var st=Ue[Fe],Ye=ge.invertedContentTypes[st]||[],ct=0;ct<Ye.length;ct++){var pt=Ye[ct];ge.zip.files[pt]&&ge.options.xmlFileNames.push(pt)}}function Ce(ge){return B(ge,function(ve,he){return(he.priority||0)-(ve.priority||0)})}function Me(ge){var ve=[];for(var he in ge)ve.push(he);for(var me=[de,we],Fe=["word/","xl/","ppt/"],Ue=0;Ue<ve.length;Ue++)for(var st=ve[Ue],Ye=0;Ye<Fe.length;Ye++){var ct=Fe[Ye];st.indexOf("".concat(ct))===0&&me.push(st)}for(var pt=0;pt<ve.length;pt++){var mt=ve[pt];me.indexOf(mt)===-1&&me.push(mt)}return me}function $e(ge,ve){ge.hideDeprecations!==!0&&console.warn(ve)}function Xe(ge,ve){if(ge.hideDeprecations!==!0)return $e(ge,'Deprecated method ".'.concat(ve,'", view upgrade guide : https://docxtemplater.com/docs/api/#upgrade-guide, stack : ').concat(new Error().stack))}function Tt(ge){ge.modules=ge.modules.filter(function(ve){if(!ve.supportedFileTypes)return!0;if(!Array.isArray(ve.supportedFileTypes))throw new Error("The supportedFileTypes field of the module must be an array");var he=ve.supportedFileTypes.includes(ge.fileType);return he||ve.on("detached"),he})}function nr(ge){var ve=ge.compiled;ge.errors=Te(Object.keys(ve).map(function(he){return ve[he].allErrors})),ge.errors.length!==0&&(ge.options.errorLogging&&K(ge.errors,ge.options.errorLogging),te(ge.errors))}function yr(ge){return typeof Buffer<"u"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(ge)}var rr=function(){function ge(ve){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=he.modules,Fe=me===void 0?[]:me,Ue=p(he,e);if(y(this,ge),this.targets=[],this.rendered=!1,this.scopeManagers={},this.compiled={},this.modules=[S()],this.xmlDocuments={},arguments.length===0)$e(this,"Deprecated docxtemplater constructor with no arguments, view upgrade guide : https://docxtemplater.com/docs/api/#upgrade-guide, stack : ".concat(new Error().stack)),this.hideDeprecations=!0,this.setOptions(Ue);else{if(this.hideDeprecations=!0,this.setOptions(Ue),yr(ve))throw new Error("You passed a Buffer to the Docxtemplater constructor. The first argument of docxtemplater's constructor must be a valid zip file (jszip v2 or pizzip v3)");if(!ve||!ve.files||typeof ve.file!="function")throw new Error("The first argument of docxtemplater's constructor must be a valid zip file (jszip v2 or pizzip v3)");if(!Array.isArray(Fe))throw new Error("The modules argument of docxtemplater's constructor must be an array");for(var st=0;st<Fe.length;st++){var Ye=Fe[st];this.attachModule(Ye)}this.loadZip(ve),this.compile(),this.v4Constructor=!0}this.hideDeprecations=!1}return w(ge,[{key:"verifyApiVersion",value:function(he){return he=he.split(".").map(function(me){return parseInt(me,10)}),he.length!==3&&ce("neededVersion is not a valid version",{neededVersion:he,explanation:"the neededVersion must be an array of length 3"}),he[0]!==ee[0]&&ce("The major api version do not match, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:he,currentModuleApiVersion:ee,explanation:"moduleAPIVersionMismatch : needed=".concat(he.join("."),", current=").concat(ee.join("."))}),he[1]>ee[1]&&ce("The minor api version is not uptodate, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:he,currentModuleApiVersion:ee,explanation:"moduleAPIVersionMismatch : needed=".concat(he.join("."),", current=").concat(ee.join("."))}),he[1]===ee[1]&&he[2]>ee[2]&&ce("The patch api version is not uptodate, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:he,currentModuleApiVersion:ee,explanation:"moduleAPIVersionMismatch : needed=".concat(he.join("."),", current=").concat(ee.join("."))}),!0}},{key:"setModules",value:function(he){for(var me=0,Fe=this.modules;me<Fe.length;me++){var Ue=Fe[me];Ue.set(he)}}},{key:"sendEvent",value:function(he){for(var me=0,Fe=this.modules;me<Fe.length;me++){var Ue=Fe[me];Ue.on(he)}}},{key:"attachModule",value:function(he){if(this.v4Constructor)throw new H("attachModule() should not be called manually when using the v4 constructor");Xe(this,"attachModule");var me=d(he);if(me==="function")throw new H("Cannot attach a class/function as a module. Most probably you forgot to instantiate the module by using `new` on the module.");if(!he||me!=="object")throw new H("Cannot attachModule with a falsy value");if(he.requiredAPIVersion&&this.verifyApiVersion(he.requiredAPIVersion),he.attached===!0)if(typeof he.clone=="function")he=he.clone();else throw new Error('Cannot attach a module that was already attached : "'.concat(he.name,'". The most likely cause is that you are instantiating the module at the root level, and using it for multiple instances of Docxtemplater'));he.attached=!0;var Fe=O(he);return this.modules.push(Fe),Fe.on("attached"),this.fileType&&Tt(this),this}},{key:"findModule",value:function(he){for(var me=0,Fe=this.modules;me<Fe.length;me++){var Ue=Fe[me];if(Ue.name===he)return Ue}}},{key:"setOptions",value:function(he){var me,Fe;if(this.v4Constructor)throw new Error("setOptions() should not be called manually when using the v4 constructor");if(!he)throw new Error("setOptions should be called with an object as first parameter");var Ue=I.validate(he);if(Ue.success===!1)throw new Error(Ue.error);Xe(this,"setOptions"),this.options={};var st=Ae();for(var Ye in st){var ct=st[Ye];this.options[Ye]=he[Ye]!=null?he[Ye]:this[Ye]||ct,this[Ye]=this.options[Ye]}return(me=this.delimiters).start&&(me.start=M(this.delimiters.start)),(Fe=this.delimiters).end&&(Fe.end=M(this.delimiters.end)),this}},{key:"loadZip",value:function(he){if(this.v4Constructor)throw new Error("loadZip() should not be called manually when using the v4 constructor");if(Xe(this,"loadZip"),he.loadAsync)throw new H("Docxtemplater doesn't handle JSZip version >=3, please use pizzip");this.zip=he,this.updateFileTypeConfig(),this.modules=Te([this.fileTypeConfig.baseModules.map(function(st){return st()}),this.modules]);for(var me=0,Fe=this.modules;me<Fe.length;me++){var Ue=Fe[me];Ue.zip=this.zip,Ue.docxtemplater=this,Ue.fileTypeConfig=this.fileTypeConfig,Ue.fileType=this.fileType,Ue.xtOptions=this.options,Ue.modules=this.modules}return Tt(this),this}},{key:"precompileFile",value:function(he){var me=this.createTemplateClass(he);me.preparse(),this.compiled[he]=me}},{key:"compileFile",value:function(he){this.compiled[he].parse()}},{key:"getScopeManager",value:function(he,me,Fe){var Ue;return(Ue=this.scopeManagers)[he]||(Ue[he]=J({tags:Fe,parser:this.parser,cachedParsers:me.cachedParsers})),this.scopeManagers[he]}},{key:"resolveData",value:function(he){var me=this;Xe(this,"resolveData");var Fe=[];return Object.keys(this.compiled).length||j(),Promise.resolve(he).then(function(Ue){return me.data=Ue,me.setModules({data:me.data,Lexer:Y}),me.mapper=me.modules.reduce(function(st,Ye){return Ye.getRenderedMap(st)},{}),Promise.all(Object.keys(me.mapper).map(function(st){var Ye=me.mapper[st],ct=Ye.from,pt=Ye.data;return Promise.resolve(pt).then(function(mt){var Ft=me.compiled[ct];return Ft.filePath=st,Ft.scopeManager=me.getScopeManager(st,Ft,mt),Ft.resolveTags(mt).then(function(at){return Ft.scopeManager.finishedResolving=!0,at},function(at){F(Fe,at)})})})).then(function(st){return Fe.length!==0&&(me.options.errorLogging&&K(Fe,me.options.errorLogging),te(Fe)),Te(st)})})}},{key:"compile",value:function(){if(Xe(this,"compile"),this.updateFileTypeConfig(),Ee(this.modules),this.modules=Ce(this.modules),Object.keys(this.compiled).length)return this;for(var he=this.options,me=0,Fe=this.modules;me<Fe.length;me++){var Ue=Fe[me];he=Ue.optionsTransformer(he,this)}this.options=he,this.options.xmlFileNames=x(this.options.xmlFileNames);for(var st=0,Ye=this.options.xmlFileNames;st<Ye.length;st++){var ct=Ye[st],pt=this.zip.files[ct].asText();this.xmlDocuments[ct]=Se(pt)}this.setModules({zip:this.zip,xmlDocuments:this.xmlDocuments});for(var mt=0,Ft=this.modules;mt<Ft.length;mt++){var at=Ft[mt];at.xmlDocuments=this.xmlDocuments}this.getTemplatedFiles(),this.sendEvent("before-preparse");for(var nn=0,jn=this.templatedFiles;nn<jn.length;nn++){var Ti=jn[nn];this.zip.files[Ti]!=null&&this.precompileFile(Ti)}this.sendEvent("after-preparse");for(var mn=0,Zi=this.templatedFiles;mn<Zi.length;mn++){var Un=Zi[mn];this.zip.files[Un]!=null&&this.compiled[Un].parse({noPostParse:!0})}this.sendEvent("after-parse");for(var sn=0,Wr=this.templatedFiles;sn<Wr.length;sn++){var ui=Wr[sn];this.zip.files[ui]!=null&&this.compiled[ui].postparse()}return this.sendEvent("after-postparse"),this.setModules({compiled:this.compiled}),nr(this),this}},{key:"updateFileTypeConfig",value:function(){this.relsTypes=D(this.zip);var he=G(this.zip),me=he.overrides,Fe=he.defaults,Ue=he.contentTypes,st=he.contentTypeXml;st&&(this.filesContentTypes=z(me,Fe,this.zip),this.invertedContentTypes=q(this.filesContentTypes),this.setModules({contentTypes:this.contentTypes,invertedContentTypes:this.invertedContentTypes}));var Ye;this.zip.files.mimetype&&(Ye="odt");for(var ct=0,pt=this.modules;ct<pt.length;ct++){var mt=pt[ct];Ye=mt.getFileType({zip:this.zip,contentTypes:Ue,contentTypeXml:st,overrides:me,defaults:Fe,doc:this})||Ye}if(this.fileType=Ye,Ye==="odt"&&oe(Ye),Ye||le(this.zip),De(this),Tt(this),this.fileTypeConfig=this.options.fileTypeConfig||this.fileTypeConfig,!this.fileTypeConfig)if(ge.FileTypeConfig[this.fileType])this.fileTypeConfig=ge.FileTypeConfig[this.fileType]();else{var Ft='Filetype "'.concat(this.fileType,'" is not supported'),at="filetype_not_supported";this.fileType==="xlsx"&&(Ft='Filetype "'.concat(this.fileType,'" is supported only with the paid XlsxModule'),at="xlsx_filetype_needs_xlsx_module");var nn=new se(Ft);throw nn.properties={id:at,explanation:Ft},nn}return this}},{key:"renderAsync",value:function(he){var me=this;this.hideDeprecations=!0;var Fe=this.resolveData(he);return this.hideDeprecations=!1,Fe.then(function(){return me.render()})}},{key:"render",value:function(he){this.rendered&&ae(),this.rendered=!0,Object.keys(this.compiled).length===0&&this.compile(),this.errors.length>0&&ie(),arguments.length>0&&(this.data=he),this.setModules({data:this.data,Lexer:Y}),this.mapper||(this.mapper=this.modules.reduce(function(Uc,Es){return Es.getRenderedMap(Uc)},{}));var me=[];for(var Fe in this.mapper){var Ue=this.mapper[Fe],st=Ue.from,Ye=Ue.data,ct=this.compiled[st];ct.scopeManager=this.getScopeManager(Fe,ct,Ye),ct.render(Fe),me.push([Fe,ct.content,ct]),delete ct.content}for(var pt=0;pt<me.length;pt++)for(var mt=me[pt],Ft=s(mt,3),at=Ft[1],nn=Ft[2],jn=0,Ti=this.modules;jn<Ti.length;jn++){var mn=Ti[jn];if(mn.preZip){var Zi=mn.preZip(at,nn);typeof Zi=="string"&&(mt[1]=Zi)}}for(var Un=0;Un<me.length;Un++){var sn=s(me[Un],2),Wr=sn[0],ui=sn[1];this.zip.file(Wr,ui,{createFolders:!0})}return nr(this),this.sendEvent("syncing-zip"),this.syncZip(),this.sendEvent("synced-zip"),this}},{key:"syncZip",value:function(){for(var he in this.xmlDocuments){this.zip.remove(he);var me=Ne(this.xmlDocuments[he]);this.zip.file(he,me,{createFolders:!0})}}},{key:"setData",value:function(he){return Xe(this,"setData"),this.data=he,this}},{key:"getZip",value:function(){return this.zip}},{key:"createTemplateClass",value:function(he){var me=this.zip.files[he].asText();return this.createTemplateClassFromContent(me,he)}},{key:"createTemplateClassFromContent",value:function(he,me){for(var Fe={filePath:me,contentType:this.filesContentTypes[me],relsType:this.relsTypes[me]},Ue=Ae(),st=F(Object.keys(Ue),["filesContentTypes","fileTypeConfig","fileType","modules"]),Ye=0;Ye<st.length;Ye++){var ct=st[Ye];Fe[ct]=this[ct]}return new ge.XmlTemplater(he,Fe)}},{key:"getFullText",value:function(he){return this.createTemplateClass(he||this.fileTypeConfig.textPath(this)).getFullText()}},{key:"getTemplatedFiles",value:function(){return this.templatedFiles=this.fileTypeConfig.getTemplatedFiles(this.zip),F(this.templatedFiles,this.targets),this.templatedFiles=x(this.templatedFiles),this.templatedFiles}},{key:"getTags",value:function(){var he={headers:[],footers:[]};for(var me in this.compiled){var Fe=this.filesContentTypes[me];Fe==="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"&&(he.document={target:me,tags:fe(this.compiled[me].postparsed)}),Fe==="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"&&he.headers.push({target:me,tags:fe(this.compiled[me].postparsed)}),Fe==="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"&&he.footers.push({target:me,tags:fe(this.compiled[me].postparsed)})}return he}},{key:"toBuffer",value:function(he){return this.zip.generate(r(r({compression:"DEFLATE",fileOrder:Me},he),{},{type:"nodebuffer"}))}},{key:"toBlob",value:function(he){return this.zip.generate(r(r({compression:"DEFLATE",fileOrder:Me},he),{},{type:"blob"}))}},{key:"toBase64",value:function(he){return this.zip.generate(r(r({compression:"DEFLATE",fileOrder:Me},he),{},{type:"base64"}))}},{key:"toUint8Array",value:function(he){return this.zip.generate(r(r({compression:"DEFLATE",fileOrder:Me},he),{},{type:"uint8array"}))}},{key:"toArrayBuffer",value:function(he){return this.zip.generate(r(r({compression:"DEFLATE",fileOrder:Me},he),{},{type:"arraybuffer"}))}}])}();rr.DocUtils=E,rr.Errors=Xi,rr.XmlTemplater=NP(),rr.FileTypeConfig=jP(),rr.XmlMatcher=wA(),i.exports=rr,i.exports.default=rr})(Ex);var UP=Ex.exports;const v2=_g(UP);var AA={exports:{}},Bf={},io="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";Bf.encode=function(i){for(var e="",t,r,n,s,a,o,l,c=0;c<i.length;)t=i.charCodeAt(c++),r=i.charCodeAt(c++),n=i.charCodeAt(c++),s=t>>2,a=(t&3)<<4|r>>4,o=(r&15)<<2|n>>6,l=n&63,isNaN(r)?o=l=64:isNaN(n)&&(l=64),e=e+io.charAt(s)+io.charAt(a)+io.charAt(o)+io.charAt(l);return e};Bf.decode=function(i){var e="",t,r,n,s,a,o,l,c=0;for(i=i.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<i.length;)s=io.indexOf(i.charAt(c++)),a=io.indexOf(i.charAt(c++)),o=io.indexOf(i.charAt(c++)),l=io.indexOf(i.charAt(c++)),t=s<<2|a>>4,r=(a&15)<<4|o>>2,n=(o&3)<<6|l,e+=String.fromCharCode(t),o!==64&&(e+=String.fromCharCode(r)),l!==64&&(e+=String.fromCharCode(n));return e};var pn={},cp;pn.base64=!0;pn.array=!0;pn.string=!0;pn.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";pn.nodebuffer=typeof Buffer<"u";pn.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")cp=pn.blob=!1;else{var y2=new ArrayBuffer(0);try{cp=pn.blob=new Blob([y2],{type:"application/zip"}).size===0}catch{try{var HP=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,w2=new HP;w2.append(y2),cp=pn.blob=w2.getBlob("application/zip").size===0}catch{cp=pn.blob=!1}}}var Ci={},zf={},jc={},Ab={exports:{}};/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */(function(i,e){(function(t,r){r(e)})(sh,function(t){function r(f){for(var P=f.length;--P>=0;)f[P]=0}var n=256,s=286,a=30,o=15,l=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),c=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),d=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p=new Array(576);r(p);var g=new Array(60);r(g);var y=new Array(512);r(y);var b=new Array(256);r(b);var w=new Array(29);r(w);var v,A,E,_=new Array(a);function C(f,P,m,$,V){this.static_tree=f,this.extra_bits=P,this.extra_base=m,this.elems=$,this.max_length=V,this.has_stree=f&&f.length}function I(f,P){this.dyn_tree=f,this.max_code=0,this.stat_desc=P}r(_);var k=function(f){return f<256?y[f]:y[256+(f>>>7)]},D=function(f,P){f.pending_buf[f.pending++]=255&P,f.pending_buf[f.pending++]=P>>>8&255},R=function(f,P,m){f.bi_valid>16-m?(f.bi_buf|=P<<f.bi_valid&65535,D(f,f.bi_buf),f.bi_buf=P>>16-f.bi_valid,f.bi_valid+=m-16):(f.bi_buf|=P<<f.bi_valid&65535,f.bi_valid+=m)},z=function(f,P,m){R(f,m[2*P],m[2*P+1])},G=function(f,P){var m=0;do m|=1&f,f>>>=1,m<<=1;while(--P>0);return m>>>1},O=function(f,P,m){var $,V,Z=new Array(16),_e=0;for($=1;$<=o;$++)_e=_e+m[$-1]<<1,Z[$]=_e;for(V=0;V<=P;V++){var re=f[2*V+1];re!==0&&(f[2*V]=G(Z[re]++,re))}},X=function(f){var P;for(P=0;P<s;P++)f.dyn_ltree[2*P]=0;for(P=0;P<a;P++)f.dyn_dtree[2*P]=0;for(P=0;P<19;P++)f.bl_tree[2*P]=0;f.dyn_ltree[512]=1,f.opt_len=f.static_len=0,f.sym_next=f.matches=0},S=function(f){f.bi_valid>8?D(f,f.bi_buf):f.bi_valid>0&&(f.pending_buf[f.pending++]=f.bi_buf),f.bi_buf=0,f.bi_valid=0},J=function(f,P,m,$){var V=2*P,Z=2*m;return f[V]<f[Z]||f[V]===f[Z]&&$[P]<=$[m]},Y=function(f,P,m){for(var $=f.heap[m],V=m<<1;V<=f.heap_len&&(V<f.heap_len&&J(P,f.heap[V+1],f.heap[V],f.depth)&&V++,!J(P,$,f.heap[V],f.depth));)f.heap[m]=f.heap[V],m=V,V<<=1;f.heap[m]=$},W=function(f,P,m){var $,V,Z,_e,re=0;if(f.sym_next!==0)do $=255&f.pending_buf[f.sym_buf+re++],$+=(255&f.pending_buf[f.sym_buf+re++])<<8,V=f.pending_buf[f.sym_buf+re++],$===0?z(f,V,P):(Z=b[V],z(f,Z+n+1,P),(_e=l[Z])!==0&&(V-=w[Z],R(f,V,_e)),$--,Z=k($),z(f,Z,m),(_e=c[Z])!==0&&($-=_[Z],R(f,$,_e)));while(re<f.sym_next);z(f,256,P)},fe=function(f,P){var m,$,V,Z=P.dyn_tree,_e=P.stat_desc.static_tree,re=P.stat_desc.has_stree,Le=P.stat_desc.elems,ue=-1;for(f.heap_len=0,f.heap_max=573,m=0;m<Le;m++)Z[2*m]!==0?(f.heap[++f.heap_len]=ue=m,f.depth[m]=0):Z[2*m+1]=0;for(;f.heap_len<2;)Z[2*(V=f.heap[++f.heap_len]=ue<2?++ue:0)]=1,f.depth[V]=0,f.opt_len--,re&&(f.static_len-=_e[2*V+1]);for(P.max_code=ue,m=f.heap_len>>1;m>=1;m--)Y(f,Z,m);V=Le;do m=f.heap[1],f.heap[1]=f.heap[f.heap_len--],Y(f,Z,1),$=f.heap[1],f.heap[--f.heap_max]=m,f.heap[--f.heap_max]=$,Z[2*V]=Z[2*m]+Z[2*$],f.depth[V]=(f.depth[m]>=f.depth[$]?f.depth[m]:f.depth[$])+1,Z[2*m+1]=Z[2*$+1]=V,f.heap[1]=V++,Y(f,Z,1);while(f.heap_len>=2);f.heap[--f.heap_max]=f.heap[1],function(pe,wt){var Ve,ke,je,bt,lt,Et,Be=wt.dyn_tree,Oe=wt.max_code,rt=wt.stat_desc.static_tree,Zt=wt.stat_desc.has_stree,Ke=wt.stat_desc.extra_bits,Rt=wt.stat_desc.extra_base,Dt=wt.stat_desc.max_length,nt=0;for(bt=0;bt<=o;bt++)pe.bl_count[bt]=0;for(Be[2*pe.heap[pe.heap_max]+1]=0,Ve=pe.heap_max+1;Ve<573;Ve++)(bt=Be[2*Be[2*(ke=pe.heap[Ve])+1]+1]+1)>Dt&&(bt=Dt,nt++),Be[2*ke+1]=bt,ke>Oe||(pe.bl_count[bt]++,lt=0,ke>=Rt&&(lt=Ke[ke-Rt]),Et=Be[2*ke],pe.opt_len+=Et*(bt+lt),Zt&&(pe.static_len+=Et*(rt[2*ke+1]+lt)));if(nt!==0){do{for(bt=Dt-1;pe.bl_count[bt]===0;)bt--;pe.bl_count[bt]--,pe.bl_count[bt+1]+=2,pe.bl_count[Dt]--,nt-=2}while(nt>0);for(bt=Dt;bt!==0;bt--)for(ke=pe.bl_count[bt];ke!==0;)(je=pe.heap[--Ve])>Oe||(Be[2*je+1]!==bt&&(pe.opt_len+=(bt-Be[2*je+1])*Be[2*je],Be[2*je+1]=bt),ke--)}}(f,P),O(Z,ue,f.bl_count)},K=function(f,P,m){var $,V,Z=-1,_e=P[1],re=0,Le=7,ue=4;for(_e===0&&(Le=138,ue=3),P[2*(m+1)+1]=65535,$=0;$<=m;$++)V=_e,_e=P[2*($+1)+1],++re<Le&&V===_e||(re<ue?f.bl_tree[2*V]+=re:V!==0?(V!==Z&&f.bl_tree[2*V]++,f.bl_tree[32]++):re<=10?f.bl_tree[34]++:f.bl_tree[36]++,re=0,Z=V,_e===0?(Le=138,ue=3):V===_e?(Le=6,ue=3):(Le=7,ue=4))},be=function(f,P,m){var $,V,Z=-1,_e=P[1],re=0,Le=7,ue=4;for(_e===0&&(Le=138,ue=3),$=0;$<=m;$++)if(V=_e,_e=P[2*($+1)+1],!(++re<Le&&V===_e)){if(re<ue)do z(f,V,f.bl_tree);while(--re!=0);else V!==0?(V!==Z&&(z(f,V,f.bl_tree),re--),z(f,16,f.bl_tree),R(f,re-3,2)):re<=10?(z(f,17,f.bl_tree),R(f,re-3,3)):(z(f,18,f.bl_tree),R(f,re-11,7));re=0,Z=V,_e===0?(Le=138,ue=3):V===_e?(Le=6,ue=3):(Le=7,ue=4)}},te=!1,j=function(f,P,m,$){R(f,0+($?1:0),3),S(f),D(f,m),D(f,~m),m&&f.pending_buf.set(f.window.subarray(P,P+m),f.pending),f.pending+=m},ie=function(f,P,m,$){var V,Z,_e=0;f.level>0?(f.strm.data_type===2&&(f.strm.data_type=function(re){var Le,ue=4093624447;for(Le=0;Le<=31;Le++,ue>>>=1)if(1&ue&&re.dyn_ltree[2*Le]!==0)return 0;if(re.dyn_ltree[18]!==0||re.dyn_ltree[20]!==0||re.dyn_ltree[26]!==0)return 1;for(Le=32;Le<n;Le++)if(re.dyn_ltree[2*Le]!==0)return 1;return 0}(f)),fe(f,f.l_desc),fe(f,f.d_desc),_e=function(re){var Le;for(K(re,re.dyn_ltree,re.l_desc.max_code),K(re,re.dyn_dtree,re.d_desc.max_code),fe(re,re.bl_desc),Le=18;Le>=3&&re.bl_tree[2*d[Le]+1]===0;Le--);return re.opt_len+=3*(Le+1)+5+5+4,Le}(f),V=f.opt_len+3+7>>>3,(Z=f.static_len+3+7>>>3)<=V&&(V=Z)):V=Z=m+5,m+4<=V&&P!==-1?j(f,P,m,$):f.strategy===4||Z===V?(R(f,2+($?1:0),3),W(f,p,g)):(R(f,4+($?1:0),3),function(re,Le,ue,pe){var wt;for(R(re,Le-257,5),R(re,ue-1,5),R(re,pe-4,4),wt=0;wt<pe;wt++)R(re,re.bl_tree[2*d[wt]+1],3);be(re,re.dyn_ltree,Le-1),be(re,re.dyn_dtree,ue-1)}(f,f.l_desc.max_code+1,f.d_desc.max_code+1,_e+1),W(f,f.dyn_ltree,f.dyn_dtree)),X(f),$&&S(f)},ae={_tr_init:function(f){te||(function(){var P,m,$,V,Z,_e=new Array(16);for($=0,V=0;V<28;V++)for(w[V]=$,P=0;P<1<<l[V];P++)b[$++]=V;for(b[$-1]=V,Z=0,V=0;V<16;V++)for(_[V]=Z,P=0;P<1<<c[V];P++)y[Z++]=V;for(Z>>=7;V<a;V++)for(_[V]=Z<<7,P=0;P<1<<c[V]-7;P++)y[256+Z++]=V;for(m=0;m<=o;m++)_e[m]=0;for(P=0;P<=143;)p[2*P+1]=8,P++,_e[8]++;for(;P<=255;)p[2*P+1]=9,P++,_e[9]++;for(;P<=279;)p[2*P+1]=7,P++,_e[7]++;for(;P<=287;)p[2*P+1]=8,P++,_e[8]++;for(O(p,287,_e),P=0;P<a;P++)g[2*P+1]=5,g[2*P]=G(P,5);v=new C(p,l,257,s,o),A=new C(g,c,0,a,o),E=new C(new Array(0),h,0,19,7)}(),te=!0),f.l_desc=new I(f.dyn_ltree,v),f.d_desc=new I(f.dyn_dtree,A),f.bl_desc=new I(f.bl_tree,E),f.bi_buf=0,f.bi_valid=0,X(f)},_tr_stored_block:j,_tr_flush_block:ie,_tr_tally:function(f,P,m){return f.pending_buf[f.sym_buf+f.sym_next++]=P,f.pending_buf[f.sym_buf+f.sym_next++]=P>>8,f.pending_buf[f.sym_buf+f.sym_next++]=m,P===0?f.dyn_ltree[2*m]++:(f.matches++,P--,f.dyn_ltree[2*(b[m]+n+1)]++,f.dyn_dtree[2*k(P)]++),f.sym_next===f.sym_end},_tr_align:function(f){R(f,2,3),z(f,256,p),function(P){P.bi_valid===16?(D(P,P.bi_buf),P.bi_buf=0,P.bi_valid=0):P.bi_valid>=8&&(P.pending_buf[P.pending++]=255&P.bi_buf,P.bi_buf>>=8,P.bi_valid-=8)}(f)}},H=function(f,P,m,$){for(var V=65535&f|0,Z=f>>>16&65535|0,_e=0;m!==0;){m-=_e=m>2e3?2e3:m;do Z=Z+(V=V+P[$++]|0)|0;while(--_e);V%=65521,Z%=65521}return V|Z<<16|0},se=new Uint32Array(function(){for(var f,P=[],m=0;m<256;m++){f=m;for(var $=0;$<8;$++)f=1&f?3988292384^f>>>1:f>>>1;P[m]=f}return P}()),le=function(f,P,m,$){var V=se,Z=$+m;f^=-1;for(var _e=$;_e<Z;_e++)f=f>>>8^V[255&(f^P[_e])];return-1^f},oe={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ce={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},Ae=ae._tr_init,Se=ae._tr_stored_block,Ne=ae._tr_flush_block,Te=ae._tr_tally,x=ae._tr_align,U=ce.Z_NO_FLUSH,B=ce.Z_PARTIAL_FLUSH,F=ce.Z_FULL_FLUSH,M=ce.Z_FINISH,q=ce.Z_BLOCK,de=ce.Z_OK,we=ce.Z_STREAM_END,ee=ce.Z_STREAM_ERROR,Ee=ce.Z_DATA_ERROR,De=ce.Z_BUF_ERROR,Ce=ce.Z_DEFAULT_COMPRESSION,Me=ce.Z_FILTERED,$e=ce.Z_HUFFMAN_ONLY,Xe=ce.Z_RLE,Tt=ce.Z_FIXED,nr=ce.Z_DEFAULT_STRATEGY,yr=ce.Z_UNKNOWN,rr=ce.Z_DEFLATED,ge=258,ve=262,he=42,me=113,Fe=666,Ue=function(f,P){return f.msg=oe[P],P},st=function(f){return 2*f-(f>4?9:0)},Ye=function(f){for(var P=f.length;--P>=0;)f[P]=0},ct=function(f){var P,m,$,V=f.w_size;$=P=f.hash_size;do m=f.head[--$],f.head[$]=m>=V?m-V:0;while(--P);$=P=V;do m=f.prev[--$],f.prev[$]=m>=V?m-V:0;while(--P)},pt=function(f,P,m){return(P<<f.hash_shift^m)&f.hash_mask},mt=function(f){var P=f.state,m=P.pending;m>f.avail_out&&(m=f.avail_out),m!==0&&(f.output.set(P.pending_buf.subarray(P.pending_out,P.pending_out+m),f.next_out),f.next_out+=m,P.pending_out+=m,f.total_out+=m,f.avail_out-=m,P.pending-=m,P.pending===0&&(P.pending_out=0))},Ft=function(f,P){Ne(f,f.block_start>=0?f.block_start:-1,f.strstart-f.block_start,P),f.block_start=f.strstart,mt(f.strm)},at=function(f,P){f.pending_buf[f.pending++]=P},nn=function(f,P){f.pending_buf[f.pending++]=P>>>8&255,f.pending_buf[f.pending++]=255&P},jn=function(f,P,m,$){var V=f.avail_in;return V>$&&(V=$),V===0?0:(f.avail_in-=V,P.set(f.input.subarray(f.next_in,f.next_in+V),m),f.state.wrap===1?f.adler=H(f.adler,P,V,m):f.state.wrap===2&&(f.adler=le(f.adler,P,V,m)),f.next_in+=V,f.total_in+=V,V)},Ti=function(f,P){var m,$,V=f.max_chain_length,Z=f.strstart,_e=f.prev_length,re=f.nice_match,Le=f.strstart>f.w_size-ve?f.strstart-(f.w_size-ve):0,ue=f.window,pe=f.w_mask,wt=f.prev,Ve=f.strstart+ge,ke=ue[Z+_e-1],je=ue[Z+_e];f.prev_length>=f.good_match&&(V>>=2),re>f.lookahead&&(re=f.lookahead);do if(ue[(m=P)+_e]===je&&ue[m+_e-1]===ke&&ue[m]===ue[Z]&&ue[++m]===ue[Z+1]){Z+=2,m++;do;while(ue[++Z]===ue[++m]&&ue[++Z]===ue[++m]&&ue[++Z]===ue[++m]&&ue[++Z]===ue[++m]&&ue[++Z]===ue[++m]&&ue[++Z]===ue[++m]&&ue[++Z]===ue[++m]&&ue[++Z]===ue[++m]&&Z<Ve);if($=ge-(Ve-Z),Z=Ve-ge,$>_e){if(f.match_start=P,_e=$,$>=re)break;ke=ue[Z+_e-1],je=ue[Z+_e]}}while((P=wt[P&pe])>Le&&--V!=0);return _e<=f.lookahead?_e:f.lookahead},mn=function(f){var P,m,$,V=f.w_size;do{if(m=f.window_size-f.lookahead-f.strstart,f.strstart>=V+(V-ve)&&(f.window.set(f.window.subarray(V,V+V-m),0),f.match_start-=V,f.strstart-=V,f.block_start-=V,f.insert>f.strstart&&(f.insert=f.strstart),ct(f),m+=V),f.strm.avail_in===0)break;if(P=jn(f.strm,f.window,f.strstart+f.lookahead,m),f.lookahead+=P,f.lookahead+f.insert>=3)for($=f.strstart-f.insert,f.ins_h=f.window[$],f.ins_h=pt(f,f.ins_h,f.window[$+1]);f.insert&&(f.ins_h=pt(f,f.ins_h,f.window[$+3-1]),f.prev[$&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=$,$++,f.insert--,!(f.lookahead+f.insert<3)););}while(f.lookahead<ve&&f.strm.avail_in!==0)},Zi=function(f,P){var m,$,V,Z=f.pending_buf_size-5>f.w_size?f.w_size:f.pending_buf_size-5,_e=0,re=f.strm.avail_in;do{if(m=65535,V=f.bi_valid+42>>3,f.strm.avail_out<V||(V=f.strm.avail_out-V,m>($=f.strstart-f.block_start)+f.strm.avail_in&&(m=$+f.strm.avail_in),m>V&&(m=V),m<Z&&(m===0&&P!==M||P===U||m!==$+f.strm.avail_in)))break;_e=P===M&&m===$+f.strm.avail_in?1:0,Se(f,0,0,_e),f.pending_buf[f.pending-4]=m,f.pending_buf[f.pending-3]=m>>8,f.pending_buf[f.pending-2]=~m,f.pending_buf[f.pending-1]=~m>>8,mt(f.strm),$&&($>m&&($=m),f.strm.output.set(f.window.subarray(f.block_start,f.block_start+$),f.strm.next_out),f.strm.next_out+=$,f.strm.avail_out-=$,f.strm.total_out+=$,f.block_start+=$,m-=$),m&&(jn(f.strm,f.strm.output,f.strm.next_out,m),f.strm.next_out+=m,f.strm.avail_out-=m,f.strm.total_out+=m)}while(_e===0);return(re-=f.strm.avail_in)&&(re>=f.w_size?(f.matches=2,f.window.set(f.strm.input.subarray(f.strm.next_in-f.w_size,f.strm.next_in),0),f.strstart=f.w_size,f.insert=f.strstart):(f.window_size-f.strstart<=re&&(f.strstart-=f.w_size,f.window.set(f.window.subarray(f.w_size,f.w_size+f.strstart),0),f.matches<2&&f.matches++,f.insert>f.strstart&&(f.insert=f.strstart)),f.window.set(f.strm.input.subarray(f.strm.next_in-re,f.strm.next_in),f.strstart),f.strstart+=re,f.insert+=re>f.w_size-f.insert?f.w_size-f.insert:re),f.block_start=f.strstart),f.high_water<f.strstart&&(f.high_water=f.strstart),_e?4:P!==U&&P!==M&&f.strm.avail_in===0&&f.strstart===f.block_start?2:(V=f.window_size-f.strstart,f.strm.avail_in>V&&f.block_start>=f.w_size&&(f.block_start-=f.w_size,f.strstart-=f.w_size,f.window.set(f.window.subarray(f.w_size,f.w_size+f.strstart),0),f.matches<2&&f.matches++,V+=f.w_size,f.insert>f.strstart&&(f.insert=f.strstart)),V>f.strm.avail_in&&(V=f.strm.avail_in),V&&(jn(f.strm,f.window,f.strstart,V),f.strstart+=V,f.insert+=V>f.w_size-f.insert?f.w_size-f.insert:V),f.high_water<f.strstart&&(f.high_water=f.strstart),V=f.bi_valid+42>>3,Z=(V=f.pending_buf_size-V>65535?65535:f.pending_buf_size-V)>f.w_size?f.w_size:V,(($=f.strstart-f.block_start)>=Z||($||P===M)&&P!==U&&f.strm.avail_in===0&&$<=V)&&(m=$>V?V:$,_e=P===M&&f.strm.avail_in===0&&m===$?1:0,Se(f,f.block_start,m,_e),f.block_start+=m,mt(f.strm)),_e?3:1)},Un=function(f,P){for(var m,$;;){if(f.lookahead<ve){if(mn(f),f.lookahead<ve&&P===U)return 1;if(f.lookahead===0)break}if(m=0,f.lookahead>=3&&(f.ins_h=pt(f,f.ins_h,f.window[f.strstart+3-1]),m=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart),m!==0&&f.strstart-m<=f.w_size-ve&&(f.match_length=Ti(f,m)),f.match_length>=3)if($=Te(f,f.strstart-f.match_start,f.match_length-3),f.lookahead-=f.match_length,f.match_length<=f.max_lazy_match&&f.lookahead>=3){f.match_length--;do f.strstart++,f.ins_h=pt(f,f.ins_h,f.window[f.strstart+3-1]),m=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart;while(--f.match_length!=0);f.strstart++}else f.strstart+=f.match_length,f.match_length=0,f.ins_h=f.window[f.strstart],f.ins_h=pt(f,f.ins_h,f.window[f.strstart+1]);else $=Te(f,0,f.window[f.strstart]),f.lookahead--,f.strstart++;if($&&(Ft(f,!1),f.strm.avail_out===0))return 1}return f.insert=f.strstart<2?f.strstart:2,P===M?(Ft(f,!0),f.strm.avail_out===0?3:4):f.sym_next&&(Ft(f,!1),f.strm.avail_out===0)?1:2},sn=function(f,P){for(var m,$,V;;){if(f.lookahead<ve){if(mn(f),f.lookahead<ve&&P===U)return 1;if(f.lookahead===0)break}if(m=0,f.lookahead>=3&&(f.ins_h=pt(f,f.ins_h,f.window[f.strstart+3-1]),m=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart),f.prev_length=f.match_length,f.prev_match=f.match_start,f.match_length=2,m!==0&&f.prev_length<f.max_lazy_match&&f.strstart-m<=f.w_size-ve&&(f.match_length=Ti(f,m),f.match_length<=5&&(f.strategy===Me||f.match_length===3&&f.strstart-f.match_start>4096)&&(f.match_length=2)),f.prev_length>=3&&f.match_length<=f.prev_length){V=f.strstart+f.lookahead-3,$=Te(f,f.strstart-1-f.prev_match,f.prev_length-3),f.lookahead-=f.prev_length-1,f.prev_length-=2;do++f.strstart<=V&&(f.ins_h=pt(f,f.ins_h,f.window[f.strstart+3-1]),m=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart);while(--f.prev_length!=0);if(f.match_available=0,f.match_length=2,f.strstart++,$&&(Ft(f,!1),f.strm.avail_out===0))return 1}else if(f.match_available){if(($=Te(f,0,f.window[f.strstart-1]))&&Ft(f,!1),f.strstart++,f.lookahead--,f.strm.avail_out===0)return 1}else f.match_available=1,f.strstart++,f.lookahead--}return f.match_available&&($=Te(f,0,f.window[f.strstart-1]),f.match_available=0),f.insert=f.strstart<2?f.strstart:2,P===M?(Ft(f,!0),f.strm.avail_out===0?3:4):f.sym_next&&(Ft(f,!1),f.strm.avail_out===0)?1:2};function Wr(f,P,m,$,V){this.good_length=f,this.max_lazy=P,this.nice_length=m,this.max_chain=$,this.func=V}var ui=[new Wr(0,0,0,0,Zi),new Wr(4,4,8,4,Un),new Wr(4,5,16,8,Un),new Wr(4,6,32,32,Un),new Wr(4,4,16,16,sn),new Wr(8,16,32,32,sn),new Wr(8,16,128,128,sn),new Wr(8,32,128,256,sn),new Wr(32,128,258,1024,sn),new Wr(32,258,258,4096,sn)];function Uc(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=rr,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ye(this.dyn_ltree),Ye(this.dyn_dtree),Ye(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Ye(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ye(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Es=function(f){if(!f)return 1;var P=f.state;return!P||P.strm!==f||P.status!==he&&P.status!==57&&P.status!==69&&P.status!==73&&P.status!==91&&P.status!==103&&P.status!==me&&P.status!==Fe?1:0},Q=function(f){if(Es(f))return Ue(f,ee);f.total_in=f.total_out=0,f.data_type=yr;var P=f.state;return P.pending=0,P.pending_out=0,P.wrap<0&&(P.wrap=-P.wrap),P.status=P.wrap===2?57:P.wrap?he:me,f.adler=P.wrap===2?0:1,P.last_flush=-2,Ae(P),de},Re=function(f){var P,m=Q(f);return m===de&&((P=f.state).window_size=2*P.w_size,Ye(P.head),P.max_lazy_match=ui[P.level].max_lazy,P.good_match=ui[P.level].good_length,P.nice_match=ui[P.level].nice_length,P.max_chain_length=ui[P.level].max_chain,P.strstart=0,P.block_start=0,P.lookahead=0,P.insert=0,P.match_length=P.prev_length=2,P.match_available=0,P.ins_h=0),m},He=function(f,P,m,$,V,Z){if(!f)return ee;var _e=1;if(P===Ce&&(P=6),$<0?(_e=0,$=-$):$>15&&(_e=2,$-=16),V<1||V>9||m!==rr||$<8||$>15||P<0||P>9||Z<0||Z>Tt||$===8&&_e!==1)return Ue(f,ee);$===8&&($=9);var re=new Uc;return f.state=re,re.strm=f,re.status=he,re.wrap=_e,re.gzhead=null,re.w_bits=$,re.w_size=1<<re.w_bits,re.w_mask=re.w_size-1,re.hash_bits=V+7,re.hash_size=1<<re.hash_bits,re.hash_mask=re.hash_size-1,re.hash_shift=~~((re.hash_bits+3-1)/3),re.window=new Uint8Array(2*re.w_size),re.head=new Uint16Array(re.hash_size),re.prev=new Uint16Array(re.w_size),re.lit_bufsize=1<<V+6,re.pending_buf_size=4*re.lit_bufsize,re.pending_buf=new Uint8Array(re.pending_buf_size),re.sym_buf=re.lit_bufsize,re.sym_end=3*(re.lit_bufsize-1),re.level=P,re.strategy=Z,re.method=m,Re(f)},Je={deflateInit:function(f,P){return He(f,P,rr,15,8,nr)},deflateInit2:He,deflateReset:Re,deflateResetKeep:Q,deflateSetHeader:function(f,P){return Es(f)||f.state.wrap!==2?ee:(f.state.gzhead=P,de)},deflate:function(f,P){if(Es(f)||P>q||P<0)return f?Ue(f,ee):ee;var m=f.state;if(!f.output||f.avail_in!==0&&!f.input||m.status===Fe&&P!==M)return Ue(f,f.avail_out===0?De:ee);var $=m.last_flush;if(m.last_flush=P,m.pending!==0){if(mt(f),f.avail_out===0)return m.last_flush=-1,de}else if(f.avail_in===0&&st(P)<=st($)&&P!==M)return Ue(f,De);if(m.status===Fe&&f.avail_in!==0)return Ue(f,De);if(m.status===he&&m.wrap===0&&(m.status=me),m.status===he){var V=rr+(m.w_bits-8<<4)<<8;if(V|=(m.strategy>=$e||m.level<2?0:m.level<6?1:m.level===6?2:3)<<6,m.strstart!==0&&(V|=32),nn(m,V+=31-V%31),m.strstart!==0&&(nn(m,f.adler>>>16),nn(m,65535&f.adler)),f.adler=1,m.status=me,mt(f),m.pending!==0)return m.last_flush=-1,de}if(m.status===57){if(f.adler=0,at(m,31),at(m,139),at(m,8),m.gzhead)at(m,(m.gzhead.text?1:0)+(m.gzhead.hcrc?2:0)+(m.gzhead.extra?4:0)+(m.gzhead.name?8:0)+(m.gzhead.comment?16:0)),at(m,255&m.gzhead.time),at(m,m.gzhead.time>>8&255),at(m,m.gzhead.time>>16&255),at(m,m.gzhead.time>>24&255),at(m,m.level===9?2:m.strategy>=$e||m.level<2?4:0),at(m,255&m.gzhead.os),m.gzhead.extra&&m.gzhead.extra.length&&(at(m,255&m.gzhead.extra.length),at(m,m.gzhead.extra.length>>8&255)),m.gzhead.hcrc&&(f.adler=le(f.adler,m.pending_buf,m.pending,0)),m.gzindex=0,m.status=69;else if(at(m,0),at(m,0),at(m,0),at(m,0),at(m,0),at(m,m.level===9?2:m.strategy>=$e||m.level<2?4:0),at(m,3),m.status=me,mt(f),m.pending!==0)return m.last_flush=-1,de}if(m.status===69){if(m.gzhead.extra){for(var Z=m.pending,_e=(65535&m.gzhead.extra.length)-m.gzindex;m.pending+_e>m.pending_buf_size;){var re=m.pending_buf_size-m.pending;if(m.pending_buf.set(m.gzhead.extra.subarray(m.gzindex,m.gzindex+re),m.pending),m.pending=m.pending_buf_size,m.gzhead.hcrc&&m.pending>Z&&(f.adler=le(f.adler,m.pending_buf,m.pending-Z,Z)),m.gzindex+=re,mt(f),m.pending!==0)return m.last_flush=-1,de;Z=0,_e-=re}var Le=new Uint8Array(m.gzhead.extra);m.pending_buf.set(Le.subarray(m.gzindex,m.gzindex+_e),m.pending),m.pending+=_e,m.gzhead.hcrc&&m.pending>Z&&(f.adler=le(f.adler,m.pending_buf,m.pending-Z,Z)),m.gzindex=0}m.status=73}if(m.status===73){if(m.gzhead.name){var ue,pe=m.pending;do{if(m.pending===m.pending_buf_size){if(m.gzhead.hcrc&&m.pending>pe&&(f.adler=le(f.adler,m.pending_buf,m.pending-pe,pe)),mt(f),m.pending!==0)return m.last_flush=-1,de;pe=0}ue=m.gzindex<m.gzhead.name.length?255&m.gzhead.name.charCodeAt(m.gzindex++):0,at(m,ue)}while(ue!==0);m.gzhead.hcrc&&m.pending>pe&&(f.adler=le(f.adler,m.pending_buf,m.pending-pe,pe)),m.gzindex=0}m.status=91}if(m.status===91){if(m.gzhead.comment){var wt,Ve=m.pending;do{if(m.pending===m.pending_buf_size){if(m.gzhead.hcrc&&m.pending>Ve&&(f.adler=le(f.adler,m.pending_buf,m.pending-Ve,Ve)),mt(f),m.pending!==0)return m.last_flush=-1,de;Ve=0}wt=m.gzindex<m.gzhead.comment.length?255&m.gzhead.comment.charCodeAt(m.gzindex++):0,at(m,wt)}while(wt!==0);m.gzhead.hcrc&&m.pending>Ve&&(f.adler=le(f.adler,m.pending_buf,m.pending-Ve,Ve))}m.status=103}if(m.status===103){if(m.gzhead.hcrc){if(m.pending+2>m.pending_buf_size&&(mt(f),m.pending!==0))return m.last_flush=-1,de;at(m,255&f.adler),at(m,f.adler>>8&255),f.adler=0}if(m.status=me,mt(f),m.pending!==0)return m.last_flush=-1,de}if(f.avail_in!==0||m.lookahead!==0||P!==U&&m.status!==Fe){var ke=m.level===0?Zi(m,P):m.strategy===$e?function(je,bt){for(var lt;;){if(je.lookahead===0&&(mn(je),je.lookahead===0)){if(bt===U)return 1;break}if(je.match_length=0,lt=Te(je,0,je.window[je.strstart]),je.lookahead--,je.strstart++,lt&&(Ft(je,!1),je.strm.avail_out===0))return 1}return je.insert=0,bt===M?(Ft(je,!0),je.strm.avail_out===0?3:4):je.sym_next&&(Ft(je,!1),je.strm.avail_out===0)?1:2}(m,P):m.strategy===Xe?function(je,bt){for(var lt,Et,Be,Oe,rt=je.window;;){if(je.lookahead<=ge){if(mn(je),je.lookahead<=ge&&bt===U)return 1;if(je.lookahead===0)break}if(je.match_length=0,je.lookahead>=3&&je.strstart>0&&(Et=rt[Be=je.strstart-1])===rt[++Be]&&Et===rt[++Be]&&Et===rt[++Be]){Oe=je.strstart+ge;do;while(Et===rt[++Be]&&Et===rt[++Be]&&Et===rt[++Be]&&Et===rt[++Be]&&Et===rt[++Be]&&Et===rt[++Be]&&Et===rt[++Be]&&Et===rt[++Be]&&Be<Oe);je.match_length=ge-(Oe-Be),je.match_length>je.lookahead&&(je.match_length=je.lookahead)}if(je.match_length>=3?(lt=Te(je,1,je.match_length-3),je.lookahead-=je.match_length,je.strstart+=je.match_length,je.match_length=0):(lt=Te(je,0,je.window[je.strstart]),je.lookahead--,je.strstart++),lt&&(Ft(je,!1),je.strm.avail_out===0))return 1}return je.insert=0,bt===M?(Ft(je,!0),je.strm.avail_out===0?3:4):je.sym_next&&(Ft(je,!1),je.strm.avail_out===0)?1:2}(m,P):ui[m.level].func(m,P);if(ke!==3&&ke!==4||(m.status=Fe),ke===1||ke===3)return f.avail_out===0&&(m.last_flush=-1),de;if(ke===2&&(P===B?x(m):P!==q&&(Se(m,0,0,!1),P===F&&(Ye(m.head),m.lookahead===0&&(m.strstart=0,m.block_start=0,m.insert=0))),mt(f),f.avail_out===0))return m.last_flush=-1,de}return P!==M?de:m.wrap<=0?we:(m.wrap===2?(at(m,255&f.adler),at(m,f.adler>>8&255),at(m,f.adler>>16&255),at(m,f.adler>>24&255),at(m,255&f.total_in),at(m,f.total_in>>8&255),at(m,f.total_in>>16&255),at(m,f.total_in>>24&255)):(nn(m,f.adler>>>16),nn(m,65535&f.adler)),mt(f),m.wrap>0&&(m.wrap=-m.wrap),m.pending!==0?de:we)},deflateEnd:function(f){if(Es(f))return ee;var P=f.state.status;return f.state=null,P===me?Ue(f,Ee):de},deflateSetDictionary:function(f,P){var m=P.length;if(Es(f))return ee;var $=f.state,V=$.wrap;if(V===2||V===1&&$.status!==he||$.lookahead)return ee;if(V===1&&(f.adler=H(f.adler,P,m,0)),$.wrap=0,m>=$.w_size){V===0&&(Ye($.head),$.strstart=0,$.block_start=0,$.insert=0);var Z=new Uint8Array($.w_size);Z.set(P.subarray(m-$.w_size,m),0),P=Z,m=$.w_size}var _e=f.avail_in,re=f.next_in,Le=f.input;for(f.avail_in=m,f.next_in=0,f.input=P,mn($);$.lookahead>=3;){var ue=$.strstart,pe=$.lookahead-2;do $.ins_h=pt($,$.ins_h,$.window[ue+3-1]),$.prev[ue&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=ue,ue++;while(--pe);$.strstart=ue,$.lookahead=2,mn($)}return $.strstart+=$.lookahead,$.block_start=$.strstart,$.insert=$.lookahead,$.lookahead=0,$.match_length=$.prev_length=2,$.match_available=0,f.next_in=re,f.input=Le,f.avail_in=_e,$.wrap=V,de},deflateInfo:"pako deflate (from Nodeca project)"};function Pt(f){return Pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(P){return typeof P}:function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},Pt(f)}var jt=function(f,P){return Object.prototype.hasOwnProperty.call(f,P)},At=function(f){for(var P=Array.prototype.slice.call(arguments,1);P.length;){var m=P.shift();if(m){if(Pt(m)!=="object")throw new TypeError(m+"must be non-object");for(var $ in m)jt(m,$)&&(f[$]=m[$])}}return f},yt=function(f){for(var P=0,m=0,$=f.length;m<$;m++)P+=f[m].length;for(var V=new Uint8Array(P),Z=0,_e=0,re=f.length;Z<re;Z++){var Le=f[Z];V.set(Le,_e),_e+=Le.length}return V},Br=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Br=!1}for(var Yt=new Uint8Array(256),Ut=0;Ut<256;Ut++)Yt[Ut]=Ut>=252?6:Ut>=248?5:Ut>=240?4:Ut>=224?3:Ut>=192?2:1;Yt[254]=Yt[254]=1;var an=function(f){if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(f);var P,m,$,V,Z,_e=f.length,re=0;for(V=0;V<_e;V++)(64512&(m=f.charCodeAt(V)))==55296&&V+1<_e&&(64512&($=f.charCodeAt(V+1)))==56320&&(m=65536+(m-55296<<10)+($-56320),V++),re+=m<128?1:m<2048?2:m<65536?3:4;for(P=new Uint8Array(re),Z=0,V=0;Z<re;V++)(64512&(m=f.charCodeAt(V)))==55296&&V+1<_e&&(64512&($=f.charCodeAt(V+1)))==56320&&(m=65536+(m-55296<<10)+($-56320),V++),m<128?P[Z++]=m:m<2048?(P[Z++]=192|m>>>6,P[Z++]=128|63&m):m<65536?(P[Z++]=224|m>>>12,P[Z++]=128|m>>>6&63,P[Z++]=128|63&m):(P[Z++]=240|m>>>18,P[Z++]=128|m>>>12&63,P[Z++]=128|m>>>6&63,P[Z++]=128|63&m);return P},pa=function(f,P){var m,$,V=P||f.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(f.subarray(0,P));var Z=new Array(2*V);for($=0,m=0;m<V;){var _e=f[m++];if(_e<128)Z[$++]=_e;else{var re=Yt[_e];if(re>4)Z[$++]=65533,m+=re-1;else{for(_e&=re===2?31:re===3?15:7;re>1&&m<V;)_e=_e<<6|63&f[m++],re--;re>1?Z[$++]=65533:_e<65536?Z[$++]=_e:(_e-=65536,Z[$++]=55296|_e>>10&1023,Z[$++]=56320|1023&_e)}}}return function(Le,ue){if(ue<65534&&Le.subarray&&Br)return String.fromCharCode.apply(null,Le.length===ue?Le:Le.subarray(0,ue));for(var pe="",wt=0;wt<ue;wt++)pe+=String.fromCharCode(Le[wt]);return pe}(Z,$)},_s=function(f,P){(P=P||f.length)>f.length&&(P=f.length);for(var m=P-1;m>=0&&(192&f[m])==128;)m--;return m<0||m===0?P:m+Yt[f[m]]>P?m:P},Xr=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},Jl=Object.prototype.toString,Kg=ce.Z_NO_FLUSH,Qg=ce.Z_SYNC_FLUSH,rE=ce.Z_FULL_FLUSH,nE=ce.Z_FINISH,Hf=ce.Z_OK,iE=ce.Z_STREAM_END,sE=ce.Z_DEFAULT_COMPRESSION,aE=ce.Z_DEFAULT_STRATEGY,oE=ce.Z_DEFLATED;function Hc(f){this.options=At({level:sE,method:oE,chunkSize:16384,windowBits:15,memLevel:8,strategy:aE},f||{});var P=this.options;P.raw&&P.windowBits>0?P.windowBits=-P.windowBits:P.gzip&&P.windowBits>0&&P.windowBits<16&&(P.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xr,this.strm.avail_out=0;var m=Je.deflateInit2(this.strm,P.level,P.method,P.windowBits,P.memLevel,P.strategy);if(m!==Hf)throw new Error(oe[m]);if(P.header&&Je.deflateSetHeader(this.strm,P.header),P.dictionary){var $;if($=typeof P.dictionary=="string"?an(P.dictionary):Jl.call(P.dictionary)==="[object ArrayBuffer]"?new Uint8Array(P.dictionary):P.dictionary,(m=Je.deflateSetDictionary(this.strm,$))!==Hf)throw new Error(oe[m]);this._dict_set=!0}}function Jg(f,P){var m=new Hc(P);if(m.push(f,!0),m.err)throw m.msg||oe[m.err];return m.result}Hc.prototype.push=function(f,P){var m,$,V=this.strm,Z=this.options.chunkSize;if(this.ended)return!1;for($=P===~~P?P:P===!0?nE:Kg,typeof f=="string"?V.input=an(f):Jl.call(f)==="[object ArrayBuffer]"?V.input=new Uint8Array(f):V.input=f,V.next_in=0,V.avail_in=V.input.length;;)if(V.avail_out===0&&(V.output=new Uint8Array(Z),V.next_out=0,V.avail_out=Z),($===Qg||$===rE)&&V.avail_out<=6)this.onData(V.output.subarray(0,V.next_out)),V.avail_out=0;else{if((m=Je.deflate(V,$))===iE)return V.next_out>0&&this.onData(V.output.subarray(0,V.next_out)),m=Je.deflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===Hf;if(V.avail_out!==0){if($>0&&V.next_out>0)this.onData(V.output.subarray(0,V.next_out)),V.avail_out=0;else if(V.avail_in===0)break}else this.onData(V.output)}return!0},Hc.prototype.onData=function(f){this.chunks.push(f)},Hc.prototype.onEnd=function(f){f===Hf&&(this.result=yt(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg};var $f={Deflate:Hc,deflate:Jg,deflateRaw:function(f,P){return(P=P||{}).raw=!0,Jg(f,P)},gzip:function(f,P){return(P=P||{}).gzip=!0,Jg(f,P)}},Vf=16209,lE=function(f,P){var m,$,V,Z,_e,re,Le,ue,pe,wt,Ve,ke,je,bt,lt,Et,Be,Oe,rt,Zt,Ke,Rt,Dt,nt,ht=f.state;m=f.next_in,Dt=f.input,$=m+(f.avail_in-5),V=f.next_out,nt=f.output,Z=V-(P-f.avail_out),_e=V+(f.avail_out-257),re=ht.dmax,Le=ht.wsize,ue=ht.whave,pe=ht.wnext,wt=ht.window,Ve=ht.hold,ke=ht.bits,je=ht.lencode,bt=ht.distcode,lt=(1<<ht.lenbits)-1,Et=(1<<ht.distbits)-1;e:do{ke<15&&(Ve+=Dt[m++]<<ke,ke+=8,Ve+=Dt[m++]<<ke,ke+=8),Be=je[Ve<];t:for(;;){if(Ve>>>=Oe=Be>>>24,ke-=Oe,(Oe=Be>>>16&255)===0)nt[V++]=65535&Be;else{if(!(16&Oe)){if(!(64&Oe)){Be=je[(65535&Be)+(Ve&(1<<Oe)-1)];continue t}if(32&Oe){ht.mode=16191;break e}f.msg="invalid literal/length code",ht.mode=Vf;break e}rt=65535&Be,(Oe&=15)&&(ke<Oe&&(Ve+=Dt[m++]<<ke,ke+=8),rt+=Ve&(1<<Oe)-1,Ve>>>=Oe,ke-=Oe),ke<15&&(Ve+=Dt[m++]<<ke,ke+=8,Ve+=Dt[m++]<<ke,ke+=8),Be=bt[Ve&Et];r:for(;;){if(Ve>>>=Oe=Be>>>24,ke-=Oe,!(16&(Oe=Be>>>16&255))){if(!(64&Oe)){Be=bt[(65535&Be)+(Ve&(1<<Oe)-1)];continue r}f.msg="invalid distance code",ht.mode=Vf;break e}if(Zt=65535&Be,ke<(Oe&=15)&&(Ve+=Dt[m++]<<ke,(ke+=8)<Oe&&(Ve+=Dt[m++]<<ke,ke+=8)),(Zt+=Ve&(1<<Oe)-1)>re){f.msg="invalid distance too far back",ht.mode=Vf;break e}if(Ve>>>=Oe,ke-=Oe,Zt>(Oe=V-Z)){if((Oe=Zt-Oe)>ue&&ht.sane){f.msg="invalid distance too far back",ht.mode=Vf;break e}if(Ke=0,Rt=wt,pe===0){if(Ke+=Le-Oe,Oe<rt){rt-=Oe;do nt[V++]=wt[Ke++];while(--Oe);Ke=V-Zt,Rt=nt}}else if(pe<Oe){if(Ke+=Le+pe-Oe,(Oe-=pe)<rt){rt-=Oe;do nt[V++]=wt[Ke++];while(--Oe);if(Ke=0,pe<rt){rt-=Oe=pe;do nt[V++]=wt[Ke++];while(--Oe);Ke=V-Zt,Rt=nt}}}else if(Ke+=pe-Oe,Oe<rt){rt-=Oe;do nt[V++]=wt[Ke++];while(--Oe);Ke=V-Zt,Rt=nt}for(;rt>2;)nt[V++]=Rt[Ke++],nt[V++]=Rt[Ke++],nt[V++]=Rt[Ke++],rt-=3;rt&&(nt[V++]=Rt[Ke++],rt>1&&(nt[V++]=Rt[Ke++]))}else{Ke=V-Zt;do nt[V++]=nt[Ke++],nt[V++]=nt[Ke++],nt[V++]=nt[Ke++],rt-=3;while(rt>2);rt&&(nt[V++]=nt[Ke++],rt>1&&(nt[V++]=nt[Ke++]))}break}}break}}while(m<$&&V<_e);m-=rt=ke>>3,Ve&=(1<<(ke-=rt<<3))-1,f.next_in=m,f.next_out=V,f.avail_in=m<$?$-m+5:5-(m-$),f.avail_out=V<_e?_e-V+257:257-(V-_e),ht.hold=Ve,ht.bits=ke},Gf=15,uE=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),cE=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),hE=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),dE=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),$c=function(f,P,m,$,V,Z,_e,re){var Le,ue,pe,wt,Ve,ke,je,bt,lt,Et=re.bits,Be=0,Oe=0,rt=0,Zt=0,Ke=0,Rt=0,Dt=0,nt=0,ht=0,Vt=0,wo=null,ga=new Uint16Array(16),Qf=new Uint16Array(16),Jf=null;for(Be=0;Be<=Gf;Be++)ga[Be]=0;for(Oe=0;Oe<$;Oe++)ga[P[m+Oe]]++;for(Ke=Et,Zt=Gf;Zt>=1&&ga[Zt]===0;Zt--);if(Ke>Zt&&(Ke=Zt),Zt===0)return V[Z++]=20971520,V[Z++]=20971520,re.bits=1,0;for(rt=1;rt<Zt&&ga[rt]===0;rt++);for(Ke<rt&&(Ke=rt),nt=1,Be=1;Be<=Gf;Be++)if(nt<<=1,(nt-=ga[Be])<0)return-1;if(nt>0&&(f===0||Zt!==1))return-1;for(Qf[1]=0,Be=1;Be<Gf;Be++)Qf[Be+1]=Qf[Be]+ga[Be];for(Oe=0;Oe<$;Oe++)P[m+Oe]!==0&&(_e[Qf[P[m+Oe]]++]=Oe);if(f===0?(wo=Jf=_e,ke=20):f===1?(wo=uE,Jf=cE,ke=257):(wo=hE,Jf=dE,ke=0),Vt=0,Oe=0,Be=rt,Ve=Z,Rt=Ke,Dt=0,pe=-1,wt=(ht=1<<Ke)-1,f===1&&ht>852||f===2&&ht>592)return 1;for(;;){je=Be-Dt,_e[Oe]+1<ke?(bt=0,lt=_e[Oe]):_e[Oe]>=ke?(bt=Jf[_e[Oe]-ke],lt=wo[_e[Oe]-ke]):(bt=96,lt=0),Le=1<<Be-Dt,rt=ue=1<<Rt;do V[Ve+(Vt>>Dt)+(ue-=Le)]=je<<24|bt<<16|lt|0;while(ue!==0);for(Le=1<<Be-1;Vt&Le;)Le>>=1;if(Le!==0?(Vt&=Le-1,Vt+=Le):Vt=0,Oe++,--ga[Be]==0){if(Be===Zt)break;Be=P[m+_e[Oe]]}if(Be>Ke&&(Vt&wt)!==pe){for(Dt===0&&(Dt=Ke),Ve+=rt,nt=1<<(Rt=Be-Dt);Rt+Dt<Zt&&!((nt-=ga[Rt+Dt])<=0);)Rt++,nt<<=1;if(ht+=1<<Rt,f===1&&ht>852||f===2&&ht>592)return 1;V[pe=Vt&wt]=Ke<<24|Rt<<16|Ve-Z|0}}return Vt!==0&&(V[Ve+Vt]=Be-Dt<<24|64<<16|0),re.bits=Ke,0},wv=ce.Z_FINISH,fE=ce.Z_BLOCK,qf=ce.Z_TREES,vo=ce.Z_OK,pE=ce.Z_STREAM_END,gE=ce.Z_NEED_DICT,ki=ce.Z_STREAM_ERROR,xv=ce.Z_DATA_ERROR,Av=ce.Z_MEM_ERROR,mE=ce.Z_BUF_ERROR,Ev=ce.Z_DEFLATED,Wf=16180,Xf=16190,Cs=16191,em=16192,tm=16194,Yf=16199,Zf=16200,rm=16206,ir=16209,_v=function(f){return(f>>>24&255)+(f>>>8&65280)+((65280&f)<<8)+((255&f)<<24)};function bE(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var nm,im,yo=function(f){if(!f)return 1;var P=f.state;return!P||P.strm!==f||P.mode<Wf||P.mode>16211?1:0},Cv=function(f){if(yo(f))return ki;var P=f.state;return f.total_in=f.total_out=P.total=0,f.msg="",P.wrap&&(f.adler=1&P.wrap),P.mode=Wf,P.last=0,P.havedict=0,P.flags=-1,P.dmax=32768,P.head=null,P.hold=0,P.bits=0,P.lencode=P.lendyn=new Int32Array(852),P.distcode=P.distdyn=new Int32Array(592),P.sane=1,P.back=-1,vo},Sv=function(f){if(yo(f))return ki;var P=f.state;return P.wsize=0,P.whave=0,P.wnext=0,Cv(f)},Tv=function(f,P){var m;if(yo(f))return ki;var $=f.state;return P<0?(m=0,P=-P):(m=5+(P>>4),P<48&&(P&=15)),P&&(P<8||P>15)?ki:($.window!==null&&$.wbits!==P&&($.window=null),$.wrap=m,$.wbits=P,Sv(f))},kv=function(f,P){if(!f)return ki;var m=new bE;f.state=m,m.strm=f,m.window=null,m.mode=Wf;var $=Tv(f,P);return $!==vo&&(f.state=null),$},Dv=!0,vE=function(f){if(Dv){nm=new Int32Array(512),im=new Int32Array(32);for(var P=0;P<144;)f.lens[P++]=8;for(;P<256;)f.lens[P++]=9;for(;P<280;)f.lens[P++]=7;for(;P<288;)f.lens[P++]=8;for($c(1,f.lens,0,288,nm,0,f.work,{bits:9}),P=0;P<32;)f.lens[P++]=5;$c(2,f.lens,0,32,im,0,f.work,{bits:5}),Dv=!1}f.lencode=nm,f.lenbits=9,f.distcode=im,f.distbits=5},Pv=function(f,P,m,$){var V,Z=f.state;return Z.window===null&&(Z.wsize=1<<Z.wbits,Z.wnext=0,Z.whave=0,Z.window=new Uint8Array(Z.wsize)),$>=Z.wsize?(Z.window.set(P.subarray(m-Z.wsize,m),0),Z.wnext=0,Z.whave=Z.wsize):((V=Z.wsize-Z.wnext)>$&&(V=$),Z.window.set(P.subarray(m-$,m-$+V),Z.wnext),($-=V)?(Z.window.set(P.subarray(m-$,m),0),Z.wnext=$,Z.whave=Z.wsize):(Z.wnext+=V,Z.wnext===Z.wsize&&(Z.wnext=0),Z.whave<Z.wsize&&(Z.whave+=V))),0},Ss={inflateReset:Sv,inflateReset2:Tv,inflateResetKeep:Cv,inflateInit:function(f){return kv(f,15)},inflateInit2:kv,inflate:function(f,P){var m,$,V,Z,_e,re,Le,ue,pe,wt,Ve,ke,je,bt,lt,Et,Be,Oe,rt,Zt,Ke,Rt,Dt,nt,ht=0,Vt=new Uint8Array(4),wo=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(yo(f)||!f.output||!f.input&&f.avail_in!==0)return ki;(m=f.state).mode===Cs&&(m.mode=em),_e=f.next_out,V=f.output,Le=f.avail_out,Z=f.next_in,$=f.input,re=f.avail_in,ue=m.hold,pe=m.bits,wt=re,Ve=Le,Rt=vo;e:for(;;)switch(m.mode){case Wf:if(m.wrap===0){m.mode=em;break}for(;pe<16;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(2&m.wrap&&ue===35615){m.wbits===0&&(m.wbits=15),m.check=0,Vt[0]=255&ue,Vt[1]=ue>>>8&255,m.check=le(m.check,Vt,2,0),ue=0,pe=0,m.mode=16181;break}if(m.head&&(m.head.done=!1),!(1&m.wrap)||(((255&ue)<<8)+(ue>>8))%31){f.msg="incorrect header check",m.mode=ir;break}if((15&ue)!==Ev){f.msg="unknown compression method",m.mode=ir;break}if(pe-=4,Ke=8+(15&(ue>>>=4)),m.wbits===0&&(m.wbits=Ke),Ke>15||Ke>m.wbits){f.msg="invalid window size",m.mode=ir;break}m.dmax=1<<m.wbits,m.flags=0,f.adler=m.check=1,m.mode=512&ue?16189:Cs,ue=0,pe=0;break;case 16181:for(;pe<16;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(m.flags=ue,(255&m.flags)!==Ev){f.msg="unknown compression method",m.mode=ir;break}if(57344&m.flags){f.msg="unknown header flags set",m.mode=ir;break}m.head&&(m.head.text=ue>>8&1),512&m.flags&&4&m.wrap&&(Vt[0]=255&ue,Vt[1]=ue>>>8&255,m.check=le(m.check,Vt,2,0)),ue=0,pe=0,m.mode=16182;case 16182:for(;pe<32;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}m.head&&(m.head.time=ue),512&m.flags&&4&m.wrap&&(Vt[0]=255&ue,Vt[1]=ue>>>8&255,Vt[2]=ue>>>16&255,Vt[3]=ue>>>24&255,m.check=le(m.check,Vt,4,0)),ue=0,pe=0,m.mode=16183;case 16183:for(;pe<16;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}m.head&&(m.head.xflags=255&ue,m.head.os=ue>>8),512&m.flags&&4&m.wrap&&(Vt[0]=255&ue,Vt[1]=ue>>>8&255,m.check=le(m.check,Vt,2,0)),ue=0,pe=0,m.mode=16184;case 16184:if(1024&m.flags){for(;pe<16;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}m.length=ue,m.head&&(m.head.extra_len=ue),512&m.flags&&4&m.wrap&&(Vt[0]=255&ue,Vt[1]=ue>>>8&255,m.check=le(m.check,Vt,2,0)),ue=0,pe=0}else m.head&&(m.head.extra=null);m.mode=16185;case 16185:if(1024&m.flags&&((ke=m.length)>re&&(ke=re),ke&&(m.head&&(Ke=m.head.extra_len-m.length,m.head.extra||(m.head.extra=new Uint8Array(m.head.extra_len)),m.head.extra.set($.subarray(Z,Z+ke),Ke)),512&m.flags&&4&m.wrap&&(m.check=le(m.check,$,ke,Z)),re-=ke,Z+=ke,m.length-=ke),m.length))break e;m.length=0,m.mode=16186;case 16186:if(2048&m.flags){if(re===0)break e;ke=0;do Ke=$[Z+ke++],m.head&&Ke&&m.length<65536&&(m.head.name+=String.fromCharCode(Ke));while(Ke&&ke<re);if(512&m.flags&&4&m.wrap&&(m.check=le(m.check,$,ke,Z)),re-=ke,Z+=ke,Ke)break e}else m.head&&(m.head.name=null);m.length=0,m.mode=16187;case 16187:if(4096&m.flags){if(re===0)break e;ke=0;do Ke=$[Z+ke++],m.head&&Ke&&m.length<65536&&(m.head.comment+=String.fromCharCode(Ke));while(Ke&&ke<re);if(512&m.flags&&4&m.wrap&&(m.check=le(m.check,$,ke,Z)),re-=ke,Z+=ke,Ke)break e}else m.head&&(m.head.comment=null);m.mode=16188;case 16188:if(512&m.flags){for(;pe<16;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(4&m.wrap&&ue!==(65535&m.check)){f.msg="header crc mismatch",m.mode=ir;break}ue=0,pe=0}m.head&&(m.head.hcrc=m.flags>>9&1,m.head.done=!0),f.adler=m.check=0,m.mode=Cs;break;case 16189:for(;pe<32;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}f.adler=m.check=_v(ue),ue=0,pe=0,m.mode=Xf;case Xf:if(m.havedict===0)return f.next_out=_e,f.avail_out=Le,f.next_in=Z,f.avail_in=re,m.hold=ue,m.bits=pe,gE;f.adler=m.check=1,m.mode=Cs;case Cs:if(P===fE||P===qf)break e;case em:if(m.last){ue>>>=7&pe,pe-=7&pe,m.mode=rm;break}for(;pe<3;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}switch(m.last=1&ue,pe-=1,3&(ue>>>=1)){case 0:m.mode=16193;break;case 1:if(vE(m),m.mode=Yf,P===qf){ue>>>=2,pe-=2;break e}break;case 2:m.mode=16196;break;case 3:f.msg="invalid block type",m.mode=ir}ue>>>=2,pe-=2;break;case 16193:for(ue>>>=7&pe,pe-=7&pe;pe<32;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if((65535&ue)!=(ue>>>16^65535)){f.msg="invalid stored block lengths",m.mode=ir;break}if(m.length=65535&ue,ue=0,pe=0,m.mode=tm,P===qf)break e;case tm:m.mode=16195;case 16195:if(ke=m.length){if(ke>re&&(ke=re),ke>Le&&(ke=Le),ke===0)break e;V.set($.subarray(Z,Z+ke),_e),re-=ke,Z+=ke,Le-=ke,_e+=ke,m.length-=ke;break}m.mode=Cs;break;case 16196:for(;pe<14;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(m.nlen=257+(31&ue),ue>>>=5,pe-=5,m.ndist=1+(31&ue),ue>>>=5,pe-=5,m.ncode=4+(15&ue),ue>>>=4,pe-=4,m.nlen>286||m.ndist>30){f.msg="too many length or distance symbols",m.mode=ir;break}m.have=0,m.mode=16197;case 16197:for(;m.have<m.ncode;){for(;pe<3;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}m.lens[wo[m.have++]]=7&ue,ue>>>=3,pe-=3}for(;m.have<19;)m.lens[wo[m.have++]]=0;if(m.lencode=m.lendyn,m.lenbits=7,Dt={bits:m.lenbits},Rt=$c(0,m.lens,0,19,m.lencode,0,m.work,Dt),m.lenbits=Dt.bits,Rt){f.msg="invalid code lengths set",m.mode=ir;break}m.have=0,m.mode=16198;case 16198:for(;m.have<m.nlen+m.ndist;){for(;Et=(ht=m.lencode[ue&(1<<m.lenbits)-1])>>>16&255,Be=65535&ht,!((lt=ht>>>24)<=pe);){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(Be<16)ue>>>=lt,pe-=lt,m.lens[m.have++]=Be;else{if(Be===16){for(nt=lt+2;pe<nt;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(ue>>>=lt,pe-=lt,m.have===0){f.msg="invalid bit length repeat",m.mode=ir;break}Ke=m.lens[m.have-1],ke=3+(3&ue),ue>>>=2,pe-=2}else if(Be===17){for(nt=lt+3;pe<nt;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}pe-=lt,Ke=0,ke=3+(7&(ue>>>=lt)),ue>>>=3,pe-=3}else{for(nt=lt+7;pe<nt;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}pe-=lt,Ke=0,ke=11+(127&(ue>>>=lt)),ue>>>=7,pe-=7}if(m.have+ke>m.nlen+m.ndist){f.msg="invalid bit length repeat",m.mode=ir;break}for(;ke--;)m.lens[m.have++]=Ke}}if(m.mode===ir)break;if(m.lens[256]===0){f.msg="invalid code -- missing end-of-block",m.mode=ir;break}if(m.lenbits=9,Dt={bits:m.lenbits},Rt=$c(1,m.lens,0,m.nlen,m.lencode,0,m.work,Dt),m.lenbits=Dt.bits,Rt){f.msg="invalid literal/lengths set",m.mode=ir;break}if(m.distbits=6,m.distcode=m.distdyn,Dt={bits:m.distbits},Rt=$c(2,m.lens,m.nlen,m.ndist,m.distcode,0,m.work,Dt),m.distbits=Dt.bits,Rt){f.msg="invalid distances set",m.mode=ir;break}if(m.mode=Yf,P===qf)break e;case Yf:m.mode=Zf;case Zf:if(re>=6&&Le>=258){f.next_out=_e,f.avail_out=Le,f.next_in=Z,f.avail_in=re,m.hold=ue,m.bits=pe,lE(f,Ve),_e=f.next_out,V=f.output,Le=f.avail_out,Z=f.next_in,$=f.input,re=f.avail_in,ue=m.hold,pe=m.bits,m.mode===Cs&&(m.back=-1);break}for(m.back=0;Et=(ht=m.lencode[ue&(1<<m.lenbits)-1])>>>16&255,Be=65535&ht,!((lt=ht>>>24)<=pe);){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(Et&&!(240&Et)){for(Oe=lt,rt=Et,Zt=Be;Et=(ht=m.lencode[Zt+((ue&(1<<Oe+rt)-1)>>Oe)])>>>16&255,Be=65535&ht,!(Oe+(lt=ht>>>24)<=pe);){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}ue>>>=Oe,pe-=Oe,m.back+=Oe}if(ue>>>=lt,pe-=lt,m.back+=lt,m.length=Be,Et===0){m.mode=16205;break}if(32&Et){m.back=-1,m.mode=Cs;break}if(64&Et){f.msg="invalid literal/length code",m.mode=ir;break}m.extra=15&Et,m.mode=16201;case 16201:if(m.extra){for(nt=m.extra;pe<nt;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}m.length+=ue&(1<<m.extra)-1,ue>>>=m.extra,pe-=m.extra,m.back+=m.extra}m.was=m.length,m.mode=16202;case 16202:for(;Et=(ht=m.distcode[ue&(1<<m.distbits)-1])>>>16&255,Be=65535&ht,!((lt=ht>>>24)<=pe);){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(!(240&Et)){for(Oe=lt,rt=Et,Zt=Be;Et=(ht=m.distcode[Zt+((ue&(1<<Oe+rt)-1)>>Oe)])>>>16&255,Be=65535&ht,!(Oe+(lt=ht>>>24)<=pe);){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}ue>>>=Oe,pe-=Oe,m.back+=Oe}if(ue>>>=lt,pe-=lt,m.back+=lt,64&Et){f.msg="invalid distance code",m.mode=ir;break}m.offset=Be,m.extra=15&Et,m.mode=16203;case 16203:if(m.extra){for(nt=m.extra;pe<nt;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}m.offset+=ue&(1<<m.extra)-1,ue>>>=m.extra,pe-=m.extra,m.back+=m.extra}if(m.offset>m.dmax){f.msg="invalid distance too far back",m.mode=ir;break}m.mode=16204;case 16204:if(Le===0)break e;if(ke=Ve-Le,m.offset>ke){if((ke=m.offset-ke)>m.whave&&m.sane){f.msg="invalid distance too far back",m.mode=ir;break}ke>m.wnext?(ke-=m.wnext,je=m.wsize-ke):je=m.wnext-ke,ke>m.length&&(ke=m.length),bt=m.window}else bt=V,je=_e-m.offset,ke=m.length;ke>Le&&(ke=Le),Le-=ke,m.length-=ke;do V[_e++]=bt[je++];while(--ke);m.length===0&&(m.mode=Zf);break;case 16205:if(Le===0)break e;V[_e++]=m.length,Le--,m.mode=Zf;break;case rm:if(m.wrap){for(;pe<32;){if(re===0)break e;re--,ue|=$[Z++]<<pe,pe+=8}if(Ve-=Le,f.total_out+=Ve,m.total+=Ve,4&m.wrap&&Ve&&(f.adler=m.check=m.flags?le(m.check,V,Ve,_e-Ve):H(m.check,V,Ve,_e-Ve)),Ve=Le,4&m.wrap&&(m.flags?ue:_v(ue))!==m.check){f.msg="incorrect data check",m.mode=ir;break}ue=0,pe=0}m.mode=16207;case 16207:if(m.wrap&&m.flags){for(;pe<32;){if(re===0)break e;re--,ue+=$[Z++]<<pe,pe+=8}if(4&m.wrap&&ue!==(4294967295&m.total)){f.msg="incorrect length check",m.mode=ir;break}ue=0,pe=0}m.mode=16208;case 16208:Rt=pE;break e;case ir:Rt=xv;break e;case 16210:return Av;default:return ki}return f.next_out=_e,f.avail_out=Le,f.next_in=Z,f.avail_in=re,m.hold=ue,m.bits=pe,(m.wsize||Ve!==f.avail_out&&m.mode<ir&&(m.mode<rm||P!==wv))&&Pv(f,f.output,f.next_out,Ve-f.avail_out),wt-=f.avail_in,Ve-=f.avail_out,f.total_in+=wt,f.total_out+=Ve,m.total+=Ve,4&m.wrap&&Ve&&(f.adler=m.check=m.flags?le(m.check,V,Ve,f.next_out-Ve):H(m.check,V,Ve,f.next_out-Ve)),f.data_type=m.bits+(m.last?64:0)+(m.mode===Cs?128:0)+(m.mode===Yf||m.mode===tm?256:0),(wt===0&&Ve===0||P===wv)&&Rt===vo&&(Rt=mE),Rt},inflateEnd:function(f){if(yo(f))return ki;var P=f.state;return P.window&&(P.window=null),f.state=null,vo},inflateGetHeader:function(f,P){if(yo(f))return ki;var m=f.state;return 2&m.wrap?(m.head=P,P.done=!1,vo):ki},inflateSetDictionary:function(f,P){var m,$=P.length;return yo(f)||(m=f.state).wrap!==0&&m.mode!==Xf?ki:m.mode===Xf&&H(1,P,$,0)!==m.check?xv:Pv(f,P,$,$)?(m.mode=16210,Av):(m.havedict=1,vo)},inflateInfo:"pako inflate (from Nodeca project)"},yE=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},Rv=Object.prototype.toString,wE=ce.Z_NO_FLUSH,xE=ce.Z_FINISH,Vc=ce.Z_OK,sm=ce.Z_STREAM_END,am=ce.Z_NEED_DICT,AE=ce.Z_STREAM_ERROR,Iv=ce.Z_DATA_ERROR,EE=ce.Z_MEM_ERROR;function Gc(f){this.options=At({chunkSize:65536,windowBits:15,to:""},f||{});var P=this.options;P.raw&&P.windowBits>=0&&P.windowBits<16&&(P.windowBits=-P.windowBits,P.windowBits===0&&(P.windowBits=-15)),!(P.windowBits>=0&&P.windowBits<16)||f&&f.windowBits||(P.windowBits+=32),P.windowBits>15&&P.windowBits<48&&!(15&P.windowBits)&&(P.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xr,this.strm.avail_out=0;var m=Ss.inflateInit2(this.strm,P.windowBits);if(m!==Vc)throw new Error(oe[m]);if(this.header=new yE,Ss.inflateGetHeader(this.strm,this.header),P.dictionary&&(typeof P.dictionary=="string"?P.dictionary=an(P.dictionary):Rv.call(P.dictionary)==="[object ArrayBuffer]"&&(P.dictionary=new Uint8Array(P.dictionary)),P.raw&&(m=Ss.inflateSetDictionary(this.strm,P.dictionary))!==Vc))throw new Error(oe[m])}function om(f,P){var m=new Gc(P);if(m.push(f),m.err)throw m.msg||oe[m.err];return m.result}Gc.prototype.push=function(f,P){var m,$,V,Z=this.strm,_e=this.options.chunkSize,re=this.options.dictionary;if(this.ended)return!1;for($=P===~~P?P:P===!0?xE:wE,Rv.call(f)==="[object ArrayBuffer]"?Z.input=new Uint8Array(f):Z.input=f,Z.next_in=0,Z.avail_in=Z.input.length;;){for(Z.avail_out===0&&(Z.output=new Uint8Array(_e),Z.next_out=0,Z.avail_out=_e),(m=Ss.inflate(Z,$))===am&&re&&((m=Ss.inflateSetDictionary(Z,re))===Vc?m=Ss.inflate(Z,$):m===Iv&&(m=am));Z.avail_in>0&&m===sm&&Z.state.wrap>0&&f[Z.next_in]!==0;)Ss.inflateReset(Z),m=Ss.inflate(Z,$);switch(m){case AE:case Iv:case am:case EE:return this.onEnd(m),this.ended=!0,!1}if(V=Z.avail_out,Z.next_out&&(Z.avail_out===0||m===sm))if(this.options.to==="string"){var Le=_s(Z.output,Z.next_out),ue=Z.next_out-Le,pe=pa(Z.output,Le);Z.next_out=ue,Z.avail_out=_e-ue,ue&&Z.output.set(Z.output.subarray(Le,Le+ue),0),this.onData(pe)}else this.onData(Z.output.length===Z.next_out?Z.output:Z.output.subarray(0,Z.next_out));if(m!==Vc||V!==0){if(m===sm)return m=Ss.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,!0;if(Z.avail_in===0)break}}return!0},Gc.prototype.onData=function(f){this.chunks.push(f)},Gc.prototype.onEnd=function(f){f===Vc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=yt(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg};var Kf={Inflate:Gc,inflate:om,inflateRaw:function(f,P){return(P=P||{}).raw=!0,om(f,P)},ungzip:om},Nv=$f.Deflate,Mv=$f.deflate,Lv=$f.deflateRaw,Ov=$f.gzip,Fv=Kf.Inflate,Bv=Kf.inflate,zv=Kf.inflateRaw,jv=Kf.ungzip,Uv=ce,_E={Deflate:Nv,deflate:Mv,deflateRaw:Lv,gzip:Ov,Inflate:Fv,inflate:Bv,inflateRaw:zv,ungzip:jv,constants:Uv};t.Deflate=Nv,t.Inflate=Fv,t.constants=Uv,t.default=_E,t.deflate=Mv,t.deflateRaw=Lv,t.gzip=Ov,t.inflate=Bv,t.inflateRaw=zv,t.ungzip=jv,Object.defineProperty(t,"__esModule",{value:!0})})})(Ab,Ab.exports);var $P=Ab.exports,EA=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",_A=$P;jc.uncompressInputType=EA?"uint8array":"array";jc.compressInputType=EA?"uint8array":"array";jc.magic="\b\0";jc.compress=function(i,e){return _A.deflateRaw(i,{level:e.level||-1})};jc.uncompress=function(i){return _A.inflateRaw(i)};zf.STORE={magic:"\0\0",compress:function(e){return e},uncompress:function(e){return e},compressInputType:null,uncompressInputType:null};zf.DEFLATE=jc;var ov={exports:{}};ov.exports=function(i,e){return typeof i=="number"?Buffer.alloc(i):Buffer.from(i,e)};ov.exports.test=function(i){return Buffer.isBuffer(i)};var lv=ov.exports;(function(i){function e(h){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},e(h)}var t=pn,r=zf,n=lv;i.string2binary=function(h){for(var d="",p=0;p<h.length;p++)d+=String.fromCharCode(h.charCodeAt(p)&255);return d},i.arrayBuffer2Blob=function(h,d){i.checkSupport("blob"),d=d||"application/zip";try{return new Blob([h],{type:d})}catch{try{var p=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,g=new p;return g.append(h),g.getBlob(d)}catch{throw new Error("Bug : can't construct the Blob.")}}};function s(h){return h}function a(h,d){for(var p=0;p<h.length;++p)d[p]=h.charCodeAt(p)&255;return d}function o(h){var d=65536,p=[],g=h.length,y=i.getTypeOf(h),b=0,w=!0;try{switch(y){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,n(0));break}}catch{w=!1}if(!w){for(var v="",A=0;A<h.length;A++)v+=String.fromCharCode(h[A]);return v}for(;b<g&&d>1;)try{y==="array"||y==="nodebuffer"?p.push(String.fromCharCode.apply(null,h.slice(b,Math.min(b+d,g)))):p.push(String.fromCharCode.apply(null,h.subarray(b,Math.min(b+d,g)))),b+=d}catch{d=Math.floor(d/2)}return p.join("")}i.applyFromCharCode=o;function l(h,d){for(var p=0;p<h.length;p++)d[p]=h[p];return d}var c={};c.string={string:s,array:function(d){return a(d,new Array(d.length))},arraybuffer:function(d){return c.string.uint8array(d).buffer},uint8array:function(d){return a(d,new Uint8Array(d.length))},nodebuffer:function(d){return a(d,n(d.length))}},c.array={string:o,array:s,arraybuffer:function(d){return new Uint8Array(d).buffer},uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return n(d)}},c.arraybuffer={string:function(d){return o(new Uint8Array(d))},array:function(d){return l(new Uint8Array(d),new Array(d.byteLength))},arraybuffer:s,uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return n(new Uint8Array(d))}},c.uint8array={string:o,array:function(d){return l(d,new Array(d.length))},arraybuffer:function(d){return d.buffer},uint8array:s,nodebuffer:function(d){return n(d)}},c.nodebuffer={string:o,array:function(d){return l(d,new Array(d.length))},arraybuffer:function(d){return c.nodebuffer.uint8array(d).buffer},uint8array:function(d){return l(d,new Uint8Array(d.length))},nodebuffer:s},i.transformTo=function(h,d){if(d||(d=""),!h)return d;i.checkSupport(h);var p=i.getTypeOf(d),g=c[p][h](d);return g},i.getTypeOf=function(h){if(h!=null){if(typeof h=="string")return"string";var d=Object.prototype.toString.call(h);if(d==="[object Array]")return"array";if(t.nodebuffer&&n.test(h))return"nodebuffer";if(t.uint8array&&d==="[object Uint8Array]")return"uint8array";if(t.arraybuffer&&d==="[object ArrayBuffer]")return"arraybuffer";if(d==="[object Promise]")throw new Error("Cannot read data from a promise, you probably are running new PizZip(data) with a promise");if(e(h)==="object"&&typeof h.file=="function")throw new Error("Cannot read data from a pizzip instance, you probably are running new PizZip(zip) with a zipinstance");if(d==="[object Date]")throw new Error("Cannot read data from a Date, you probably are running new PizZip(data) with a date");if(e(h)==="object"&&h.crc32==null)throw new Error("Unsupported data given to new PizZip(data) (object given)")}},i.checkSupport=function(h){var d=t[h.toLowerCase()];if(!d)throw new Error(h+" is not supported by this browser")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(h){var d="",p,g;for(g=0;g<(h||"").length;g++)p=h.charCodeAt(g),d+="\\x"+(p<16?"0":"")+p.toString(16).toUpperCase();return d},i.findCompression=function(h){for(var d in r)if(r.hasOwnProperty(d)&&r[d].magic===h)return r[d];return null},i.isRegExp=function(h){return Object.prototype.toString.call(h)==="[object RegExp]"},i.extend=function(){var h={},d,p;for(d=0;d<arguments.length;d++)for(p in arguments[d])arguments[d].hasOwnProperty(p)&&typeof h[p]>"u"&&(h[p]=arguments[d][p]);return h}})(Ci);var VP=Ci,GP=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],qP=function(e,t){if(typeof e>"u"||!e.length)return 0;var r=VP.getTypeOf(e)!=="string";typeof t>"u"&&(t=0);var n=0,s=0,a=0;t^=-1;for(var o=0,l=e.length;o<l;o++)a=r?e[o]:e.charCodeAt(o),s=(t^a)&255,n=GP[s],t=t>>>8^n;return t^-1},bo={};bo.LOCAL_FILE_HEADER="PK";bo.CENTRAL_FILE_HEADER="PK";bo.CENTRAL_DIRECTORY_END="PK";bo.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";bo.ZIP64_CENTRAL_DIRECTORY_END="PK";bo.DATA_DESCRIPTOR="PK\x07\b";var Si={};Si.base64=!1;Si.binary=!1;Si.dir=!1;Si.createFolders=!1;Si.date=null;Si.compression=null;Si.compressionOptions=null;Si.comment=null;Si.unixPermissions=null;Si.dosPermissions=null;function CA(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}CA.prototype={getContent:function(){return null},getCompressedContent:function(){return null}};var SA=CA,Zg={},Eb=Ci,Dh=pn,WP=lv,Yh=new Array(256);for(var va=0;va<256;va++)Yh[va]=va>=252?6:va>=248?5:va>=240?4:va>=224?3:va>=192?2:1;Yh[254]=Yh[254]=1;function XP(i){var e,t,r,n,s,a=0,o=i.length;for(n=0;n<o;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<o&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),a+=t<128?1:t<2048?2:t<65536?3:4;for(Dh.uint8array?e=new Uint8Array(a):e=new Array(a),s=0,n=0;s<a;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<o&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),t<128?e[s++]=t:t<2048?(e[s++]=192|t>>>6,e[s++]=128|t&63):t<65536?(e[s++]=224|t>>>12,e[s++]=128|t>>>6&63,e[s++]=128|t&63):(e[s++]=240|t>>>18,e[s++]=128|t>>>12&63,e[s++]=128|t>>>6&63,e[s++]=128|t&63);return e}function YP(i,e){var t;for(e=e||i.length,e>i.length&&(e=i.length),t=e-1;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+Yh[i[t]]>e?t:e}function x2(i){var e,t,r,n,s=i.length,a=new Array(s*2);for(t=0,e=0;e<s;){if(r=i[e++],r<128){a[t++]=r;continue}if(n=Yh[r],n>4){a[t++]=65533,e+=n-1;continue}for(r&=n===2?31:n===3?15:7;n>1&&e<s;)r=r<<6|i[e++]&63,n--;if(n>1){a[t++]=65533;continue}r<65536?a[t++]=r:(r-=65536,a[t++]=55296|r>>10&1023,a[t++]=56320|r&1023)}return a.length!==t&&(a.subarray?a=a.subarray(0,t):a.length=t),Eb.applyFromCharCode(a)}Zg.utf8encode=function(e){return Dh.nodebuffer?WP(e,"utf-8"):XP(e)};Zg.utf8decode=function(e){if(Dh.nodebuffer)return Eb.transformTo("nodebuffer",e).toString("utf-8");e=Eb.transformTo(Dh.uint8array?"uint8array":"array",e);for(var t=[],r=e.length,n=65536,s=0;s<r;){var a=YP(e,Math.min(s+n,r));Dh.uint8array?t.push(x2(e.subarray(s,a))):t.push(x2(e.slice(s,a))),s=a}return t.join("")};var ZP=Ci;function TA(){this.data=[]}TA.prototype={append:function(e){e=ZP.transformTo("string",e),this.data.push(e)},finalize:function(){return this.data.join("")}};var KP=TA,QP=Ci;function kA(i){this.data=new Uint8Array(i),this.index=0}kA.prototype={append:function(e){e.length!==0&&(e=QP.transformTo("uint8array",e),this.data.set(e,this.index),this.index+=e.length)},finalize:function(){return this.data}};var JP=kA;function eR(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=tR(i))||e){t&&(i=t);var r=0,n=function(){};return{s:n,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(c){throw c},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
58
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,a=!0,o=!1;return{s:function(){t=t.call(i)},n:function(){var c=t.next();return a=c.done,c},e:function(c){o=!0,s=c},f:function(){try{a||t.return==null||t.return()}finally{if(o)throw s}}}}function tR(i,e){if(i){if(typeof i=="string")return A2(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A2(i,e):void 0}}function A2(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=Array(e);t<e;t++)r[t]=i[t];return r}var rR=pn,er=Ci,uv=qP,_b=bo,nR=Si,DA=Bf,Cb=zf,ng=SA,iR=lv,yu=Zg,sR=KP,aR=JP;function PA(i){if(i._data instanceof ng&&(i._data=i._data.getContent(),i.options.binary=!0,i.options.base64=!1,er.getTypeOf(i._data)==="uint8array")){var e=i._data;i._data=new Uint8Array(e.length),e.length!==0&&i._data.set(e,0)}return i._data}function Sb(i){var e=PA(i),t=er.getTypeOf(e);return t==="string"?!i.options.binary&&rR.nodebuffer?iR(e,"utf-8"):i.asBinary():e}var Tb={load:function(){throw new Error("Load method is not defined. Is the file pizzip-load.js included ?")},filter:function(e){var t=[],r,n,s,a;for(r in this.files)this.files.hasOwnProperty(r)&&(s=this.files[r],a=new cv(s.name,s._data,er.extend(s.options)),n=r.slice(this.root.length,r.length),r.slice(0,this.root.length)===this.root&&e(n,a)&&t.push(a));return t},file:function(e,t,r){if(arguments.length===1){if(er.isRegExp(e)){var n=e;return this.filter(function(s,a){return!a.dir&&n.test(s)})}return this.filter(function(s,a){return!a.dir&&s===e})[0]||null}return e=this.root+e,RA.call(this,e,t,r),this},folder:function(e){if(!e)return this;if(er.isRegExp(e))return this.filter(function(s,a){return a.dir&&e.test(s)});var t=this.root+e,r=NA.call(this,t),n=this.shallowClone();return n.root=r.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||(e.slice(-1)!=="/"&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(s,a){return a.name.slice(0,e.length)===e}),n=0;n<r.length;n++)delete this.files[r[n].name];return this},generate:function(e){e=er.extend(e||{},{base64:!0,compression:"STORE",compressionOptions:null,type:"base64",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:yu.utf8encode}),er.checkSupport(e.type),(e.platform==="darwin"||e.platform==="freebsd"||e.platform==="linux"||e.platform==="sunos")&&(e.platform="UNIX"),e.platform==="win32"&&(e.platform="DOS");var t=[],r=er.transformTo("string",e.encodeFileName(e.comment||this.comment||"")),n=0,s=0,a,o,l=[];e.fileOrder instanceof Array&&(l=e.fileOrder);for(var c in this.files)l.indexOf(c)===-1&&l.push(c);typeof e.fileOrder=="function"&&(l=e.fileOrder(this.files));var h=eR(l),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;if(this.files.hasOwnProperty(p)){var g=this.files[p],y=g.options.compression||e.compression.toUpperCase(),b=Cb[y];if(!b)throw new Error(y+" is not a valid compression method !");var w=g.options.compressionOptions||e.compressionOptions||{},v=uR.call(this,g,b,w),A=dR.call(this,p,g,v,n,e.platform,e.encodeFileName);n+=A.fileRecord.length+v.compressedSize,s+=A.dirRecord.length,t.push(A)}}}catch(I){h.e(I)}finally{h.f()}var E="";E=_b.CENTRAL_DIRECTORY_END+"\0\0\0\0"+gr(t.length,2)+gr(t.length,2)+gr(s,4)+gr(n,4)+gr(r.length,2)+r;var _=e.type.toLowerCase();for(_==="uint8array"||_==="arraybuffer"||_==="blob"||_==="nodebuffer"?a=new aR(n+s+E.length):a=new sR(n+s+E.length),o=0;o<t.length;o++)a.append(t[o].fileRecord),a.append(t[o].compressedObject.compressedContent);for(o=0;o<t.length;o++)a.append(t[o].dirRecord);a.append(E);var C=a.finalize();switch(e.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return er.transformTo(e.type.toLowerCase(),C);case"blob":return er.arrayBuffer2Blob(er.transformTo("arraybuffer",C),e.mimeType);case"base64":return e.base64?DA.encode(C):C;default:return C}},crc32:function(e,t){return uv(e,t)},utf8encode:function(e){return er.transformTo("string",yu.utf8encode(e))},utf8decode:function(e){return yu.utf8decode(e)}};function E2(i){var e=PA(this);return e===null||typeof e>"u"?"":(this.options.base64&&(e=DA.decode(e)),i&&this.options.binary?e=Tb.utf8decode(e):e=er.transformTo("string",e),!i&&!this.options.binary&&(e=er.transformTo("string",Tb.utf8encode(e))),e)}function cv(i,e,t){this.name=i,this.dir=t.dir,this.date=t.date,this.comment=t.comment,this.unixPermissions=t.unixPermissions,this.dosPermissions=t.dosPermissions,this._data=e,this.options=t,this._initialMetadata={dir:t.dir,date:t.date}}cv.prototype={asText:function(){return E2.call(this,!0)},asBinary:function(){return E2.call(this,!1)},asNodeBuffer:function(){var e=Sb(this);return er.transformTo("nodebuffer",e)},asUint8Array:function(){var e=Sb(this);return er.transformTo("uint8array",e)},asArrayBuffer:function(){return this.asUint8Array().buffer}};function gr(i,e){var t="",r;for(r=0;r<e;r++)t+=String.fromCharCode(i&255),i>>>=8;return t}function oR(i){return i=i||{},i.base64===!0&&(i.binary===null||i.binary===void 0)&&(i.binary=!0),i=er.extend(i,nR),i.date=i.date||new Date,i.compression!==null&&(i.compression=i.compression.toUpperCase()),i}function RA(i,e,t){var r=er.getTypeOf(e),n;if(t=oR(t),typeof t.unixPermissions=="string"&&(t.unixPermissions=parseInt(t.unixPermissions,8)),t.unixPermissions&&t.unixPermissions&16384&&(t.dir=!0),t.dosPermissions&&t.dosPermissions&16&&(t.dir=!0),t.dir&&(i=IA(i)),t.createFolders&&(n=lR(i))&&NA.call(this,n,!0),t.dir||e===null||typeof e>"u")t.base64=!1,t.binary=!1,e=null,r=null;else if(r==="string")t.binary&&!t.base64&&t.optimizedBinaryString!==!0&&(e=er.string2binary(e));else{if(t.base64=!1,t.binary=!0,!r&&!(e instanceof ng))throw new Error("The data of '"+i+"' is in an unsupported format !");r==="arraybuffer"&&(e=er.transformTo("uint8array",e))}var s=new cv(i,e,t);return this.files[i]=s,s}function lR(i){i.slice(-1)==="/"&&(i=i.substring(0,i.length-1));var e=i.lastIndexOf("/");return e>0?i.substring(0,e):""}function IA(i){return i.slice(-1)!=="/"&&(i+="/"),i}function NA(i,e){return e=typeof e<"u"?e:!1,i=IA(i),this.files[i]||RA.call(this,i,null,{dir:!0,createFolders:e}),this.files[i]}function uR(i,e,t){var r=new ng,n;return i._data instanceof ng?(r.uncompressedSize=i._data.uncompressedSize,r.crc32=i._data.crc32,r.uncompressedSize===0||i.dir?(e=Cb.STORE,r.compressedContent="",r.crc32=0):i._data.compressionMethod===e.magic?r.compressedContent=i._data.getCompressedContent():(n=i._data.getContent(),r.compressedContent=e.compress(er.transformTo(e.compressInputType,n),t))):(n=Sb(i),(!n||n.length===0||i.dir)&&(e=Cb.STORE,n=""),r.uncompressedSize=n.length,r.crc32=uv(n),r.compressedContent=e.compress(er.transformTo(e.compressInputType,n),t)),r.compressedSize=r.compressedContent.length,r.compressionMethod=e.magic,r}function cR(i,e){var t=i;return i||(t=e?16893:33204),(t&65535)<<16}function hR(i){return(i||0)&63}function dR(i,e,t,r,n,s){var a=s!==yu.utf8encode,o=er.transformTo("string",s(e.name)),l=er.transformTo("string",yu.utf8encode(e.name)),c=e.comment||"",h=er.transformTo("string",s(c)),d=er.transformTo("string",yu.utf8encode(c)),p=l.length!==e.name.length,g=d.length!==c.length,y=e.options,b,w,v="",A="",E="",_,C;e._initialMetadata.dir!==e.dir?_=e.dir:_=y.dir,e._initialMetadata.date!==e.date?C=e.date:C=y.date;var I=0,k=0;_&&(I|=16),n==="UNIX"?(k=798,I|=cR(e.unixPermissions,_)):(k=20,I|=hR(e.dosPermissions)),b=C.getHours(),b<<=6,b|=C.getMinutes(),b<<=5,b|=C.getSeconds()/2,w=C.getFullYear()-1980,w<<=4,w|=C.getMonth()+1,w<<=5,w|=C.getDate(),p&&(A=gr(1,1)+gr(uv(o),4)+l,v+="up"+gr(A.length,2)+A),g&&(E=gr(1,1)+gr(this.crc32(h),4)+d,v+="uc"+gr(E.length,2)+E);var D="";D+=`
|
|
59
|
+
\0`,D+=!a&&(p||g)?"\0\b":"\0\0",D+=t.compressionMethod,D+=gr(b,2),D+=gr(w,2),D+=gr(t.crc32,4),D+=gr(t.compressedSize,4),D+=gr(t.uncompressedSize,4),D+=gr(o.length,2),D+=gr(v.length,2);var R=_b.LOCAL_FILE_HEADER+D+o+v,z=_b.CENTRAL_FILE_HEADER+gr(k,2)+D+gr(h.length,2)+"\0\0\0\0"+gr(I,4)+gr(r,4)+o+v+h;return{fileRecord:R,dirRecord:z,compressedObject:t}}var MA=Tb,fR=Ci;function LA(){this.data=null,this.length=0,this.index=0,this.zero=0}LA.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,r;for(this.checkOffset(e),r=this.index+e-1;r>=this.index;r--)t=(t<<8)+this.byteAt(r);return this.index+=e,t},readString:function(e){return fR.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1)}};var OA=LA,pR=OA,gR=Ci;function jf(i,e){this.data=i,e||(this.data=gR.string2binary(this.data)),this.length=this.data.length,this.index=0,this.zero=0}jf.prototype=new pR;jf.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)};jf.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero};jf.prototype.readData=function(i){this.checkOffset(i);var e=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,e};var FA=jf,mR=OA;function Uf(i){if(i){this.data=i,this.length=this.data.length,this.index=0,this.zero=0;for(var e=0;e<this.data.length;e++)i[e]&=i[e]}}Uf.prototype=new mR;Uf.prototype.byteAt=function(i){return this.data[this.zero+i]};Uf.prototype.lastIndexOfSignature=function(i){for(var e=i.charCodeAt(0),t=i.charCodeAt(1),r=i.charCodeAt(2),n=i.charCodeAt(3),s=this.length-4;s>=0;--s)if(this.data[s]===e&&this.data[s+1]===t&&this.data[s+2]===r&&this.data[s+3]===n)return s-this.zero;return-1};Uf.prototype.readData=function(i){if(this.checkOffset(i),i===0)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,e};var BA=Uf,bR=BA;function hv(i){i&&(this.data=i,this.length=this.data.length,this.index=0,this.zero=0)}hv.prototype=new bR;hv.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,e};var zA=hv,vR=zA;function dv(i){this.data=i,this.length=this.data.length,this.index=0,this.zero=0}dv.prototype=new vR;dv.prototype.readData=function(i){this.checkOffset(i);var e=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,e};var yR=dv,Km=FA,Pi=Ci,wR=SA,Ao=MA,xR=pn,AR=0,ER=3;function jA(i,e){this.options=i,this.loadOptions=e}jA.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},prepareCompressedContent:function(e,t,r){return function(){var n=e.index;e.setIndex(t);var s=e.readData(r);return e.setIndex(n),s}},prepareContent:function(e,t,r,n,s){return function(){var a=Pi.transformTo(n.uncompressInputType,this.getCompressedContent()),o=n.uncompress(a);if(o.length!==s)throw new Error("Bug : uncompressed data size mismatch");return o}},readLocalPart:function(e){e.skip(22),this.fileNameLength=e.readInt(2);var t=e.readInt(2);if(this.fileName=e.readData(this.fileNameLength),e.skip(t),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");var r=Pi.findCompression(this.compressionMethod);if(r===null)throw new Error("Corrupted zip : compression "+Pi.pretty(this.compressionMethod)+" unknown (inner file : "+Pi.transformTo("string",this.fileName)+")");if(this.decompressed=new wR,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(e,e.index,this.compressedSize,r),this.decompressed.getContent=this.prepareContent(e,e.index,this.compressedSize,r,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=Pi.transformTo("string",this.decompressed.getContent()),Ao.crc32(this.decompressed)!==this.crc32))throw new Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(e){if(this.versionMadeBy=e.readInt(2),this.versionNeeded=e.readInt(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4),this.fileNameLength=e.readInt(2),this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");this.fileName=e.readData(this.fileNameLength),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===AR&&(this.dosPermissions=this.externalFileAttributes&63),e===ER&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=new Km(this.extraFields[1].value);this.uncompressedSize===Pi.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Pi.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Pi.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Pi.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t=e.index,r,n,s;for(this.extraFields=this.extraFields||{};e.index<t+this.extraFieldsLength;)r=e.readInt(2),n=e.readInt(2),s=e.readString(n),this.extraFields[r]={id:r,length:n,value:s}},handleUTF8:function(){var e=xR.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Ao.utf8decode(this.fileName),this.fileCommentStr=Ao.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var r=Pi.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var s=Pi.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=new Km(e.value);return t.readInt(1)!==1||Ao.crc32(this.fileName)!==t.readInt(4)?null:Ao.utf8decode(t.readString(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=new Km(e.value);return t.readInt(1)!==1||Ao.crc32(this.fileComment)!==t.readInt(4)?null:Ao.utf8decode(t.readString(e.length-5))}return null}};var _R=jA,CR=FA,SR=yR,TR=zA,kR=BA,Hn=Ci,Ri=bo,DR=_R,hp=pn;function UA(i,e){this.files=[],this.loadOptions=e,i&&this.load(i)}UA.prototype={checkSignature:function(e){var t=this.reader.readString(4);if(t!==e)throw new Error("Corrupted zip or bug : unexpected signature ("+Hn.pretty(t)+", expected "+Hn.pretty(e)+")")},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4),s=n===t;return this.reader.setIndex(r),s},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=hp.uint8array?"uint8array":"array",r=Hn.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,r,n,s;t<e;)r=this.reader.readInt(2),n=this.reader.readInt(4),s=this.reader.readString(n),this.zip64ExtensibleData[r]={id:r,length:n,value:s}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(Ri.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readString(4)===Ri.CENTRAL_FILE_HEADER;)e=new DR({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(Ri.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,Ri.LOCAL_FILE_HEADER);throw t?new Error("Can't find end of central directory : is this a zip file ?"):new Error("Corrupted zip : can't find end of central directory")}this.reader.setIndex(e);var r=e;if(this.checkSignature(Ri.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===Hn.MAX_VALUE_16BITS||this.diskWithCentralDirStart===Hn.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===Hn.MAX_VALUE_16BITS||this.centralDirRecords===Hn.MAX_VALUE_16BITS||this.centralDirSize===Hn.MAX_VALUE_32BITS||this.centralDirOffset===Hn.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(Ri.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(Ri.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,Ri.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(Ri.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip : can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(Ri.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var s=r-n;if(s>0)this.isSignature(r,Ri.CENTRAL_FILE_HEADER)||(this.reader.zero=s);else if(s<0)throw new Error("Corrupted zip: missing "+Math.abs(s)+" bytes.")},prepareReader:function(e){var t=Hn.getTypeOf(e);if(Hn.checkSupport(t),t==="string"&&!hp.uint8array)this.reader=new CR(e,this.loadOptions.optimizedBinaryString);else if(t==="nodebuffer")this.reader=new SR(e);else if(hp.uint8array)this.reader=new TR(Hn.transformTo("uint8array",e));else if(hp.array)this.reader=new kR(Hn.transformTo("array",e));else throw new Error("Unexpected error: unsupported type '"+t+"'")},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};var PR=UA,RR=Bf,IR=Zg,NR=Ci,MR=PR,LR=function(i,e){var t,r;e=NR.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:IR.utf8decode}),e.base64&&(i=RR.decode(i));var n=new MR(i,e),s=n.files;for(t=0;t<s.length;t++)r=s[t],this.file(r.fileNameStr,r.decompressed,{binary:!0,optimizedBinaryString:!0,date:r.date,dir:r.dir,comment:r.fileCommentStr.length?r.fileCommentStr:null,unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions,createFolders:e.createFolders});return n.zipComment.length&&(this.comment=n.zipComment),this},zn={},Ln=Ci;zn.string2binary=function(i){return Ln.string2binary(i)};zn.string2Uint8Array=function(i){return Ln.transformTo("uint8array",i)};zn.uint8Array2String=function(i){return Ln.transformTo("string",i)};zn.string2Blob=function(i){var e=Ln.transformTo("arraybuffer",i);return Ln.arrayBuffer2Blob(e)};zn.arrayBuffer2Blob=function(i){return Ln.arrayBuffer2Blob(i)};zn.transformTo=function(i,e){return Ln.transformTo(i,e)};zn.getTypeOf=function(i){return Ln.getTypeOf(i)};zn.checkSupport=function(i){return Ln.checkSupport(i)};zn.MAX_VALUE_16BITS=Ln.MAX_VALUE_16BITS;zn.MAX_VALUE_32BITS=Ln.MAX_VALUE_32BITS;zn.pretty=function(i){return Ln.pretty(i)};zn.findCompression=function(i){return Ln.findCompression(i)};zn.isRegExp=function(i){return Ln.isRegExp(i)};(function(i){var e=Bf;function t(r,n){if(!(this instanceof t))return new t(r,n);this.files={},this.comment=null,this.root="",r&&this.load(r,n),this.clone=function(){var s=this,a=new t;return Object.keys(this.files).forEach(function(o){a.file(o,s.files[o].asUint8Array())}),a},this.shallowClone=function(){var s=new t;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}t.prototype=MA,t.prototype.load=LR,t.support=pn,t.defaults=Si,t.utils=zn,t.base64={encode:function(n){return e.encode(n)},decode:function(n){return e.decode(n)}},t.compressions=zf,i.exports=t,i.exports.default=t})(AA);var OR=AA.exports;const _2=_g(OR);function dp(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var HA={exports:{}};/*!
|
|
60
|
+
|
|
61
|
+
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
62
|
+
<http://stuartk.com/jszip>
|
|
63
|
+
|
|
64
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
65
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
66
|
+
|
|
67
|
+
JSZip uses the library pako released under the MIT license :
|
|
68
|
+
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
69
|
+
*/(function(i,e){(function(t){i.exports=t()})(function(){return function t(r,n,s){function a(c,h){if(!n[c]){if(!r[c]){var d=typeof dp=="function"&&dp;if(!h&&d)return d(c,!0);if(o)return o(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var g=n[c]={exports:{}};r[c][0].call(g.exports,function(y){var b=r[c][1][y];return a(b||y)},g,g.exports,t,r,n,s)}return n[c].exports}for(var o=typeof dp=="function"&&dp,l=0;l<s.length;l++)a(s[l]);return a}({1:[function(t,r,n){var s=t("./utils"),a=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(l){for(var c,h,d,p,g,y,b,w=[],v=0,A=l.length,E=A,_=s.getTypeOf(l)!=="string";v<l.length;)E=A-v,d=_?(c=l[v++],h=v<A?l[v++]:0,v<A?l[v++]:0):(c=l.charCodeAt(v++),h=v<A?l.charCodeAt(v++):0,v<A?l.charCodeAt(v++):0),p=c>>2,g=(3&c)<<4|h>>4,y=1<E?(15&h)<<2|d>>6:64,b=2<E?63&d:64,w.push(o.charAt(p)+o.charAt(g)+o.charAt(y)+o.charAt(b));return w.join("")},n.decode=function(l){var c,h,d,p,g,y,b=0,w=0,v="data:";if(l.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var A,E=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===o.charAt(64)&&E--,l.charAt(l.length-2)===o.charAt(64)&&E--,E%1!=0)throw new Error("Invalid base64 input, bad content length.");for(A=a.uint8array?new Uint8Array(0|E):new Array(0|E);b<l.length;)c=o.indexOf(l.charAt(b++))<<2|(p=o.indexOf(l.charAt(b++)))>>4,h=(15&p)<<4|(g=o.indexOf(l.charAt(b++)))>>2,d=(3&g)<<6|(y=o.indexOf(l.charAt(b++))),A[w++]=c,g!==64&&(A[w++]=h),y!==64&&(A[w++]=d);return A}},{"./support":30,"./utils":32}],2:[function(t,r,n){var s=t("./external"),a=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(h,d,p,g,y){this.compressedSize=h,this.uncompressedSize=d,this.crc32=p,this.compression=g,this.compressedContent=y}c.prototype={getContentWorker:function(){var h=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return h.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(h,d,p){return h.pipe(new o).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,n){var s=t("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},n.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,n){var s=t("./utils"),a=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();r.exports=function(o,l){return o!==void 0&&o.length?s.getTypeOf(o)!=="string"?function(c,h,d,p){var g=a,y=p+d;c^=-1;for(var b=p;b<y;b++)c=c>>>8^g[255&(c^h[b])];return-1^c}(0|l,o,o.length,0):function(c,h,d,p){var g=a,y=p+d;c^=-1;for(var b=p;b<y;b++)c=c>>>8^g[255&(c^h.charCodeAt(b))];return-1^c}(0|l,o,o.length,0):0}},{"./utils":32}],5:[function(t,r,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(t,r,n){var s=null;s=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:s}},{lie:37}],7:[function(t,r,n){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),o=t("./utils"),l=t("./stream/GenericWorker"),c=s?"uint8array":"array";function h(d,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,this.meta={}}n.magic="\b\0",o.inherits(h,l),h.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(c,d.data),!1)},h.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(p){d.push({data:p,meta:d.meta})}},n.compressWorker=function(d){return new h("Deflate",d)},n.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,n){function s(g,y){var b,w="";for(b=0;b<y;b++)w+=String.fromCharCode(255&g),g>>>=8;return w}function a(g,y,b,w,v,A){var E,_,C=g.file,I=g.compression,k=A!==c.utf8encode,D=o.transformTo("string",A(C.name)),R=o.transformTo("string",c.utf8encode(C.name)),z=C.comment,G=o.transformTo("string",A(z)),O=o.transformTo("string",c.utf8encode(z)),X=R.length!==C.name.length,S=O.length!==z.length,J="",Y="",W="",fe=C.dir,K=C.date,be={crc32:0,compressedSize:0,uncompressedSize:0};y&&!b||(be.crc32=g.crc32,be.compressedSize=g.compressedSize,be.uncompressedSize=g.uncompressedSize);var te=0;y&&(te|=8),k||!X&&!S||(te|=2048);var j=0,ie=0;fe&&(j|=16),v==="UNIX"?(ie=798,j|=function(H,se){var le=H;return H||(le=se?16893:33204),(65535&le)<<16}(C.unixPermissions,fe)):(ie=20,j|=function(H){return 63&(H||0)}(C.dosPermissions)),E=K.getUTCHours(),E<<=6,E|=K.getUTCMinutes(),E<<=5,E|=K.getUTCSeconds()/2,_=K.getUTCFullYear()-1980,_<<=4,_|=K.getUTCMonth()+1,_<<=5,_|=K.getUTCDate(),X&&(Y=s(1,1)+s(h(D),4)+R,J+="up"+s(Y.length,2)+Y),S&&(W=s(1,1)+s(h(G),4)+O,J+="uc"+s(W.length,2)+W);var ae="";return ae+=`
|
|
70
|
+
\0`,ae+=s(te,2),ae+=I.magic,ae+=s(E,2),ae+=s(_,2),ae+=s(be.crc32,4),ae+=s(be.compressedSize,4),ae+=s(be.uncompressedSize,4),ae+=s(D.length,2),ae+=s(J.length,2),{fileRecord:d.LOCAL_FILE_HEADER+ae+D+J,dirRecord:d.CENTRAL_FILE_HEADER+s(ie,2)+ae+s(G.length,2)+"\0\0\0\0"+s(j,4)+s(w,4)+D+J+G}}var o=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),h=t("../crc32"),d=t("../signature");function p(g,y,b,w){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=b,this.encodeFileName=w,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(p,l),p.prototype.push=function(g){var y=g.meta.percent||0,b=this.entriesCount,w=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:b?(y+100*(b-w-1))/b:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var y=this.streamFiles&&!g.file.dir;if(y){var b=a(g,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:b.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var y=this.streamFiles&&!g.file.dir,b=a(g,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(b.dirRecord),y)this.push({data:function(w){return d.DATA_DESCRIPTOR+s(w.crc32,4)+s(w.compressedSize,4)+s(w.uncompressedSize,4)}(g),meta:{percent:100}});else for(this.push({data:b.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var b=this.bytesWritten-g,w=function(v,A,E,_,C){var I=o.transformTo("string",C(_));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(v,2)+s(v,2)+s(A,4)+s(E,4)+s(I.length,2)+I}(this.dirRecords.length,b,g,this.zipComment,this.encodeFileName);this.push({data:w,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var y=this;return g.on("data",function(b){y.processChunk(b)}),g.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),g.on("error",function(b){y.error(b)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var y=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var b=0;b<y.length;b++)try{y[b].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,y=0;y<g.length;y++)g[y].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,r,n){var s=t("../compressions"),a=t("./ZipFileWorker");n.generateWorker=function(o,l,c){var h=new a(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{o.forEach(function(p,g){d++;var y=function(A,E){var _=A||E,C=s[_];if(!C)throw new Error(_+" is not a valid compression method !");return C}(g.options.compression,l.compression),b=g.options.compressionOptions||l.compressionOptions||{},w=g.dir,v=g.date;g._compressWorker(y,b).withStreamInfo("file",{name:p,dir:w,date:v,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(h)}),h.entriesCount=d}catch(p){h.error(p)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,r,n){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new s;for(var o in this)typeof this[o]!="function"&&(a[o]=this[o]);return a}}(s.prototype=t("./object")).loadAsync=t("./load"),s.support=t("./support"),s.defaults=t("./defaults"),s.version="3.10.1",s.loadAsync=function(a,o){return new s().loadAsync(a,o)},s.external=t("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,r,n){var s=t("./utils"),a=t("./external"),o=t("./utf8"),l=t("./zipEntries"),c=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function d(p){return new a.Promise(function(g,y){var b=p.decompressed.getContentWorker().pipe(new c);b.on("error",function(w){y(w)}).on("end",function(){b.streamInfo.crc32!==p.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var y=this;return g=s.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),h.isNode&&h.isStream(p)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(b){var w=new l(g);return w.load(b),w}).then(function(b){var w=[a.Promise.resolve(b)],v=b.files;if(g.checkCRC32)for(var A=0;A<v.length;A++)w.push(d(v[A]));return a.Promise.all(w)}).then(function(b){for(var w=b.shift(),v=w.files,A=0;A<v.length;A++){var E=v[A],_=E.fileNameStr,C=s.resolve(E.fileNameStr);y.file(C,E.decompressed,{binary:!0,optimizedBinaryString:!0,date:E.date,dir:E.dir,comment:E.fileCommentStr.length?E.fileCommentStr:null,unixPermissions:E.unixPermissions,dosPermissions:E.dosPermissions,createFolders:g.createFolders}),E.dir||(y.file(C).unsafeOriginalName=_)}return w.zipComment.length&&(y.comment=w.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,r,n){var s=t("../utils"),a=t("../stream/GenericWorker");function o(l,c){a.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}s.inherits(o,a),o.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(h){c.push({data:h,meta:{percent:0}})}).on("error",function(h){c.isPaused?this.generatedError=h:c.error(h)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},o.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,r,n){var s=t("readable-stream").Readable;function a(o,l,c){s.call(this,l),this._helper=o;var h=this;o.on("data",function(d,p){h.push(d)||h._helper.pause(),c&&c(p)}).on("error",function(d){h.emit("error",d)}).on("end",function(){h.push(null)})}t("../utils").inherits(a,s),a.prototype._read=function(){this._helper.resume()},r.exports=a},{"../utils":32,"readable-stream":16}],14:[function(t,r,n){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,a);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,a)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var a=new Buffer(s);return a.fill(0),a},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(t,r,n){function s(C,I,k){var D,R=o.getTypeOf(I),z=o.extend(k||{},h);z.date=z.date||new Date,z.compression!==null&&(z.compression=z.compression.toUpperCase()),typeof z.unixPermissions=="string"&&(z.unixPermissions=parseInt(z.unixPermissions,8)),z.unixPermissions&&16384&z.unixPermissions&&(z.dir=!0),z.dosPermissions&&16&z.dosPermissions&&(z.dir=!0),z.dir&&(C=v(C)),z.createFolders&&(D=w(C))&&A.call(this,D,!0);var G=R==="string"&&z.binary===!1&&z.base64===!1;k&&k.binary!==void 0||(z.binary=!G),(I instanceof d&&I.uncompressedSize===0||z.dir||!I||I.length===0)&&(z.base64=!1,z.binary=!0,I="",z.compression="STORE",R="string");var O=null;O=I instanceof d||I instanceof l?I:y.isNode&&y.isStream(I)?new b(C,I):o.prepareContent(C,I,z.binary,z.optimizedBinaryString,z.base64);var X=new p(C,O,z);this.files[C]=X}var a=t("./utf8"),o=t("./utils"),l=t("./stream/GenericWorker"),c=t("./stream/StreamHelper"),h=t("./defaults"),d=t("./compressedObject"),p=t("./zipObject"),g=t("./generate"),y=t("./nodejsUtils"),b=t("./nodejs/NodejsStreamInputAdapter"),w=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var I=C.lastIndexOf("/");return 0<I?C.substring(0,I):""},v=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},A=function(C,I){return I=I!==void 0?I:h.createFolders,C=v(C),this.files[C]||s.call(this,C,null,{dir:!0,createFolders:I}),this.files[C]};function E(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var I,k,D;for(I in this.files)D=this.files[I],(k=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&C(k,D)},filter:function(C){var I=[];return this.forEach(function(k,D){C(k,D)&&I.push(D)}),I},file:function(C,I,k){if(arguments.length!==1)return C=this.root+C,s.call(this,C,I,k),this;if(E(C)){var D=C;return this.filter(function(z,G){return!G.dir&&D.test(z)})}var R=this.files[this.root+C];return R&&!R.dir?R:null},folder:function(C){if(!C)return this;if(E(C))return this.filter(function(R,z){return z.dir&&C.test(R)});var I=this.root+C,k=A.call(this,I),D=this.clone();return D.root=k.name,D},remove:function(C){C=this.root+C;var I=this.files[C];if(I||(C.slice(-1)!=="/"&&(C+="/"),I=this.files[C]),I&&!I.dir)delete this.files[C];else for(var k=this.filter(function(R,z){return z.name.slice(0,C.length)===C}),D=0;D<k.length;D++)delete this.files[k[D].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var I,k={};try{if((k=o.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=k.type.toLowerCase(),k.compression=k.compression.toUpperCase(),k.type==="binarystring"&&(k.type="string"),!k.type)throw new Error("No output type specified.");o.checkSupport(k.type),k.platform!=="darwin"&&k.platform!=="freebsd"&&k.platform!=="linux"&&k.platform!=="sunos"||(k.platform="UNIX"),k.platform==="win32"&&(k.platform="DOS");var D=k.comment||this.comment||"";I=g.generateWorker(this,k,D)}catch(R){(I=new l("error")).error(R)}return new c(I,k.type||"string",k.mimeType)},generateAsync:function(C,I){return this.generateInternalStream(C).accumulate(I)},generateNodeStream:function(C,I){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(I)}};r.exports=_},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,r,n){r.exports=t("stream")},{stream:void 0}],17:[function(t,r,n){var s=t("./DataReader");function a(o){s.call(this,o);for(var l=0;l<this.data.length;l++)o[l]=255&o[l]}t("../utils").inherits(a,s),a.prototype.byteAt=function(o){return this.data[this.zero+o]},a.prototype.lastIndexOfSignature=function(o){for(var l=o.charCodeAt(0),c=o.charCodeAt(1),h=o.charCodeAt(2),d=o.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===c&&this.data[p+2]===h&&this.data[p+3]===d)return p-this.zero;return-1},a.prototype.readAndCheckSignature=function(o){var l=o.charCodeAt(0),c=o.charCodeAt(1),h=o.charCodeAt(2),d=o.charCodeAt(3),p=this.readData(4);return l===p[0]&&c===p[1]&&h===p[2]&&d===p[3]},a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./DataReader":18}],18:[function(t,r,n){var s=t("../utils");function a(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var l,c=0;for(this.checkOffset(o),l=this.index+o-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=o,c},readString:function(o){return s.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=a},{"../utils":32}],19:[function(t,r,n){var s=t("./Uint8ArrayReader");function a(o){s.call(this,o)}t("../utils").inherits(a,s),a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,n){var s=t("./DataReader");function a(o){s.call(this,o)}t("../utils").inherits(a,s),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,r,n){var s=t("./ArrayReader");function a(o){s.call(this,o)}t("../utils").inherits(a,s),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,n){var s=t("../utils"),a=t("../support"),o=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");r.exports=function(d){var p=s.getTypeOf(d);return s.checkSupport(p),p!=="string"||a.uint8array?p==="nodebuffer"?new c(d):a.uint8array?new h(s.transformTo("uint8array",d)):new o(s.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,r,n){var s=t("./GenericWorker"),a=t("../utils");function o(l){s.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(o,s),o.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,n){var s=t("./GenericWorker"),a=t("../crc32");function o(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,s),o.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,n){var s=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(o,a),o.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}a.prototype.processChunk.call(this,l)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,n){var s=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(h){c.dataIsReady=!0,c.data=h,c.max=h&&h.length||0,c.type=s.getTypeOf(h),c.isPaused||c._tickAndRepeat()},function(h){c.error(h)})}s.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,n){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var l=0;l<this._listeners[a].length;l++)this._listeners[a][l].call(this,o)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var o=this;return a.on("data",function(l){o.processChunk(l)}),a.on("end",function(){o.end()}),a.on("error",function(l){o.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,o){return this.extraStreamInfo[a]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},r.exports=s},{}],29:[function(t,r,n){var s=t("../utils"),a=t("./ConvertWorker"),o=t("./GenericWorker"),l=t("../base64"),c=t("../support"),h=t("../external"),d=null;if(c.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(y,b){return new h.Promise(function(w,v){var A=[],E=y._internalType,_=y._outputType,C=y._mimeType;y.on("data",function(I,k){A.push(I),b&&b(k)}).on("error",function(I){A=[],v(I)}).on("end",function(){try{var I=function(k,D,R){switch(k){case"blob":return s.newBlob(s.transformTo("arraybuffer",D),R);case"base64":return l.encode(D);default:return s.transformTo(k,D)}}(_,function(k,D){var R,z=0,G=null,O=0;for(R=0;R<D.length;R++)O+=D[R].length;switch(k){case"string":return D.join("");case"array":return Array.prototype.concat.apply([],D);case"uint8array":for(G=new Uint8Array(O),R=0;R<D.length;R++)G.set(D[R],z),z+=D[R].length;return G;case"nodebuffer":return Buffer.concat(D);default:throw new Error("concat : unsupported type '"+k+"'")}}(E,A),C);w(I)}catch(k){v(k)}A=[]}).resume()})}function g(y,b,w){var v=b;switch(b){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=b,this._mimeType=w,s.checkSupport(v),this._worker=y.pipe(new a(v)),y.lock()}catch(A){this._worker=new o("error"),this._worker.error(A)}}g.prototype={accumulate:function(y){return p(this,y)},on:function(y,b){var w=this;return y==="data"?this._worker.on(y,function(v){b.call(w,v.data,v.meta)}):this._worker.on(y,function(){s.delay(b,arguments,w)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},y)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,r,n){if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",n.nodebuffer=typeof Buffer<"u",n.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")n.blob=!1;else{var s=new ArrayBuffer(0);try{n.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(s),n.blob=a.getBlob("application/zip").size===0}catch{n.blob=!1}}}try{n.nodestream=!!t("readable-stream").Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,n){for(var s=t("./utils"),a=t("./support"),o=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),h=0;h<256;h++)c[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}n.utf8encode=function(g){return a.nodebuffer?o.newBufferFrom(g,"utf-8"):function(y){var b,w,v,A,E,_=y.length,C=0;for(A=0;A<_;A++)(64512&(w=y.charCodeAt(A)))==55296&&A+1<_&&(64512&(v=y.charCodeAt(A+1)))==56320&&(w=65536+(w-55296<<10)+(v-56320),A++),C+=w<128?1:w<2048?2:w<65536?3:4;for(b=a.uint8array?new Uint8Array(C):new Array(C),A=E=0;E<C;A++)(64512&(w=y.charCodeAt(A)))==55296&&A+1<_&&(64512&(v=y.charCodeAt(A+1)))==56320&&(w=65536+(w-55296<<10)+(v-56320),A++),w<128?b[E++]=w:(w<2048?b[E++]=192|w>>>6:(w<65536?b[E++]=224|w>>>12:(b[E++]=240|w>>>18,b[E++]=128|w>>>12&63),b[E++]=128|w>>>6&63),b[E++]=128|63&w);return b}(g)},n.utf8decode=function(g){return a.nodebuffer?s.transformTo("nodebuffer",g).toString("utf-8"):function(y){var b,w,v,A,E=y.length,_=new Array(2*E);for(b=w=0;b<E;)if((v=y[b++])<128)_[w++]=v;else if(4<(A=c[v]))_[w++]=65533,b+=A-1;else{for(v&=A===2?31:A===3?15:7;1<A&&b<E;)v=v<<6|63&y[b++],A--;1<A?_[w++]=65533:v<65536?_[w++]=v:(v-=65536,_[w++]=55296|v>>10&1023,_[w++]=56320|1023&v)}return _.length!==w&&(_.subarray?_=_.subarray(0,w):_.length=w),s.applyFromCharCode(_)}(g=s.transformTo(a.uint8array?"uint8array":"array",g))},s.inherits(d,l),d.prototype.processChunk=function(g){var y=s.transformTo(a.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var b=y;(y=new Uint8Array(b.length+this.leftOver.length)).set(this.leftOver,0),y.set(b,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var w=function(A,E){var _;for((E=E||A.length)>A.length&&(E=A.length),_=E-1;0<=_&&(192&A[_])==128;)_--;return _<0||_===0?E:_+c[A[_]]>E?_:E}(y),v=y;w!==y.length&&(a.uint8array?(v=y.subarray(0,w),this.leftOver=y.subarray(w,y.length)):(v=y.slice(0,w),this.leftOver=y.slice(w,y.length))),this.push({data:n.utf8decode(v),meta:g.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=d,s.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:n.utf8encode(g.data),meta:g.meta})},n.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,n){var s=t("./support"),a=t("./base64"),o=t("./nodejsUtils"),l=t("./external");function c(b){return b}function h(b,w){for(var v=0;v<b.length;++v)w[v]=255&b.charCodeAt(v);return w}t("setimmediate"),n.newBlob=function(b,w){n.checkSupport("blob");try{return new Blob([b],{type:w})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(b),v.getBlob(w)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(b,w,v){var A=[],E=0,_=b.length;if(_<=v)return String.fromCharCode.apply(null,b);for(;E<_;)w==="array"||w==="nodebuffer"?A.push(String.fromCharCode.apply(null,b.slice(E,Math.min(E+v,_)))):A.push(String.fromCharCode.apply(null,b.subarray(E,Math.min(E+v,_)))),E+=v;return A.join("")},stringifyByChar:function(b){for(var w="",v=0;v<b.length;v++)w+=String.fromCharCode(b[v]);return w},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}}()}};function p(b){var w=65536,v=n.getTypeOf(b),A=!0;if(v==="uint8array"?A=d.applyCanBeUsed.uint8array:v==="nodebuffer"&&(A=d.applyCanBeUsed.nodebuffer),A)for(;1<w;)try{return d.stringifyByChunk(b,v,w)}catch{w=Math.floor(w/2)}return d.stringifyByChar(b)}function g(b,w){for(var v=0;v<b.length;v++)w[v]=b[v];return w}n.applyFromCharCode=p;var y={};y.string={string:c,array:function(b){return h(b,new Array(b.length))},arraybuffer:function(b){return y.string.uint8array(b).buffer},uint8array:function(b){return h(b,new Uint8Array(b.length))},nodebuffer:function(b){return h(b,o.allocBuffer(b.length))}},y.array={string:p,array:c,arraybuffer:function(b){return new Uint8Array(b).buffer},uint8array:function(b){return new Uint8Array(b)},nodebuffer:function(b){return o.newBufferFrom(b)}},y.arraybuffer={string:function(b){return p(new Uint8Array(b))},array:function(b){return g(new Uint8Array(b),new Array(b.byteLength))},arraybuffer:c,uint8array:function(b){return new Uint8Array(b)},nodebuffer:function(b){return o.newBufferFrom(new Uint8Array(b))}},y.uint8array={string:p,array:function(b){return g(b,new Array(b.length))},arraybuffer:function(b){return b.buffer},uint8array:c,nodebuffer:function(b){return o.newBufferFrom(b)}},y.nodebuffer={string:p,array:function(b){return g(b,new Array(b.length))},arraybuffer:function(b){return y.nodebuffer.uint8array(b).buffer},uint8array:function(b){return g(b,new Uint8Array(b.length))},nodebuffer:c},n.transformTo=function(b,w){if(w=w||"",!b)return w;n.checkSupport(b);var v=n.getTypeOf(w);return y[v][b](w)},n.resolve=function(b){for(var w=b.split("/"),v=[],A=0;A<w.length;A++){var E=w[A];E==="."||E===""&&A!==0&&A!==w.length-1||(E===".."?v.pop():v.push(E))}return v.join("/")},n.getTypeOf=function(b){return typeof b=="string"?"string":Object.prototype.toString.call(b)==="[object Array]"?"array":s.nodebuffer&&o.isBuffer(b)?"nodebuffer":s.uint8array&&b instanceof Uint8Array?"uint8array":s.arraybuffer&&b instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(b){if(!s[b.toLowerCase()])throw new Error(b+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(b){var w,v,A="";for(v=0;v<(b||"").length;v++)A+="\\x"+((w=b.charCodeAt(v))<16?"0":"")+w.toString(16).toUpperCase();return A},n.delay=function(b,w,v){setImmediate(function(){b.apply(v||null,w||[])})},n.inherits=function(b,w){function v(){}v.prototype=w.prototype,b.prototype=new v},n.extend=function(){var b,w,v={};for(b=0;b<arguments.length;b++)for(w in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],w)&&v[w]===void 0&&(v[w]=arguments[b][w]);return v},n.prepareContent=function(b,w,v,A,E){return l.Promise.resolve(w).then(function(_){return s.blob&&(_ instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(_))!==-1)&&typeof FileReader<"u"?new l.Promise(function(C,I){var k=new FileReader;k.onload=function(D){C(D.target.result)},k.onerror=function(D){I(D.target.error)},k.readAsArrayBuffer(_)}):_}).then(function(_){var C=n.getTypeOf(_);return C?(C==="arraybuffer"?_=n.transformTo("uint8array",_):C==="string"&&(E?_=a.decode(_):v&&A!==!0&&(_=function(I){return h(I,s.uint8array?new Uint8Array(I.length):new Array(I.length))}(_))),_):l.Promise.reject(new Error("Can't read the data of '"+b+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,r,n){var s=t("./reader/readerFor"),a=t("./utils"),o=t("./signature"),l=t("./zipEntry"),c=t("./support");function h(d){this.files=[],this.loadOptions=d}h.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(p)+", expected "+a.pretty(d)+")")}},isSignature:function(d,p){var g=this.reader.index;this.reader.setIndex(d);var y=this.reader.readString(4)===p;return this.reader.setIndex(g),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),p=c.uint8array?"uint8array":"array",g=a.transformTo(p,d);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,p,g,y=this.zip64EndOfCentralSize-44;0<y;)d=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[d]={id:d,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,p;for(d=0;d<this.files.length;d++)p=this.files[d],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var p=d;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var y=p-g;if(0<y)this.isSignature(p,o.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(d){this.reader=s(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,r,n){var s=t("./reader/readerFor"),a=t("./utils"),o=t("./compressedObject"),l=t("./crc32"),c=t("./utf8"),h=t("./compressions"),d=t("./support");function p(g,y){this.options=g,this.loadOptions=y}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var y,b;if(g.skip(22),this.fileNameLength=g.readInt(2),b=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(b),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=function(w){for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)&&h[v].magic===w)return h[v];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,y,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var y=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(y),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var y,b,w,v=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<v;)y=g.readInt(2),b=g.readInt(2),w=g.readData(b),this.extraFields[y]={id:y,length:b,value:w};g.setIndex(v)},handleUTF8:function(){var g=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var b=a.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(b)}var w=this.findExtraFieldUnicodeComment();if(w!==null)this.fileCommentStr=w;else{var v=a.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var y=s(g.value);return y.readInt(1)!==1||l(this.fileName)!==y.readInt(4)?null:c.utf8decode(y.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var y=s(g.value);return y.readInt(1)!==1||l(this.fileComment)!==y.readInt(4)?null:c.utf8decode(y.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,r,n){function s(y,b,w){this.name=y,this.dir=w.dir,this.date=w.date,this.comment=w.comment,this.unixPermissions=w.unixPermissions,this.dosPermissions=w.dosPermissions,this._data=b,this._dataBinary=w.binary,this.options={compression:w.compression,compressionOptions:w.compressionOptions}}var a=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),l=t("./utf8"),c=t("./compressedObject"),h=t("./stream/GenericWorker");s.prototype={internalStream:function(y){var b=null,w="string";try{if(!y)throw new Error("No output type specified.");var v=(w=y.toLowerCase())==="string"||w==="text";w!=="binarystring"&&w!=="text"||(w="string"),b=this._decompressWorker();var A=!this._dataBinary;A&&!v&&(b=b.pipe(new l.Utf8EncodeWorker)),!A&&v&&(b=b.pipe(new l.Utf8DecodeWorker))}catch(E){(b=new h("error")).error(E)}return new a(b,w,"")},async:function(y,b){return this.internalStream(y).accumulate(b)},nodeStream:function(y,b){return this.internalStream(y||"nodebuffer").toNodejsStream(b)},_compressWorker:function(y,b){if(this._data instanceof c&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var w=this._decompressWorker();return this._dataBinary||(w=w.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(w,y,b)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof h?this._data:new o(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<d.length;g++)s.prototype[d[g]]=p;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,r,n){(function(s){var a,o,l=s.MutationObserver||s.WebKitMutationObserver;if(l){var c=0,h=new l(y),d=s.document.createTextNode("");h.observe(d,{characterData:!0}),a=function(){d.data=c=++c%2}}else if(s.setImmediate||s.MessageChannel===void 0)a="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var b=s.document.createElement("script");b.onreadystatechange=function(){y(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},s.document.documentElement.appendChild(b)}:function(){setTimeout(y,0)};else{var p=new s.MessageChannel;p.port1.onmessage=y,a=function(){p.port2.postMessage(0)}}var g=[];function y(){var b,w;o=!0;for(var v=g.length;v;){for(w=g,g=[],b=-1;++b<v;)w[b]();v=g.length}o=!1}r.exports=function(b){g.push(b)!==1||o||a()}}).call(this,typeof sh<"u"?sh:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,r,n){var s=t("immediate");function a(){}var o={},l=["REJECTED"],c=["FULFILLED"],h=["PENDING"];function d(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,v!==a&&b(this,v)}function p(v,A,E){this.promise=v,typeof A=="function"&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof E=="function"&&(this.onRejected=E,this.callRejected=this.otherCallRejected)}function g(v,A,E){s(function(){var _;try{_=A(E)}catch(C){return o.reject(v,C)}_===v?o.reject(v,new TypeError("Cannot resolve promise with itself")):o.resolve(v,_)})}function y(v){var A=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof A=="function")return function(){A.apply(v,arguments)}}function b(v,A){var E=!1;function _(k){E||(E=!0,o.reject(v,k))}function C(k){E||(E=!0,o.resolve(v,k))}var I=w(function(){A(C,_)});I.status==="error"&&_(I.value)}function w(v,A){var E={};try{E.value=v(A),E.status="success"}catch(_){E.status="error",E.value=_}return E}(r.exports=d).prototype.finally=function(v){if(typeof v!="function")return this;var A=this.constructor;return this.then(function(E){return A.resolve(v()).then(function(){return E})},function(E){return A.resolve(v()).then(function(){throw E})})},d.prototype.catch=function(v){return this.then(null,v)},d.prototype.then=function(v,A){if(typeof v!="function"&&this.state===c||typeof A!="function"&&this.state===l)return this;var E=new this.constructor(a);return this.state!==h?g(E,this.state===c?v:A,this.outcome):this.queue.push(new p(E,v,A)),E},p.prototype.callFulfilled=function(v){o.resolve(this.promise,v)},p.prototype.otherCallFulfilled=function(v){g(this.promise,this.onFulfilled,v)},p.prototype.callRejected=function(v){o.reject(this.promise,v)},p.prototype.otherCallRejected=function(v){g(this.promise,this.onRejected,v)},o.resolve=function(v,A){var E=w(y,A);if(E.status==="error")return o.reject(v,E.value);var _=E.value;if(_)b(v,_);else{v.state=c,v.outcome=A;for(var C=-1,I=v.queue.length;++C<I;)v.queue[C].callFulfilled(A)}return v},o.reject=function(v,A){v.state=l,v.outcome=A;for(var E=-1,_=v.queue.length;++E<_;)v.queue[E].callRejected(A);return v},d.resolve=function(v){return v instanceof this?v:o.resolve(new this(a),v)},d.reject=function(v){var A=new this(a);return o.reject(A,v)},d.all=function(v){var A=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=v.length,_=!1;if(!E)return this.resolve([]);for(var C=new Array(E),I=0,k=-1,D=new this(a);++k<E;)R(v[k],k);return D;function R(z,G){A.resolve(z).then(function(O){C[G]=O,++I!==E||_||(_=!0,o.resolve(D,C))},function(O){_||(_=!0,o.reject(D,O))})}},d.race=function(v){var A=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=v.length,_=!1;if(!E)return this.resolve([]);for(var C=-1,I=new this(a);++C<E;)k=v[C],A.resolve(k).then(function(D){_||(_=!0,o.resolve(I,D))},function(D){_||(_=!0,o.reject(I,D))});var k;return I}},{immediate:36}],38:[function(t,r,n){var s={};(0,t("./lib/utils/common").assign)(s,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,r,n){var s=t("./zlib/deflate"),a=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/messages"),c=t("./zlib/zstream"),h=Object.prototype.toString,d=0,p=-1,g=0,y=8;function b(v){if(!(this instanceof b))return new b(v);this.options=a.assign({level:p,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},v||{});var A=this.options;A.raw&&0<A.windowBits?A.windowBits=-A.windowBits:A.gzip&&0<A.windowBits&&A.windowBits<16&&(A.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var E=s.deflateInit2(this.strm,A.level,A.method,A.windowBits,A.memLevel,A.strategy);if(E!==d)throw new Error(l[E]);if(A.header&&s.deflateSetHeader(this.strm,A.header),A.dictionary){var _;if(_=typeof A.dictionary=="string"?o.string2buf(A.dictionary):h.call(A.dictionary)==="[object ArrayBuffer]"?new Uint8Array(A.dictionary):A.dictionary,(E=s.deflateSetDictionary(this.strm,_))!==d)throw new Error(l[E]);this._dict_set=!0}}function w(v,A){var E=new b(A);if(E.push(v,!0),E.err)throw E.msg||l[E.err];return E.result}b.prototype.push=function(v,A){var E,_,C=this.strm,I=this.options.chunkSize;if(this.ended)return!1;_=A===~~A?A:A===!0?4:0,typeof v=="string"?C.input=o.string2buf(v):h.call(v)==="[object ArrayBuffer]"?C.input=new Uint8Array(v):C.input=v,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new a.Buf8(I),C.next_out=0,C.avail_out=I),(E=s.deflate(C,_))!==1&&E!==d)return this.onEnd(E),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||_!==4&&_!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(a.shrinkBuf(C.output,C.next_out))):this.onData(a.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&E!==1);return _===4?(E=s.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===d):_!==2||(this.onEnd(d),!(C.avail_out=0))},b.prototype.onData=function(v){this.chunks.push(v)},b.prototype.onEnd=function(v){v===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},n.Deflate=b,n.deflate=w,n.deflateRaw=function(v,A){return(A=A||{}).raw=!0,w(v,A)},n.gzip=function(v,A){return(A=A||{}).gzip=!0,w(v,A)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,r,n){var s=t("./zlib/inflate"),a=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/constants"),c=t("./zlib/messages"),h=t("./zlib/zstream"),d=t("./zlib/gzheader"),p=Object.prototype.toString;function g(b){if(!(this instanceof g))return new g(b);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},b||{});var w=this.options;w.raw&&0<=w.windowBits&&w.windowBits<16&&(w.windowBits=-w.windowBits,w.windowBits===0&&(w.windowBits=-15)),!(0<=w.windowBits&&w.windowBits<16)||b&&b.windowBits||(w.windowBits+=32),15<w.windowBits&&w.windowBits<48&&!(15&w.windowBits)&&(w.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var v=s.inflateInit2(this.strm,w.windowBits);if(v!==l.Z_OK)throw new Error(c[v]);this.header=new d,s.inflateGetHeader(this.strm,this.header)}function y(b,w){var v=new g(w);if(v.push(b,!0),v.err)throw v.msg||c[v.err];return v.result}g.prototype.push=function(b,w){var v,A,E,_,C,I,k=this.strm,D=this.options.chunkSize,R=this.options.dictionary,z=!1;if(this.ended)return!1;A=w===~~w?w:w===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof b=="string"?k.input=o.binstring2buf(b):p.call(b)==="[object ArrayBuffer]"?k.input=new Uint8Array(b):k.input=b,k.next_in=0,k.avail_in=k.input.length;do{if(k.avail_out===0&&(k.output=new a.Buf8(D),k.next_out=0,k.avail_out=D),(v=s.inflate(k,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&R&&(I=typeof R=="string"?o.string2buf(R):p.call(R)==="[object ArrayBuffer]"?new Uint8Array(R):R,v=s.inflateSetDictionary(this.strm,I)),v===l.Z_BUF_ERROR&&z===!0&&(v=l.Z_OK,z=!1),v!==l.Z_STREAM_END&&v!==l.Z_OK)return this.onEnd(v),!(this.ended=!0);k.next_out&&(k.avail_out!==0&&v!==l.Z_STREAM_END&&(k.avail_in!==0||A!==l.Z_FINISH&&A!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(E=o.utf8border(k.output,k.next_out),_=k.next_out-E,C=o.buf2string(k.output,E),k.next_out=_,k.avail_out=D-_,_&&a.arraySet(k.output,k.output,E,_,0),this.onData(C)):this.onData(a.shrinkBuf(k.output,k.next_out)))),k.avail_in===0&&k.avail_out===0&&(z=!0)}while((0<k.avail_in||k.avail_out===0)&&v!==l.Z_STREAM_END);return v===l.Z_STREAM_END&&(A=l.Z_FINISH),A===l.Z_FINISH?(v=s.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===l.Z_OK):A!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(k.avail_out=0))},g.prototype.onData=function(b){this.chunks.push(b)},g.prototype.onEnd=function(b){b===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},n.Inflate=g,n.inflate=y,n.inflateRaw=function(b,w){return(w=w||{}).raw=!0,y(b,w)},n.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,r,n){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";n.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var h=c.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])}}return l},n.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var a={arraySet:function(l,c,h,d,p){if(c.subarray&&l.subarray)l.set(c.subarray(h,h+d),p);else for(var g=0;g<d;g++)l[p+g]=c[h+g]},flattenChunks:function(l){var c,h,d,p,g,y;for(c=d=0,h=l.length;c<h;c++)d+=l[c].length;for(y=new Uint8Array(d),c=p=0,h=l.length;c<h;c++)g=l[c],y.set(g,p),p+=g.length;return y}},o={arraySet:function(l,c,h,d,p){for(var g=0;g<d;g++)l[p+g]=c[h+g]},flattenChunks:function(l){return[].concat.apply([],l)}};n.setTyped=function(l){l?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,a)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(s)},{}],42:[function(t,r,n){var s=t("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var l=new s.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function h(d,p){if(p<65537&&(d.subarray&&o||!d.subarray&&a))return String.fromCharCode.apply(null,s.shrinkBuf(d,p));for(var g="",y=0;y<p;y++)g+=String.fromCharCode(d[y]);return g}l[254]=l[254]=1,n.string2buf=function(d){var p,g,y,b,w,v=d.length,A=0;for(b=0;b<v;b++)(64512&(g=d.charCodeAt(b)))==55296&&b+1<v&&(64512&(y=d.charCodeAt(b+1)))==56320&&(g=65536+(g-55296<<10)+(y-56320),b++),A+=g<128?1:g<2048?2:g<65536?3:4;for(p=new s.Buf8(A),b=w=0;w<A;b++)(64512&(g=d.charCodeAt(b)))==55296&&b+1<v&&(64512&(y=d.charCodeAt(b+1)))==56320&&(g=65536+(g-55296<<10)+(y-56320),b++),g<128?p[w++]=g:(g<2048?p[w++]=192|g>>>6:(g<65536?p[w++]=224|g>>>12:(p[w++]=240|g>>>18,p[w++]=128|g>>>12&63),p[w++]=128|g>>>6&63),p[w++]=128|63&g);return p},n.buf2binstring=function(d){return h(d,d.length)},n.binstring2buf=function(d){for(var p=new s.Buf8(d.length),g=0,y=p.length;g<y;g++)p[g]=d.charCodeAt(g);return p},n.buf2string=function(d,p){var g,y,b,w,v=p||d.length,A=new Array(2*v);for(g=y=0;g<v;)if((b=d[g++])<128)A[y++]=b;else if(4<(w=l[b]))A[y++]=65533,g+=w-1;else{for(b&=w===2?31:w===3?15:7;1<w&&g<v;)b=b<<6|63&d[g++],w--;1<w?A[y++]=65533:b<65536?A[y++]=b:(b-=65536,A[y++]=55296|b>>10&1023,A[y++]=56320|1023&b)}return h(A,y)},n.utf8border=function(d,p){var g;for((p=p||d.length)>d.length&&(p=d.length),g=p-1;0<=g&&(192&d[g])==128;)g--;return g<0||g===0?p:g+l[d[g]]>p?g:p}},{"./common":41}],43:[function(t,r,n){r.exports=function(s,a,o,l){for(var c=65535&s|0,h=s>>>16&65535|0,d=0;o!==0;){for(o-=d=2e3<o?2e3:o;h=h+(c=c+a[l++]|0)|0,--d;);c%=65521,h%=65521}return c|h<<16|0}},{}],44:[function(t,r,n){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,r,n){var s=function(){for(var a,o=[],l=0;l<256;l++){a=l;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;o[l]=a}return o}();r.exports=function(a,o,l,c){var h=s,d=c+l;a^=-1;for(var p=c;p<d;p++)a=a>>>8^h[255&(a^o[p])];return-1^a}},{}],46:[function(t,r,n){var s,a=t("../utils/common"),o=t("./trees"),l=t("./adler32"),c=t("./crc32"),h=t("./messages"),d=0,p=4,g=0,y=-2,b=-1,w=4,v=2,A=8,E=9,_=286,C=30,I=19,k=2*_+1,D=15,R=3,z=258,G=z+R+1,O=42,X=113,S=1,J=2,Y=3,W=4;function fe(x,U){return x.msg=h[U],U}function K(x){return(x<<1)-(4<x?9:0)}function be(x){for(var U=x.length;0<=--U;)x[U]=0}function te(x){var U=x.state,B=U.pending;B>x.avail_out&&(B=x.avail_out),B!==0&&(a.arraySet(x.output,U.pending_buf,U.pending_out,B,x.next_out),x.next_out+=B,U.pending_out+=B,x.total_out+=B,x.avail_out-=B,U.pending-=B,U.pending===0&&(U.pending_out=0))}function j(x,U){o._tr_flush_block(x,0<=x.block_start?x.block_start:-1,x.strstart-x.block_start,U),x.block_start=x.strstart,te(x.strm)}function ie(x,U){x.pending_buf[x.pending++]=U}function ae(x,U){x.pending_buf[x.pending++]=U>>>8&255,x.pending_buf[x.pending++]=255&U}function H(x,U){var B,F,M=x.max_chain_length,q=x.strstart,de=x.prev_length,we=x.nice_match,ee=x.strstart>x.w_size-G?x.strstart-(x.w_size-G):0,Ee=x.window,De=x.w_mask,Ce=x.prev,Me=x.strstart+z,$e=Ee[q+de-1],Xe=Ee[q+de];x.prev_length>=x.good_match&&(M>>=2),we>x.lookahead&&(we=x.lookahead);do if(Ee[(B=U)+de]===Xe&&Ee[B+de-1]===$e&&Ee[B]===Ee[q]&&Ee[++B]===Ee[q+1]){q+=2,B++;do;while(Ee[++q]===Ee[++B]&&Ee[++q]===Ee[++B]&&Ee[++q]===Ee[++B]&&Ee[++q]===Ee[++B]&&Ee[++q]===Ee[++B]&&Ee[++q]===Ee[++B]&&Ee[++q]===Ee[++B]&&Ee[++q]===Ee[++B]&&q<Me);if(F=z-(Me-q),q=Me-z,de<F){if(x.match_start=U,we<=(de=F))break;$e=Ee[q+de-1],Xe=Ee[q+de]}}while((U=Ce[U&De])>ee&&--M!=0);return de<=x.lookahead?de:x.lookahead}function se(x){var U,B,F,M,q,de,we,ee,Ee,De,Ce=x.w_size;do{if(M=x.window_size-x.lookahead-x.strstart,x.strstart>=Ce+(Ce-G)){for(a.arraySet(x.window,x.window,Ce,Ce,0),x.match_start-=Ce,x.strstart-=Ce,x.block_start-=Ce,U=B=x.hash_size;F=x.head[--U],x.head[U]=Ce<=F?F-Ce:0,--B;);for(U=B=Ce;F=x.prev[--U],x.prev[U]=Ce<=F?F-Ce:0,--B;);M+=Ce}if(x.strm.avail_in===0)break;if(de=x.strm,we=x.window,ee=x.strstart+x.lookahead,Ee=M,De=void 0,De=de.avail_in,Ee<De&&(De=Ee),B=De===0?0:(de.avail_in-=De,a.arraySet(we,de.input,de.next_in,De,ee),de.state.wrap===1?de.adler=l(de.adler,we,De,ee):de.state.wrap===2&&(de.adler=c(de.adler,we,De,ee)),de.next_in+=De,de.total_in+=De,De),x.lookahead+=B,x.lookahead+x.insert>=R)for(q=x.strstart-x.insert,x.ins_h=x.window[q],x.ins_h=(x.ins_h<<x.hash_shift^x.window[q+1])&x.hash_mask;x.insert&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[q+R-1])&x.hash_mask,x.prev[q&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=q,q++,x.insert--,!(x.lookahead+x.insert<R)););}while(x.lookahead<G&&x.strm.avail_in!==0)}function le(x,U){for(var B,F;;){if(x.lookahead<G){if(se(x),x.lookahead<G&&U===d)return S;if(x.lookahead===0)break}if(B=0,x.lookahead>=R&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+R-1])&x.hash_mask,B=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),B!==0&&x.strstart-B<=x.w_size-G&&(x.match_length=H(x,B)),x.match_length>=R)if(F=o._tr_tally(x,x.strstart-x.match_start,x.match_length-R),x.lookahead-=x.match_length,x.match_length<=x.max_lazy_match&&x.lookahead>=R){for(x.match_length--;x.strstart++,x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+R-1])&x.hash_mask,B=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart,--x.match_length!=0;);x.strstart++}else x.strstart+=x.match_length,x.match_length=0,x.ins_h=x.window[x.strstart],x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+1])&x.hash_mask;else F=o._tr_tally(x,0,x.window[x.strstart]),x.lookahead--,x.strstart++;if(F&&(j(x,!1),x.strm.avail_out===0))return S}return x.insert=x.strstart<R-1?x.strstart:R-1,U===p?(j(x,!0),x.strm.avail_out===0?Y:W):x.last_lit&&(j(x,!1),x.strm.avail_out===0)?S:J}function oe(x,U){for(var B,F,M;;){if(x.lookahead<G){if(se(x),x.lookahead<G&&U===d)return S;if(x.lookahead===0)break}if(B=0,x.lookahead>=R&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+R-1])&x.hash_mask,B=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),x.prev_length=x.match_length,x.prev_match=x.match_start,x.match_length=R-1,B!==0&&x.prev_length<x.max_lazy_match&&x.strstart-B<=x.w_size-G&&(x.match_length=H(x,B),x.match_length<=5&&(x.strategy===1||x.match_length===R&&4096<x.strstart-x.match_start)&&(x.match_length=R-1)),x.prev_length>=R&&x.match_length<=x.prev_length){for(M=x.strstart+x.lookahead-R,F=o._tr_tally(x,x.strstart-1-x.prev_match,x.prev_length-R),x.lookahead-=x.prev_length-1,x.prev_length-=2;++x.strstart<=M&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+R-1])&x.hash_mask,B=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),--x.prev_length!=0;);if(x.match_available=0,x.match_length=R-1,x.strstart++,F&&(j(x,!1),x.strm.avail_out===0))return S}else if(x.match_available){if((F=o._tr_tally(x,0,x.window[x.strstart-1]))&&j(x,!1),x.strstart++,x.lookahead--,x.strm.avail_out===0)return S}else x.match_available=1,x.strstart++,x.lookahead--}return x.match_available&&(F=o._tr_tally(x,0,x.window[x.strstart-1]),x.match_available=0),x.insert=x.strstart<R-1?x.strstart:R-1,U===p?(j(x,!0),x.strm.avail_out===0?Y:W):x.last_lit&&(j(x,!1),x.strm.avail_out===0)?S:J}function ce(x,U,B,F,M){this.good_length=x,this.max_lazy=U,this.nice_length=B,this.max_chain=F,this.func=M}function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=A,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*k),this.dyn_dtree=new a.Buf16(2*(2*C+1)),this.bl_tree=new a.Buf16(2*(2*I+1)),be(this.dyn_ltree),be(this.dyn_dtree),be(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(D+1),this.heap=new a.Buf16(2*_+1),be(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*_+1),be(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Se(x){var U;return x&&x.state?(x.total_in=x.total_out=0,x.data_type=v,(U=x.state).pending=0,U.pending_out=0,U.wrap<0&&(U.wrap=-U.wrap),U.status=U.wrap?O:X,x.adler=U.wrap===2?0:1,U.last_flush=d,o._tr_init(U),g):fe(x,y)}function Ne(x){var U=Se(x);return U===g&&function(B){B.window_size=2*B.w_size,be(B.head),B.max_lazy_match=s[B.level].max_lazy,B.good_match=s[B.level].good_length,B.nice_match=s[B.level].nice_length,B.max_chain_length=s[B.level].max_chain,B.strstart=0,B.block_start=0,B.lookahead=0,B.insert=0,B.match_length=B.prev_length=R-1,B.match_available=0,B.ins_h=0}(x.state),U}function Te(x,U,B,F,M,q){if(!x)return y;var de=1;if(U===b&&(U=6),F<0?(de=0,F=-F):15<F&&(de=2,F-=16),M<1||E<M||B!==A||F<8||15<F||U<0||9<U||q<0||w<q)return fe(x,y);F===8&&(F=9);var we=new Ae;return(x.state=we).strm=x,we.wrap=de,we.gzhead=null,we.w_bits=F,we.w_size=1<<we.w_bits,we.w_mask=we.w_size-1,we.hash_bits=M+7,we.hash_size=1<<we.hash_bits,we.hash_mask=we.hash_size-1,we.hash_shift=~~((we.hash_bits+R-1)/R),we.window=new a.Buf8(2*we.w_size),we.head=new a.Buf16(we.hash_size),we.prev=new a.Buf16(we.w_size),we.lit_bufsize=1<<M+6,we.pending_buf_size=4*we.lit_bufsize,we.pending_buf=new a.Buf8(we.pending_buf_size),we.d_buf=1*we.lit_bufsize,we.l_buf=3*we.lit_bufsize,we.level=U,we.strategy=q,we.method=B,Ne(x)}s=[new ce(0,0,0,0,function(x,U){var B=65535;for(B>x.pending_buf_size-5&&(B=x.pending_buf_size-5);;){if(x.lookahead<=1){if(se(x),x.lookahead===0&&U===d)return S;if(x.lookahead===0)break}x.strstart+=x.lookahead,x.lookahead=0;var F=x.block_start+B;if((x.strstart===0||x.strstart>=F)&&(x.lookahead=x.strstart-F,x.strstart=F,j(x,!1),x.strm.avail_out===0)||x.strstart-x.block_start>=x.w_size-G&&(j(x,!1),x.strm.avail_out===0))return S}return x.insert=0,U===p?(j(x,!0),x.strm.avail_out===0?Y:W):(x.strstart>x.block_start&&(j(x,!1),x.strm.avail_out),S)}),new ce(4,4,8,4,le),new ce(4,5,16,8,le),new ce(4,6,32,32,le),new ce(4,4,16,16,oe),new ce(8,16,32,32,oe),new ce(8,16,128,128,oe),new ce(8,32,128,256,oe),new ce(32,128,258,1024,oe),new ce(32,258,258,4096,oe)],n.deflateInit=function(x,U){return Te(x,U,A,15,8,0)},n.deflateInit2=Te,n.deflateReset=Ne,n.deflateResetKeep=Se,n.deflateSetHeader=function(x,U){return x&&x.state?x.state.wrap!==2?y:(x.state.gzhead=U,g):y},n.deflate=function(x,U){var B,F,M,q;if(!x||!x.state||5<U||U<0)return x?fe(x,y):y;if(F=x.state,!x.output||!x.input&&x.avail_in!==0||F.status===666&&U!==p)return fe(x,x.avail_out===0?-5:y);if(F.strm=x,B=F.last_flush,F.last_flush=U,F.status===O)if(F.wrap===2)x.adler=0,ie(F,31),ie(F,139),ie(F,8),F.gzhead?(ie(F,(F.gzhead.text?1:0)+(F.gzhead.hcrc?2:0)+(F.gzhead.extra?4:0)+(F.gzhead.name?8:0)+(F.gzhead.comment?16:0)),ie(F,255&F.gzhead.time),ie(F,F.gzhead.time>>8&255),ie(F,F.gzhead.time>>16&255),ie(F,F.gzhead.time>>24&255),ie(F,F.level===9?2:2<=F.strategy||F.level<2?4:0),ie(F,255&F.gzhead.os),F.gzhead.extra&&F.gzhead.extra.length&&(ie(F,255&F.gzhead.extra.length),ie(F,F.gzhead.extra.length>>8&255)),F.gzhead.hcrc&&(x.adler=c(x.adler,F.pending_buf,F.pending,0)),F.gzindex=0,F.status=69):(ie(F,0),ie(F,0),ie(F,0),ie(F,0),ie(F,0),ie(F,F.level===9?2:2<=F.strategy||F.level<2?4:0),ie(F,3),F.status=X);else{var de=A+(F.w_bits-8<<4)<<8;de|=(2<=F.strategy||F.level<2?0:F.level<6?1:F.level===6?2:3)<<6,F.strstart!==0&&(de|=32),de+=31-de%31,F.status=X,ae(F,de),F.strstart!==0&&(ae(F,x.adler>>>16),ae(F,65535&x.adler)),x.adler=1}if(F.status===69)if(F.gzhead.extra){for(M=F.pending;F.gzindex<(65535&F.gzhead.extra.length)&&(F.pending!==F.pending_buf_size||(F.gzhead.hcrc&&F.pending>M&&(x.adler=c(x.adler,F.pending_buf,F.pending-M,M)),te(x),M=F.pending,F.pending!==F.pending_buf_size));)ie(F,255&F.gzhead.extra[F.gzindex]),F.gzindex++;F.gzhead.hcrc&&F.pending>M&&(x.adler=c(x.adler,F.pending_buf,F.pending-M,M)),F.gzindex===F.gzhead.extra.length&&(F.gzindex=0,F.status=73)}else F.status=73;if(F.status===73)if(F.gzhead.name){M=F.pending;do{if(F.pending===F.pending_buf_size&&(F.gzhead.hcrc&&F.pending>M&&(x.adler=c(x.adler,F.pending_buf,F.pending-M,M)),te(x),M=F.pending,F.pending===F.pending_buf_size)){q=1;break}q=F.gzindex<F.gzhead.name.length?255&F.gzhead.name.charCodeAt(F.gzindex++):0,ie(F,q)}while(q!==0);F.gzhead.hcrc&&F.pending>M&&(x.adler=c(x.adler,F.pending_buf,F.pending-M,M)),q===0&&(F.gzindex=0,F.status=91)}else F.status=91;if(F.status===91)if(F.gzhead.comment){M=F.pending;do{if(F.pending===F.pending_buf_size&&(F.gzhead.hcrc&&F.pending>M&&(x.adler=c(x.adler,F.pending_buf,F.pending-M,M)),te(x),M=F.pending,F.pending===F.pending_buf_size)){q=1;break}q=F.gzindex<F.gzhead.comment.length?255&F.gzhead.comment.charCodeAt(F.gzindex++):0,ie(F,q)}while(q!==0);F.gzhead.hcrc&&F.pending>M&&(x.adler=c(x.adler,F.pending_buf,F.pending-M,M)),q===0&&(F.status=103)}else F.status=103;if(F.status===103&&(F.gzhead.hcrc?(F.pending+2>F.pending_buf_size&&te(x),F.pending+2<=F.pending_buf_size&&(ie(F,255&x.adler),ie(F,x.adler>>8&255),x.adler=0,F.status=X)):F.status=X),F.pending!==0){if(te(x),x.avail_out===0)return F.last_flush=-1,g}else if(x.avail_in===0&&K(U)<=K(B)&&U!==p)return fe(x,-5);if(F.status===666&&x.avail_in!==0)return fe(x,-5);if(x.avail_in!==0||F.lookahead!==0||U!==d&&F.status!==666){var we=F.strategy===2?function(ee,Ee){for(var De;;){if(ee.lookahead===0&&(se(ee),ee.lookahead===0)){if(Ee===d)return S;break}if(ee.match_length=0,De=o._tr_tally(ee,0,ee.window[ee.strstart]),ee.lookahead--,ee.strstart++,De&&(j(ee,!1),ee.strm.avail_out===0))return S}return ee.insert=0,Ee===p?(j(ee,!0),ee.strm.avail_out===0?Y:W):ee.last_lit&&(j(ee,!1),ee.strm.avail_out===0)?S:J}(F,U):F.strategy===3?function(ee,Ee){for(var De,Ce,Me,$e,Xe=ee.window;;){if(ee.lookahead<=z){if(se(ee),ee.lookahead<=z&&Ee===d)return S;if(ee.lookahead===0)break}if(ee.match_length=0,ee.lookahead>=R&&0<ee.strstart&&(Ce=Xe[Me=ee.strstart-1])===Xe[++Me]&&Ce===Xe[++Me]&&Ce===Xe[++Me]){$e=ee.strstart+z;do;while(Ce===Xe[++Me]&&Ce===Xe[++Me]&&Ce===Xe[++Me]&&Ce===Xe[++Me]&&Ce===Xe[++Me]&&Ce===Xe[++Me]&&Ce===Xe[++Me]&&Ce===Xe[++Me]&&Me<$e);ee.match_length=z-($e-Me),ee.match_length>ee.lookahead&&(ee.match_length=ee.lookahead)}if(ee.match_length>=R?(De=o._tr_tally(ee,1,ee.match_length-R),ee.lookahead-=ee.match_length,ee.strstart+=ee.match_length,ee.match_length=0):(De=o._tr_tally(ee,0,ee.window[ee.strstart]),ee.lookahead--,ee.strstart++),De&&(j(ee,!1),ee.strm.avail_out===0))return S}return ee.insert=0,Ee===p?(j(ee,!0),ee.strm.avail_out===0?Y:W):ee.last_lit&&(j(ee,!1),ee.strm.avail_out===0)?S:J}(F,U):s[F.level].func(F,U);if(we!==Y&&we!==W||(F.status=666),we===S||we===Y)return x.avail_out===0&&(F.last_flush=-1),g;if(we===J&&(U===1?o._tr_align(F):U!==5&&(o._tr_stored_block(F,0,0,!1),U===3&&(be(F.head),F.lookahead===0&&(F.strstart=0,F.block_start=0,F.insert=0))),te(x),x.avail_out===0))return F.last_flush=-1,g}return U!==p?g:F.wrap<=0?1:(F.wrap===2?(ie(F,255&x.adler),ie(F,x.adler>>8&255),ie(F,x.adler>>16&255),ie(F,x.adler>>24&255),ie(F,255&x.total_in),ie(F,x.total_in>>8&255),ie(F,x.total_in>>16&255),ie(F,x.total_in>>24&255)):(ae(F,x.adler>>>16),ae(F,65535&x.adler)),te(x),0<F.wrap&&(F.wrap=-F.wrap),F.pending!==0?g:1)},n.deflateEnd=function(x){var U;return x&&x.state?(U=x.state.status)!==O&&U!==69&&U!==73&&U!==91&&U!==103&&U!==X&&U!==666?fe(x,y):(x.state=null,U===X?fe(x,-3):g):y},n.deflateSetDictionary=function(x,U){var B,F,M,q,de,we,ee,Ee,De=U.length;if(!x||!x.state||(q=(B=x.state).wrap)===2||q===1&&B.status!==O||B.lookahead)return y;for(q===1&&(x.adler=l(x.adler,U,De,0)),B.wrap=0,De>=B.w_size&&(q===0&&(be(B.head),B.strstart=0,B.block_start=0,B.insert=0),Ee=new a.Buf8(B.w_size),a.arraySet(Ee,U,De-B.w_size,B.w_size,0),U=Ee,De=B.w_size),de=x.avail_in,we=x.next_in,ee=x.input,x.avail_in=De,x.next_in=0,x.input=U,se(B);B.lookahead>=R;){for(F=B.strstart,M=B.lookahead-(R-1);B.ins_h=(B.ins_h<<B.hash_shift^B.window[F+R-1])&B.hash_mask,B.prev[F&B.w_mask]=B.head[B.ins_h],B.head[B.ins_h]=F,F++,--M;);B.strstart=F,B.lookahead=R-1,se(B)}return B.strstart+=B.lookahead,B.block_start=B.strstart,B.insert=B.lookahead,B.lookahead=0,B.match_length=B.prev_length=R-1,B.match_available=0,x.next_in=we,x.input=ee,x.avail_in=de,B.wrap=q,g},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,r,n){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,r,n){r.exports=function(s,a){var o,l,c,h,d,p,g,y,b,w,v,A,E,_,C,I,k,D,R,z,G,O,X,S,J;o=s.state,l=s.next_in,S=s.input,c=l+(s.avail_in-5),h=s.next_out,J=s.output,d=h-(a-s.avail_out),p=h+(s.avail_out-257),g=o.dmax,y=o.wsize,b=o.whave,w=o.wnext,v=o.window,A=o.hold,E=o.bits,_=o.lencode,C=o.distcode,I=(1<<o.lenbits)-1,k=(1<<o.distbits)-1;e:do{E<15&&(A+=S[l++]<<E,E+=8,A+=S[l++]<<E,E+=8),D=_[A&I];t:for(;;){if(A>>>=R=D>>>24,E-=R,(R=D>>>16&255)===0)J[h++]=65535&D;else{if(!(16&R)){if(!(64&R)){D=_[(65535&D)+(A&(1<<R)-1)];continue t}if(32&R){o.mode=12;break e}s.msg="invalid literal/length code",o.mode=30;break e}z=65535&D,(R&=15)&&(E<R&&(A+=S[l++]<<E,E+=8),z+=A&(1<<R)-1,A>>>=R,E-=R),E<15&&(A+=S[l++]<<E,E+=8,A+=S[l++]<<E,E+=8),D=C[A&k];r:for(;;){if(A>>>=R=D>>>24,E-=R,!(16&(R=D>>>16&255))){if(!(64&R)){D=C[(65535&D)+(A&(1<<R)-1)];continue r}s.msg="invalid distance code",o.mode=30;break e}if(G=65535&D,E<(R&=15)&&(A+=S[l++]<<E,(E+=8)<R&&(A+=S[l++]<<E,E+=8)),g<(G+=A&(1<<R)-1)){s.msg="invalid distance too far back",o.mode=30;break e}if(A>>>=R,E-=R,(R=h-d)<G){if(b<(R=G-R)&&o.sane){s.msg="invalid distance too far back",o.mode=30;break e}if(X=v,(O=0)===w){if(O+=y-R,R<z){for(z-=R;J[h++]=v[O++],--R;);O=h-G,X=J}}else if(w<R){if(O+=y+w-R,(R-=w)<z){for(z-=R;J[h++]=v[O++],--R;);if(O=0,w<z){for(z-=R=w;J[h++]=v[O++],--R;);O=h-G,X=J}}}else if(O+=w-R,R<z){for(z-=R;J[h++]=v[O++],--R;);O=h-G,X=J}for(;2<z;)J[h++]=X[O++],J[h++]=X[O++],J[h++]=X[O++],z-=3;z&&(J[h++]=X[O++],1<z&&(J[h++]=X[O++]))}else{for(O=h-G;J[h++]=J[O++],J[h++]=J[O++],J[h++]=J[O++],2<(z-=3););z&&(J[h++]=J[O++],1<z&&(J[h++]=J[O++]))}break}}break}}while(l<c&&h<p);l-=z=E>>3,A&=(1<<(E-=z<<3))-1,s.next_in=l,s.next_out=h,s.avail_in=l<c?c-l+5:5-(l-c),s.avail_out=h<p?p-h+257:257-(h-p),o.hold=A,o.bits=E}},{}],49:[function(t,r,n){var s=t("../utils/common"),a=t("./adler32"),o=t("./crc32"),l=t("./inffast"),c=t("./inftrees"),h=1,d=2,p=0,g=-2,y=1,b=852,w=592;function v(O){return(O>>>24&255)+(O>>>8&65280)+((65280&O)<<8)+((255&O)<<24)}function A(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function E(O){var X;return O&&O.state?(X=O.state,O.total_in=O.total_out=X.total=0,O.msg="",X.wrap&&(O.adler=1&X.wrap),X.mode=y,X.last=0,X.havedict=0,X.dmax=32768,X.head=null,X.hold=0,X.bits=0,X.lencode=X.lendyn=new s.Buf32(b),X.distcode=X.distdyn=new s.Buf32(w),X.sane=1,X.back=-1,p):g}function _(O){var X;return O&&O.state?((X=O.state).wsize=0,X.whave=0,X.wnext=0,E(O)):g}function C(O,X){var S,J;return O&&O.state?(J=O.state,X<0?(S=0,X=-X):(S=1+(X>>4),X<48&&(X&=15)),X&&(X<8||15<X)?g:(J.window!==null&&J.wbits!==X&&(J.window=null),J.wrap=S,J.wbits=X,_(O))):g}function I(O,X){var S,J;return O?(J=new A,(O.state=J).window=null,(S=C(O,X))!==p&&(O.state=null),S):g}var k,D,R=!0;function z(O){if(R){var X;for(k=new s.Buf32(512),D=new s.Buf32(32),X=0;X<144;)O.lens[X++]=8;for(;X<256;)O.lens[X++]=9;for(;X<280;)O.lens[X++]=7;for(;X<288;)O.lens[X++]=8;for(c(h,O.lens,0,288,k,0,O.work,{bits:9}),X=0;X<32;)O.lens[X++]=5;c(d,O.lens,0,32,D,0,O.work,{bits:5}),R=!1}O.lencode=k,O.lenbits=9,O.distcode=D,O.distbits=5}function G(O,X,S,J){var Y,W=O.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new s.Buf8(W.wsize)),J>=W.wsize?(s.arraySet(W.window,X,S-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(J<(Y=W.wsize-W.wnext)&&(Y=J),s.arraySet(W.window,X,S-J,Y,W.wnext),(J-=Y)?(s.arraySet(W.window,X,S-J,J,0),W.wnext=J,W.whave=W.wsize):(W.wnext+=Y,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=Y))),0}n.inflateReset=_,n.inflateReset2=C,n.inflateResetKeep=E,n.inflateInit=function(O){return I(O,15)},n.inflateInit2=I,n.inflate=function(O,X){var S,J,Y,W,fe,K,be,te,j,ie,ae,H,se,le,oe,ce,Ae,Se,Ne,Te,x,U,B,F,M=0,q=new s.Buf8(4),de=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!O||!O.state||!O.output||!O.input&&O.avail_in!==0)return g;(S=O.state).mode===12&&(S.mode=13),fe=O.next_out,Y=O.output,be=O.avail_out,W=O.next_in,J=O.input,K=O.avail_in,te=S.hold,j=S.bits,ie=K,ae=be,U=p;e:for(;;)switch(S.mode){case y:if(S.wrap===0){S.mode=13;break}for(;j<16;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(2&S.wrap&&te===35615){q[S.check=0]=255&te,q[1]=te>>>8&255,S.check=o(S.check,q,2,0),j=te=0,S.mode=2;break}if(S.flags=0,S.head&&(S.head.done=!1),!(1&S.wrap)||(((255&te)<<8)+(te>>8))%31){O.msg="incorrect header check",S.mode=30;break}if((15&te)!=8){O.msg="unknown compression method",S.mode=30;break}if(j-=4,x=8+(15&(te>>>=4)),S.wbits===0)S.wbits=x;else if(x>S.wbits){O.msg="invalid window size",S.mode=30;break}S.dmax=1<<x,O.adler=S.check=1,S.mode=512&te?10:12,j=te=0;break;case 2:for(;j<16;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(S.flags=te,(255&S.flags)!=8){O.msg="unknown compression method",S.mode=30;break}if(57344&S.flags){O.msg="unknown header flags set",S.mode=30;break}S.head&&(S.head.text=te>>8&1),512&S.flags&&(q[0]=255&te,q[1]=te>>>8&255,S.check=o(S.check,q,2,0)),j=te=0,S.mode=3;case 3:for(;j<32;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}S.head&&(S.head.time=te),512&S.flags&&(q[0]=255&te,q[1]=te>>>8&255,q[2]=te>>>16&255,q[3]=te>>>24&255,S.check=o(S.check,q,4,0)),j=te=0,S.mode=4;case 4:for(;j<16;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}S.head&&(S.head.xflags=255&te,S.head.os=te>>8),512&S.flags&&(q[0]=255&te,q[1]=te>>>8&255,S.check=o(S.check,q,2,0)),j=te=0,S.mode=5;case 5:if(1024&S.flags){for(;j<16;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}S.length=te,S.head&&(S.head.extra_len=te),512&S.flags&&(q[0]=255&te,q[1]=te>>>8&255,S.check=o(S.check,q,2,0)),j=te=0}else S.head&&(S.head.extra=null);S.mode=6;case 6:if(1024&S.flags&&(K<(H=S.length)&&(H=K),H&&(S.head&&(x=S.head.extra_len-S.length,S.head.extra||(S.head.extra=new Array(S.head.extra_len)),s.arraySet(S.head.extra,J,W,H,x)),512&S.flags&&(S.check=o(S.check,J,H,W)),K-=H,W+=H,S.length-=H),S.length))break e;S.length=0,S.mode=7;case 7:if(2048&S.flags){if(K===0)break e;for(H=0;x=J[W+H++],S.head&&x&&S.length<65536&&(S.head.name+=String.fromCharCode(x)),x&&H<K;);if(512&S.flags&&(S.check=o(S.check,J,H,W)),K-=H,W+=H,x)break e}else S.head&&(S.head.name=null);S.length=0,S.mode=8;case 8:if(4096&S.flags){if(K===0)break e;for(H=0;x=J[W+H++],S.head&&x&&S.length<65536&&(S.head.comment+=String.fromCharCode(x)),x&&H<K;);if(512&S.flags&&(S.check=o(S.check,J,H,W)),K-=H,W+=H,x)break e}else S.head&&(S.head.comment=null);S.mode=9;case 9:if(512&S.flags){for(;j<16;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(te!==(65535&S.check)){O.msg="header crc mismatch",S.mode=30;break}j=te=0}S.head&&(S.head.hcrc=S.flags>>9&1,S.head.done=!0),O.adler=S.check=0,S.mode=12;break;case 10:for(;j<32;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}O.adler=S.check=v(te),j=te=0,S.mode=11;case 11:if(S.havedict===0)return O.next_out=fe,O.avail_out=be,O.next_in=W,O.avail_in=K,S.hold=te,S.bits=j,2;O.adler=S.check=1,S.mode=12;case 12:if(X===5||X===6)break e;case 13:if(S.last){te>>>=7&j,j-=7&j,S.mode=27;break}for(;j<3;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}switch(S.last=1&te,j-=1,3&(te>>>=1)){case 0:S.mode=14;break;case 1:if(z(S),S.mode=20,X!==6)break;te>>>=2,j-=2;break e;case 2:S.mode=17;break;case 3:O.msg="invalid block type",S.mode=30}te>>>=2,j-=2;break;case 14:for(te>>>=7&j,j-=7&j;j<32;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if((65535&te)!=(te>>>16^65535)){O.msg="invalid stored block lengths",S.mode=30;break}if(S.length=65535&te,j=te=0,S.mode=15,X===6)break e;case 15:S.mode=16;case 16:if(H=S.length){if(K<H&&(H=K),be<H&&(H=be),H===0)break e;s.arraySet(Y,J,W,H,fe),K-=H,W+=H,be-=H,fe+=H,S.length-=H;break}S.mode=12;break;case 17:for(;j<14;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(S.nlen=257+(31&te),te>>>=5,j-=5,S.ndist=1+(31&te),te>>>=5,j-=5,S.ncode=4+(15&te),te>>>=4,j-=4,286<S.nlen||30<S.ndist){O.msg="too many length or distance symbols",S.mode=30;break}S.have=0,S.mode=18;case 18:for(;S.have<S.ncode;){for(;j<3;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}S.lens[de[S.have++]]=7&te,te>>>=3,j-=3}for(;S.have<19;)S.lens[de[S.have++]]=0;if(S.lencode=S.lendyn,S.lenbits=7,B={bits:S.lenbits},U=c(0,S.lens,0,19,S.lencode,0,S.work,B),S.lenbits=B.bits,U){O.msg="invalid code lengths set",S.mode=30;break}S.have=0,S.mode=19;case 19:for(;S.have<S.nlen+S.ndist;){for(;ce=(M=S.lencode[te&(1<<S.lenbits)-1])>>>16&255,Ae=65535&M,!((oe=M>>>24)<=j);){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(Ae<16)te>>>=oe,j-=oe,S.lens[S.have++]=Ae;else{if(Ae===16){for(F=oe+2;j<F;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(te>>>=oe,j-=oe,S.have===0){O.msg="invalid bit length repeat",S.mode=30;break}x=S.lens[S.have-1],H=3+(3&te),te>>>=2,j-=2}else if(Ae===17){for(F=oe+3;j<F;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}j-=oe,x=0,H=3+(7&(te>>>=oe)),te>>>=3,j-=3}else{for(F=oe+7;j<F;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}j-=oe,x=0,H=11+(127&(te>>>=oe)),te>>>=7,j-=7}if(S.have+H>S.nlen+S.ndist){O.msg="invalid bit length repeat",S.mode=30;break}for(;H--;)S.lens[S.have++]=x}}if(S.mode===30)break;if(S.lens[256]===0){O.msg="invalid code -- missing end-of-block",S.mode=30;break}if(S.lenbits=9,B={bits:S.lenbits},U=c(h,S.lens,0,S.nlen,S.lencode,0,S.work,B),S.lenbits=B.bits,U){O.msg="invalid literal/lengths set",S.mode=30;break}if(S.distbits=6,S.distcode=S.distdyn,B={bits:S.distbits},U=c(d,S.lens,S.nlen,S.ndist,S.distcode,0,S.work,B),S.distbits=B.bits,U){O.msg="invalid distances set",S.mode=30;break}if(S.mode=20,X===6)break e;case 20:S.mode=21;case 21:if(6<=K&&258<=be){O.next_out=fe,O.avail_out=be,O.next_in=W,O.avail_in=K,S.hold=te,S.bits=j,l(O,ae),fe=O.next_out,Y=O.output,be=O.avail_out,W=O.next_in,J=O.input,K=O.avail_in,te=S.hold,j=S.bits,S.mode===12&&(S.back=-1);break}for(S.back=0;ce=(M=S.lencode[te&(1<<S.lenbits)-1])>>>16&255,Ae=65535&M,!((oe=M>>>24)<=j);){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(ce&&!(240&ce)){for(Se=oe,Ne=ce,Te=Ae;ce=(M=S.lencode[Te+((te&(1<<Se+Ne)-1)>>Se)])>>>16&255,Ae=65535&M,!(Se+(oe=M>>>24)<=j);){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}te>>>=Se,j-=Se,S.back+=Se}if(te>>>=oe,j-=oe,S.back+=oe,S.length=Ae,ce===0){S.mode=26;break}if(32&ce){S.back=-1,S.mode=12;break}if(64&ce){O.msg="invalid literal/length code",S.mode=30;break}S.extra=15&ce,S.mode=22;case 22:if(S.extra){for(F=S.extra;j<F;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}S.length+=te&(1<<S.extra)-1,te>>>=S.extra,j-=S.extra,S.back+=S.extra}S.was=S.length,S.mode=23;case 23:for(;ce=(M=S.distcode[te&(1<<S.distbits)-1])>>>16&255,Ae=65535&M,!((oe=M>>>24)<=j);){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(!(240&ce)){for(Se=oe,Ne=ce,Te=Ae;ce=(M=S.distcode[Te+((te&(1<<Se+Ne)-1)>>Se)])>>>16&255,Ae=65535&M,!(Se+(oe=M>>>24)<=j);){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}te>>>=Se,j-=Se,S.back+=Se}if(te>>>=oe,j-=oe,S.back+=oe,64&ce){O.msg="invalid distance code",S.mode=30;break}S.offset=Ae,S.extra=15&ce,S.mode=24;case 24:if(S.extra){for(F=S.extra;j<F;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}S.offset+=te&(1<<S.extra)-1,te>>>=S.extra,j-=S.extra,S.back+=S.extra}if(S.offset>S.dmax){O.msg="invalid distance too far back",S.mode=30;break}S.mode=25;case 25:if(be===0)break e;if(H=ae-be,S.offset>H){if((H=S.offset-H)>S.whave&&S.sane){O.msg="invalid distance too far back",S.mode=30;break}se=H>S.wnext?(H-=S.wnext,S.wsize-H):S.wnext-H,H>S.length&&(H=S.length),le=S.window}else le=Y,se=fe-S.offset,H=S.length;for(be<H&&(H=be),be-=H,S.length-=H;Y[fe++]=le[se++],--H;);S.length===0&&(S.mode=21);break;case 26:if(be===0)break e;Y[fe++]=S.length,be--,S.mode=21;break;case 27:if(S.wrap){for(;j<32;){if(K===0)break e;K--,te|=J[W++]<<j,j+=8}if(ae-=be,O.total_out+=ae,S.total+=ae,ae&&(O.adler=S.check=S.flags?o(S.check,Y,ae,fe-ae):a(S.check,Y,ae,fe-ae)),ae=be,(S.flags?te:v(te))!==S.check){O.msg="incorrect data check",S.mode=30;break}j=te=0}S.mode=28;case 28:if(S.wrap&&S.flags){for(;j<32;){if(K===0)break e;K--,te+=J[W++]<<j,j+=8}if(te!==(4294967295&S.total)){O.msg="incorrect length check",S.mode=30;break}j=te=0}S.mode=29;case 29:U=1;break e;case 30:U=-3;break e;case 31:return-4;case 32:default:return g}return O.next_out=fe,O.avail_out=be,O.next_in=W,O.avail_in=K,S.hold=te,S.bits=j,(S.wsize||ae!==O.avail_out&&S.mode<30&&(S.mode<27||X!==4))&&G(O,O.output,O.next_out,ae-O.avail_out)?(S.mode=31,-4):(ie-=O.avail_in,ae-=O.avail_out,O.total_in+=ie,O.total_out+=ae,S.total+=ae,S.wrap&&ae&&(O.adler=S.check=S.flags?o(S.check,Y,ae,O.next_out-ae):a(S.check,Y,ae,O.next_out-ae)),O.data_type=S.bits+(S.last?64:0)+(S.mode===12?128:0)+(S.mode===20||S.mode===15?256:0),(ie==0&&ae===0||X===4)&&U===p&&(U=-5),U)},n.inflateEnd=function(O){if(!O||!O.state)return g;var X=O.state;return X.window&&(X.window=null),O.state=null,p},n.inflateGetHeader=function(O,X){var S;return O&&O.state&&2&(S=O.state).wrap?((S.head=X).done=!1,p):g},n.inflateSetDictionary=function(O,X){var S,J=X.length;return O&&O.state?(S=O.state).wrap!==0&&S.mode!==11?g:S.mode===11&&a(1,X,J,0)!==S.check?-3:G(O,X,J,J)?(S.mode=31,-4):(S.havedict=1,p):g},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,r,n){var s=t("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(h,d,p,g,y,b,w,v){var A,E,_,C,I,k,D,R,z,G=v.bits,O=0,X=0,S=0,J=0,Y=0,W=0,fe=0,K=0,be=0,te=0,j=null,ie=0,ae=new s.Buf16(16),H=new s.Buf16(16),se=null,le=0;for(O=0;O<=15;O++)ae[O]=0;for(X=0;X<g;X++)ae[d[p+X]]++;for(Y=G,J=15;1<=J&&ae[J]===0;J--);if(J<Y&&(Y=J),J===0)return y[b++]=20971520,y[b++]=20971520,v.bits=1,0;for(S=1;S<J&&ae[S]===0;S++);for(Y<S&&(Y=S),O=K=1;O<=15;O++)if(K<<=1,(K-=ae[O])<0)return-1;if(0<K&&(h===0||J!==1))return-1;for(H[1]=0,O=1;O<15;O++)H[O+1]=H[O]+ae[O];for(X=0;X<g;X++)d[p+X]!==0&&(w[H[d[p+X]]++]=X);if(k=h===0?(j=se=w,19):h===1?(j=a,ie-=257,se=o,le-=257,256):(j=l,se=c,-1),O=S,I=b,fe=X=te=0,_=-1,C=(be=1<<(W=Y))-1,h===1&&852<be||h===2&&592<be)return 1;for(;;){for(D=O-fe,z=w[X]<k?(R=0,w[X]):w[X]>k?(R=se[le+w[X]],j[ie+w[X]]):(R=96,0),A=1<<O-fe,S=E=1<<W;y[I+(te>>fe)+(E-=A)]=D<<24|R<<16|z|0,E!==0;);for(A=1<<O-1;te&A;)A>>=1;if(A!==0?(te&=A-1,te+=A):te=0,X++,--ae[O]==0){if(O===J)break;O=d[p+w[X]]}if(Y<O&&(te&C)!==_){for(fe===0&&(fe=Y),I+=S,K=1<<(W=O-fe);W+fe<J&&!((K-=ae[W+fe])<=0);)W++,K<<=1;if(be+=1<<W,h===1&&852<be||h===2&&592<be)return 1;y[_=te&C]=Y<<24|W<<16|I-b|0}}return te!==0&&(y[I+te]=O-fe<<24|64<<16|0),v.bits=Y,0}},{"../utils/common":41}],51:[function(t,r,n){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,r,n){var s=t("../utils/common"),a=0,o=1;function l(M){for(var q=M.length;0<=--q;)M[q]=0}var c=0,h=29,d=256,p=d+1+h,g=30,y=19,b=2*p+1,w=15,v=16,A=7,E=256,_=16,C=17,I=18,k=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],D=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],R=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],G=new Array(2*(p+2));l(G);var O=new Array(2*g);l(O);var X=new Array(512);l(X);var S=new Array(256);l(S);var J=new Array(h);l(J);var Y,W,fe,K=new Array(g);function be(M,q,de,we,ee){this.static_tree=M,this.extra_bits=q,this.extra_base=de,this.elems=we,this.max_length=ee,this.has_stree=M&&M.length}function te(M,q){this.dyn_tree=M,this.max_code=0,this.stat_desc=q}function j(M){return M<256?X[M]:X[256+(M>>>7)]}function ie(M,q){M.pending_buf[M.pending++]=255&q,M.pending_buf[M.pending++]=q>>>8&255}function ae(M,q,de){M.bi_valid>v-de?(M.bi_buf|=q<<M.bi_valid&65535,ie(M,M.bi_buf),M.bi_buf=q>>v-M.bi_valid,M.bi_valid+=de-v):(M.bi_buf|=q<<M.bi_valid&65535,M.bi_valid+=de)}function H(M,q,de){ae(M,de[2*q],de[2*q+1])}function se(M,q){for(var de=0;de|=1&M,M>>>=1,de<<=1,0<--q;);return de>>>1}function le(M,q,de){var we,ee,Ee=new Array(w+1),De=0;for(we=1;we<=w;we++)Ee[we]=De=De+de[we-1]<<1;for(ee=0;ee<=q;ee++){var Ce=M[2*ee+1];Ce!==0&&(M[2*ee]=se(Ee[Ce]++,Ce))}}function oe(M){var q;for(q=0;q<p;q++)M.dyn_ltree[2*q]=0;for(q=0;q<g;q++)M.dyn_dtree[2*q]=0;for(q=0;q<y;q++)M.bl_tree[2*q]=0;M.dyn_ltree[2*E]=1,M.opt_len=M.static_len=0,M.last_lit=M.matches=0}function ce(M){8<M.bi_valid?ie(M,M.bi_buf):0<M.bi_valid&&(M.pending_buf[M.pending++]=M.bi_buf),M.bi_buf=0,M.bi_valid=0}function Ae(M,q,de,we){var ee=2*q,Ee=2*de;return M[ee]<M[Ee]||M[ee]===M[Ee]&&we[q]<=we[de]}function Se(M,q,de){for(var we=M.heap[de],ee=de<<1;ee<=M.heap_len&&(ee<M.heap_len&&Ae(q,M.heap[ee+1],M.heap[ee],M.depth)&&ee++,!Ae(q,we,M.heap[ee],M.depth));)M.heap[de]=M.heap[ee],de=ee,ee<<=1;M.heap[de]=we}function Ne(M,q,de){var we,ee,Ee,De,Ce=0;if(M.last_lit!==0)for(;we=M.pending_buf[M.d_buf+2*Ce]<<8|M.pending_buf[M.d_buf+2*Ce+1],ee=M.pending_buf[M.l_buf+Ce],Ce++,we===0?H(M,ee,q):(H(M,(Ee=S[ee])+d+1,q),(De=k[Ee])!==0&&ae(M,ee-=J[Ee],De),H(M,Ee=j(--we),de),(De=D[Ee])!==0&&ae(M,we-=K[Ee],De)),Ce<M.last_lit;);H(M,E,q)}function Te(M,q){var de,we,ee,Ee=q.dyn_tree,De=q.stat_desc.static_tree,Ce=q.stat_desc.has_stree,Me=q.stat_desc.elems,$e=-1;for(M.heap_len=0,M.heap_max=b,de=0;de<Me;de++)Ee[2*de]!==0?(M.heap[++M.heap_len]=$e=de,M.depth[de]=0):Ee[2*de+1]=0;for(;M.heap_len<2;)Ee[2*(ee=M.heap[++M.heap_len]=$e<2?++$e:0)]=1,M.depth[ee]=0,M.opt_len--,Ce&&(M.static_len-=De[2*ee+1]);for(q.max_code=$e,de=M.heap_len>>1;1<=de;de--)Se(M,Ee,de);for(ee=Me;de=M.heap[1],M.heap[1]=M.heap[M.heap_len--],Se(M,Ee,1),we=M.heap[1],M.heap[--M.heap_max]=de,M.heap[--M.heap_max]=we,Ee[2*ee]=Ee[2*de]+Ee[2*we],M.depth[ee]=(M.depth[de]>=M.depth[we]?M.depth[de]:M.depth[we])+1,Ee[2*de+1]=Ee[2*we+1]=ee,M.heap[1]=ee++,Se(M,Ee,1),2<=M.heap_len;);M.heap[--M.heap_max]=M.heap[1],function(Xe,Tt){var nr,yr,rr,ge,ve,he,me=Tt.dyn_tree,Fe=Tt.max_code,Ue=Tt.stat_desc.static_tree,st=Tt.stat_desc.has_stree,Ye=Tt.stat_desc.extra_bits,ct=Tt.stat_desc.extra_base,pt=Tt.stat_desc.max_length,mt=0;for(ge=0;ge<=w;ge++)Xe.bl_count[ge]=0;for(me[2*Xe.heap[Xe.heap_max]+1]=0,nr=Xe.heap_max+1;nr<b;nr++)pt<(ge=me[2*me[2*(yr=Xe.heap[nr])+1]+1]+1)&&(ge=pt,mt++),me[2*yr+1]=ge,Fe<yr||(Xe.bl_count[ge]++,ve=0,ct<=yr&&(ve=Ye[yr-ct]),he=me[2*yr],Xe.opt_len+=he*(ge+ve),st&&(Xe.static_len+=he*(Ue[2*yr+1]+ve)));if(mt!==0){do{for(ge=pt-1;Xe.bl_count[ge]===0;)ge--;Xe.bl_count[ge]--,Xe.bl_count[ge+1]+=2,Xe.bl_count[pt]--,mt-=2}while(0<mt);for(ge=pt;ge!==0;ge--)for(yr=Xe.bl_count[ge];yr!==0;)Fe<(rr=Xe.heap[--nr])||(me[2*rr+1]!==ge&&(Xe.opt_len+=(ge-me[2*rr+1])*me[2*rr],me[2*rr+1]=ge),yr--)}}(M,q),le(Ee,$e,M.bl_count)}function x(M,q,de){var we,ee,Ee=-1,De=q[1],Ce=0,Me=7,$e=4;for(De===0&&(Me=138,$e=3),q[2*(de+1)+1]=65535,we=0;we<=de;we++)ee=De,De=q[2*(we+1)+1],++Ce<Me&&ee===De||(Ce<$e?M.bl_tree[2*ee]+=Ce:ee!==0?(ee!==Ee&&M.bl_tree[2*ee]++,M.bl_tree[2*_]++):Ce<=10?M.bl_tree[2*C]++:M.bl_tree[2*I]++,Ee=ee,$e=(Ce=0)===De?(Me=138,3):ee===De?(Me=6,3):(Me=7,4))}function U(M,q,de){var we,ee,Ee=-1,De=q[1],Ce=0,Me=7,$e=4;for(De===0&&(Me=138,$e=3),we=0;we<=de;we++)if(ee=De,De=q[2*(we+1)+1],!(++Ce<Me&&ee===De)){if(Ce<$e)for(;H(M,ee,M.bl_tree),--Ce!=0;);else ee!==0?(ee!==Ee&&(H(M,ee,M.bl_tree),Ce--),H(M,_,M.bl_tree),ae(M,Ce-3,2)):Ce<=10?(H(M,C,M.bl_tree),ae(M,Ce-3,3)):(H(M,I,M.bl_tree),ae(M,Ce-11,7));Ee=ee,$e=(Ce=0)===De?(Me=138,3):ee===De?(Me=6,3):(Me=7,4)}}l(K);var B=!1;function F(M,q,de,we){ae(M,(c<<1)+(we?1:0),3),function(ee,Ee,De,Ce){ce(ee),ie(ee,De),ie(ee,~De),s.arraySet(ee.pending_buf,ee.window,Ee,De,ee.pending),ee.pending+=De}(M,q,de)}n._tr_init=function(M){B||(function(){var q,de,we,ee,Ee,De=new Array(w+1);for(ee=we=0;ee<h-1;ee++)for(J[ee]=we,q=0;q<1<<k[ee];q++)S[we++]=ee;for(S[we-1]=ee,ee=Ee=0;ee<16;ee++)for(K[ee]=Ee,q=0;q<1<<D[ee];q++)X[Ee++]=ee;for(Ee>>=7;ee<g;ee++)for(K[ee]=Ee<<7,q=0;q<1<<D[ee]-7;q++)X[256+Ee++]=ee;for(de=0;de<=w;de++)De[de]=0;for(q=0;q<=143;)G[2*q+1]=8,q++,De[8]++;for(;q<=255;)G[2*q+1]=9,q++,De[9]++;for(;q<=279;)G[2*q+1]=7,q++,De[7]++;for(;q<=287;)G[2*q+1]=8,q++,De[8]++;for(le(G,p+1,De),q=0;q<g;q++)O[2*q+1]=5,O[2*q]=se(q,5);Y=new be(G,k,d+1,p,w),W=new be(O,D,0,g,w),fe=new be(new Array(0),R,0,y,A)}(),B=!0),M.l_desc=new te(M.dyn_ltree,Y),M.d_desc=new te(M.dyn_dtree,W),M.bl_desc=new te(M.bl_tree,fe),M.bi_buf=0,M.bi_valid=0,oe(M)},n._tr_stored_block=F,n._tr_flush_block=function(M,q,de,we){var ee,Ee,De=0;0<M.level?(M.strm.data_type===2&&(M.strm.data_type=function(Ce){var Me,$e=4093624447;for(Me=0;Me<=31;Me++,$e>>>=1)if(1&$e&&Ce.dyn_ltree[2*Me]!==0)return a;if(Ce.dyn_ltree[18]!==0||Ce.dyn_ltree[20]!==0||Ce.dyn_ltree[26]!==0)return o;for(Me=32;Me<d;Me++)if(Ce.dyn_ltree[2*Me]!==0)return o;return a}(M)),Te(M,M.l_desc),Te(M,M.d_desc),De=function(Ce){var Me;for(x(Ce,Ce.dyn_ltree,Ce.l_desc.max_code),x(Ce,Ce.dyn_dtree,Ce.d_desc.max_code),Te(Ce,Ce.bl_desc),Me=y-1;3<=Me&&Ce.bl_tree[2*z[Me]+1]===0;Me--);return Ce.opt_len+=3*(Me+1)+5+5+4,Me}(M),ee=M.opt_len+3+7>>>3,(Ee=M.static_len+3+7>>>3)<=ee&&(ee=Ee)):ee=Ee=de+5,de+4<=ee&&q!==-1?F(M,q,de,we):M.strategy===4||Ee===ee?(ae(M,2+(we?1:0),3),Ne(M,G,O)):(ae(M,4+(we?1:0),3),function(Ce,Me,$e,Xe){var Tt;for(ae(Ce,Me-257,5),ae(Ce,$e-1,5),ae(Ce,Xe-4,4),Tt=0;Tt<Xe;Tt++)ae(Ce,Ce.bl_tree[2*z[Tt]+1],3);U(Ce,Ce.dyn_ltree,Me-1),U(Ce,Ce.dyn_dtree,$e-1)}(M,M.l_desc.max_code+1,M.d_desc.max_code+1,De+1),Ne(M,M.dyn_ltree,M.dyn_dtree)),oe(M),we&&ce(M)},n._tr_tally=function(M,q,de){return M.pending_buf[M.d_buf+2*M.last_lit]=q>>>8&255,M.pending_buf[M.d_buf+2*M.last_lit+1]=255&q,M.pending_buf[M.l_buf+M.last_lit]=255&de,M.last_lit++,q===0?M.dyn_ltree[2*de]++:(M.matches++,q--,M.dyn_ltree[2*(S[de]+d+1)]++,M.dyn_dtree[2*j(q)]++),M.last_lit===M.lit_bufsize-1},n._tr_align=function(M){ae(M,2,3),H(M,E,G),function(q){q.bi_valid===16?(ie(q,q.bi_buf),q.bi_buf=0,q.bi_valid=0):8<=q.bi_valid&&(q.pending_buf[q.pending++]=255&q.bi_buf,q.bi_buf>>=8,q.bi_valid-=8)}(M)}},{"../utils/common":41}],53:[function(t,r,n){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,r,n){(function(s){(function(a,o){if(!a.setImmediate){var l,c,h,d,p=1,g={},y=!1,b=a.document,w=Object.getPrototypeOf&&Object.getPrototypeOf(a);w=w&&w.setTimeout?w:a,l={}.toString.call(a.process)==="[object process]"?function(_){process.nextTick(function(){A(_)})}:function(){if(a.postMessage&&!a.importScripts){var _=!0,C=a.onmessage;return a.onmessage=function(){_=!1},a.postMessage("","*"),a.onmessage=C,_}}()?(d="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",E,!1):a.attachEvent("onmessage",E),function(_){a.postMessage(d+_,"*")}):a.MessageChannel?((h=new MessageChannel).port1.onmessage=function(_){A(_.data)},function(_){h.port2.postMessage(_)}):b&&"onreadystatechange"in b.createElement("script")?(c=b.documentElement,function(_){var C=b.createElement("script");C.onreadystatechange=function(){A(_),C.onreadystatechange=null,c.removeChild(C),C=null},c.appendChild(C)}):function(_){setTimeout(A,0,_)},w.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var C=new Array(arguments.length-1),I=0;I<C.length;I++)C[I]=arguments[I+1];var k={callback:_,args:C};return g[p]=k,l(p),p++},w.clearImmediate=v}function v(_){delete g[_]}function A(_){if(y)setTimeout(A,0,_);else{var C=g[_];if(C){y=!0;try{(function(I){var k=I.callback,D=I.args;switch(D.length){case 0:k();break;case 1:k(D[0]);break;case 2:k(D[0],D[1]);break;case 3:k(D[0],D[1],D[2]);break;default:k.apply(o,D)}})(C)}finally{v(_),y=!1}}}}function E(_){_.source===a&&typeof _.data=="string"&&_.data.indexOf(d)===0&&A(+_.data.slice(d.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof sh<"u"?sh:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(HA);var FR=HA.exports;const BR=_g(FR);/*
|
|
71
|
+
* @license
|
|
72
|
+
* docx-preview <https://github.com/VolodymyrBaydalka/docxjs>
|
|
73
|
+
* Released under Apache License 2.0 <https://github.com/VolodymyrBaydalka/docxjs/blob/master/LICENSE>
|
|
74
|
+
* Copyright Volodymyr Baydalka
|
|
75
|
+
*/var Er;(function(i){i.OfficeDocument="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",i.FontTable="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",i.Image="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",i.Numbering="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",i.Styles="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",i.StylesWithEffects="http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects",i.Theme="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",i.Settings="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",i.WebSettings="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",i.Hyperlink="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",i.Footnotes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",i.Endnotes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",i.Footer="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",i.Header="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",i.ExtendedProperties="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",i.CoreProperties="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",i.CustomProperties="http://schemas.openxmlformats.org/package/2006/relationships/metadata/custom-properties",i.Comments="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",i.CommentsExtended="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",i.AltChunk="http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk"})(Er||(Er={}));function zR(i,e){return e.elements(i).map(t=>({id:e.attr(t,"Id"),type:e.attr(t,"Type"),target:e.attr(t,"Target"),targetMode:e.attr(t,"TargetMode")}))}function jR(i){return i==null?void 0:i.replace(/[ .]+/g,"-").replace(/[&]+/g,"and").toLowerCase()}function kb(i){return/^[^"'].*\s.*[^"']$/.test(i)?`'${i}'`:i}function Gp(i){let e=i.lastIndexOf("/")+1,t=e==0?"":i.substring(0,e),r=e==0?i:i.substring(e);return[t,r]}function Qm(i,e){try{const t="http://docx/";return new URL(i,t+e).toString().substring(t.length)}catch{return`${e}${i}`}}function wa(i,e){return i.reduce((t,r)=>(t[e(r)]=r,t),{})}function UR(i){return new Promise((e,t)=>{const r=new FileReader;r.onloadend=()=>e(r.result),r.onerror=()=>t(),r.readAsDataURL(i)})}function Jm(i){return i&&typeof i=="object"&&!Array.isArray(i)}function HR(i){return typeof i=="string"||i instanceof String}function ig(i,...e){if(!e.length)return i;const t=e.shift();if(Jm(i)&&Jm(t))for(const r in t)if(Jm(t[r])){const n=i[r]??(i[r]={});ig(n,t[r])}else i[r]=t[r];return ig(i,...e)}function nh(i){return Array.isArray(i)?i:[i]}function $R(i,e,t){return e>i?e:t<i?t:i}const $A={wordml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},kr={Dxa:{mul:.05,unit:"pt"},Emu:{mul:1/12700,unit:"pt"},FontSize:{mul:.5,unit:"pt"},Border:{mul:.125,unit:"pt",min:.25,max:12},Point:{mul:1,unit:"pt"},Percent:{mul:.02,unit:"%"}};function VA(i,e=kr.Dxa){if(i==null||/.+(p[xt]|[%])$/.test(i))return i;var t=parseInt(i)*e.mul;return e.min&&e.max&&(t=$R(t,e.min,e.max)),`${t.toFixed(2)}${e.unit}`}function VR(i,e=!1){switch(i){case"1":return!0;case"0":return!1;case"on":return!0;case"off":return!1;case"true":return!0;case"false":return!1;default:return e}}function GA(i,e,t){if(i.namespaceURI!=$A.wordml)return!1;switch(i.localName){case"color":e.color=t.attr(i,"val");break;case"sz":e.fontSize=t.lengthAttr(i,"val",kr.FontSize);break;default:return!1}return!0}function GR(i,e=!1){e&&(i=i.replace(/<[?].*[?]>/,"")),i=WR(i);const t=new DOMParser().parseFromString(i,"application/xml"),r=qR(t);if(r)throw new Error(r);return t}function qR(i){var e;return(e=i.getElementsByTagName("parsererror")[0])==null?void 0:e.textContent}function WR(i){return i.charCodeAt(0)===65279?i.substring(1):i}function XR(i){return new XMLSerializer().serializeToString(i)}class qA{elements(e,t=null){const r=[];for(let n=0,s=e.childNodes.length;n<s;n++){let a=e.childNodes.item(n);a.nodeType==Node.ELEMENT_NODE&&(t==null||a.localName==t)&&r.push(a)}return r}element(e,t){for(let r=0,n=e.childNodes.length;r<n;r++){let s=e.childNodes.item(r);if(s.nodeType==1&&s.localName==t)return s}return null}elementAttr(e,t,r){var n=this.element(e,t);return n?this.attr(n,r):void 0}attrs(e){return Array.from(e.attributes)}attr(e,t){for(let r=0,n=e.attributes.length;r<n;r++){let s=e.attributes.item(r);if(s.localName==t)return s.value}return null}intAttr(e,t,r=null){var n=this.attr(e,t);return n?parseInt(n):r}hexAttr(e,t,r=null){var n=this.attr(e,t);return n?parseInt(n,16):r}floatAttr(e,t,r=null){var n=this.attr(e,t);return n?parseFloat(n):r}boolAttr(e,t,r=null){return VR(this.attr(e,t),r)}lengthAttr(e,t,r=kr.Dxa){return VA(this.attr(e,t),r)}}const ne=new qA;class li{constructor(e,t){this._package=e,this.path=t}async load(){this.rels=await this._package.loadRelationships(this.path);const e=await this._package.load(this.path),t=this._package.parseXmlDocument(e);this._package.options.keepOrigin&&(this._xmlDocument=t),this.parseXml(t.firstElementChild)}save(){this._package.update(this.path,XR(this._xmlDocument))}parseXml(e){}}const YR={embedRegular:"regular",embedBold:"bold",embedItalic:"italic",embedBoldItalic:"boldItalic"};function ZR(i,e){return e.elements(i).map(t=>KR(t,e))}function KR(i,e){let t={name:e.attr(i,"name"),embedFontRefs:[]};for(let r of e.elements(i))switch(r.localName){case"family":t.family=e.attr(r,"val");break;case"altName":t.altName=e.attr(r,"val");break;case"embedRegular":case"embedBold":case"embedItalic":case"embedBoldItalic":t.embedFontRefs.push(QR(r,e));break}return t}function QR(i,e){return{id:e.attr(i,"id"),key:e.attr(i,"fontKey"),type:YR[i.localName]}}class JR extends li{parseXml(e){this.fonts=ZR(e,this._package.xmlParser)}}class fv{constructor(e,t){this._zip=e,this.options=t,this.xmlParser=new qA}get(e){const t=e3(e);return this._zip.files[t]??this._zip.files[t.replace(/\//g,"\\")]}update(e,t){this._zip.file(e,t)}static async load(e,t){const r=await BR.loadAsync(e);return new fv(r,t)}save(e="blob"){return this._zip.generateAsync({type:e})}load(e,t="string"){var r;return((r=this.get(e))==null?void 0:r.async(t))??Promise.resolve(null)}async loadRelationships(e=null){let t="_rels/.rels";if(e!=null){const[n,s]=Gp(e);t=`${n}_rels/${s}.rels`}const r=await this.load(t);return r?zR(this.parseXmlDocument(r).firstElementChild,this.xmlParser):null}parseXmlDocument(e){return GR(e,this.options.trimXmlDeclaration)}}function e3(i){return i.startsWith("/")?i.substr(1):i}class t3 extends li{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.body=this._documentParser.parseDocumentFile(e)}}function fp(i,e){return{type:e.attr(i,"val"),color:e.attr(i,"color"),size:e.lengthAttr(i,"sz",kr.Border),offset:e.lengthAttr(i,"space",kr.Point),frame:e.boolAttr(i,"frame"),shadow:e.boolAttr(i,"shadow")}}function r3(i,e){var t={};for(let r of e.elements(i))switch(r.localName){case"left":t.left=fp(r,e);break;case"top":t.top=fp(r,e);break;case"right":t.right=fp(r,e);break;case"bottom":t.bottom=fp(r,e);break}return t}var C2;(function(i){i.Continuous="continuous",i.NextPage="nextPage",i.NextColumn="nextColumn",i.EvenPage="evenPage",i.OddPage="oddPage"})(C2||(C2={}));function WA(i,e=ne){var t={};for(let r of e.elements(i))switch(r.localName){case"pgSz":t.pageSize={width:e.lengthAttr(r,"w"),height:e.lengthAttr(r,"h"),orientation:e.attr(r,"orient")};break;case"type":t.type=e.attr(r,"val");break;case"pgMar":t.pageMargins={left:e.lengthAttr(r,"left"),right:e.lengthAttr(r,"right"),top:e.lengthAttr(r,"top"),bottom:e.lengthAttr(r,"bottom"),header:e.lengthAttr(r,"header"),footer:e.lengthAttr(r,"footer"),gutter:e.lengthAttr(r,"gutter")};break;case"cols":t.columns=n3(r,e);break;case"headerReference":(t.headerRefs??(t.headerRefs=[])).push(S2(r,e));break;case"footerReference":(t.footerRefs??(t.footerRefs=[])).push(S2(r,e));break;case"titlePg":t.titlePage=e.boolAttr(r,"val",!0);break;case"pgBorders":t.pageBorders=r3(r,e);break;case"pgNumType":t.pageNumber=i3(r,e);break}return t}function n3(i,e){return{numberOfColumns:e.intAttr(i,"num"),space:e.lengthAttr(i,"space"),separator:e.boolAttr(i,"sep"),equalWidth:e.boolAttr(i,"equalWidth",!0),columns:e.elements(i,"col").map(t=>({width:e.lengthAttr(t,"w"),space:e.lengthAttr(t,"space")}))}}function i3(i,e){return{chapSep:e.attr(i,"chapSep"),chapStyle:e.attr(i,"chapStyle"),format:e.attr(i,"fmt"),start:e.intAttr(i,"start")}}function S2(i,e){return{id:e.attr(i,"id"),type:e.attr(i,"type")}}function s3(i,e){return{before:e.lengthAttr(i,"before"),after:e.lengthAttr(i,"after"),line:e.intAttr(i,"line"),lineRule:e.attr(i,"lineRule")}}function pv(i,e){let t={};for(let r of e.elements(i))a3(r,t,e);return t}function a3(i,e,t){return!!GA(i,e,t)}function XA(i,e){let t={};for(let r of e.elements(i))YA(r,t,e);return t}function YA(i,e,t){if(i.namespaceURI!=$A.wordml)return!1;if(GA(i,e,t))return!0;switch(i.localName){case"tabs":e.tabs=o3(i,t);break;case"sectPr":e.sectionProps=WA(i,t);break;case"numPr":e.numbering=l3(i,t);break;case"spacing":return e.lineSpacing=s3(i,t),!1;case"textAlignment":return e.textAlignment=t.attr(i,"val"),!1;case"keepLines":e.keepLines=t.boolAttr(i,"val",!0);break;case"keepNext":e.keepNext=t.boolAttr(i,"val",!0);break;case"pageBreakBefore":e.pageBreakBefore=t.boolAttr(i,"val",!0);break;case"outlineLvl":e.outlineLevel=t.intAttr(i,"val");break;case"pStyle":e.styleName=t.attr(i,"val");break;case"rPr":e.runProps=pv(i,t);break;default:return!1}return!0}function o3(i,e){return e.elements(i,"tab").map(t=>({position:e.lengthAttr(t,"pos"),leader:e.attr(t,"leader"),style:e.attr(t,"val")}))}function l3(i,e){var t={};for(let r of e.elements(i))switch(r.localName){case"numId":t.id=e.attr(r,"val");break;case"ilvl":t.level=e.intAttr(r,"val");break}return t}function u3(i,e){let t={numberings:[],abstractNumberings:[],bulletPictures:[]};for(let r of e.elements(i))switch(r.localName){case"num":t.numberings.push(c3(r,e));break;case"abstractNum":t.abstractNumberings.push(h3(r,e));break;case"numPicBullet":t.bulletPictures.push(f3(r,e));break}return t}function c3(i,e){let t={id:e.attr(i,"numId"),overrides:[]};for(let r of e.elements(i))switch(r.localName){case"abstractNumId":t.abstractId=e.attr(r,"val");break;case"lvlOverride":t.overrides.push(d3(r,e));break}return t}function h3(i,e){let t={id:e.attr(i,"abstractNumId"),levels:[]};for(let r of e.elements(i))switch(r.localName){case"name":t.name=e.attr(r,"val");break;case"multiLevelType":t.multiLevelType=e.attr(r,"val");break;case"numStyleLink":t.numberingStyleLink=e.attr(r,"val");break;case"styleLink":t.styleLink=e.attr(r,"val");break;case"lvl":t.levels.push(ZA(r,e));break}return t}function ZA(i,e){let t={level:e.intAttr(i,"ilvl")};for(let r of e.elements(i))switch(r.localName){case"start":t.start=e.attr(r,"val");break;case"lvlRestart":t.restart=e.intAttr(r,"val");break;case"numFmt":t.format=e.attr(r,"val");break;case"lvlText":t.text=e.attr(r,"val");break;case"lvlJc":t.justification=e.attr(r,"val");break;case"lvlPicBulletId":t.bulletPictureId=e.attr(r,"val");break;case"pStyle":t.paragraphStyle=e.attr(r,"val");break;case"pPr":t.paragraphProps=XA(r,e);break;case"rPr":t.runProps=pv(r,e);break}return t}function d3(i,e){let t={level:e.intAttr(i,"ilvl")};for(let r of e.elements(i))switch(r.localName){case"startOverride":t.start=e.intAttr(r,"val");break;case"lvl":t.numberingLevel=ZA(r,e);break}return t}function f3(i,e){var t=e.element(i,"pict"),r=t&&e.element(t,"shape"),n=r&&e.element(r,"imagedata");return n?{id:e.attr(i,"numPicBulletId"),referenceId:e.attr(n,"id"),style:e.attr(r,"style")}:null}class p3 extends li{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){Object.assign(this,u3(e,this._package.xmlParser)),this.domNumberings=this._documentParser.parseNumberingFile(e)}}class g3 extends li{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.styles=this._documentParser.parseStylesFile(e)}}var xe;(function(i){i.Document="document",i.Paragraph="paragraph",i.Run="run",i.Break="break",i.NoBreakHyphen="noBreakHyphen",i.Table="table",i.Row="row",i.Cell="cell",i.Hyperlink="hyperlink",i.SmartTag="smartTag",i.Drawing="drawing",i.Image="image",i.Text="text",i.Tab="tab",i.Symbol="symbol",i.BookmarkStart="bookmarkStart",i.BookmarkEnd="bookmarkEnd",i.Footer="footer",i.Header="header",i.FootnoteReference="footnoteReference",i.EndnoteReference="endnoteReference",i.Footnote="footnote",i.Endnote="endnote",i.SimpleField="simpleField",i.ComplexField="complexField",i.Instruction="instruction",i.VmlPicture="vmlPicture",i.MmlMath="mmlMath",i.MmlMathParagraph="mmlMathParagraph",i.MmlFraction="mmlFraction",i.MmlFunction="mmlFunction",i.MmlFunctionName="mmlFunctionName",i.MmlNumerator="mmlNumerator",i.MmlDenominator="mmlDenominator",i.MmlRadical="mmlRadical",i.MmlBase="mmlBase",i.MmlDegree="mmlDegree",i.MmlSuperscript="mmlSuperscript",i.MmlSubscript="mmlSubscript",i.MmlPreSubSuper="mmlPreSubSuper",i.MmlSubArgument="mmlSubArgument",i.MmlSuperArgument="mmlSuperArgument",i.MmlNary="mmlNary",i.MmlDelimiter="mmlDelimiter",i.MmlRun="mmlRun",i.MmlEquationArray="mmlEquationArray",i.MmlLimit="mmlLimit",i.MmlLimitLower="mmlLimitLower",i.MmlMatrix="mmlMatrix",i.MmlMatrixRow="mmlMatrixRow",i.MmlBox="mmlBox",i.MmlBar="mmlBar",i.MmlGroupChar="mmlGroupChar",i.VmlElement="vmlElement",i.Inserted="inserted",i.Deleted="deleted",i.DeletedText="deletedText",i.Comment="comment",i.CommentReference="commentReference",i.CommentRangeStart="commentRangeStart",i.CommentRangeEnd="commentRangeEnd",i.AltChunk="altChunk"})(xe||(xe={}));class Ql{constructor(){this.children=[],this.cssStyle={}}}class m3 extends Ql{constructor(){super(...arguments),this.type=xe.Header}}class b3 extends Ql{constructor(){super(...arguments),this.type=xe.Footer}}class KA extends li{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.rootElement=this.createRootElement(),this.rootElement.children=this._documentParser.parseBodyElements(e)}}class v3 extends KA{createRootElement(){return new m3}}class y3 extends KA{createRootElement(){return new b3}}function w3(i,e){const t={};for(let r of e.elements(i))switch(r.localName){case"Template":t.template=r.textContent;break;case"Pages":t.pages=ih(r.textContent);break;case"Words":t.words=ih(r.textContent);break;case"Characters":t.characters=ih(r.textContent);break;case"Application":t.application=r.textContent;break;case"Lines":t.lines=ih(r.textContent);break;case"Paragraphs":t.paragraphs=ih(r.textContent);break;case"Company":t.company=r.textContent;break;case"AppVersion":t.appVersion=r.textContent;break}return t}function ih(i){if(!(typeof i>"u"))return parseInt(i)}class x3 extends li{parseXml(e){this.props=w3(e,this._package.xmlParser)}}function A3(i,e){const t={};for(let r of e.elements(i))switch(r.localName){case"title":t.title=r.textContent;break;case"description":t.description=r.textContent;break;case"subject":t.subject=r.textContent;break;case"creator":t.creator=r.textContent;break;case"keywords":t.keywords=r.textContent;break;case"language":t.language=r.textContent;break;case"lastModifiedBy":t.lastModifiedBy=r.textContent;break;case"revision":r.textContent&&(t.revision=parseInt(r.textContent));break}return t}class E3 extends li{parseXml(e){this.props=A3(e,this._package.xmlParser)}}class _3{}function C3(i,e){var t=new _3,r=e.element(i,"themeElements");for(let n of e.elements(r))switch(n.localName){case"clrScheme":t.colorScheme=S3(n,e);break;case"fontScheme":t.fontScheme=T3(n,e);break}return t}function S3(i,e){var t={name:e.attr(i,"name"),colors:{}};for(let s of e.elements(i)){var r=e.element(s,"srgbClr"),n=e.element(s,"sysClr");r?t.colors[s.localName]=e.attr(r,"val"):n&&(t.colors[s.localName]=e.attr(n,"lastClr"))}return t}function T3(i,e){var t={name:e.attr(i,"name")};for(let r of e.elements(i))switch(r.localName){case"majorFont":t.majorFont=T2(r,e);break;case"minorFont":t.minorFont=T2(r,e);break}return t}function T2(i,e){return{latinTypeface:e.elementAttr(i,"latin","typeface"),eaTypeface:e.elementAttr(i,"ea","typeface"),csTypeface:e.elementAttr(i,"cs","typeface")}}class k3 extends li{constructor(e,t){super(e,t)}parseXml(e){this.theme=C3(e,this._package.xmlParser)}}class QA{}class D3 extends QA{constructor(){super(...arguments),this.type=xe.Footnote}}class P3 extends QA{constructor(){super(...arguments),this.type=xe.Endnote}}class JA extends li{constructor(e,t,r){super(e,t),this._documentParser=r}}class R3 extends JA{constructor(e,t,r){super(e,t,r)}parseXml(e){this.notes=this._documentParser.parseNotes(e,"footnote",D3)}}class I3 extends JA{constructor(e,t,r){super(e,t,r)}parseXml(e){this.notes=this._documentParser.parseNotes(e,"endnote",P3)}}function N3(i,e){var t={};for(let r of e.elements(i))switch(r.localName){case"defaultTabStop":t.defaultTabStop=e.lengthAttr(r,"val");break;case"footnotePr":t.footnoteProps=k2(r,e);break;case"endnotePr":t.endnoteProps=k2(r,e);break;case"autoHyphenation":t.autoHyphenation=e.boolAttr(r,"val");break}return t}function k2(i,e){var t={defaultNoteIds:[]};for(let r of e.elements(i))switch(r.localName){case"numFmt":t.nummeringFormat=e.attr(r,"val");break;case"footnote":case"endnote":t.defaultNoteIds.push(e.attr(r,"id"));break}return t}class M3 extends li{constructor(e,t){super(e,t)}parseXml(e){this.settings=N3(e,this._package.xmlParser)}}function L3(i,e){return e.elements(i,"property").map(t=>{const r=t.firstChild;return{formatId:e.attr(t,"fmtid"),name:e.attr(t,"name"),type:r.nodeName,value:r.textContent}})}class O3 extends li{parseXml(e){this.props=L3(e,this._package.xmlParser)}}class F3 extends li{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.comments=this._documentParser.parseComments(e),this.commentMap=wa(this.comments,t=>t.id)}}class B3 extends li{constructor(e,t){super(e,t),this.comments=[]}parseXml(e){const t=this._package.xmlParser;for(let r of t.elements(e,"commentEx"))this.comments.push({paraId:t.attr(r,"paraId"),paraIdParent:t.attr(r,"paraIdParent"),done:t.boolAttr(r,"done")});this.commentMap=wa(this.comments,r=>r.paraId)}}const z3=[{type:Er.OfficeDocument,target:"word/document.xml"},{type:Er.ExtendedProperties,target:"docProps/app.xml"},{type:Er.CoreProperties,target:"docProps/core.xml"},{type:Er.CustomProperties,target:"docProps/custom.xml"}];class gv{constructor(){this.parts=[],this.partsMap={}}static async load(e,t,r){var n=new gv;return n._options=r,n._parser=t,n._package=await fv.load(e,r),n.rels=await n._package.loadRelationships(),await Promise.all(z3.map(s=>{const a=n.rels.find(o=>o.type===s.type)??s;return n.loadRelationshipPart(a.target,a.type)})),n}save(e="blob"){return this._package.save(e)}async loadRelationshipPart(e,t){var n;if(this.partsMap[e])return this.partsMap[e];if(!this._package.get(e))return null;let r=null;switch(t){case Er.OfficeDocument:this.documentPart=r=new t3(this._package,e,this._parser);break;case Er.FontTable:this.fontTablePart=r=new JR(this._package,e);break;case Er.Numbering:this.numberingPart=r=new p3(this._package,e,this._parser);break;case Er.Styles:this.stylesPart=r=new g3(this._package,e,this._parser);break;case Er.Theme:this.themePart=r=new k3(this._package,e);break;case Er.Footnotes:this.footnotesPart=r=new R3(this._package,e,this._parser);break;case Er.Endnotes:this.endnotesPart=r=new I3(this._package,e,this._parser);break;case Er.Footer:r=new y3(this._package,e,this._parser);break;case Er.Header:r=new v3(this._package,e,this._parser);break;case Er.CoreProperties:this.corePropsPart=r=new E3(this._package,e);break;case Er.ExtendedProperties:this.extendedPropsPart=r=new x3(this._package,e);break;case Er.CustomProperties:r=new O3(this._package,e);break;case Er.Settings:this.settingsPart=r=new M3(this._package,e);break;case Er.Comments:this.commentsPart=r=new F3(this._package,e,this._parser);break;case Er.CommentsExtended:this.commentsExtendedPart=r=new B3(this._package,e);break}if(r==null)return Promise.resolve(null);if(this.partsMap[e]=r,this.parts.push(r),await r.load(),((n=r.rels)==null?void 0:n.length)>0){const[s]=Gp(r.path);await Promise.all(r.rels.map(a=>this.loadRelationshipPart(Qm(a.target,s),a.type)))}return r}async loadDocumentImage(e,t){const r=await this.loadResource(t??this.documentPart,e,"blob");return this.blobToURL(r)}async loadNumberingImage(e){const t=await this.loadResource(this.numberingPart,e,"blob");return this.blobToURL(t)}async loadFont(e,t){const r=await this.loadResource(this.fontTablePart,e,"uint8array");return r&&this.blobToURL(new Blob([j3(r,t)]))}async loadAltChunk(e,t){return await this.loadResource(t??this.documentPart,e,"string")}blobToURL(e){return e?this._options.useBase64URL?UR(e):URL.createObjectURL(e):null}findPartByRelId(e,t=null){var r=(t.rels??this.rels).find(s=>s.id==e);const n=t?Gp(t.path)[0]:"";return r?this.partsMap[Qm(r.target,n)]:null}getPathById(e,t){const r=e.rels.find(s=>s.id==t),[n]=Gp(e.path);return r?Qm(r.target,n):null}loadResource(e,t,r){const n=this.getPathById(e,t);return n?this._package.load(n,r):Promise.resolve(null)}}function j3(i,e){const r=e.replace(/{|}|-/g,""),n=new Array(16);for(let s=0;s<16;s++)n[16-s-1]=parseInt(r.substring(s*2,s*2+2),16);for(let s=0;s<32;s++)i[s]=i[s]^n[s%16];return i}function U3(i,e){return{type:xe.BookmarkStart,id:e.attr(i,"id"),name:e.attr(i,"name"),colFirst:e.intAttr(i,"colFirst"),colLast:e.intAttr(i,"colLast")}}function H3(i,e){return{type:xe.BookmarkEnd,id:e.attr(i,"id")}}class $3 extends Ql{constructor(){super(...arguments),this.type=xe.VmlElement,this.attrs={}}}function eE(i,e){var t=new $3;switch(i.localName){case"rect":t.tagName="rect",Object.assign(t.attrs,{width:"100%",height:"100%"});break;case"oval":t.tagName="ellipse",Object.assign(t.attrs,{cx:"50%",cy:"50%",rx:"50%",ry:"50%"});break;case"line":t.tagName="line";break;case"shape":t.tagName="g";break;case"textbox":t.tagName="foreignObject",Object.assign(t.attrs,{width:"100%",height:"100%"});break;default:return null}for(const r of ne.attrs(i))switch(r.localName){case"style":t.cssStyleText=r.value;break;case"fillcolor":t.attrs.fill=r.value;break;case"from":const[n,s]=D2(r.value);Object.assign(t.attrs,{x1:n,y1:s});break;case"to":const[a,o]=D2(r.value);Object.assign(t.attrs,{x2:a,y2:o});break}for(const r of ne.elements(i))switch(r.localName){case"stroke":Object.assign(t.attrs,V3(r));break;case"fill":Object.assign(t.attrs,G3());break;case"imagedata":t.tagName="image",Object.assign(t.attrs,{width:"100%",height:"100%"}),t.imageHref={id:ne.attr(r,"id"),title:ne.attr(r,"title")};break;case"txbxContent":t.children.push(...e.parseBodyElements(r));break;default:const n=eE(r,e);n&&t.children.push(n);break}return t}function V3(i){return{stroke:ne.attr(i,"color"),"stroke-width":ne.lengthAttr(i,"weight",kr.Emu)??"1px"}}function G3(i){return{}}function D2(i){return i.split(",")}class q3 extends Ql{constructor(){super(...arguments),this.type=xe.Comment}}class W3 extends Ql{constructor(e){super(),this.id=e,this.type=xe.CommentReference}}class X3 extends Ql{constructor(e){super(),this.id=e,this.type=xe.CommentRangeStart}}class Y3 extends Ql{constructor(e){super(),this.id=e,this.type=xe.CommentRangeEnd}}var qp={shd:"inherit",color:"black",borderColor:"black",highlight:"transparent"};const Z3=[],P2={oMath:xe.MmlMath,oMathPara:xe.MmlMathParagraph,f:xe.MmlFraction,func:xe.MmlFunction,fName:xe.MmlFunctionName,num:xe.MmlNumerator,den:xe.MmlDenominator,rad:xe.MmlRadical,deg:xe.MmlDegree,e:xe.MmlBase,sSup:xe.MmlSuperscript,sSub:xe.MmlSubscript,sPre:xe.MmlPreSubSuper,sup:xe.MmlSuperArgument,sub:xe.MmlSubArgument,d:xe.MmlDelimiter,nary:xe.MmlNary,eqArr:xe.MmlEquationArray,lim:xe.MmlLimit,limLow:xe.MmlLimitLower,m:xe.MmlMatrix,mr:xe.MmlMatrixRow,box:xe.MmlBox,bar:xe.MmlBar,groupChr:xe.MmlGroupChar};class K3{constructor(e){this.options={ignoreWidth:!1,debug:!1,...e}}parseNotes(e,t,r){var n=[];for(let s of ne.elements(e,t)){const a=new r;a.id=ne.attr(s,"id"),a.noteType=ne.attr(s,"type"),a.children=this.parseBodyElements(s),n.push(a)}return n}parseComments(e){var t=[];for(let r of ne.elements(e,"comment")){const n=new q3;n.id=ne.attr(r,"id"),n.author=ne.attr(r,"author"),n.initials=ne.attr(r,"initials"),n.date=ne.attr(r,"date"),n.children=this.parseBodyElements(r),t.push(n)}return t}parseDocumentFile(e){var t=ne.element(e,"body"),r=ne.element(e,"background"),n=ne.element(t,"sectPr");return{type:xe.Document,children:this.parseBodyElements(t),props:n?WA(n,ne):{},cssStyle:r?this.parseBackground(r):{}}}parseBackground(e){var t={},r=hu.colorAttr(e,"color");return r&&(t["background-color"]=r),t}parseBodyElements(e){var t=[];for(const r of ne.elements(e))switch(r.localName){case"p":t.push(this.parseParagraph(r));break;case"altChunk":t.push(this.parseAltChunk(r));break;case"tbl":t.push(this.parseTable(r));break;case"sdt":t.push(...this.parseSdt(r,n=>this.parseBodyElements(n)));break}return t}parseStylesFile(e){var t=[];for(const r of ne.elements(e))switch(r.localName){case"style":t.push(this.parseStyle(r));break;case"docDefaults":t.push(this.parseDefaultStyles(r));break}return t}parseDefaultStyles(e){var t={id:null,name:null,target:null,basedOn:null,styles:[]};for(const s of ne.elements(e))switch(s.localName){case"rPrDefault":var r=ne.element(s,"rPr");r&&t.styles.push({target:"span",values:this.parseDefaultProperties(r,{})});break;case"pPrDefault":var n=ne.element(s,"pPr");n&&t.styles.push({target:"p",values:this.parseDefaultProperties(n,{})});break}return t}parseStyle(e){var t={id:ne.attr(e,"styleId"),isDefault:ne.boolAttr(e,"default"),name:null,target:null,basedOn:null,styles:[],linked:null};switch(ne.attr(e,"type")){case"paragraph":t.target="p";break;case"table":t.target="table";break;case"character":t.target="span";break}for(const r of ne.elements(e))switch(r.localName){case"basedOn":t.basedOn=ne.attr(r,"val");break;case"name":t.name=ne.attr(r,"val");break;case"link":t.linked=ne.attr(r,"val");break;case"next":t.next=ne.attr(r,"val");break;case"aliases":t.aliases=ne.attr(r,"val").split(",");break;case"pPr":t.styles.push({target:"p",values:this.parseDefaultProperties(r,{})}),t.paragraphProps=XA(r,ne);break;case"rPr":t.styles.push({target:"span",values:this.parseDefaultProperties(r,{})}),t.runProps=pv(r,ne);break;case"tblPr":case"tcPr":t.styles.push({target:"td",values:this.parseDefaultProperties(r,{})});break;case"tblStylePr":for(let n of this.parseTableStyle(r))t.styles.push(n);break;case"rsid":case"qFormat":case"hidden":case"semiHidden":case"unhideWhenUsed":case"autoRedefine":case"uiPriority":break;default:this.options.debug&&console.warn(`DOCX: Unknown style element: ${r.localName}`)}return t}parseTableStyle(e){var t=[],r=ne.attr(e,"type"),n="",s="";switch(r){case"firstRow":s=".first-row",n="tr.first-row td";break;case"lastRow":s=".last-row",n="tr.last-row td";break;case"firstCol":s=".first-col",n="td.first-col";break;case"lastCol":s=".last-col",n="td.last-col";break;case"band1Vert":s=":not(.no-vband)",n="td.odd-col";break;case"band2Vert":s=":not(.no-vband)",n="td.even-col";break;case"band1Horz":s=":not(.no-hband)",n="tr.odd-row";break;case"band2Horz":s=":not(.no-hband)",n="tr.even-row";break;default:return[]}for(const a of ne.elements(e))switch(a.localName){case"pPr":t.push({target:`${n} p`,mod:s,values:this.parseDefaultProperties(a,{})});break;case"rPr":t.push({target:`${n} span`,mod:s,values:this.parseDefaultProperties(a,{})});break;case"tblPr":case"tcPr":t.push({target:n,mod:s,values:this.parseDefaultProperties(a,{})});break}return t}parseNumberingFile(e){var t=[],r={},n=[];for(const o of ne.elements(e))switch(o.localName){case"abstractNum":this.parseAbstractNumbering(o,n).forEach(l=>t.push(l));break;case"numPicBullet":n.push(this.parseNumberingPicBullet(o));break;case"num":var s=ne.attr(o,"numId"),a=ne.elementAttr(o,"abstractNumId","val");r[a]=s;break}return t.forEach(o=>o.id=r[o.id]),t}parseNumberingPicBullet(e){var t=ne.element(e,"pict"),r=t&&ne.element(t,"shape"),n=r&&ne.element(r,"imagedata");return n?{id:ne.intAttr(e,"numPicBulletId"),src:ne.attr(n,"id"),style:ne.attr(r,"style")}:null}parseAbstractNumbering(e,t){var r=[],n=ne.attr(e,"abstractNumId");for(const s of ne.elements(e))switch(s.localName){case"lvl":r.push(this.parseNumberingLevel(n,s,t));break}return r}parseNumberingLevel(e,t,r){var n={id:e,level:ne.intAttr(t,"ilvl"),start:1,pStyleName:void 0,pStyle:{},rStyle:{},suff:"tab"};for(const a of ne.elements(t))switch(a.localName){case"start":n.start=ne.intAttr(a,"val");break;case"pPr":this.parseDefaultProperties(a,n.pStyle);break;case"rPr":this.parseDefaultProperties(a,n.rStyle);break;case"lvlPicBulletId":var s=ne.intAttr(a,"val");n.bullet=r.find(o=>(o==null?void 0:o.id)==s);break;case"lvlText":n.levelText=ne.attr(a,"val");break;case"pStyle":n.pStyleName=ne.attr(a,"val");break;case"numFmt":n.format=ne.attr(a,"val");break;case"suff":n.suff=ne.attr(a,"val");break}return n}parseSdt(e,t){const r=ne.element(e,"sdtContent");return r?t(r):[]}parseInserted(e,t){var r;return{type:xe.Inserted,children:((r=t(e))==null?void 0:r.children)??[]}}parseDeleted(e,t){var r;return{type:xe.Deleted,children:((r=t(e))==null?void 0:r.children)??[]}}parseAltChunk(e){return{type:xe.AltChunk,children:[],id:ne.attr(e,"id")}}parseParagraph(e){var t={type:xe.Paragraph,children:[]};for(let r of ne.elements(e))switch(r.localName){case"pPr":this.parseParagraphProperties(r,t);break;case"r":t.children.push(this.parseRun(r,t));break;case"hyperlink":t.children.push(this.parseHyperlink(r,t));break;case"smartTag":t.children.push(this.parseSmartTag(r,t));break;case"bookmarkStart":t.children.push(U3(r,ne));break;case"bookmarkEnd":t.children.push(H3(r,ne));break;case"commentRangeStart":t.children.push(new X3(ne.attr(r,"id")));break;case"commentRangeEnd":t.children.push(new Y3(ne.attr(r,"id")));break;case"oMath":case"oMathPara":t.children.push(this.parseMathElement(r));break;case"sdt":t.children.push(...this.parseSdt(r,n=>this.parseParagraph(n).children));break;case"ins":t.children.push(this.parseInserted(r,n=>this.parseParagraph(n)));break;case"del":t.children.push(this.parseDeleted(r,n=>this.parseParagraph(n)));break}return t}parseParagraphProperties(e,t){this.parseDefaultProperties(e,t.cssStyle={},null,r=>{if(YA(r,t,ne))return!0;switch(r.localName){case"pStyle":t.styleName=ne.attr(r,"val");break;case"cnfStyle":t.className=Kt.classNameOfCnfStyle(r);break;case"framePr":this.parseFrame(r,t);break;case"rPr":break;default:return!1}return!0})}parseFrame(e,t){var r=ne.attr(e,"dropCap");r=="drop"&&(t.cssStyle.float="left")}parseHyperlink(e,t){var r={type:xe.Hyperlink,parent:t,children:[]};r.anchor=ne.attr(e,"anchor"),r.id=ne.attr(e,"id");for(const n of ne.elements(e))switch(n.localName){case"r":r.children.push(this.parseRun(n,r));break}return r}parseSmartTag(e,t){var r={type:xe.SmartTag,parent:t,children:[]},n=ne.attr(e,"uri"),s=ne.attr(e,"element");n&&(r.uri=n),s&&(r.element=s);for(const a of ne.elements(e))switch(a.localName){case"r":r.children.push(this.parseRun(a,r));break}return r}parseRun(e,t){var r={type:xe.Run,parent:t,children:[]};for(let n of ne.elements(e))switch(n=this.checkAlternateContent(n),n.localName){case"t":r.children.push({type:xe.Text,text:n.textContent});break;case"delText":r.children.push({type:xe.DeletedText,text:n.textContent});break;case"commentReference":r.children.push(new W3(ne.attr(n,"id")));break;case"fldSimple":r.children.push({type:xe.SimpleField,instruction:ne.attr(n,"instr"),lock:ne.boolAttr(n,"lock",!1),dirty:ne.boolAttr(n,"dirty",!1)});break;case"instrText":r.fieldRun=!0,r.children.push({type:xe.Instruction,text:n.textContent});break;case"fldChar":r.fieldRun=!0,r.children.push({type:xe.ComplexField,charType:ne.attr(n,"fldCharType"),lock:ne.boolAttr(n,"lock",!1),dirty:ne.boolAttr(n,"dirty",!1)});break;case"noBreakHyphen":r.children.push({type:xe.NoBreakHyphen});break;case"br":r.children.push({type:xe.Break,break:ne.attr(n,"type")||"textWrapping"});break;case"lastRenderedPageBreak":r.children.push({type:xe.Break,break:"lastRenderedPageBreak"});break;case"sym":r.children.push({type:xe.Symbol,font:kb(ne.attr(n,"font")),char:ne.attr(n,"char")});break;case"tab":r.children.push({type:xe.Tab});break;case"footnoteReference":r.children.push({type:xe.FootnoteReference,id:ne.attr(n,"id")});break;case"endnoteReference":r.children.push({type:xe.EndnoteReference,id:ne.attr(n,"id")});break;case"drawing":let s=this.parseDrawing(n);s&&(r.children=[s]);break;case"pict":r.children.push(this.parseVmlPicture(n));break;case"rPr":this.parseRunProperties(n,r);break}return r}parseMathElement(e){const t=`${e.localName}Pr`,r={type:P2[e.localName],children:[]};for(const s of ne.elements(e))if(P2[s.localName])r.children.push(this.parseMathElement(s));else if(s.localName=="r"){var n=this.parseRun(s);n.type=xe.MmlRun,r.children.push(n)}else s.localName==t&&(r.props=this.parseMathProperies(s));return r}parseMathProperies(e){const t={};for(const r of ne.elements(e))switch(r.localName){case"chr":t.char=ne.attr(r,"val");break;case"vertJc":t.verticalJustification=ne.attr(r,"val");break;case"pos":t.position=ne.attr(r,"val");break;case"degHide":t.hideDegree=ne.boolAttr(r,"val");break;case"begChr":t.beginChar=ne.attr(r,"val");break;case"endChr":t.endChar=ne.attr(r,"val");break}return t}parseRunProperties(e,t){this.parseDefaultProperties(e,t.cssStyle={},null,r=>{switch(r.localName){case"rStyle":t.styleName=ne.attr(r,"val");break;case"vertAlign":t.verticalAlign=Kt.valueOfVertAlign(r,!0);break;default:return!1}return!0})}parseVmlPicture(e){const t={type:xe.VmlPicture,children:[]};for(const r of ne.elements(e)){const n=eE(r,this);n&&t.children.push(n)}return t}checkAlternateContent(e){var s;if(e.localName!="AlternateContent")return e;var t=ne.element(e,"Choice");if(t){var r=ne.attr(t,"Requires"),n=e.lookupNamespaceURI(r);if(Z3.includes(n))return t.firstElementChild}return(s=ne.element(e,"Fallback"))==null?void 0:s.firstElementChild}parseDrawing(e){for(var t of ne.elements(e))switch(t.localName){case"inline":case"anchor":return this.parseDrawingWrapper(t)}}parseDrawingWrapper(e){var t={type:xe.Drawing,children:[],cssStyle:{}},r=e.localName=="anchor";let n=null,s=ne.boolAttr(e,"simplePos");ne.boolAttr(e,"behindDoc");let a={relative:"page",align:"left",offset:"0"},o={relative:"page",align:"top",offset:"0"};for(var l of ne.elements(e))switch(l.localName){case"simplePos":s&&(a.offset=ne.lengthAttr(l,"x",kr.Emu),o.offset=ne.lengthAttr(l,"y",kr.Emu));break;case"extent":t.cssStyle.width=ne.lengthAttr(l,"cx",kr.Emu),t.cssStyle.height=ne.lengthAttr(l,"cy",kr.Emu);break;case"positionH":case"positionV":if(!s){let p=l.localName=="positionH"?a:o;var c=ne.element(l,"align"),h=ne.element(l,"posOffset");p.relative=ne.attr(l,"relativeFrom")??p.relative,c&&(p.align=c.textContent),h&&(p.offset=VA(h.textContent,kr.Emu))}break;case"wrapTopAndBottom":n="wrapTopAndBottom";break;case"wrapNone":n="wrapNone";break;case"graphic":var d=this.parseGraphic(l);d&&t.children.push(d);break}return n=="wrapTopAndBottom"?(t.cssStyle.display="block",a.align&&(t.cssStyle["text-align"]=a.align,t.cssStyle.width="100%")):n=="wrapNone"?(t.cssStyle.display="block",t.cssStyle.position="relative",t.cssStyle.width="0px",t.cssStyle.height="0px",a.offset&&(t.cssStyle.left=a.offset),o.offset&&(t.cssStyle.top=o.offset)):r&&(a.align=="left"||a.align=="right")&&(t.cssStyle.float=a.align),t}parseGraphic(e){var t=ne.element(e,"graphicData");for(let r of ne.elements(t))switch(r.localName){case"pic":return this.parsePicture(r)}return null}parsePicture(e){var t={type:xe.Image,src:"",cssStyle:{}},r=ne.element(e,"blipFill"),n=ne.element(r,"blip"),s=ne.element(r,"srcRect");t.src=ne.attr(n,"embed"),s&&(t.srcRect=[ne.intAttr(s,"l",0)/1e5,ne.intAttr(s,"t",0)/1e5,ne.intAttr(s,"r",0)/1e5,ne.intAttr(s,"b",0)/1e5]);var a=ne.element(e,"spPr"),o=ne.element(a,"xfrm");if(t.cssStyle.position="relative",o){t.rotation=ne.intAttr(o,"rot",0)/6e4;for(var l of ne.elements(o))switch(l.localName){case"ext":t.cssStyle.width=ne.lengthAttr(l,"cx",kr.Emu),t.cssStyle.height=ne.lengthAttr(l,"cy",kr.Emu);break;case"off":t.cssStyle.left=ne.lengthAttr(l,"x",kr.Emu),t.cssStyle.top=ne.lengthAttr(l,"y",kr.Emu);break}}return t}parseTable(e){var t={type:xe.Table,children:[]};for(const r of ne.elements(e))switch(r.localName){case"tr":t.children.push(this.parseTableRow(r));break;case"tblGrid":t.columns=this.parseTableColumns(r);break;case"tblPr":this.parseTableProperties(r,t);break}return t}parseTableColumns(e){var t=[];for(const r of ne.elements(e))switch(r.localName){case"gridCol":t.push({width:ne.lengthAttr(r,"w")});break}return t}parseTableProperties(e,t){switch(t.cssStyle={},t.cellStyle={},this.parseDefaultProperties(e,t.cssStyle,t.cellStyle,r=>{switch(r.localName){case"tblStyle":t.styleName=ne.attr(r,"val");break;case"tblLook":t.className=Kt.classNameOftblLook(r);break;case"tblpPr":this.parseTablePosition(r,t);break;case"tblStyleColBandSize":t.colBandSize=ne.intAttr(r,"val");break;case"tblStyleRowBandSize":t.rowBandSize=ne.intAttr(r,"val");break;case"hidden":t.cssStyle.display="none";break;default:return!1}return!0}),t.cssStyle["text-align"]){case"center":delete t.cssStyle["text-align"],t.cssStyle["margin-left"]="auto",t.cssStyle["margin-right"]="auto";break;case"right":delete t.cssStyle["text-align"],t.cssStyle["margin-left"]="auto";break}}parseTablePosition(e,t){var r=ne.lengthAttr(e,"topFromText"),n=ne.lengthAttr(e,"bottomFromText"),s=ne.lengthAttr(e,"rightFromText"),a=ne.lengthAttr(e,"leftFromText");t.cssStyle.float="left",t.cssStyle["margin-bottom"]=Kt.addSize(t.cssStyle["margin-bottom"],n),t.cssStyle["margin-left"]=Kt.addSize(t.cssStyle["margin-left"],a),t.cssStyle["margin-right"]=Kt.addSize(t.cssStyle["margin-right"],s),t.cssStyle["margin-top"]=Kt.addSize(t.cssStyle["margin-top"],r)}parseTableRow(e){var t={type:xe.Row,children:[]};for(const r of ne.elements(e))switch(r.localName){case"tc":t.children.push(this.parseTableCell(r));break;case"trPr":case"tblPrEx":this.parseTableRowProperties(r,t);break}return t}parseTableRowProperties(e,t){t.cssStyle=this.parseDefaultProperties(e,{},null,r=>{switch(r.localName){case"cnfStyle":t.className=Kt.classNameOfCnfStyle(r);break;case"tblHeader":t.isHeader=ne.boolAttr(r,"val");break;case"gridBefore":t.gridBefore=ne.intAttr(r,"val");break;case"gridAfter":t.gridAfter=ne.intAttr(r,"val");break;default:return!1}return!0})}parseTableCell(e){var t={type:xe.Cell,children:[]};for(const r of ne.elements(e))switch(r.localName){case"tbl":t.children.push(this.parseTable(r));break;case"p":t.children.push(this.parseParagraph(r));break;case"tcPr":this.parseTableCellProperties(r,t);break}return t}parseTableCellProperties(e,t){t.cssStyle=this.parseDefaultProperties(e,{},null,r=>{switch(r.localName){case"gridSpan":t.span=ne.intAttr(r,"val",null);break;case"vMerge":t.verticalMerge=ne.attr(r,"val")??"continue";break;case"cnfStyle":t.className=Kt.classNameOfCnfStyle(r);break;default:return!1}return!0}),this.parseTableCellVerticalText(e,t)}parseTableCellVerticalText(e,t){const r={btLr:{writingMode:"vertical-rl",transform:"rotate(180deg)"},lrTb:{writingMode:"vertical-lr",transform:"none"},tbRl:{writingMode:"vertical-rl",transform:"none"}};for(const n of ne.elements(e))if(n.localName==="textDirection"){const s=ne.attr(n,"val"),a=r[s]||{writingMode:"horizontal-tb"};t.cssStyle["writing-mode"]=a.writingMode,t.cssStyle.transform=a.transform}}parseDefaultProperties(e,t=null,r=null,n=null){t=t||{};for(const s of ne.elements(e))if(!(n!=null&&n(s)))switch(s.localName){case"jc":t["text-align"]=Kt.valueOfJc(s);break;case"textAlignment":t["vertical-align"]=Kt.valueOfTextAlignment(s);break;case"color":t.color=hu.colorAttr(s,"val",null,qp.color);break;case"sz":t["font-size"]=t["min-height"]=ne.lengthAttr(s,"val",kr.FontSize);break;case"shd":t["background-color"]=hu.colorAttr(s,"fill",null,qp.shd);break;case"highlight":t["background-color"]=hu.colorAttr(s,"val",null,qp.highlight);break;case"vertAlign":break;case"position":t.verticalAlign=ne.lengthAttr(s,"val",kr.FontSize);break;case"tcW":if(this.options.ignoreWidth)break;case"tblW":t.width=Kt.valueOfSize(s,"w");break;case"trHeight":this.parseTrHeight(s,t);break;case"strike":t["text-decoration"]=ne.boolAttr(s,"val",!0)?"line-through":"none";break;case"b":t["font-weight"]=ne.boolAttr(s,"val",!0)?"bold":"normal";break;case"i":t["font-style"]=ne.boolAttr(s,"val",!0)?"italic":"normal";break;case"caps":t["text-transform"]=ne.boolAttr(s,"val",!0)?"uppercase":"none";break;case"smallCaps":t["font-variant"]=ne.boolAttr(s,"val",!0)?"small-caps":"none";break;case"u":this.parseUnderline(s,t);break;case"ind":case"tblInd":this.parseIndentation(s,t);break;case"rFonts":this.parseFont(s,t);break;case"tblBorders":this.parseBorderProperties(s,r||t);break;case"tblCellSpacing":t["border-spacing"]=Kt.valueOfMargin(s),t["border-collapse"]="separate";break;case"pBdr":this.parseBorderProperties(s,t);break;case"bdr":t.border=Kt.valueOfBorder(s);break;case"tcBorders":this.parseBorderProperties(s,t);break;case"vanish":ne.boolAttr(s,"val",!0)&&(t.display="none");break;case"kern":break;case"noWrap":break;case"tblCellMar":case"tcMar":this.parseMarginProperties(s,r||t);break;case"tblLayout":t["table-layout"]=Kt.valueOfTblLayout(s);break;case"vAlign":t["vertical-align"]=Kt.valueOfTextAlignment(s);break;case"spacing":e.localName=="pPr"&&this.parseSpacing(s,t);break;case"wordWrap":ne.boolAttr(s,"val")&&(t["overflow-wrap"]="break-word");break;case"suppressAutoHyphens":t.hyphens=ne.boolAttr(s,"val",!0)?"none":"auto";break;case"lang":t.$lang=ne.attr(s,"val");break;case"rtl":case"bidi":ne.boolAttr(s,"val",!0)&&(t.direction="rtl");break;case"bCs":case"iCs":case"szCs":case"tabs":case"outlineLvl":case"contextualSpacing":case"tblStyleColBandSize":case"tblStyleRowBandSize":case"webHidden":case"pageBreakBefore":case"suppressLineNumbers":case"keepLines":case"keepNext":case"widowControl":case"bidi":case"rtl":case"noProof":break;default:this.options.debug&&console.warn(`DOCX: Unknown document element: ${e.localName}.${s.localName}`);break}return t}parseUnderline(e,t){var r=ne.attr(e,"val");if(r!=null){switch(r){case"dash":case"dashDotDotHeavy":case"dashDotHeavy":case"dashedHeavy":case"dashLong":case"dashLongHeavy":case"dotDash":case"dotDotDash":t["text-decoration"]="underline dashed";break;case"dotted":case"dottedHeavy":t["text-decoration"]="underline dotted";break;case"double":t["text-decoration"]="underline double";break;case"single":case"thick":t["text-decoration"]="underline";break;case"wave":case"wavyDouble":case"wavyHeavy":t["text-decoration"]="underline wavy";break;case"words":t["text-decoration"]="underline";break;case"none":t["text-decoration"]="none";break}var n=hu.colorAttr(e,"color");n&&(t["text-decoration-color"]=n)}}parseFont(e,t){var r=ne.attr(e,"ascii"),n=Kt.themeValue(e,"asciiTheme"),s=ne.attr(e,"eastAsia"),a=[r,n,s].filter(o=>o).map(o=>kb(o));a.length>0&&(t["font-family"]=[...new Set(a)].join(", "))}parseIndentation(e,t){var r=ne.lengthAttr(e,"firstLine"),n=ne.lengthAttr(e,"hanging"),s=ne.lengthAttr(e,"left"),a=ne.lengthAttr(e,"start"),o=ne.lengthAttr(e,"right"),l=ne.lengthAttr(e,"end");r&&(t["text-indent"]=r),n&&(t["text-indent"]=`-${n}`),(s||a)&&(t["margin-inline-start"]=s||a),(o||l)&&(t["margin-inline-end"]=o||l)}parseSpacing(e,t){var r=ne.lengthAttr(e,"before"),n=ne.lengthAttr(e,"after"),s=ne.intAttr(e,"line",null),a=ne.attr(e,"lineRule");if(r&&(t["margin-top"]=r),n&&(t["margin-bottom"]=n),s!==null)switch(a){case"auto":t["line-height"]=`${(s/240).toFixed(2)}`;break;case"atLeast":t["line-height"]=`calc(100% + ${s/20}pt)`;break;default:t["line-height"]=t["min-height"]=`${s/20}pt`;break}}parseMarginProperties(e,t){for(const r of ne.elements(e))switch(r.localName){case"left":t["padding-left"]=Kt.valueOfMargin(r);break;case"right":t["padding-right"]=Kt.valueOfMargin(r);break;case"top":t["padding-top"]=Kt.valueOfMargin(r);break;case"bottom":t["padding-bottom"]=Kt.valueOfMargin(r);break}}parseTrHeight(e,t){switch(ne.attr(e,"hRule")){case"exact":t.height=ne.lengthAttr(e,"val");break;case"atLeast":default:t.height=ne.lengthAttr(e,"val");break}}parseBorderProperties(e,t){for(const r of ne.elements(e))switch(r.localName){case"start":case"left":t["border-left"]=Kt.valueOfBorder(r);break;case"end":case"right":t["border-right"]=Kt.valueOfBorder(r);break;case"top":t["border-top"]=Kt.valueOfBorder(r);break;case"bottom":t["border-bottom"]=Kt.valueOfBorder(r);break}}}const Q3=["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","none","red","white","yellow"];class hu{static colorAttr(e,t,r=null,n="black"){var s=ne.attr(e,t);if(s)return s=="auto"?n:Q3.includes(s)?s:`#${s}`;var a=ne.attr(e,"themeColor");return a?`var(--docx-${a}-color)`:r}}class Kt{static themeValue(e,t){var r=ne.attr(e,t);return r?`var(--docx-${r}-font)`:null}static valueOfSize(e,t){var r=kr.Dxa;switch(ne.attr(e,"type")){case"dxa":break;case"pct":r=kr.Percent;break;case"auto":return"auto"}return ne.lengthAttr(e,t,r)}static valueOfMargin(e){return ne.lengthAttr(e,"w")}static valueOfBorder(e){var t=Kt.parseBorderType(ne.attr(e,"val"));if(t=="none")return"none";var r=hu.colorAttr(e,"color"),n=ne.lengthAttr(e,"sz",kr.Border);return`${n} ${t} ${r=="auto"?qp.borderColor:r}`}static parseBorderType(e){switch(e){case"single":return"solid";case"dashDotStroked":return"solid";case"dashed":return"dashed";case"dashSmallGap":return"dashed";case"dotDash":return"dotted";case"dotDotDash":return"dotted";case"dotted":return"dotted";case"double":return"double";case"doubleWave":return"double";case"inset":return"inset";case"nil":return"none";case"none":return"none";case"outset":return"outset";case"thick":return"solid";case"thickThinLargeGap":return"solid";case"thickThinMediumGap":return"solid";case"thickThinSmallGap":return"solid";case"thinThickLargeGap":return"solid";case"thinThickMediumGap":return"solid";case"thinThickSmallGap":return"solid";case"thinThickThinLargeGap":return"solid";case"thinThickThinMediumGap":return"solid";case"thinThickThinSmallGap":return"solid";case"threeDEmboss":return"solid";case"threeDEngrave":return"solid";case"triple":return"double";case"wave":return"solid"}return"solid"}static valueOfTblLayout(e){var t=ne.attr(e,"val");return t=="fixed"?"fixed":"auto"}static classNameOfCnfStyle(e){const t=ne.attr(e,"val");return["first-row","last-row","first-col","last-col","odd-col","even-col","odd-row","even-row","ne-cell","nw-cell","se-cell","sw-cell"].filter((n,s)=>t[s]=="1").join(" ")}static valueOfJc(e){var t=ne.attr(e,"val");switch(t){case"start":case"left":return"left";case"center":return"center";case"end":case"right":return"right";case"both":return"justify"}return t}static valueOfVertAlign(e,t=!1){var r=ne.attr(e,"val");switch(r){case"subscript":return"sub";case"superscript":return t?"sup":"super"}return t?null:r}static valueOfTextAlignment(e){var t=ne.attr(e,"val");switch(t){case"auto":case"baseline":return"baseline";case"top":return"top";case"center":return"middle";case"bottom":return"bottom"}return t}static addSize(e,t){return e==null?t:t==null?e:`calc(${e} + ${t})`}static classNameOftblLook(e){const t=ne.hexAttr(e,"val",0);let r="";return(ne.boolAttr(e,"firstRow")||t&32)&&(r+=" first-row"),(ne.boolAttr(e,"lastRow")||t&64)&&(r+=" last-row"),(ne.boolAttr(e,"firstColumn")||t&128)&&(r+=" first-col"),(ne.boolAttr(e,"lastColumn")||t&256)&&(r+=" last-col"),(ne.boolAttr(e,"noHBand")||t&512)&&(r+=" no-hband"),(ne.boolAttr(e,"noVBand")||t&1024)&&(r+=" no-vband"),r.trim()}}const R2={pos:0,leader:"none",style:"left"},J3=50;function e5(i=document.body){const e=document.createElement("div");e.style.width="100pt",i.appendChild(e);const t=100/e.offsetWidth;return i.removeChild(e),t}function t5(i,e,t,r=72/96){const n=i.closest("p"),s=i.getBoundingClientRect(),a=n.getBoundingClientRect(),o=getComputedStyle(n),l=(e==null?void 0:e.length)>0?e.map(A=>({pos:I2(A.position),leader:A.leader,style:A.style})).sort((A,E)=>A.pos-E.pos):[R2],c=l[l.length-1],h=a.width*r,d=I2(t);let p=c.pos+d;if(p<h)for(;p<h&&l.length<J3;p+=d)l.push({...R2,pos:p});const g=parseFloat(o.marginLeft),y=a.left+g,b=(s.left-y)*r,w=l.find(A=>A.style!="clear"&&A.pos>b);if(w==null)return;let v=1;if(w.style=="right"||w.style=="center"){const A=Array.from(n.querySelectorAll(`.${i.className}`)),E=A.indexOf(i)+1,_=document.createRange();_.setStart(i,1),E<A.length?_.setEndBefore(A[E]):_.setEndAfter(n);const C=w.style=="center"?.5:1,I=_.getBoundingClientRect(),k=I.left+C*I.width-(a.left-g);v=w.pos-k*r}else v=w.pos-b;switch(i.innerHTML=" ",i.style.textDecoration="inherit",i.style.wordSpacing=`${v.toFixed(0)}pt`,w.leader){case"dot":case"middleDot":i.style.textDecoration="underline",i.style.textDecorationStyle="dotted";break;case"hyphen":case"heavy":case"underscore":i.style.textDecoration="underline";break}}function I2(i){return parseFloat(i)}const _t={svg:"http://www.w3.org/2000/svg",mathML:"http://www.w3.org/1998/Math/MathML"};class r5{constructor(e){this.htmlDocument=e,this.className="docx",this.styleMap={},this.currentPart=null,this.tableVerticalMerges=[],this.currentVerticalMerge=null,this.tableCellPositions=[],this.currentCellPosition=null,this.footnoteMap={},this.endnoteMap={},this.currentEndnoteIds=[],this.usedHederFooterParts=[],this.currentTabs=[],this.commentMap={},this.tasks=[],this.postRenderTasks=[]}async render(e,t,r=null,n){var a;this.document=e,this.options=n,this.className=n.className,this.rootSelector=n.inWrapper?`.${this.className}-wrapper`:":root",this.styleMap=null,this.tasks=[],this.options.renderComments&&globalThis.Highlight&&(this.commentHighlight=new Highlight),r=r||t,N2(r),N2(t),r.appendChild(this.createComment("docxjs library predefined styles")),r.appendChild(this.renderDefaultStyle()),e.themePart&&(r.appendChild(this.createComment("docxjs document theme values")),this.renderTheme(e.themePart,r)),e.stylesPart!=null&&(this.styleMap=this.processStyles(e.stylesPart.styles),r.appendChild(this.createComment("docxjs document styles")),r.appendChild(this.renderStyles(e.stylesPart.styles))),e.numberingPart&&(this.prodessNumberings(e.numberingPart.domNumberings),r.appendChild(this.createComment("docxjs document numbering styles")),r.appendChild(this.renderNumbering(e.numberingPart.domNumberings,r))),e.footnotesPart&&(this.footnoteMap=wa(e.footnotesPart.notes,o=>o.id)),e.endnotesPart&&(this.endnoteMap=wa(e.endnotesPart.notes,o=>o.id)),e.settingsPart&&(this.defaultTabSize=(a=e.settingsPart.settings)==null?void 0:a.defaultTabStop),!n.ignoreFonts&&e.fontTablePart&&this.renderFontTable(e.fontTablePart,r);var s=this.renderSections(e.documentPart.body);this.options.inWrapper?t.appendChild(this.renderWrapper(s)):e0(t,s),this.commentHighlight&&n.renderComments&&CSS.highlights.set(`${this.className}-comments`,this.commentHighlight),this.postRenderTasks.forEach(o=>o()),await Promise.allSettled(this.tasks),this.refreshTabStops()}renderTheme(e,t){var o,l;const r={},n=(o=e.theme)==null?void 0:o.fontScheme;n&&(n.majorFont&&(r["--docx-majorHAnsi-font"]=n.majorFont.latinTypeface),n.minorFont&&(r["--docx-minorHAnsi-font"]=n.minorFont.latinTypeface));const s=(l=e.theme)==null?void 0:l.colorScheme;if(s)for(let[c,h]of Object.entries(s.colors))r[`--docx-${c}-color`]=`#${h}`;const a=this.styleToString(`.${this.className}`,r);t.appendChild(this.createStyleElement(a))}renderFontTable(e,t){for(let r of e.fonts)for(let n of r.embedFontRefs)this.tasks.push(this.document.loadFont(n.id,n.key).then(s=>{const a={"font-family":kb(r.name),src:`url(${s})`};(n.type=="bold"||n.type=="boldItalic")&&(a["font-weight"]="bold"),(n.type=="italic"||n.type=="boldItalic")&&(a["font-style"]="italic");const o=this.styleToString("@font-face",a);t.appendChild(this.createComment(`docxjs ${r.name} font`)),t.appendChild(this.createStyleElement(o))}))}processStyleName(e){return e?`${this.className}_${jR(e)}`:this.className}processStyles(e){const t=wa(e.filter(n=>n.id!=null),n=>n.id);for(const n of e.filter(s=>s.basedOn)){var r=t[n.basedOn];if(r){n.paragraphProps=ig(n.paragraphProps,r.paragraphProps),n.runProps=ig(n.runProps,r.runProps);for(const s of r.styles){const a=n.styles.find(o=>o.target==s.target);a?this.copyStyleProperties(s.values,a.values):n.styles.push({...s,values:{...s.values}})}}else this.options.debug&&console.warn(`Can't find base style ${n.basedOn}`)}for(let n of e)n.cssName=this.processStyleName(n.id);return t}prodessNumberings(e){var t;for(let r of e.filter(n=>n.pStyleName)){const n=this.findStyle(r.pStyleName);(t=n==null?void 0:n.paragraphProps)!=null&&t.numbering&&(n.paragraphProps.numbering.level=r.level)}}processElement(e){if(e.children)for(var t of e.children)t.parent=e,t.type==xe.Table?this.processTable(t):this.processElement(t)}processTable(e){for(var t of e.children)for(var r of t.children)r.cssStyle=this.copyStyleProperties(e.cellStyle,r.cssStyle,["border-left","border-right","border-top","border-bottom","padding-left","padding-right","padding-top","padding-bottom"]),this.processElement(r)}copyStyleProperties(e,t,r=null){if(!e)return t;t==null&&(t={}),r==null&&(r=Object.getOwnPropertyNames(e));for(var n of r)e.hasOwnProperty(n)&&!t.hasOwnProperty(n)&&(t[n]=e[n]);return t}createPageElement(e,t){var r=this.createElement("section",{className:e});return t&&(t.pageMargins&&(r.style.paddingLeft=t.pageMargins.left,r.style.paddingRight=t.pageMargins.right,r.style.paddingTop=t.pageMargins.top,r.style.paddingBottom=t.pageMargins.bottom),t.pageSize&&(this.options.ignoreWidth||(r.style.width=t.pageSize.width),this.options.ignoreHeight||(r.style.minHeight=t.pageSize.height))),r}createSectionContent(e){var t=this.createElement("article");return e.columns&&e.columns.numberOfColumns&&(t.style.columnCount=`${e.columns.numberOfColumns}`,t.style.columnGap=e.columns.space,e.columns.separator&&(t.style.columnRule="1px solid black")),t}renderSections(e){const t=[];this.processElement(e);const r=this.splitBySection(e.children,e.props),n=this.groupByPageBreaks(r);let s=null;for(let o=0,l=n.length;o<l;o++){this.currentFootnoteIds=[];let h=n[o][0].sectProps;const d=this.createPageElement(this.className,h);this.renderStyleValues(e.cssStyle,d),this.options.renderHeaders&&this.renderHeaderFooter(h.headerRefs,h,t.length,s!=h,d);for(const p of n[o]){var a=this.createSectionContent(p.sectProps);this.renderElements(p.elements,a),d.appendChild(a),h=p.sectProps}this.options.renderFootnotes&&this.renderNotes(this.currentFootnoteIds,this.footnoteMap,d),this.options.renderEndnotes&&o==l-1&&this.renderNotes(this.currentEndnoteIds,this.endnoteMap,d),this.options.renderFooters&&this.renderHeaderFooter(h.footerRefs,h,t.length,s!=h,d),t.push(d),s=h}return t}renderHeaderFooter(e,t,r,n,s){if(e){var a=(t.titlePage&&n?e.find(l=>l.type=="first"):null)??(r%2==1?e.find(l=>l.type=="even"):null)??e.find(l=>l.type=="default"),o=a&&this.document.findPartByRelId(a.id,this.document.documentPart);if(o){this.currentPart=o,this.usedHederFooterParts.includes(o.path)||(this.processElement(o.rootElement),this.usedHederFooterParts.push(o.path));const[l]=this.renderElements([o.rootElement],s);t!=null&&t.pageMargins&&(o.rootElement.type===xe.Header?(l.style.marginTop=`calc(${t.pageMargins.header} - ${t.pageMargins.top})`,l.style.minHeight=`calc(${t.pageMargins.top} - ${t.pageMargins.header})`):o.rootElement.type===xe.Footer&&(l.style.marginBottom=`calc(${t.pageMargins.footer} - ${t.pageMargins.bottom})`,l.style.minHeight=`calc(${t.pageMargins.bottom} - ${t.pageMargins.footer})`)),this.currentPart=null}}}isPageBreakElement(e){return e.type!=xe.Break?!1:e.break=="lastRenderedPageBreak"?!this.options.ignoreLastRenderedPageBreak:e.break=="page"}isPageBreakSection(e,t){var r,n,s,a,o,l;return!e||!t?!1:((r=e.pageSize)==null?void 0:r.orientation)!=((n=t.pageSize)==null?void 0:n.orientation)||((s=e.pageSize)==null?void 0:s.width)!=((a=t.pageSize)==null?void 0:a.width)||((o=e.pageSize)==null?void 0:o.height)!=((l=t.pageSize)==null?void 0:l.height)}splitBySection(e,t){var d;var r={sectProps:null,elements:[],pageBreak:!1},n=[r];for(let p of e){if(p.type==xe.Paragraph){const g=this.findStyle(p.styleName);(d=g==null?void 0:g.paragraphProps)!=null&&d.pageBreakBefore&&(r.sectProps=s,r.pageBreak=!0,r={sectProps:null,elements:[],pageBreak:!1},n.push(r))}if(r.elements.push(p),p.type==xe.Paragraph){const g=p;var s=g.sectionProps,a=-1,o=-1;if(this.options.breakPages&&g.children&&(a=g.children.findIndex(y=>{var b;return o=((b=y.children)==null?void 0:b.findIndex(this.isPageBreakElement.bind(this)))??-1,o!=-1})),(s||a!=-1)&&(r.sectProps=s,r.pageBreak=a!=-1,r={sectProps:null,elements:[],pageBreak:!1},n.push(r)),a!=-1){let y=g.children[a],b=o<y.children.length-1;if(a<g.children.length-1||b){var l=p.children,c={...p,children:l.slice(a)};if(p.children=l.slice(0,a),r.elements.push(c),b){let w=y.children,v={...y,children:w.slice(0,o)};p.children.push(v),y.children=w.slice(o)}}}}}let h=null;for(let p=n.length-1;p>=0;p--)n[p].sectProps==null?n[p].sectProps=h??t:h=n[p].sectProps;return n}groupByPageBreaks(e){let t=[],r;const n=[t];for(let s of e)t.push(s),(this.options.ignoreLastRenderedPageBreak||s.pageBreak||this.isPageBreakSection(r,s.sectProps))&&n.push(t=[]),r=s.sectProps;return n.filter(s=>s.length>0)}renderWrapper(e){return this.createElement("div",{className:`${this.className}-wrapper`},e)}renderDefaultStyle(){var e=this.className,t=`
|
|
76
|
+
.${e}-wrapper { background: gray; padding: 30px; padding-bottom: 0px; display: flex; flex-flow: column; align-items: center; }
|
|
77
|
+
.${e}-wrapper>section.${e} { background: white; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); margin-bottom: 30px; }`;this.options.hideWrapperOnPrint&&(t=`@media not print { ${t} }`);var r=`${t}
|
|
78
|
+
.${e} { color: black; hyphens: auto; text-underline-position: from-font; }
|
|
79
|
+
section.${e} { box-sizing: border-box; display: flex; flex-flow: column nowrap; position: relative; overflow: hidden; }
|
|
80
|
+
section.${e}>article { margin-bottom: auto; z-index: 1; }
|
|
81
|
+
section.${e}>footer { z-index: 1; }
|
|
82
|
+
.${e} table { border-collapse: collapse; }
|
|
83
|
+
.${e} table td, .${e} table th { vertical-align: top; }
|
|
84
|
+
.${e} p { margin: 0pt; min-height: 1em; }
|
|
85
|
+
.${e} span { white-space: pre-wrap; overflow-wrap: break-word; }
|
|
86
|
+
.${e} a { color: inherit; text-decoration: inherit; }
|
|
87
|
+
.${e} svg { fill: transparent; }
|
|
88
|
+
`;return this.options.renderComments&&(r+=`
|
|
89
|
+
.${e}-comment-ref { cursor: default; }
|
|
90
|
+
.${e}-comment-popover { display: none; z-index: 1000; padding: 0.5rem; background: white; position: absolute; box-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.25); width: 30ch; }
|
|
91
|
+
.${e}-comment-ref:hover~.${e}-comment-popover { display: block; }
|
|
92
|
+
.${e}-comment-author,.${e}-comment-date { font-size: 0.875rem; color: #888; }
|
|
93
|
+
`),this.createStyleElement(r)}renderNumbering(e,t){var r="",n=[];for(var s of e){var a=`p.${this.numberingClass(s.id,s.level)}`,o="none";if(s.bullet){let l=`--${this.className}-${s.bullet.src}`.toLowerCase();r+=this.styleToString(`${a}:before`,{content:"' '",display:"inline-block",background:`var(${l})`},s.bullet.style),this.tasks.push(this.document.loadNumberingImage(s.bullet.src).then(c=>{var h=`${this.rootSelector} { ${l}: url(${c}) }`;t.appendChild(this.createStyleElement(h))}))}else if(s.levelText){let l=this.numberingCounter(s.id,s.level);const c=l+" "+(s.start-1);s.level>0&&(r+=this.styleToString(`p.${this.numberingClass(s.id,s.level-1)}`,{"counter-set":c})),n.push(c),r+=this.styleToString(`${a}:before`,{content:this.levelTextToContent(s.levelText,s.suff,s.id,this.numFormatToCssValue(s.format)),"counter-increment":l,...s.rStyle})}else o=this.numFormatToCssValue(s.format);r+=this.styleToString(a,{display:"list-item","list-style-position":"inside","list-style-type":o,...s.pStyle})}return n.length>0&&(r+=this.styleToString(this.rootSelector,{"counter-reset":n.join(" ")})),this.createStyleElement(r)}renderStyles(e){var t="";const r=this.styleMap,n=wa(e.filter(l=>l.isDefault),l=>l.target);for(const l of e){var s=l.styles;if(l.linked){var a=l.linked&&r[l.linked];a?s=s.concat(a.styles):this.options.debug&&console.warn(`Can't find linked style ${l.linked}`)}for(const c of s){var o=`${l.target??""}.${l.cssName}`;l.target!=c.target&&(o+=` ${c.target}`),n[l.target]==l&&(o=`.${this.className} ${l.target}, `+o),t+=this.styleToString(o,c.values)}}return this.createStyleElement(t)}renderNotes(e,t,r){var n=e.map(a=>t[a]).filter(a=>a);if(n.length>0){var s=this.createElement("ol",null,this.renderElements(n));r.appendChild(s)}}renderElement(e){switch(e.type){case xe.Paragraph:return this.renderParagraph(e);case xe.BookmarkStart:return this.renderBookmarkStart(e);case xe.BookmarkEnd:return null;case xe.Run:return this.renderRun(e);case xe.Table:return this.renderTable(e);case xe.Row:return this.renderTableRow(e);case xe.Cell:return this.renderTableCell(e);case xe.Hyperlink:return this.renderHyperlink(e);case xe.SmartTag:return this.renderSmartTag(e);case xe.Drawing:return this.renderDrawing(e);case xe.Image:return this.renderImage(e);case xe.Text:return this.renderText(e);case xe.Text:return this.renderText(e);case xe.DeletedText:return this.renderDeletedText(e);case xe.Tab:return this.renderTab(e);case xe.Symbol:return this.renderSymbol(e);case xe.Break:return this.renderBreak(e);case xe.Footer:return this.renderContainer(e,"footer");case xe.Header:return this.renderContainer(e,"header");case xe.Footnote:case xe.Endnote:return this.renderContainer(e,"li");case xe.FootnoteReference:return this.renderFootnoteReference(e);case xe.EndnoteReference:return this.renderEndnoteReference(e);case xe.NoBreakHyphen:return this.createElement("wbr");case xe.VmlPicture:return this.renderVmlPicture(e);case xe.VmlElement:return this.renderVmlElement(e);case xe.MmlMath:return this.renderContainerNS(e,_t.mathML,"math",{xmlns:_t.mathML});case xe.MmlMathParagraph:return this.renderContainer(e,"span");case xe.MmlFraction:return this.renderContainerNS(e,_t.mathML,"mfrac");case xe.MmlBase:return this.renderContainerNS(e,_t.mathML,e.parent.type==xe.MmlMatrixRow?"mtd":"mrow");case xe.MmlNumerator:case xe.MmlDenominator:case xe.MmlFunction:case xe.MmlLimit:case xe.MmlBox:return this.renderContainerNS(e,_t.mathML,"mrow");case xe.MmlGroupChar:return this.renderMmlGroupChar(e);case xe.MmlLimitLower:return this.renderContainerNS(e,_t.mathML,"munder");case xe.MmlMatrix:return this.renderContainerNS(e,_t.mathML,"mtable");case xe.MmlMatrixRow:return this.renderContainerNS(e,_t.mathML,"mtr");case xe.MmlRadical:return this.renderMmlRadical(e);case xe.MmlSuperscript:return this.renderContainerNS(e,_t.mathML,"msup");case xe.MmlSubscript:return this.renderContainerNS(e,_t.mathML,"msub");case xe.MmlDegree:case xe.MmlSuperArgument:case xe.MmlSubArgument:return this.renderContainerNS(e,_t.mathML,"mn");case xe.MmlFunctionName:return this.renderContainerNS(e,_t.mathML,"ms");case xe.MmlDelimiter:return this.renderMmlDelimiter(e);case xe.MmlRun:return this.renderMmlRun(e);case xe.MmlNary:return this.renderMmlNary(e);case xe.MmlPreSubSuper:return this.renderMmlPreSubSuper(e);case xe.MmlBar:return this.renderMmlBar(e);case xe.MmlEquationArray:return this.renderMllList(e);case xe.Inserted:return this.renderInserted(e);case xe.Deleted:return this.renderDeleted(e);case xe.CommentRangeStart:return this.renderCommentRangeStart(e);case xe.CommentRangeEnd:return this.renderCommentRangeEnd(e);case xe.CommentReference:return this.renderCommentReference(e);case xe.AltChunk:return this.renderAltChunk(e)}return null}renderElements(e,t){if(e==null)return null;var r=e.flatMap(n=>this.renderElement(n)).filter(n=>n!=null);return t&&e0(t,r),r}renderContainer(e,t,r){return this.createElement(t,r,this.renderElements(e.children))}renderContainerNS(e,t,r,n){return this.createElementNS(t,r,n,this.renderElements(e.children))}renderParagraph(e){var s,a;var t=this.renderContainer(e,"p");const r=this.findStyle(e.styleName);e.tabs??(e.tabs=(s=r==null?void 0:r.paragraphProps)==null?void 0:s.tabs),this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t),this.renderCommonProperties(t.style,e);const n=e.numbering??((a=r==null?void 0:r.paragraphProps)==null?void 0:a.numbering);return n&&t.classList.add(this.numberingClass(n.id,n.level)),t}renderRunProperties(e,t){this.renderCommonProperties(e,t)}renderCommonProperties(e,t){t!=null&&(t.color&&(e.color=t.color),t.fontSize&&(e["font-size"]=t.fontSize))}renderHyperlink(e){var t=this.renderContainer(e,"a");this.renderStyleValues(e.cssStyle,t);let r="";if(e.id){const n=this.document.documentPart.rels.find(s=>s.id==e.id&&s.targetMode==="External");r=(n==null?void 0:n.target)??r}return e.anchor&&(r+=`#${e.anchor}`),t.href=r,t}renderSmartTag(e){return this.renderContainer(e,"span")}renderCommentRangeStart(e){var n;if(!this.options.renderComments)return null;const t=new Range;(n=this.commentHighlight)==null||n.add(t);const r=this.createComment(`start of comment #${e.id}`);return this.later(()=>t.setStart(r,0)),this.commentMap[e.id]=t,r}renderCommentRangeEnd(e){if(!this.options.renderComments)return null;const t=this.commentMap[e.id],r=this.createComment(`end of comment #${e.id}`);return this.later(()=>t==null?void 0:t.setEnd(r,0)),r}renderCommentReference(e){var a;if(!this.options.renderComments)return null;var t=(a=this.document.commentsPart)==null?void 0:a.commentMap[e.id];if(!t)return null;const r=new DocumentFragment,n=this.createElement("span",{className:`${this.className}-comment-ref`},["💬"]),s=this.createElement("div",{className:`${this.className}-comment-popover`});return this.renderCommentContent(t,s),r.appendChild(this.createComment(`comment #${t.id} by ${t.author} on ${t.date}`)),r.appendChild(n),r.appendChild(s),r}renderAltChunk(e){if(!this.options.renderAltChunks)return null;var t=this.createElement("iframe");return this.tasks.push(this.document.loadAltChunk(e.id,this.currentPart).then(r=>{t.srcdoc=r})),t}renderCommentContent(e,t){t.appendChild(this.createElement("div",{className:`${this.className}-comment-author`},[e.author])),t.appendChild(this.createElement("div",{className:`${this.className}-comment-date`},[new Date(e.date).toLocaleString()])),this.renderElements(e.children,t)}renderDrawing(e){var t=this.renderContainer(e,"div");return t.style.display="inline-block",t.style.position="relative",t.style.textIndent="0px",this.renderStyleValues(e.cssStyle,t),t}renderImage(e){var l;let t=this.createElement("img"),r=(l=e.cssStyle)==null?void 0:l.transform;if(this.renderStyleValues(e.cssStyle,t),e.srcRect&&e.srcRect.some(c=>c!=0)){var[n,s,a,o]=e.srcRect;r=`scale(${1/(1-n-a)}, ${1/(1-s-o)})`,t.style["clip-path"]=`rect(${(100*s).toFixed(2)}% ${(100*(1-a)).toFixed(2)}% ${(100*(1-o)).toFixed(2)}% ${(100*n).toFixed(2)}%)`}return e.rotation&&(r=`rotate(${e.rotation}deg) ${r??""}`),t.style.transform=r==null?void 0:r.trim(),this.document&&this.tasks.push(this.document.loadDocumentImage(e.src,this.currentPart).then(c=>{t.src=c})),t}renderText(e){return this.htmlDocument.createTextNode(e.text)}renderDeletedText(e){return this.options.renderChanges?this.renderText(e):null}renderBreak(e){return e.break=="textWrapping"?this.createElement("br"):null}renderInserted(e){return this.options.renderChanges?this.renderContainer(e,"ins"):this.renderElements(e.children)}renderDeleted(e){return this.options.renderChanges?this.renderContainer(e,"del"):null}renderSymbol(e){var t=this.createElement("span");return t.style.fontFamily=e.font,t.innerHTML=`&#x${e.char};`,t}renderFootnoteReference(e){var t=this.createElement("sup");return this.currentFootnoteIds.push(e.id),t.textContent=`${this.currentFootnoteIds.length}`,t}renderEndnoteReference(e){var t=this.createElement("sup");return this.currentEndnoteIds.push(e.id),t.textContent=`${this.currentEndnoteIds.length}`,t}renderTab(e){var n;var t=this.createElement("span");if(t.innerHTML=" ",this.options.experimental){t.className=this.tabStopClass();var r=(n=n5(e,xe.Paragraph))==null?void 0:n.tabs;this.currentTabs.push({stops:r,span:t})}return t}renderBookmarkStart(e){return this.createElement("span",{id:e.name})}renderRun(e){if(e.fieldRun)return null;const t=this.createElement("span");if(e.id&&(t.id=e.id),this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t),e.verticalAlign){const r=this.createElement(e.verticalAlign);this.renderElements(e.children,r),t.appendChild(r)}else this.renderElements(e.children,t);return t}renderTable(e){let t=this.createElement("table");return this.tableCellPositions.push(this.currentCellPosition),this.tableVerticalMerges.push(this.currentVerticalMerge),this.currentVerticalMerge={},this.currentCellPosition={col:0,row:0},e.columns&&t.appendChild(this.renderTableColumns(e.columns)),this.renderClass(e,t),this.renderElements(e.children,t),this.renderStyleValues(e.cssStyle,t),this.currentVerticalMerge=this.tableVerticalMerges.pop(),this.currentCellPosition=this.tableCellPositions.pop(),t}renderTableColumns(e){let t=this.createElement("colgroup");for(let r of e){let n=this.createElement("col");r.width&&(n.style.width=r.width),t.appendChild(n)}return t}renderTableRow(e){let t=this.createElement("tr");return this.currentCellPosition.col=0,e.gridBefore&&t.appendChild(this.renderTableCellPlaceholder(e.gridBefore)),this.renderClass(e,t),this.renderElements(e.children,t),this.renderStyleValues(e.cssStyle,t),e.gridAfter&&t.appendChild(this.renderTableCellPlaceholder(e.gridAfter)),this.currentCellPosition.row++,t}renderTableCellPlaceholder(e){const t=this.createElement("td",{colSpan:e});return t.style.border="none",t}renderTableCell(e){let t=this.renderContainer(e,"td");const r=this.currentCellPosition.col;return e.verticalMerge?e.verticalMerge=="restart"?(this.currentVerticalMerge[r]=t,t.rowSpan=1):this.currentVerticalMerge[r]&&(this.currentVerticalMerge[r].rowSpan+=1,t.style.display="none"):this.currentVerticalMerge[r]=null,this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t),e.span&&(t.colSpan=e.span),this.currentCellPosition.col+=t.colSpan,t}renderVmlPicture(e){return this.renderContainer(e,"div")}renderVmlElement(e){var n,s;var t=this.createSvgElement("svg");t.setAttribute("style",e.cssStyleText);const r=this.renderVmlChildElement(e);return(n=e.imageHref)!=null&&n.id&&this.tasks.push((s=this.document)==null?void 0:s.loadDocumentImage(e.imageHref.id,this.currentPart).then(a=>r.setAttribute("href",a))),t.appendChild(r),requestAnimationFrame(()=>{const a=t.firstElementChild.getBBox();t.setAttribute("width",`${Math.ceil(a.x+a.width)}`),t.setAttribute("height",`${Math.ceil(a.y+a.height)}`)}),t}renderVmlChildElement(e){const t=this.createSvgElement(e.tagName);Object.entries(e.attrs).forEach(([r,n])=>t.setAttribute(r,n));for(let r of e.children)r.type==xe.VmlElement?t.appendChild(this.renderVmlChildElement(r)):t.appendChild(...nh(this.renderElement(r)));return t}renderMmlRadical(e){var n;const t=e.children.find(s=>s.type==xe.MmlBase);if((n=e.props)!=null&&n.hideDegree)return this.createElementNS(_t.mathML,"msqrt",null,this.renderElements([t]));const r=e.children.find(s=>s.type==xe.MmlDegree);return this.createElementNS(_t.mathML,"mroot",null,this.renderElements([t,r]))}renderMmlDelimiter(e){const t=[];return t.push(this.createElementNS(_t.mathML,"mo",null,[e.props.beginChar??"("])),t.push(...this.renderElements(e.children)),t.push(this.createElementNS(_t.mathML,"mo",null,[e.props.endChar??")"])),this.createElementNS(_t.mathML,"mrow",null,t)}renderMmlNary(e){var c;const t=[],r=wa(e.children,h=>h.type),n=r[xe.MmlSuperArgument],s=r[xe.MmlSubArgument],a=n?this.createElementNS(_t.mathML,"mo",null,nh(this.renderElement(n))):null,o=s?this.createElementNS(_t.mathML,"mo",null,nh(this.renderElement(s))):null,l=this.createElementNS(_t.mathML,"mo",null,[((c=e.props)==null?void 0:c.char)??"∫"]);return a||o?t.push(this.createElementNS(_t.mathML,"munderover",null,[l,o,a])):a?t.push(this.createElementNS(_t.mathML,"mover",null,[l,a])):o?t.push(this.createElementNS(_t.mathML,"munder",null,[l,o])):t.push(l),t.push(...this.renderElements(r[xe.MmlBase].children)),this.createElementNS(_t.mathML,"mrow",null,t)}renderMmlPreSubSuper(e){const t=[],r=wa(e.children,c=>c.type),n=r[xe.MmlSuperArgument],s=r[xe.MmlSubArgument],a=n?this.createElementNS(_t.mathML,"mo",null,nh(this.renderElement(n))):null,o=s?this.createElementNS(_t.mathML,"mo",null,nh(this.renderElement(s))):null,l=this.createElementNS(_t.mathML,"mo",null);return t.push(this.createElementNS(_t.mathML,"msubsup",null,[l,o,a])),t.push(...this.renderElements(r[xe.MmlBase].children)),this.createElementNS(_t.mathML,"mrow",null,t)}renderMmlGroupChar(e){const t=e.props.verticalJustification==="bot"?"mover":"munder",r=this.renderContainerNS(e,_t.mathML,t);return e.props.char&&r.appendChild(this.createElementNS(_t.mathML,"mo",null,[e.props.char])),r}renderMmlBar(e){const t=this.renderContainerNS(e,_t.mathML,"mrow");switch(e.props.position){case"top":t.style.textDecoration="overline";break;case"bottom":t.style.textDecoration="underline";break}return t}renderMmlRun(e){const t=this.createElementNS(_t.mathML,"ms",null,this.renderElements(e.children));return this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t),t}renderMllList(e){const t=this.createElementNS(_t.mathML,"mtable");this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t);for(let r of this.renderElements(e.children))t.appendChild(this.createElementNS(_t.mathML,"mtr",null,[this.createElementNS(_t.mathML,"mtd",null,[r])]));return t}renderStyleValues(e,t){for(let r in e)r.startsWith("$")?t.setAttribute(r.slice(1),e[r]):t.style[r]=e[r]}renderClass(e,t){e.className&&(t.className=e.className),e.styleName&&t.classList.add(this.processStyleName(e.styleName))}findStyle(e){var t;return e&&((t=this.styleMap)==null?void 0:t[e])}numberingClass(e,t){return`${this.className}-num-${e}-${t}`}tabStopClass(){return`${this.className}-tab-stop`}styleToString(e,t,r=null){let n=`${e} {\r
|
|
94
|
+
`;for(const s in t)s.startsWith("$")||(n+=` ${s}: ${t[s]};\r
|
|
95
|
+
`);return r&&(n+=r),n+`}\r
|
|
96
|
+
`}numberingCounter(e,t){return`${this.className}-num-${e}-${t}`}levelTextToContent(e,t,r,n){const s={tab:"\\9",space:"\\a0"};var a=e.replace(/%\d*/g,o=>{let l=parseInt(o.substring(1),10)-1;return`"counter(${this.numberingCounter(r,l)}, ${n})"`});return`"${a}${s[t]??""}"`}numFormatToCssValue(e){var t={none:"none",bullet:"disc",decimal:"decimal",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",decimalZero:"decimal-leading-zero",aiueo:"katakana",aiueoFullWidth:"katakana",chineseCounting:"simp-chinese-informal",chineseCountingThousand:"simp-chinese-informal",chineseLegalSimplified:"simp-chinese-formal",chosung:"hangul-consonant",ideographDigital:"cjk-ideographic",ideographTraditional:"cjk-heavenly-stem",ideographLegalTraditional:"trad-chinese-formal",ideographZodiac:"cjk-earthly-branch",iroha:"katakana-iroha",irohaFullWidth:"katakana-iroha",japaneseCounting:"japanese-informal",japaneseDigitalTenThousand:"cjk-decimal",japaneseLegal:"japanese-formal",thaiNumbers:"thai",koreanCounting:"korean-hangul-formal",koreanDigital:"korean-hangul-formal",koreanDigital2:"korean-hanja-informal",hebrew1:"hebrew",hebrew2:"hebrew",hindiNumbers:"devanagari",ganada:"hangul",taiwaneseCounting:"cjk-ideographic",taiwaneseCountingThousand:"cjk-ideographic",taiwaneseDigital:"cjk-decimal"};return t[e]??e}refreshTabStops(){this.options.experimental&&setTimeout(()=>{const e=e5();for(let t of this.currentTabs)t5(t.span,t.stops,this.defaultTabSize,e)},500)}createElementNS(e,t,r,n){var s=e?this.htmlDocument.createElementNS(e,t):this.htmlDocument.createElement(t);return Object.assign(s,r),n&&e0(s,n),s}createElement(e,t,r){return this.createElementNS(void 0,e,t,r)}createSvgElement(e,t,r){return this.createElementNS(_t.svg,e,t,r)}createStyleElement(e){return this.createElement("style",{innerHTML:e})}createComment(e){return this.htmlDocument.createComment(e)}later(e){this.postRenderTasks.push(e)}}function N2(i){i.innerHTML=""}function e0(i,e){e.forEach(t=>i.appendChild(HR(t)?document.createTextNode(t):t))}function n5(i,e){for(var t=i.parent;t!=null&&t.type!=e;)t=t.parent;return t}const tE={ignoreHeight:!1,ignoreWidth:!1,ignoreFonts:!1,breakPages:!0,debug:!1,experimental:!1,className:"docx",inWrapper:!0,hideWrapperOnPrint:!1,trimXmlDeclaration:!0,ignoreLastRenderedPageBreak:!0,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,renderEndnotes:!0,useBase64URL:!1,renderChanges:!1,renderComments:!1,renderAltChunks:!0};function i5(i,e){const t={...tE,...e};return gv.load(i,new K3(t),t)}async function s5(i,e,t,r){const n={...tE,...r};return await new r5(window.document).render(i,e,t,n)}async function a5(i,e,t,r){const n=await i5(i,r);return await s5(n,e,t,r),n}class o5{constructor(e={}){Ie(this,"checkboxData");Ie(this,"schema");Ie(this,"finalGeneration");Ie(this,"name","CheckboxModule");this.checkboxData=e.checkboxData||{},this.schema=e.schema,this.finalGeneration=e.finalGeneration||!1}parse(e){return null}postparse(e){return e}render(e,t){return e}postrender(e,t){return!!(t&&t.contentType&&t.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")?(()=>{try{const n=e.map(a=>{const o=typeof a=="string",l=a&&typeof a=="object"&&a.value,c=()=>o&&a,h=()=>!o&&l&&a.value,d=()=>!o&&!l&&String(a);return c()||h()||d()}).join("");return[this.processCheckboxPatterns(n)]}catch{return e}})():e}processCheckboxPatterns(e){try{const t=/<w:bookmarkStart[^>]*w:name="(Check\d+)"[^>]*\/>/gi;t.lastIndex=0;const r=[];let n;for(;(n=t.exec(e))!==null;)r.push(n[1]);return r.length>0?(()=>{const a=()=>(r.forEach(h=>{const p=this.getCheckboxState(h)?"1":"0",g=new RegExp(`(<w:fldChar w:fldCharType="begin">.*?<w:name w:val="${h}".*?<w:default w:val=")([01])(".*?</w:fldChar>)`,"gs");e=e.replace(g,`$1${p}$3`)}),e),o=()=>(t.lastIndex=0,e.replace(t,(h,d)=>{try{return`<w:r><w:t>${`|||${this.getCheckboxState(d)?"☑":"☐"}|||checkbox:${d}|||`}</w:t></w:r><w:bookmarkStart w:name="${d}" w:id="0"/>`}catch{return h}})),l=()=>this.finalGeneration&&a(),c=()=>!this.finalGeneration&&o();return l()||c()})():e}catch{return e}}getCheckboxState(e){const t=!!this.schema,r=()=>!t&&(this.checkboxData[e]||!1),n=()=>t&&(()=>{const s=Object.entries(this.schema.properties||{}).find(([a,o])=>{const c=o.docx_mapping,h=c&&c.type==="checkbox",d=c&&c.type==="radio"&&c.mapping,p=h&&c.name===e,g=h&&c.true_name===e,y=h&&c.false_name===e,b=d&&c.mapping.find(w=>w.name===e);return p||g||y||!!b});return s?(()=>{const[a,o]=s,c=o.docx_mapping,h=c&&c.type==="checkbox"&&c.name===e,d=c&&c.type==="checkbox"&&c.true_name===e,p=c&&c.type==="checkbox"&&c.false_name===e,g=c&&c.type==="radio"&&c.mapping&&c.mapping.find(v=>v.name===e),y=()=>(h||d)&&this.checkboxData[a]===!0,b=()=>p&&this.checkboxData[a]===!1,w=()=>g&&this.checkboxData[a]===g.value;return y()||b()||w()||!1})():this.checkboxData[e]||!1})();return r()||n()||!1}updateCheckboxData(e){this.checkboxData={...this.checkboxData,...e}}}let vn={},M2={};const l5=({docxUrl:i,schema:e,onDataChange:t,initialData:r,onSaveRef:n,readonly:s=!1})=>{const[a,o]=Pe.useState([]),[l,c]=Pe.useState(!0),[h,d]=Pe.useState(null),[p,g]=Pe.useState(0),y=Pe.useRef(null),b=Pe.useCallback(fe=>{const K=/\{([^}]+)\}/g,be=[];let te;for(;(te=K.exec(fe))!==null;)be.push(te[1]);return[...new Set(be)]},[]),w=Pe.useCallback((fe,K)=>{vn={...vn,[fe]:K},E(fe,K),t==null||t(vn)},[t]),v=Pe.useCallback((fe,K)=>{!Object.entries(e.properties||{}).find(([te,j])=>{var ce;const ae=j.docx_mapping,H=(ae==null?void 0:ae.type)==="checkbox"&&ae.name===fe;H&&w(te,K);const se=(ae==null?void 0:ae.type)==="checkbox"&&ae.true_name===fe,le=(ae==null?void 0:ae.type)==="checkbox"&&ae.false_name===fe;se&&w(te,K),le&&w(te,!K);const oe=(ae==null?void 0:ae.type)==="radio"&&((ce=ae.mapping)==null?void 0:ce.find(Ae=>Ae.name===fe));return oe&&w(te,oe.value),H||se||le||!!oe})&&w(fe,K)},[w,e]),A=Pe.useCallback((fe,K)=>{const be=M2[fe];return!(K===be||K===""&&be==null||be===""&&K==null)},[]),E=Pe.useCallback((fe,K)=>{const be=!!y.current,te=A(fe,K);be&&y.current.querySelectorAll(`[data-field-path="${fe}"]`).forEach(ie=>{const ae=te?"field-edited":"field-original",H=te?"field-original":"field-edited";ie.classList.remove(H),ie.classList.add(ae)})},[A]),_=Pe.useCallback(()=>{!!y.current&&Object.entries(vn).forEach(([K,be])=>{E(K,be)})},[E]),C=Pe.useCallback(async()=>{t==null||t(vn),g(fe=>fe+1)},[t]);Pe.useEffect(()=>{n&&(n.current=C)},[C,n]);const I=Pe.useCallback(async fe=>{try{const be=await(await fetch(i)).arrayBuffer(),te=new _2(be),j={};Object.entries(fe).forEach(([le,oe])=>{(typeof oe=="boolean"||oe==="true"||oe==="false")&&(j[le]=oe===!0||oe==="true")});const ie=new v2(te,{paragraphLoop:!0,linebreaks:!0,nullGetter:le=>`||| |||${le.value||"unknown_field"}|||`,modules:[new o5({checkboxData:j,schema:e,finalGeneration:!1})]}),ae={},H="__NEWLINE__";return Object.entries(fe).forEach(([le,oe])=>{if(oe!=null&&oe!==""){let ce=oe;typeof oe=="string"&&(ce=oe.replace(/\n/g,H)),ae[le]=`|||${ce}|||${le}|||`}else ae[le]=null}),ie.render(ae),ie.getZip().generate({type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})}catch(K){throw console.error("Error processing document:",K),new Error(K instanceof Error?K.message:"Failed to process document")}},[i,e]),k=Pe.useCallback((fe,K,be,te)=>{const j=document.createElement("span");j.className="inline-field-container",j.setAttribute("data-field-path",fe);const ie=s,ae=K||vn[fe]||"",H=()=>{const U=be.type==="boolean"?(()=>{const B=document.createElement("span");return B.textContent=ae==="true"||vn[fe]===!0?"☑":"☐",B.className="inline-checkbox-readonly",B})():(()=>{const B="__NEWLINE__",F=String(ae).replace(new RegExp(B,"g"),`
|
|
97
|
+
`),M=document.createElement("span");return M.textContent=F,M.className="inline-field-readonly",M.style.whiteSpace="pre-wrap",M})();return j.appendChild(U),j},se=()=>{const x=document.createElement("input");return x.type="checkbox",x.checked=K==="true"||vn[fe]===!0,x.className="inline-checkbox rounded border-gray-300 text-green-600 focus:ring-green-500",x.setAttribute("data-field-path",fe),x.addEventListener("change",U=>{w(fe,U.target.checked)}),j.appendChild(x),j},le=()=>{const x=document.createElement("select");x.className="inline-select border border-gray-300 rounded px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-500",x.setAttribute("data-field-path",fe);const U=document.createElement("option");return U.value="",U.textContent="Select...",x.appendChild(U),be.enum.forEach(B=>{const F=document.createElement("option");F.value=String(B),F.textContent=String(B),F.selected=K===B||vn[fe]===B,x.appendChild(F)}),x.addEventListener("change",B=>{w(fe,B.target.value)}),j.appendChild(x),j},oe=()=>{const x=document.createElement("input");return x.type=be.format==="date"?"date":"datetime-local",x.value=String(K||vn[fe]||""),x.className="inline-date-input text-sm focus:outline-none",x.setAttribute("data-field-path",fe),x.style.width="100%",x.style.maxWidth="200px",x.placeholder=String(be.description||fe),x.addEventListener("input",U=>{w(fe,U.target.value)}),j.appendChild(x),j},ce=()=>{const x="__NEWLINE__",U=String(K||vn[fe]||"").replace(new RegExp(x,"g"),`
|
|
98
|
+
`),B=document.createElement("textarea");B.value=U,B.className="inline-textarea text-sm focus:outline-none resize-none",B.setAttribute("data-field-path",fe),B.style.width="100%",B.style.minHeight="17px",B.style.overflow="hidden",B.placeholder=String(be.description||fe),B.rows=1;const F=()=>{B.style.height="auto";const M=B.value.includes(`
|
|
99
|
+
`)||B.scrollHeight>25;B.style.height=M?Math.max(17,B.scrollHeight)+"px":"17px"};return B.addEventListener("input",M=>{w(fe,M.target.value),F()}),setTimeout(F,0),j.appendChild(B),j},Ae=()=>ie&&H(),Se=()=>!ie&&be.type==="boolean"&&se(),Ne=()=>!ie&&be.enum&&le(),Te=()=>!ie&&(be.format==="date"||be.format==="date-time")&&oe();return Ae()||Se()||Ne()||Te()||ce()},[w,s]),D=Pe.useCallback((fe,K)=>{const be=document.createTreeWalker(fe,NodeFilter.SHOW_TEXT,null,!1),te=[];let j;for(;j=be.nextNode();)te.push(j);te.forEach(ie=>{const ae=!!ie.textContent,H=/\|\|\|([^|]*)\|\|\|([^|]+)\|\|\|/g,se=ie.textContent||"",le=H.test(se),oe=ie.parentNode;ae&&le&&oe&&(()=>{let ce=0;const Ae=document.createDocumentFragment();ie.textContent.replace(H,(Se,Ne,Te,x)=>{x>ce&&Ae.appendChild(document.createTextNode(se.slice(ce,x)));const M=Te.startsWith("checkbox:")?(()=>{const q=Te.replace("checkbox:",""),de=Object.entries(e.properties||{}).find(([ge,ve])=>{const me=ve.docx_mapping;return(me==null?void 0:me.type)==="checkbox"&&me.true_name&&me.false_name&&(me.true_name===q||me.false_name===q)}),[we,ee]=de||[],Ee=ee,De=Ee==null?void 0:Ee.docx_mapping,Ce=!!de,Me=(De==null?void 0:De.true_name)===q,$e=()=>{const ge=document.createElement("span");return ge.textContent=Ne,ge.className="inline-checkbox-readonly",ge},Xe=()=>{const ge=document.createElement("span");ge.className="inline-radio-container";const ve=document.createElement("input");ve.type="radio",ve.name=`radio-group-${we}`,ve.value=Me?"true":"false";const he=K[we];return ve.checked=Me?he===!0||he==="true":he===!1||he==="false",ve.className="text-green-600 focus:ring-green-500 border-gray-300",ve.setAttribute("data-field-path",q),ve.addEventListener("change",me=>{me.target.checked&&v(q,!0)}),ge.appendChild(ve),ge},Tt=()=>{const ge=document.createElement("input");return ge.type="checkbox",ge.checked=Ne==="☑",ge.className="inline-checkbox rounded border-gray-300 text-green-600 focus:ring-green-500",ge.setAttribute("data-field-path",q),ge.addEventListener("change",ve=>{v(q,ve.target.checked)}),ge},nr=()=>s&&$e(),yr=()=>!s&&Ce&&Xe(),rr=()=>!s&&!Ce&&Tt();return nr()||yr()||rr()})():(()=>{var de;const q=((de=e.properties)==null?void 0:de[Te])||{};return k(Te,Ne,q,K)})();return Ae.appendChild(M),ce=x+Se.length,Se}),ce<se.length&&Ae.appendChild(document.createTextNode(se.slice(ce))),oe.replaceChild(Ae,ie)})()})},[e,k,v,s]),R=Pe.useCallback(async fe=>{!!y.current&&await(async()=>{try{const be=await I(fe);for(;y.current.firstChild;)y.current.removeChild(y.current.firstChild);await a5(be,y.current,void 0,{className:"docx-preview",inWrapper:!0,hideWrapperOnPrint:!0,ignoreWidth:!1,ignoreHeight:!1,ignoreFonts:!1,breakPages:!0,debug:!1,experimental:!0,trimXmlDeclaration:!0,renderHeaders:!1,renderFooters:!1,renderFootnotes:!0,renderEndnotes:!0,ignoreLastRenderedPageBreak:!0,useBase64URL:!1,renderChanges:!1,renderComments:!1}),setTimeout(()=>{!!y.current&&(D(y.current,fe),_())},100)}catch(be){console.error("Error updating preview:",be),!!y.current&&(()=>{for(;y.current.firstChild;)y.current.removeChild(y.current.firstChild);const j=document.createElement("div");j.className="p-4 text-red-600",j.textContent=`Error updating preview: ${be instanceof Error?be.message:"Unknown error"}`,y.current.appendChild(j)})()}})()},[I,D,_]),z=Pe.useCallback(async()=>{try{c(!0);const K=await(await fetch(i)).arrayBuffer(),be=new _2(K),j=new v2(be).getFullText(),ie=b(j);o(ie);const ae={};ie.forEach(se=>{var Te;const le=(Te=e.properties)==null?void 0:Te[se],oe=!!le,ce=()=>oe&&le.type==="boolean"&&!1,Ae=()=>oe&&le.type==="string"&&le.format==="date"&&"",Se=()=>oe&&le.type!=="boolean"&&!(le.type==="string"&&le.format==="date")&&"",Ne=()=>!oe&&"";ae[se]=ce()||Ae()||Se()||""});const H={...ae,...r};vn=H,M2={...H},d(null)}catch(fe){d(`Failed to load document: ${fe instanceof Error?fe.message:"Unknown error"}`)}finally{c(!1)}},[i,e,b,r]);Pe.useEffect(()=>{z()},[z]),Pe.useEffect(()=>{!l&&Object.keys(vn).length>0&&!!y.current&&R(vn)},[l,R]),Pe.useEffect(()=>{p>0&&!!y.current&&R(vn)},[p,R]);const G=()=>ye.jsx("div",{className:"flex items-center justify-center p-8",children:ye.jsx("div",{className:"text-body",children:"Loading document..."})}),O=()=>ye.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-md p-4",children:[ye.jsx("div",{className:"text-red-800 text-body-em",children:"Error"}),ye.jsx("div",{className:"text-red-700 text-body mt-1",children:h})]}),X=l,S=!l&&!!h,J=()=>X&&ye.jsx(G,{}),Y=()=>S&&ye.jsx(O,{}),W=()=>!X&&!S&&ye.jsxs("div",{children:[ye.jsx("style",{children:`
|
|
100
|
+
.inline-field-container {
|
|
101
|
+
display: block;
|
|
102
|
+
margin: 0;
|
|
103
|
+
padding: 0;
|
|
104
|
+
width: 100%;
|
|
105
|
+
}
|
|
106
|
+
.inline-input, .inline-select {
|
|
107
|
+
background: rgba(255, 255, 255, 0.9);
|
|
108
|
+
border: 1px solid #d1d5db;
|
|
109
|
+
border-radius: 4px;
|
|
110
|
+
padding: 4px 8px;
|
|
111
|
+
font-size: 13px;
|
|
112
|
+
line-height: 1.4;
|
|
113
|
+
font-family: inherit;
|
|
114
|
+
height: 17px;
|
|
115
|
+
}
|
|
116
|
+
.inline-input:focus, .inline-select:focus {
|
|
117
|
+
outline: none;
|
|
118
|
+
border-color: #10b981;
|
|
119
|
+
box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
|
|
120
|
+
}
|
|
121
|
+
.inline-textarea {
|
|
122
|
+
background: transparent;
|
|
123
|
+
border: none;
|
|
124
|
+
border-radius: 0;
|
|
125
|
+
padding: 2px 4px;
|
|
126
|
+
font-size: 13px;
|
|
127
|
+
line-height: 1.4;
|
|
128
|
+
font-family: inherit;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
word-wrap: break-word;
|
|
131
|
+
display: inline-block;
|
|
132
|
+
vertical-align: top;
|
|
133
|
+
}
|
|
134
|
+
.inline-textarea:focus {
|
|
135
|
+
outline: none;
|
|
136
|
+
background: transparent;
|
|
137
|
+
}
|
|
138
|
+
.inline-textarea:hover {
|
|
139
|
+
background: rgba(0, 0, 0, 0.02);
|
|
140
|
+
}
|
|
141
|
+
.inline-date-input {
|
|
142
|
+
background: transparent;
|
|
143
|
+
border: none;
|
|
144
|
+
border-radius: 0;
|
|
145
|
+
padding: 2px 4px;
|
|
146
|
+
font-size: 13px;
|
|
147
|
+
line-height: 1.4;
|
|
148
|
+
font-family: inherit;
|
|
149
|
+
color: inherit;
|
|
150
|
+
height: 17px;
|
|
151
|
+
}
|
|
152
|
+
.inline-date-input:focus {
|
|
153
|
+
outline: none;
|
|
154
|
+
background: transparent;
|
|
155
|
+
}
|
|
156
|
+
.inline-date-input:hover {
|
|
157
|
+
background: rgba(0, 0, 0, 0.02);
|
|
158
|
+
}
|
|
159
|
+
/* Style the date picker icon */
|
|
160
|
+
.inline-date-input::-webkit-calendar-picker-indicator {
|
|
161
|
+
opacity: 0.6;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
}
|
|
164
|
+
.inline-date-input::-webkit-calendar-picker-indicator:hover {
|
|
165
|
+
opacity: 1;
|
|
166
|
+
}
|
|
167
|
+
.inline-checkbox {
|
|
168
|
+
margin: 0 4px;
|
|
169
|
+
transform: scale(0.9);
|
|
170
|
+
}
|
|
171
|
+
/* Original field styles */
|
|
172
|
+
.field-original {
|
|
173
|
+
background: rgba(229, 231, 235, 0.3) !important;
|
|
174
|
+
}
|
|
175
|
+
.field-original:focus {
|
|
176
|
+
background: rgba(229, 231, 235, 0.4) !important;
|
|
177
|
+
}
|
|
178
|
+
/* Edited field styles */
|
|
179
|
+
.field-edited {
|
|
180
|
+
background: rgba(254, 240, 138, 0.4) !important;
|
|
181
|
+
}
|
|
182
|
+
.field-edited:focus {
|
|
183
|
+
background: rgba(254, 240, 138, 0.5) !important;
|
|
184
|
+
}
|
|
185
|
+
/* Textarea color coding */
|
|
186
|
+
.inline-textarea.field-original {
|
|
187
|
+
background: rgba(229, 231, 235, 0.2) !important;
|
|
188
|
+
border-radius: 3px !important;
|
|
189
|
+
}
|
|
190
|
+
.inline-textarea.field-edited {
|
|
191
|
+
background: rgba(254, 240, 138, 0.3) !important;
|
|
192
|
+
border-radius: 3px !important;
|
|
193
|
+
}
|
|
194
|
+
/* Date input color coding */
|
|
195
|
+
.inline-date-input.field-original {
|
|
196
|
+
background: rgba(229, 231, 235, 0.2) !important;
|
|
197
|
+
border-radius: 3px !important;
|
|
198
|
+
}
|
|
199
|
+
.inline-date-input.field-edited {
|
|
200
|
+
background: rgba(254, 240, 138, 0.3) !important;
|
|
201
|
+
border-radius: 3px !important;
|
|
202
|
+
}
|
|
203
|
+
/* Checkbox color coding */
|
|
204
|
+
.inline-checkbox.field-original {
|
|
205
|
+
accent-color: #9ca3af;
|
|
206
|
+
}
|
|
207
|
+
.inline-checkbox.field-edited {
|
|
208
|
+
accent-color: #f59e0b;
|
|
209
|
+
}
|
|
210
|
+
.docx-preview .inline-field-container {
|
|
211
|
+
background: rgba(255, 247, 230, 0.5);
|
|
212
|
+
border-radius: 3px;
|
|
213
|
+
padding: 1px 2px;
|
|
214
|
+
}
|
|
215
|
+
/* Readonly containers should be transparent */
|
|
216
|
+
.docx-preview .inline-field-container:has(.inline-field-readonly),
|
|
217
|
+
.docx-preview .inline-field-container:has(.inline-checkbox-readonly) {
|
|
218
|
+
background: transparent !important;
|
|
219
|
+
border-radius: 0 !important;
|
|
220
|
+
padding: 0 !important;
|
|
221
|
+
}
|
|
222
|
+
/* Container color coding */
|
|
223
|
+
.docx-preview .inline-field-container.field-original {
|
|
224
|
+
background: rgba(229, 231, 235, 0.3) !important;
|
|
225
|
+
}
|
|
226
|
+
.docx-preview .inline-field-container.field-edited {
|
|
227
|
+
background: rgba(254, 240, 138, 0.4) !important;
|
|
228
|
+
}
|
|
229
|
+
/* Readonly mode: remove all background colors */
|
|
230
|
+
.docx-preview .inline-field-container.field-original:has(.inline-field-readonly) {
|
|
231
|
+
background: transparent !important;
|
|
232
|
+
}
|
|
233
|
+
.docx-preview .inline-field-container.field-edited:has(.inline-field-readonly) {
|
|
234
|
+
background: transparent !important;
|
|
235
|
+
}
|
|
236
|
+
/* Remove header/footer padding from docx-preview */
|
|
237
|
+
.docx-preview .docx-wrapper .docx-document {
|
|
238
|
+
padding-top: 0 !important;
|
|
239
|
+
padding-bottom: 0 !important;
|
|
240
|
+
}
|
|
241
|
+
.docx-preview .docx-wrapper section {
|
|
242
|
+
padding-top: 0 !important;
|
|
243
|
+
padding-bottom: 0 !important;
|
|
244
|
+
}
|
|
245
|
+
.docx-preview .docx-wrapper .docx-page {
|
|
246
|
+
padding-top: 0 !important;
|
|
247
|
+
padding-bottom: 0 !important;
|
|
248
|
+
}
|
|
249
|
+
/* Override inline padding styles on section elements */
|
|
250
|
+
section.docx-preview {
|
|
251
|
+
padding-top: 20pt !important;
|
|
252
|
+
padding-bottom: 20pt !important;
|
|
253
|
+
}
|
|
254
|
+
/* Override docx-preview-wrapper styles */
|
|
255
|
+
.docx-preview-wrapper {
|
|
256
|
+
background: transparent !important;
|
|
257
|
+
padding: 0 !important;
|
|
258
|
+
}
|
|
259
|
+
.docx-preview-wrapper>section.docx-preview {
|
|
260
|
+
margin-bottom: 0 !important;
|
|
261
|
+
box-shadow: none !important;
|
|
262
|
+
}
|
|
263
|
+
/* Scale down all text in the document by 20% */
|
|
264
|
+
.docx-preview {
|
|
265
|
+
font-size: 80% !important;
|
|
266
|
+
}
|
|
267
|
+
@media (max-width: 1024px) {
|
|
268
|
+
.docx-preview {
|
|
269
|
+
width: auto !important;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
.docx-preview * {
|
|
273
|
+
font-size: inherit !important;
|
|
274
|
+
}
|
|
275
|
+
/* Readonly field styles */
|
|
276
|
+
.inline-field-readonly {
|
|
277
|
+
color: inherit;
|
|
278
|
+
font-family: inherit;
|
|
279
|
+
font-size: 13px;
|
|
280
|
+
line-height: 1.4;
|
|
281
|
+
background: transparent;
|
|
282
|
+
border-radius: 0;
|
|
283
|
+
padding: 2px 4px;
|
|
284
|
+
border: none;
|
|
285
|
+
}
|
|
286
|
+
.inline-checkbox-readonly {
|
|
287
|
+
color: inherit;
|
|
288
|
+
font-family: inherit;
|
|
289
|
+
font-size: inherit;
|
|
290
|
+
margin: 0 2px;
|
|
291
|
+
}
|
|
292
|
+
`}),ye.jsx("div",{className:"bg-white max-w-full",children:ye.jsx("div",{ref:y,className:"bg-white"})})]});return J()||Y()||W()};exports.DocumentEditor=l5;exports.HelloWorld=IE;exports.ImageViewer=A_;exports.InputPrompt=h_;exports.PdfViewer=KS;exports.Sidebar=y_;exports.TabsContainer=JS;exports.materialTheme=DE;exports.tailwindTheme=kE;
|