| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- var Mg=Object.defineProperty;var Zd=d=>{throw TypeError(d)};var Ig=(d,t,e)=>t in d?Mg(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var O=(d,t,e)=>Ig(d,typeof t!="symbol"?t+"":t,e),Xc=(d,t,e)=>t.has(d)||Zd("Cannot "+e);var o=(d,t,e)=>(Xc(d,t,"read from private field"),e?e.call(d):t.get(d)),A=(d,t,e)=>t.has(d)?Zd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(d):t.set(d,e),b=(d,t,e,s)=>(Xc(d,t,"write to private field"),s?s.call(d,e):t.set(d,e),e),v=(d,t,e)=>(Xc(d,t,"access private method"),e);var ce=(d,t,e,s)=>({set _(i){b(d,t,i,e)},get _(){return o(d,t,s)}});import{_ as ct,o as N,d as X,e as M,t as $t,c as It,f as at,h as St,l as ah,m as Mt,n as Gu,w as ut,g as At,r as st,p as fi,F as Ms,q as di,s as Al,v as Fg,x as Lg,i as Wi,j as wa,y as Kr,z as Fc,A as Vu,B as Wu,C as Yu,D as Pg,E as Xu,M as $u,k as xr,G as Cl,H as Ku,I as Lc,J as Dg,K as Pc,L as Ng,N as Og,u as Bg}from"./index-HWB3SZvY.js";import{L as zg}from"./LayoutExperience-DqH5RO9Z.js";import{C as jg}from"./ContentContainer-gLH9cPrb.js";import{C as Hg}from"./ChatAsideMenu-B3lw5Ylq.js";import{f as Ed,j as tu,a as Qu}from"./utils-CDfxrmAT.js";import{u as Ju}from"./use-all-agents-DMRzhIVc.js";import{g as Zu,a as Dc}from"./get-icon-4-dialog-Bzd6LYpE.js";import"./Header-Ba5hsLOS.js";import"./Header.vue_vue_type_style_index_0_scoped_8d56b6fd_lang-B6JykzJN.js";import"./use-current-user-CkRMvTAG.js";/* empty css */import"./icon-map-CJXc1eYn.js";const Ug={},qg={class:"dialog-aside-left"};function Gg(d,t){return N(),X("div",qg,t[0]||(t[0]=[M("div",null,null,-1)]))}const Vg=ct(Ug,[["render",Gg],["__scopeId","data-v-c656b8f9"]]),Wg={class:"dialog-header"},Yg={__name:"DialogHeader",props:{agent_info:Object},setup(d){return(t,e)=>(N(),X("div",Wg,[M("div",null,$t(d.agent_info.agent.name),1)]))}},Xg=ct(Yg,[["__scopeId","data-v-54c912dd"]]),$g={class:"dialog-welcome-content"},Kg={__name:"DialogWelcome",props:{agent_info:Object},setup(d){return(t,e)=>(N(),X("div",$g,e[0]||(e[0]=[M("div",null,null,-1)])))}},Qg=ct(Kg,[["__scopeId","data-v-f217c60a"]]),Jg={class:"dialog-item-select question-select"},Zg={__name:"BtnSelectItem",props:{is_selected:Boolean},emits:["change"],setup(d,{emit:t}){return(e,s)=>(N(),X("div",Jg))}},tp=ct(Zg,[["__scopeId","data-v-c43761d9"]]),tm={class:"dialog-chat-answer-content"},em={key:0},sm=["innerHTML"],im={__name:"DialogContent",props:{type:String,content:String,is_loading:Boolean},setup(d){return(t,e)=>{const s=It("a-spin");return N(),X("div",tm,[d.is_loading?(N(),X("div",em,[at(s)])):St("",!0),d.is_loading?St("",!0):(N(),X("div",{key:1,innerHTML:d.content},null,8,sm)),ah(t.$slots,"default",{},void 0,!0)])}}},ep=ct(im,[["__scopeId","data-v-a2f46930"]]);/**
- * filesize
- *
- * @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
- * @license BSD-3-Clause
- * @version 10.1.6
- */const nm="array",am="bit",eu="bits",rm="byte",su="bytes",ua="",om="exponent",lm="function",iu="iec",cm="Invalid number",hm="Invalid rounding method",$c="jedec",dm="object",nu=".",um="round",pm="s",fm="si",gm="kbit",mm="kB",bm=" ",vm="string",Am="0",Kc={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function _m(d,{bits:t=!1,pad:e=!1,base:s=-1,round:i=2,locale:n=ua,localeOptions:r={},separator:a=ua,spacer:c=bm,symbols:l={},standard:h=ua,output:u=vm,fullform:p=!1,fullforms:f=[],exponent:g=-1,roundingMethod:m=um,precision:_=0}={}){let y=g,x=Number(d),w=[],k=0,S=ua;h===fm?(s=10,h=$c):h===iu||h===$c?s=2:s===2?h=iu:(s=10,h=$c);const C=s===10?1e3:1024,E=p===!0,T=x<0,q=Math[m];if(typeof d!="bigint"&&isNaN(d))throw new TypeError(cm);if(typeof q!==lm)throw new TypeError(hm);if(T&&(x=-x),(y===-1||isNaN(y))&&(y=Math.floor(Math.log(x)/Math.log(C)),y<0&&(y=0)),y>8&&(_>0&&(_+=8-y),y=8),u===om)return y;if(x===0)w[0]=0,S=w[1]=Kc.symbol[h][t?eu:su][y];else{k=x/(s===2?Math.pow(2,y*10):Math.pow(1e3,y)),t&&(k=k*8,k>=C&&y<8&&(k=k/C,y++));const j=Math.pow(10,y>0?i:0);w[0]=q(k*j)/j,w[0]===C&&y<8&&g===-1&&(w[0]=1,y++),S=w[1]=s===10&&y===1?t?gm:mm:Kc.symbol[h][t?eu:su][y]}if(T&&(w[0]=-w[0]),_>0&&(w[0]=w[0].toPrecision(_)),w[1]=l[w[1]]||w[1],n===!0?w[0]=w[0].toLocaleString():n.length>0?w[0]=w[0].toLocaleString(n,r):a.length>0&&(w[0]=w[0].toString().replace(nu,a)),e&&i>0){const j=w[0].toString(),H=a||(j.match(/(\D)/g)||[]).pop()||nu,Z=j.toString().split(H),$=Z[1]||ua,W=$.length,mt=i-W;w[0]=`${Z[0]}${H}${$.padEnd(W+mt,Am)}`}return E&&(w[1]=f[y]?f[y]:Kc.fullform[h][y]+(t?am:rm)+(w[0]===1?ua:pm)),u===nm?w:u===dm?{value:w[0],symbol:w[1],exponent:y,unit:S}:w.join(c)}function ym(d){return _m(d,{standard:"jedec"})}const wm="data:image/png;base64,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",xm="data:image/png;base64,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",km="data:image/png;base64,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",Sm="data:image/png;base64,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",Cm="data:image/png;base64,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",Em="data:image/png;base64,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",Tm="data:image/png;base64,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",Rm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAYAAACPZlfNAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAATwSURBVHgB7Z3NbxtFGMafcRCWIoiiUh8qImFUgURBqnMqPdUXPiQqOMABcSEcWsSp7F8Q58aJTU+V0ks5UHEADqiXwqFOLzEHiCPaVMKK5ESJenDatE5zcBV3OrNuKrX1rmfXu7bf2fcnOf7YsRPpp2f2nZn1RKBPXPdiEXhUgBCn1NOCuuWRMt4/caJ08uTxOQyAlxAR112YUZK+BmQREEgzUsrS0tIKBiEttDAvUQKzHVESTIdBScuEafzj+YVzEPJaRxbzPE+kzSJBjIW55y/OCol5MIEkLc1ImJal/pISGCOSlNZTmFdcsKzQJCUtUJjrXsirAsMFE4kkpAUnTIzpXzYJJjJxS/MV5qULmAHTN3FK809YJ11MTMQlLahLLIKJlTikdRWmKsNUzglGpdVqGbftV5pPwjJ5MMY0d3dDte9Hmo+wdgGMMTs7OwhLVGl+57A8GGOazSb29/cRlijSQk3+Mt1pt9vY2NhAFMJKY2Ex0djeRqPRQBTCSGNhMbKuUra3t4comEpjYTGiu8YbN29ia2sLUTCRxsISYFMJq66s4G4C1WPkazqYYPRgularIZvNYnx83Lvpx4aULv/yx/2vvvz0hQVjFpYwWpy+hR2rCWSOd3udu0RisDBisDBisDBisDBisDBisDBiWDEOO3bsbXz4wame7RYXK1iu/gfKWJGwqdePGLU7evQNUMcKYc1muCV6yqTqHGaDWDsStssJs5JW6yGokzJh5tcPjip2dIn3HyAtcNFBDEuKDk6YlbQectFBCq4SRwSe6bAUG6pJa4SlJWUpKzp44EwKLjpGCO4SLcMWoRYlLB2zHalJmA3nL401wnotnbCwEcMWIb3gLpEY9hQdPa7rsGG1WcMJI0aKhHHCRoq0XNfBXSIxLCo6ghPGXSIxbLieQ2PVTEdQt2dLl2jNPh1ayM+Xf8fExCtdjzUad2ADVm2sopdQbF8X46/MEoOFEcO6vab0Bly5w4e8c5l37tq+a1U3aY0wLWq68B6mp999Yde0tbV1LF5fskKcFcImJl7FF59/4t13Q38ZfWrqCH797Qr5atGKc1iQrAOy2ZdVu9M924065IXpPTpMJWhpJvt5jDL0hb3zVqj2udxrnjiqkBeWyx0O1V7LotwtkhcWJS2csCESpVSnPBFMXtjaWj1Mc+8KYcqlPXlhq7dqodpXKv+AMuSF6bToWQwTdBpXb/0PylgxcF5evoHK38HJ0aL+/Os6qGPNXGKl8i9WV2vefGIud+hp6b65eduTpe9twLoFTNPukSq8HkYMFkYMFkYMFkYMFkYMFkYMFkYMFkYMFkYMFkYMFkYMFkYMP2F1MENFyvZ6t9d9hIk6mGFT7faij7B2GcyQ6R4a4dfcnV/Q/9p7EswwqDvfn32z2wH/okPiJzBDQSBT9jsWUCW258EMBSnH5vyO+QpznO/q6p2csgGj0nXJcb6p+x3vMQ57VFI/7oEZFPeC0qUJFNZJmQj8ACZGpJwLSpem50yH45yZ1x8EJlk8Wd/2rBvGYMDVq1fKH390WkCIIpj46cgqmTQ1EqZhaQkhpaNk/WDaXCAkrnshDzF2TT3Mg+mHqqoPlKwz5TBvCi3sANddmBFCnJOQBTDGqC6qLNVwyXHOXkIEIgs7QIlTwmRRiMxn6ukkC3wW0Vn5qCpJi6rGq4ZN1PM8BoCnJWYEhfjKAAAAAElFTkSuQmCC",Mm={excel:Tm,pdf:Sm,word:Em,txt:Cm,code:wm,html:xm,json:km,unknow:Rm},Im={class:"file-icon-display"},Fm=["src"],Lm={__name:"FileIcon",props:{file_end_fix:Object},setup(d){const t=d,e=Mt(()=>{const s=t.file_end_fix;let i="unknow";return s==="doc"||s==="docx"?i="word":s==="excel"||s==="xlsx"||s==="xls"?i="excel":s==="pdf"?i="pdf":s==="txt"||s==="md"?i="txt":s==="js"||s==="python"||s==="sql"||s==="php"?i="code":s==="html"?i="html":s==="json"?i="json":i="unknow",Mm[i]});return(s,i)=>(N(),X("div",Im,[M("span",null,[M("img",{src:e.value},null,8,Fm)])]))}},Pm=ct(Lm,[["__scopeId","data-v-f4c0f14f"]]),Dm={class:"file-size-display"},Nm={__name:"FileSize",props:{file_size:Object},setup(d){const t=d,e=Mt(()=>ym(t.file_size));return(s,i)=>(N(),X("div",Dm,[M("div",null,$t(e.value),1)]))}},Om=ct(Nm,[["__scopeId","data-v-294c1454"]]),Bm={__name:"FileItemRemoveBtn",emits:["delete"],setup(d,{emit:t}){const e=t,s=()=>{e("delete")};return(i,n)=>{const r=It("icon-close");return N(),X("span",{class:"file-item-remove-btn",onClick:Gu(s,["stop"])},[at(r)])}}},sp=ct(Bm,[["__scopeId","data-v-b7ca47d5"]]),zm={class:"file-item-doc-preview"},jm={class:"file-item-info-container"},Hm={class:"file-item-doc-title"},Um={__name:"FileItemDocPreview",props:{file:Object,enable_remove:Boolean},emits:["delete"],setup(d,{emit:t}){const e=d,s=t,i=Mt(()=>{const r=e.file;if(!r)return"";const c=(r.name||"").split(".");return c[c.length-1]}),n=()=>{console.log("移除文件"),s("delete")};return(r,a)=>{const c=It("a-tooltip");return N(),X("div",zm,[at(Pm,{file_end_fix:i.value},null,8,["file_end_fix"]),M("div",jm,[at(c,{content:d.file.name,position:"top"},{default:ut(()=>[M("div",Hm,$t(d.file.name),1)]),_:1},8,["content"]),at(Om,{file_size:d.file.size},null,8,["file_size"])]),d.enable_remove?(N(),At(sp,{key:0,class:"file-item-remove-button",onDelete:n})):St("",!0)])}}},ip=ct(Um,[["__scopeId","data-v-bb84aeaa"]]),qm={class:"file-item-image-preview"},Gm={ref:"container"},Vm={__name:"FileItemImagePreview",props:{file:Object,enable_remove:Boolean},emits:["delete"],setup(d,{emit:t}){const e=d,s=t,i=st(1),n=st(""),r=()=>{s("delete")};return fi(()=>{const a=e.file;if(a){var c=new FileReader;c.onload=function(l){i.value=2,n.value=l.target.result},c.readAsDataURL(a)}}),(a,c)=>{const l=It("a-image");return N(),X("div",qm,[M("div",Gm,[i.value===1?(N(),At(l,{key:0,width:"100"})):St("",!0),i.value===2?(N(),At(l,{key:1,width:"100",src:n.value},null,8,["src"])):St("",!0)],512),d.enable_remove?(N(),At(sp,{key:0,class:"file-item-remove-button",onDelete:r})):St("",!0)])}}},np=ct(Vm,[["__scopeId","data-v-84427406"]]),Wm=d=>d==="jpg"||d==="png"||d==="jpeg"||d==="gif";function ac(d){const t=d.split("."),e=t[t.length-1];return Wm(e)}const Ym={class:"file-upload-preview-area"},Xm={class:"file-doc-preview-container"},$m={class:"file-image-preview-container"},Km={__name:"FileUploadPreviewV2",props:{file_list:Array,enable_remove:Boolean},emits:["delete"],setup(d,{emit:t}){const e=d,s=Mt(()=>{const n=[];return e.file_list.forEach((r,a)=>{const c=r.name;ac(c)&&n.push(r)}),n}),i=Mt(()=>{const n=[];return e.file_list.forEach((r,a)=>{const c=r.name;ac(c)||n.push(r)}),n});return(n,r)=>(N(),X("div",Ym,[M("div",Xm,[(N(!0),X(Ms,null,di(i.value,(a,c)=>(N(),At(ip,{class:"file-preview-item",key:a.name+c,file:a},null,8,["file"]))),128))]),M("div",$m,[(N(!0),X(Ms,null,di(s.value,(a,c)=>(N(),At(np,{class:"file-preview-item",key:a.name+c,file:a},null,8,["file"]))),128))])]))}},Qm=ct(Km,[["__scopeId","data-v-abc070bd"]]),Jm={class:"dialog-item dialog-question"},Zm={class:"dialog-main question-main"},t0={class:"dialog-content question-content"},e0={class:"dialog-icon question-icon"},s0=["src"],i0={__name:"DialogQuestion",props:{show_select:!0,question:Object},emits:["select"],setup(d,{emit:t}){const e=d,s=Mt(()=>e.show_select===!0),i=Mt(()=>Array.isArray(e.question.client_custom_upload_file_list)?e.question.client_custom_upload_file_list:[]),n=t,r=()=>{n("select")};return(a,c)=>(N(),X("div",Jm,[s.value?(N(),At(tp,{key:0,onChange:r})):St("",!0),M("div",Zm,[M("div",t0,[M("div",null,[at(ep,{content:d.question.content,class:"question-content-core-text"},{default:ut(()=>[i.value.length!==0?(N(),At(Qm,{key:0,file_list:i.value,enable_remove:!1},null,8,["file_list"])):St("",!0)]),_:1},8,["content"])])]),M("div",e0,[M("img",{src:d.question.client_custom_icon},null,8,s0)])])]))}},n0=ct(i0,[["__scopeId","data-v-c54a06c5"]]),a0={class:"dialog-actions-container"},r0={class:"dialog-action-part dialog-action-left"},o0={__name:"DialogActions",emits:["copy","retry","share"],setup(d,{emit:t}){const e=t,s=()=>{e("copy")};return(i,n)=>{const r=It("icon-copy"),a=It("a-tooltip");return N(),X("div",a0,[M("div",r0,[at(a,{content:"复制",position:"right"},{default:ut(()=>[M("div",{class:"action-btn-item",onClick:s},[at(r,{size:"22"})])]),_:1})]),n[0]||(n[0]=M("div",{class:"dialog-action-part dialog-action-right"},[M("div",{class:"action-btn-item"})],-1))])}}},l0=ct(o0,[["__scopeId","data-v-01a676ba"]]),c0={__name:"BtnStopChat",emits:["stop"],setup(d,{emit:t}){const e=t,s=()=>{e("stop")};return(i,n)=>(N(),X("div",{class:"btn-chat-stop-generate",onClick:s},"停止生成"))}},h0=ct(c0,[["__scopeId","data-v-9cc78a1d"]]);function Td(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let la=Td();function ap(d){la=d}const Vr={exec:()=>null};function yt(d,t=""){let e=typeof d=="string"?d:d.source;const s={replace:(i,n)=>{let r=typeof n=="string"?n:n.source;return r=r.replace(ue.caret,"$1"),e=e.replace(i,r),s},getRegex:()=>new RegExp(e,t)};return s}const ue={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:d=>new RegExp(`^( {0,3}${d})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}#`),htmlBeginRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}<(?:[a-z].*>|!--)`,"i")},d0=/^(?:[ \t]*(?:\n|$))+/,u0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,p0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,gl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,f0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,rp=/(?:[*+-]|\d{1,9}[.)])/,op=yt(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,rp).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Rd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,g0=/^[^\n]+/,Md=/(?!\s*\])(?:\\.|[^\[\]\\])+/,m0=yt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Md).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),b0=yt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,rp).getRegex(),Nc="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Id=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,v0=yt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Id).replace("tag",Nc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lp=yt(Rd).replace("hr",gl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nc).getRegex(),A0=yt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lp).getRegex(),Fd={blockquote:A0,code:u0,def:m0,fences:p0,heading:f0,hr:gl,html:v0,lheading:op,list:b0,newline:d0,paragraph:lp,table:Vr,text:g0},au=yt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",gl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nc).getRegex(),_0={...Fd,table:au,paragraph:yt(Rd).replace("hr",gl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",au).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nc).getRegex()},y0={...Fd,html:yt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Id).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Vr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:yt(Rd).replace("hr",gl).replace("heading",` *#{1,6} *[^
- ]`).replace("lheading",op).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},cp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,w0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hp=/^( {2,}|\\)\n(?!\s*$)/,x0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Oc=/[\p{P}\p{S}]/u,Ld=/[\s\p{P}\p{S}]/u,dp=/[^\s\p{P}\p{S}]/u,k0=yt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ld).getRegex(),S0=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,C0=yt(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,"u").replace(/punct/g,Oc).getRegex(),E0=yt("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,dp).replace(/punctSpace/g,Ld).replace(/punct/g,Oc).getRegex(),T0=yt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,dp).replace(/punctSpace/g,Ld).replace(/punct/g,Oc).getRegex(),R0=yt(/\\(punct)/,"gu").replace(/punct/g,Oc).getRegex(),M0=yt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),I0=yt(Id).replace("(?:-->|$)","-->").getRegex(),F0=yt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",I0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),rc=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,L0=yt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",rc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),up=yt(/^!?\[(label)\]\[(ref)\]/).replace("label",rc).replace("ref",Md).getRegex(),pp=yt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Md).getRegex(),P0=yt("reflink|nolink(?!\\()","g").replace("reflink",up).replace("nolink",pp).getRegex(),Pd={_backpedal:Vr,anyPunctuation:R0,autolink:M0,blockSkip:S0,br:hp,code:w0,del:Vr,emStrongLDelim:C0,emStrongRDelimAst:E0,emStrongRDelimUnd:T0,escape:cp,link:L0,nolink:pp,punctuation:k0,reflink:up,reflinkSearch:P0,tag:F0,text:x0,url:Vr},D0={...Pd,link:yt(/^!?\[(label)\]\((.*?)\)/).replace("label",rc).getRegex(),reflink:yt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",rc).getRegex()},rh={...Pd,escape:yt(cp).replace("])","~|])").getRegex(),url:yt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},N0={...rh,br:yt(hp).replace("{2,}","*").getRegex(),text:yt(rh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_l={normal:Fd,gfm:_0,pedantic:y0},kr={normal:Pd,gfm:rh,breaks:N0,pedantic:D0},O0={"&":"&","<":"<",">":">",'"':""","'":"'"},ru=d=>O0[d];function ds(d,t){if(t){if(ue.escapeTest.test(d))return d.replace(ue.escapeReplace,ru)}else if(ue.escapeTestNoEncode.test(d))return d.replace(ue.escapeReplaceNoEncode,ru);return d}function ou(d){try{d=encodeURI(d).replace(ue.percentDecode,"%")}catch{return null}return d}function lu(d,t){var n;const e=d.replace(ue.findPipe,(r,a,c)=>{let l=!1,h=a;for(;--h>=0&&c[h]==="\\";)l=!l;return l?"|":" |"}),s=e.split(ue.splitPipe);let i=0;if(s[0].trim()||s.shift(),s.length>0&&!((n=s.at(-1))!=null&&n.trim())&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(ue.slashPipe,"|");return s}function Sr(d,t,e){const s=d.length;if(s===0)return"";let i=0;for(;i<s;){const n=d.charAt(s-i-1);if(n===t&&!e)i++;else if(n!==t&&e)i++;else break}return d.slice(0,s-i)}function B0(d,t){if(d.indexOf(t[1])===-1)return-1;let e=0;for(let s=0;s<d.length;s++)if(d[s]==="\\")s++;else if(d[s]===t[0])e++;else if(d[s]===t[1]&&(e--,e<0))return s;return-1}function cu(d,t,e,s,i){const n=t.href,r=t.title||null,a=d[1].replace(i.other.outputLinkReplace,"$1");if(d[0].charAt(0)!=="!"){s.state.inLink=!0;const c={type:"link",raw:e,href:n,title:r,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,c}return{type:"image",raw:e,href:n,title:r,text:a}}function z0(d,t,e){const s=d.match(e.other.indentCodeCompensation);if(s===null)return t;const i=s[1];return t.split(`
- `).map(n=>{const r=n.match(e.other.beginningSpace);if(r===null)return n;const[a]=r;return a.length>=i.length?n.slice(i.length):n}).join(`
- `)}class oc{constructor(t){O(this,"options");O(this,"rules");O(this,"lexer");this.options=t||la}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const s=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?s:Sr(s,`
- `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const s=e[0],i=z0(s,e[3]||"",this.rules);return{type:"code",raw:s,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let s=e[2].trim();if(this.rules.other.endingHash.test(s)){const i=Sr(s,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(s=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Sr(e[0],`
- `)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let s=Sr(e[0],`
- `).split(`
- `),i="",n="";const r=[];for(;s.length>0;){let a=!1;const c=[];let l;for(l=0;l<s.length;l++)if(this.rules.other.blockquoteStart.test(s[l]))c.push(s[l]),a=!0;else if(!a)c.push(s[l]);else break;s=s.slice(l);const h=c.join(`
- `),u=h.replace(this.rules.other.blockquoteSetextReplace,`
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
- ${h}`:h,n=n?`${n}
- ${u}`:u;const p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,r,!0),this.lexer.state.top=p,s.length===0)break;const f=r.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){const g=f,m=g.raw+`
- `+s.join(`
- `),_=this.blockquote(m);r[r.length-1]=_,i=i.substring(0,i.length-g.raw.length)+_.raw,n=n.substring(0,n.length-g.text.length)+_.text;break}else if((f==null?void 0:f.type)==="list"){const g=f,m=g.raw+`
- `+s.join(`
- `),_=this.list(m);r[r.length-1]=_,i=i.substring(0,i.length-f.raw.length)+_.raw,n=n.substring(0,n.length-g.raw.length)+_.raw,s=m.substring(r.at(-1).raw.length).split(`
- `);continue}}return{type:"blockquote",raw:i,tokens:r,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim();const i=s.length>1,n={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");const r=this.rules.other.listItemRegex(s);let a=!1;for(;t;){let l=!1,h="",u="";if(!(e=r.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let p=e[2].split(`
- `,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),f=t.split(`
- `,1)[0],g=!p.trim(),m=0;if(this.options.pedantic?(m=2,u=p.trimStart()):g?m=e[1].length+1:(m=e[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=p.slice(m),m+=e[1].length),g&&this.rules.other.blankLine.test(f)&&(h+=f+`
- `,t=t.substring(f.length+1),l=!0),!l){const x=this.rules.other.nextBulletRegex(m),w=this.rules.other.hrRegex(m),k=this.rules.other.fencesBeginRegex(m),S=this.rules.other.headingBeginRegex(m),C=this.rules.other.htmlBeginRegex(m);for(;t;){const E=t.split(`
- `,1)[0];let T;if(f=E,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),T=f):T=f.replace(this.rules.other.tabCharGlobal," "),k.test(f)||S.test(f)||C.test(f)||x.test(f)||w.test(f))break;if(T.search(this.rules.other.nonSpaceChar)>=m||!f.trim())u+=`
- `+T.slice(m);else{if(g||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(p)||S.test(p)||w.test(p))break;u+=`
- `+f}!g&&!f.trim()&&(g=!0),h+=E+`
- `,t=t.substring(E.length+1),p=T.slice(m)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0));let _=null,y;this.options.gfm&&(_=this.rules.other.listIsTask.exec(u),_&&(y=_[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:h,task:!!_,checked:y,loose:!1,text:u,tokens:[]}),n.raw+=h}const c=n.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let l=0;l<n.items.length;l++)if(this.lexer.state.top=!1,n.items[l].tokens=this.lexer.blockTokens(n.items[l].text,[]),!n.loose){const h=n.items[l].tokens.filter(p=>p.type==="space"),u=h.length>0&&h.some(p=>this.rules.other.anyLine.test(p.raw));n.loose=u}if(n.loose)for(let l=0;l<n.items.length;l++)n.items[l].loose=!0;return n}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const s=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:s,raw:e[0],href:i,title:n}}}table(t){var a;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const s=lu(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(a=e[3])!=null&&a.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
- `):[],r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(s.length===i.length){for(const c of i)this.rules.other.tableAlignRight.test(c)?r.align.push("right"):this.rules.other.tableAlignCenter.test(c)?r.align.push("center"):this.rules.other.tableAlignLeft.test(c)?r.align.push("left"):r.align.push(null);for(let c=0;c<s.length;c++)r.header.push({text:s[c],tokens:this.lexer.inline(s[c]),header:!0,align:r.align[c]});for(const c of n)r.rows.push(lu(c,r.header.length).map((l,h)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[h]})));return r}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const s=e[1].charAt(e[1].length-1)===`
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:s,tokens:this.lexer.inline(s)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const s=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;const r=Sr(s.slice(0,-1),"\\");if((s.length-r.length)%2===0)return}else{const r=B0(e[2],"()");if(r>-1){const c=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,c).trim(),e[3]=""}}let i=e[2],n="";if(this.options.pedantic){const r=this.rules.other.pedanticHrefTitle.exec(i);r&&(i=r[1],n=r[3])}else n=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?i=i.slice(1):i=i.slice(1,-1)),cu(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let s;if((s=this.rules.inline.reflink.exec(t))||(s=this.rules.inline.nolink.exec(t))){const i=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[i.toLowerCase()];if(!n){const r=s[0].charAt(0);return{type:"text",raw:r,text:r}}return cu(s,n,s[0],this.lexer,this.rules)}}emStrong(t,e,s=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!i||i[3]&&s.match(this.rules.other.unicodeAlphaNumeric))return;if(!(i[1]||i[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const r=[...i[0]].length-1;let a,c,l=r,h=0;const u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+r);(i=u.exec(e))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(c=[...a].length,i[3]||i[4]){l+=c;continue}else if((i[5]||i[6])&&r%3&&!((r+c)%3)){h+=c;continue}if(l-=c,l>0)continue;c=Math.min(c,c+l+h);const p=[...i[0]][0].length,f=t.slice(0,r+i.index+p+c);if(Math.min(r,c)%2){const m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}const g=f.slice(2,-2);return{type:"strong",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let s=e[2].replace(this.rules.other.newLineCharGlobal," ");const i=this.rules.other.nonSpaceChar.test(s),n=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return i&&n&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:e[0],text:s}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let s,i;return e[2]==="@"?(s=e[1],i="mailto:"+s):(s=e[1],i=s),{type:"link",raw:e[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}url(t){var s;let e;if(e=this.rules.inline.url.exec(t)){let i,n;if(e[2]==="@")i=e[0],n="mailto:"+i;else{let r;do r=e[0],e[0]=((s=this.rules.inline._backpedal.exec(e[0]))==null?void 0:s[0])??"";while(r!==e[0]);i=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const s=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:s}}}}class Ge{constructor(t){O(this,"tokens");O(this,"options");O(this,"state");O(this,"tokenizer");O(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||la,this.options.tokenizer=this.options.tokenizer||new oc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const e={other:ue,block:_l.normal,inline:kr.normal};this.options.pedantic?(e.block=_l.pedantic,e.inline=kr.pedantic):this.options.gfm&&(e.block=_l.gfm,this.options.breaks?e.inline=kr.breaks:e.inline=kr.gfm),this.tokenizer.rules=e}static get rules(){return{block:_l,inline:kr}}static lex(t,e){return new Ge(e).lex(t)}static lexInline(t,e){return new Ge(e).inlineTokens(t)}lex(t){t=t.replace(ue.carriageReturn,`
- `),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const s=this.inlineQueue[e];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],s=!1){var i,n,r;for(this.options.pedantic&&(t=t.replace(ue.tabCharGlobal," ").replace(ue.spaceLine,""));t;){let a;if((n=(i=this.options.extensions)==null?void 0:i.block)!=null&&n.some(l=>(a=l.call({lexer:this},t,e))?(t=t.substring(a.raw.length),e.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);const l=e.at(-1);a.raw.length===1&&l!==void 0?l.raw+=`
- `:e.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);const l=e.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
- `+a.raw,l.text+=`
- `+a.text,this.inlineQueue.at(-1).src=l.text):e.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);const l=e.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
- `+a.raw,l.text+=`
- `+a.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),e.push(a);continue}let c=t;if((r=this.options.extensions)!=null&&r.startBlock){let l=1/0;const h=t.slice(1);let u;this.options.extensions.startBlock.forEach(p=>{u=p.call({lexer:this},h),typeof u=="number"&&u>=0&&(l=Math.min(l,u))}),l<1/0&&l>=0&&(c=t.substring(0,l+1))}if(this.state.top&&(a=this.tokenizer.paragraph(c))){const l=e.at(-1);s&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=`
- `+a.raw,l.text+=`
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):e.push(a),s=c.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);const l=e.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=`
- `+a.raw,l.text+=`
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):e.push(a);continue}if(t){const l="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){var a,c,l;let s=t,i=null;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)h.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n=!1,r="";for(;t;){n||(r=""),n=!1;let h;if((c=(a=this.options.extensions)==null?void 0:a.inline)!=null&&c.some(p=>(h=p.call({lexer:this},t,e))?(t=t.substring(h.raw.length),e.push(h),!0):!1))continue;if(h=this.tokenizer.escape(t)){t=t.substring(h.raw.length),e.push(h);continue}if(h=this.tokenizer.tag(t)){t=t.substring(h.raw.length),e.push(h);continue}if(h=this.tokenizer.link(t)){t=t.substring(h.raw.length),e.push(h);continue}if(h=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(h.raw.length);const p=e.at(-1);h.type==="text"&&(p==null?void 0:p.type)==="text"?(p.raw+=h.raw,p.text+=h.text):e.push(h);continue}if(h=this.tokenizer.emStrong(t,s,r)){t=t.substring(h.raw.length),e.push(h);continue}if(h=this.tokenizer.codespan(t)){t=t.substring(h.raw.length),e.push(h);continue}if(h=this.tokenizer.br(t)){t=t.substring(h.raw.length),e.push(h);continue}if(h=this.tokenizer.del(t)){t=t.substring(h.raw.length),e.push(h);continue}if(h=this.tokenizer.autolink(t)){t=t.substring(h.raw.length),e.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(t))){t=t.substring(h.raw.length),e.push(h);continue}let u=t;if((l=this.options.extensions)!=null&&l.startInline){let p=1/0;const f=t.slice(1);let g;this.options.extensions.startInline.forEach(m=>{g=m.call({lexer:this},f),typeof g=="number"&&g>=0&&(p=Math.min(p,g))}),p<1/0&&p>=0&&(u=t.substring(0,p+1))}if(h=this.tokenizer.inlineText(u)){t=t.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(r=h.raw.slice(-1)),n=!0;const p=e.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=h.raw,p.text+=h.text):e.push(h);continue}if(t){const p="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return e}}class lc{constructor(t){O(this,"options");O(this,"parser");this.options=t||la}space(t){return""}code({text:t,lang:e,escaped:s}){var r;const i=(r=(e||"").match(ue.notSpaceStart))==null?void 0:r[0],n=t.replace(ue.endingNewline,"")+`
- `;return i?'<pre><code class="language-'+ds(i)+'">'+(s?n:ds(n,!0))+`</code></pre>
- `:"<pre><code>"+(s?n:ds(n,!0))+`</code></pre>
- `}blockquote({tokens:t}){return`<blockquote>
- ${this.parser.parse(t)}</blockquote>
- `}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
- `}hr(t){return`<hr>
- `}list(t){const e=t.ordered,s=t.start;let i="";for(let a=0;a<t.items.length;a++){const c=t.items[a];i+=this.listitem(c)}const n=e?"ol":"ul",r=e&&s!==1?' start="'+s+'"':"";return"<"+n+r+`>
- `+i+"</"+n+`>
- `}listitem(t){var s;let e="";if(t.task){const i=this.checkbox({checked:!!t.checked});t.loose?((s=t.tokens[0])==null?void 0:s.type)==="paragraph"?(t.tokens[0].text=i+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=i+" "+ds(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):e+=i+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
- `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
- `}table(t){let e="",s="";for(let n=0;n<t.header.length;n++)s+=this.tablecell(t.header[n]);e+=this.tablerow({text:s});let i="";for(let n=0;n<t.rows.length;n++){const r=t.rows[n];s="";for(let a=0;a<r.length;a++)s+=this.tablecell(r[a]);i+=this.tablerow({text:s})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
- <thead>
- `+e+`</thead>
- `+i+`</table>
- `}tablerow({text:t}){return`<tr>
- ${t}</tr>
- `}tablecell(t){const e=this.parser.parseInline(t.tokens),s=t.header?"th":"td";return(t.align?`<${s} align="${t.align}">`:`<${s}>`)+e+`</${s}>
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ds(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:s}){const i=this.parser.parseInline(s),n=ou(t);if(n===null)return i;t=n;let r='<a href="'+t+'"';return e&&(r+=' title="'+ds(e)+'"'),r+=">"+i+"</a>",r}image({href:t,title:e,text:s}){const i=ou(t);if(i===null)return ds(s);t=i;let n=`<img src="${t}" alt="${s}"`;return e&&(n+=` title="${ds(e)}"`),n+=">",n}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ds(t.text)}}class Dd{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}}class Ve{constructor(t){O(this,"options");O(this,"renderer");O(this,"textRenderer");this.options=t||la,this.options.renderer=this.options.renderer||new lc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Dd}static parse(t,e){return new Ve(e).parse(t)}static parseInline(t,e){return new Ve(e).parseInline(t)}parse(t,e=!0){var i,n;let s="";for(let r=0;r<t.length;r++){const a=t[r];if((n=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&n[a.type]){const l=a,h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){s+=h||"";continue}}const c=a;switch(c.type){case"space":{s+=this.renderer.space(c);continue}case"hr":{s+=this.renderer.hr(c);continue}case"heading":{s+=this.renderer.heading(c);continue}case"code":{s+=this.renderer.code(c);continue}case"table":{s+=this.renderer.table(c);continue}case"blockquote":{s+=this.renderer.blockquote(c);continue}case"list":{s+=this.renderer.list(c);continue}case"html":{s+=this.renderer.html(c);continue}case"paragraph":{s+=this.renderer.paragraph(c);continue}case"text":{let l=c,h=this.renderer.text(l);for(;r+1<t.length&&t[r+1].type==="text";)l=t[++r],h+=`
- `+this.renderer.text(l);e?s+=this.renderer.paragraph({type:"paragraph",raw:h,text:h,tokens:[{type:"text",raw:h,text:h,escaped:!0}]}):s+=h;continue}default:{const l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}parseInline(t,e=this.renderer){var i,n;let s="";for(let r=0;r<t.length;r++){const a=t[r];if((n=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&n[a.type]){const l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";continue}}const c=a;switch(c.type){case"escape":{s+=e.text(c);break}case"html":{s+=e.html(c);break}case"link":{s+=e.link(c);break}case"image":{s+=e.image(c);break}case"strong":{s+=e.strong(c);break}case"em":{s+=e.em(c);break}case"codespan":{s+=e.codespan(c);break}case"br":{s+=e.br(c);break}case"del":{s+=e.del(c);break}case"text":{s+=e.text(c);break}default:{const l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}}class Wr{constructor(t){O(this,"options");O(this,"block");this.options=t||la}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ge.lex:Ge.lexInline}provideParser(){return this.block?Ve.parse:Ve.parseInline}}O(Wr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class fp{constructor(...t){O(this,"defaults",Td());O(this,"options",this.setOptions);O(this,"parse",this.parseMarkdown(!0));O(this,"parseInline",this.parseMarkdown(!1));O(this,"Parser",Ve);O(this,"Renderer",lc);O(this,"TextRenderer",Dd);O(this,"Lexer",Ge);O(this,"Tokenizer",oc);O(this,"Hooks",Wr);this.use(...t)}walkTokens(t,e){var i,n;let s=[];for(const r of t)switch(s=s.concat(e.call(this,r)),r.type){case"table":{const a=r;for(const c of a.header)s=s.concat(this.walkTokens(c.tokens,e));for(const c of a.rows)for(const l of c)s=s.concat(this.walkTokens(l.tokens,e));break}case"list":{const a=r;s=s.concat(this.walkTokens(a.items,e));break}default:{const a=r;(n=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&n[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{const l=a[c].flat(1/0);s=s.concat(this.walkTokens(l,e))}):a.tokens&&(s=s.concat(this.walkTokens(a.tokens,e)))}}return s}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(s=>{const i={...s};if(i.async=this.defaults.async||i.async||!1,s.extensions&&(s.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){const r=e.renderers[n.name];r?e.renderers[n.name]=function(...a){let c=n.renderer.apply(this,a);return c===!1&&(c=r.apply(this,a)),c}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=e[n.level];r?r.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),s.renderer){const n=this.defaults.renderer||new lc(this.defaults);for(const r in s.renderer){if(!(r in n))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const a=r,c=s.renderer[a],l=n[a];n[a]=(...h)=>{let u=c.apply(n,h);return u===!1&&(u=l.apply(n,h)),u||""}}i.renderer=n}if(s.tokenizer){const n=this.defaults.tokenizer||new oc(this.defaults);for(const r in s.tokenizer){if(!(r in n))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const a=r,c=s.tokenizer[a],l=n[a];n[a]=(...h)=>{let u=c.apply(n,h);return u===!1&&(u=l.apply(n,h)),u}}i.tokenizer=n}if(s.hooks){const n=this.defaults.hooks||new Wr;for(const r in s.hooks){if(!(r in n))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const a=r,c=s.hooks[a],l=n[a];Wr.passThroughHooks.has(r)?n[a]=h=>{if(this.defaults.async)return Promise.resolve(c.call(n,h)).then(p=>l.call(n,p));const u=c.call(n,h);return l.call(n,u)}:n[a]=(...h)=>{let u=c.apply(n,h);return u===!1&&(u=l.apply(n,h)),u}}i.hooks=n}if(s.walkTokens){const n=this.defaults.walkTokens,r=s.walkTokens;i.walkTokens=function(a){let c=[];return c.push(r.call(this,a)),n&&(c=c.concat(n.call(this,a))),c}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ge.lex(t,e??this.defaults)}parser(t,e){return Ve.parse(t,e??this.defaults)}parseMarkdown(t){return(s,i)=>{const n={...i},r={...this.defaults,...n},a=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof s>"u"||s===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=t);const c=r.hooks?r.hooks.provideLexer():t?Ge.lex:Ge.lexInline,l=r.hooks?r.hooks.provideParser():t?Ve.parse:Ve.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).then(h=>c(h,r)).then(h=>r.hooks?r.hooks.processAllTokens(h):h).then(h=>r.walkTokens?Promise.all(this.walkTokens(h,r.walkTokens)).then(()=>h):h).then(h=>l(h,r)).then(h=>r.hooks?r.hooks.postprocess(h):h).catch(a);try{r.hooks&&(s=r.hooks.preprocess(s));let h=c(s,r);r.hooks&&(h=r.hooks.processAllTokens(h)),r.walkTokens&&this.walkTokens(h,r.walkTokens);let u=l(h,r);return r.hooks&&(u=r.hooks.postprocess(u)),u}catch(h){return a(h)}}}onError(t,e){return s=>{if(s.message+=`
- Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+ds(s.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(s);throw s}}}const sa=new fp;function vt(d,t){return sa.parse(d,t)}vt.options=vt.setOptions=function(d){return sa.setOptions(d),vt.defaults=sa.defaults,ap(vt.defaults),vt};vt.getDefaults=Td;vt.defaults=la;vt.use=function(...d){return sa.use(...d),vt.defaults=sa.defaults,ap(vt.defaults),vt};vt.walkTokens=function(d,t){return sa.walkTokens(d,t)};vt.parseInline=sa.parseInline;vt.Parser=Ve;vt.parser=Ve.parse;vt.Renderer=lc;vt.TextRenderer=Dd;vt.Lexer=Ge;vt.lexer=Ge.lex;vt.Tokenizer=oc;vt.Hooks=Wr;vt.parse=vt;vt.options;vt.setOptions;vt.use;vt.walkTokens;vt.parseInline;Ve.parse;Ge.lex;const j0=new fp,H0="refference-flag",U0=d=>d.replace(/##\d\$\$/g,' <span class="circle"></span>');function q0(d){if(!d)return"";let t=U0(d);d.indexOf("![]")<0;var i=j0.parse(t).replace("<a href=",'<a target="_blank" href=').replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi,function(c,l){const h=document.createElement("div");h.innerHTML=c;const u=h.querySelector("img"),p=u.src,f=Ed(p),g=u.alt;return`<img data-src="${f}" src="${f}" data-alt="${g}"></img>`});const n=/<span class="circle" data-list-index="\d"><\/span>/g;let r=0;return i.replaceAll(n,function(c,l,h,u){let p=c.replace("></span>",`data-flag-index="${r}"></span>`);return p=p.replace('class="circle"',`class="refflag-refflag-refflag ${H0}"`),r++,p})}function gp(d,t){return!d||!d.doc_aggs?"":'<div class="client-formated-markdown-element-item client-formated-markdown-doc-refference-container"></div>'}function mp(d){if(!d)return"";let t=d;return t=t.replace(/##\d\$\$/g,function(e,s,i){return`<span class="client-formated-markdown-element-item client-formated-markdown-doc-refference-flag" data-ref-index="${e.replace("##","").replace("$$","")}"></span>`}),t}function G0(d,t,e){if(!d||!t)return"";let s=t.replace("//","/");return s=t.replace("/./","/"),s=t.replace("./","/"),s=Ed(s),`<div class="client-formated-markdown-element-item client-formated-download-container">
- <a class="download-link" href="${s}" target="_blank">
- <span class="download-icon"><svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" class="arco-icon arco-icon-download" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter" filter="downl" data-v-2bc6460e="" style="font-size: 32px;"><path d="m33.072 22.071-9.07 9.071-9.072-9.07M24 5v26m16 4v6H8v-6"></path></svg></span>
- <span>${d}</span>
- </a>
- </div>`}var oh={d:(d,t)=>{for(var e in t)oh.o(t,e)&&!oh.o(d,e)&&Object.defineProperty(d,e,{enumerable:!0,get:t[e]})},o:(d,t)=>Object.prototype.hasOwnProperty.call(d,t)},J=globalThis.pdfjsLib={};oh.d(J,{AbortException:()=>ha,AnnotationEditorLayer:()=>Ad,AnnotationEditorParamsType:()=>Q,AnnotationEditorType:()=>et,AnnotationEditorUIManager:()=>na,AnnotationLayer:()=>Jv,AnnotationMode:()=>vi,ColorPicker:()=>pc,DOMSVGFactory:()=>Xd,DrawLayer:()=>xd,FeatureTest:()=>pe,GlobalWorkerOptions:()=>oi,ImageKind:()=>Tl,InvalidPDFException:()=>Ap,MissingPDFException:()=>ca,OPS:()=>Ke,OutputScale:()=>ph,PDFDataRangeTransport:()=>ff,PDFDateString:()=>Hd,PDFWorker:()=>ka,PasswordResponses:()=>wb,PermissionFlag:()=>Q0,PixelsPerInch:()=>Yi,RenderingCancelledException:()=>zd,TextLayer:()=>Qr,UnexpectedResponseException:()=>Hc,Util:()=>G,VerbosityLevel:()=>Bc,XfaLayer:()=>mf,build:()=>Lv,createValidAbsoluteUrl:()=>Sb,fetchData:()=>qc,getDocument:()=>Cv,getFilenameFromUrl:()=>Ob,getPdfFilenameFromUrl:()=>Bb,getXfaPageViewport:()=>zb,isDataScheme:()=>Gc,isPdfFile:()=>jd,noContextMenu:()=>Ye,normalizeUnicode:()=>Eb,setLayerDimensions:()=>ia,shadow:()=>lt,version:()=>Fv});const oe=!(typeof process!="object"||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type!=="browser"),bp=[1,0,0,1,0,0],lh=[.001,0,0,.001,0,0],Qc=1.35,V0=1,Nd=2,cc=4,W0=16,Y0=32,X0=64,$0=128,K0=256,vi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},et={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Q={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},Q0={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},El=0,Jc=1,Cr=2,J0=3,hu=3,Z0=4,Tl={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},tb=1,eb=2,sb=3,ib=4,nb=5,ab=6,rb=7,ob=8,lb=9,cb=10,hb=11,db=12,ub=13,pb=14,fb=15,vp=16,gb=17,mb=20,bb=1,vb=2,Ab=3,_b=4,yb=5,Bc={ERRORS:0,WARNINGS:1,INFOS:5},Ke={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},wb={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let zc=Bc.WARNINGS;function xb(d){Number.isInteger(d)&&(zc=d)}function kb(){return zc}function jc(d){zc>=Bc.INFOS&&console.log(`Info: ${d}`)}function nt(d){zc>=Bc.WARNINGS&&console.log(`Warning: ${d}`)}function xt(d){throw new Error(d)}function Ut(d,t){d||xt(t)}function Sb(d,t=null,e=null){if(!d)return null;try{if(e&&typeof d=="string"){if(e.addDefaultProtocol&&d.startsWith("www.")){const i=d.match(/\./g);(i==null?void 0:i.length)>=2&&(d=`http://${d}`)}if(e.tryConvertEncoding)try{d=function(n){return decodeURIComponent(escape(n))}(d)}catch{}}const s=t?new URL(d,t):new URL(d);if(function(n){switch(n==null?void 0:n.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(s))return s}catch{}return null}function lt(d,t,e,s=!1){return Object.defineProperty(d,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const Qi=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class ch extends Qi{constructor(t,e){super(t,"PasswordException"),this.code=e}}class hh extends Qi{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Ap extends Qi{constructor(t){super(t,"InvalidPDFException")}}class ca extends Qi{constructor(t){super(t,"MissingPDFException")}}class Hc extends Qi{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Cb extends Qi{constructor(t){super(t,"FormatError")}}class ha extends Qi{constructor(t){super(t,"AbortException")}}function _p(d){typeof d=="object"&&(d==null?void 0:d.length)!==void 0||xt("Invalid argument for bytesToString");const t=d.length,e=8192;if(t<e)return String.fromCharCode.apply(null,d);const s=[];for(let i=0;i<t;i+=e){const n=Math.min(i+e,t),r=d.subarray(i,n);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function Uc(d){typeof d!="string"&&xt("Invalid argument for stringToBytes");const t=d.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=255&d.charCodeAt(s);return e}function Od(d){const t=Object.create(null);for(const[e,s]of d)t[e]=s;return t}class pe{static get isLittleEndian(){return lt(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}())}static get isEvalSupported(){return lt(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return lt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?lt(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):lt(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return lt(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Zc=Array.from(Array(256).keys(),d=>d.toString(16).padStart(2,"0"));var ci,Rl,dh;class G{static makeHexColor(t,e,s){return`#${Zc[t]}${Zc[e]}${Zc[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){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),r=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],n[0],r[0]),Math.min(s[1],i[1],n[1],r[1]),Math.max(s[0],i[0],n[0],r[0]),Math.max(s[1],i[1],n[1],r[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],r=t[2]*e[1]+t[3]*e[3],a=(s+r)/2,c=Math.sqrt((s+r)**2-4*(s*r-n*i))/2,l=a+c||1,h=a-c||1;return[Math.sqrt(l),Math.sqrt(h)]}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])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>r?null:[s,n,i,r]}static bezierBoundingBox(t,e,s,i,n,r,a,c,l){return l?(l[0]=Math.min(l[0],t,a),l[1]=Math.min(l[1],e,c),l[2]=Math.max(l[2],t,a),l[3]=Math.max(l[3],e,c)):l=[Math.min(t,a),Math.min(e,c),Math.max(t,a),Math.max(e,c)],v(this,ci,dh).call(this,t,s,n,a,e,i,r,c,3*(3*(s-n)-t+a),6*(t-2*s+n),3*(s-t),l),v(this,ci,dh).call(this,t,s,n,a,e,i,r,c,3*(3*(i-r)-e+c),6*(e-2*i+r),3*(i-e),l),l}}ci=new WeakSet,Rl=function(t,e,s,i,n,r,a,c,l,h){if(l<=0||l>=1)return;const u=1-l,p=l*l,f=p*l,g=u*(u*(u*t+3*l*e)+3*p*s)+f*i,m=u*(u*(u*n+3*l*r)+3*p*a)+f*c;h[0]=Math.min(h[0],g),h[1]=Math.min(h[1],m),h[2]=Math.max(h[2],g),h[3]=Math.max(h[3],m)},dh=function(t,e,s,i,n,r,a,c,l,h,u,p){if(Math.abs(l)<1e-12){Math.abs(h)>=1e-12&&v(this,ci,Rl).call(this,t,e,s,i,n,r,a,c,-u/h,p);return}const f=h**2-4*u*l;if(f<0)return;const g=Math.sqrt(f),m=2*l;v(this,ci,Rl).call(this,t,e,s,i,n,r,a,c,(-h+g)/m,p),v(this,ci,Rl).call(this,t,e,s,i,n,r,a,c,(-h-g)/m,p)},A(G,ci);let th=null,du=null;function Eb(d){return th||(th=/([\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,du=new Map([["ſt","ſt"]])),d.replaceAll(th,(t,e,s)=>e?e.normalize("NFKC"):du.get(s))}const Bd="pdfjs_internal_id_",Tb=0,Rb=1,Mb=2,Ib=3,Fb=4,Lb=5,Pb=6,Db=7,Nb=8,Ps="http://www.w3.org/2000/svg",sn=class sn{};O(sn,"CSS",96),O(sn,"PDF",72),O(sn,"PDF_TO_CSS_UNITS",sn.CSS/sn.PDF);let Yi=sn;async function qc(d,t="text"){if(Rr(d,document.baseURI)){const e=await fetch(d);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",d,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE)if(i.status!==200&&i.status!==0)s(new Error(i.statusText));else{switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText)}},i.send(null)})}class ml{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:n=0,dontFlip:r=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=n;const a=(t[2]+t[0])/2,c=(t[3]+t[1])/2;let l,h,u,p,f,g,m,_;switch((s%=360)<0&&(s+=360),s){case 180:l=-1,h=0,u=0,p=1;break;case 90:l=0,h=1,u=1,p=0;break;case 270:l=0,h=-1,u=-1,p=0;break;case 0:l=1,h=0,u=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(u=-u,p=-p),l===0?(f=Math.abs(c-t[1])*e+i,g=Math.abs(a-t[0])*e+n,m=(t[3]-t[1])*e,_=(t[2]-t[0])*e):(f=Math.abs(a-t[0])*e+i,g=Math.abs(c-t[1])*e+n,m=(t[2]-t[0])*e,_=(t[3]-t[1])*e),this.transform=[l*e,h*e,u*e,p*e,f-l*e*a-u*e*c,g-h*e*a-p*e*c],this.width=m,this.height=_}get rawDims(){const{viewBox:t}=this;return lt(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new ml({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){return G.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=G.applyTransform([t[0],t[1]],this.transform),s=G.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return G.applyInverseTransform([t,e],this.transform)}}class zd extends Qi{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function Gc(d){const t=d.length;let e=0;for(;e<t&&d[e].trim()==="";)e++;return d.substring(e,e+5).toLowerCase()==="data:"}function jd(d){return typeof d=="string"&&/\.pdf$/i.test(d)}function Ob(d){return[d]=d.split(/[#?]/,1),d.substring(d.lastIndexOf("/")+1)}function Bb(d,t="document.pdf"){if(typeof d!="string")return t;if(Gc(d))return nt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(d);let i=e.exec(s[1])||e.exec(s[2])||e.exec(s[3]);if(i&&(i=i[0],i.includes("%")))try{i=e.exec(decodeURIComponent(i))[0]}catch{}return i||t}class uu{constructor(){O(this,"started",Object.create(null));O(this,"times",[])}time(t){t in this.started&&nt(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||nt(`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
- `);return t.join("")}}function Rr(d,t){try{const{protocol:e}=t?new URL(d,t):new URL(d);return e==="http:"||e==="https:"}catch{return!1}}function Ye(d){d.preventDefault()}function pu(d){console.log("Deprecated API usage: "+d)}var Zr;class Hd{static toDateObject(t){if(!t||typeof t!="string")return null;o(this,Zr)||b(this,Zr,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=o(this,Zr).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 r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let c=parseInt(e[6],10);c=c>=0&&c<=59?c:0;const l=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,l==="-"?(r+=h,a+=u):l==="+"&&(r-=h,a-=u),new Date(Date.UTC(s,i,n,r,a,c))}}Zr=new WeakMap,A(Hd,Zr);function zb(d,{scale:t=1,rotation:e=0}){const{width:s,height:i}=d.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new ml({viewBox:n,scale:t,rotation:e})}function uh(d){if(d.startsWith("#")){const t=parseInt(d.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return d.startsWith("rgb(")?d.slice(4,-1).split(",").map(t=>parseInt(t)):d.startsWith("rgba(")?d.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(nt(`Not a valid color format: "${d}"`),[0,0,0])}function Rt(d){const{a:t,b:e,c:s,d:i,e:n,f:r}=d.getTransform();return[t,e,s,i,n,r]}function Ls(d){const{a:t,b:e,c:s,d:i,e:n,f:r}=d.getTransform().invertSelf();return[t,e,s,i,n,r]}function ia(d,t,e=!1,s=!0){if(t instanceof ml){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:r}=d,a=pe.isCSSRoundSupported,c=`var(--scale-factor) * ${i}px`,l=`var(--scale-factor) * ${n}px`,h=a?`round(down, ${c}, var(--scale-round-x, 1px))`:`calc(${c})`,u=a?`round(down, ${l}, var(--scale-round-y, 1px))`:`calc(${l})`;e&&t.rotation%180!=0?(r.width=u,r.height=h):(r.width=h,r.height=u)}s&&d.setAttribute("data-main-rotation",t.rotation)}class ph{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var Ai,rn,Qe,on,to,eo,gc,yp,fe,wp,xp,Ml,kp,gh;const Ds=class Ds{constructor(t){A(this,fe);A(this,Ai,null);A(this,rn,null);A(this,Qe);A(this,on,null);A(this,to,null);b(this,Qe,t),o(Ds,eo)||b(Ds,eo,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"}))}render(){const t=b(this,Ai,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=o(this,Qe)._uiManager._signal;t.addEventListener("contextmenu",Ye,{signal:e}),t.addEventListener("pointerdown",v(Ds,gc,yp),{signal:e});const s=b(this,on,document.createElement("div"));s.className="buttons",t.append(s);const i=o(this,Qe).toolbarPosition;if(i){const{style:n}=t,r=o(this,Qe)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=100*r+"%",n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return v(this,fe,kp).call(this),t}get div(){return o(this,Ai)}hide(){var t;o(this,Ai).classList.add("hidden"),(t=o(this,rn))==null||t.hideDropdown()}show(){var t;o(this,Ai).classList.remove("hidden"),(t=o(this,to))==null||t.shown()}async addAltText(t){const e=await t.render();v(this,fe,Ml).call(this,e),o(this,on).prepend(e,o(this,fe,gh)),b(this,to,t)}addColorPicker(t){b(this,rn,t);const e=t.renderButton();v(this,fe,Ml).call(this,e),o(this,on).prepend(e,o(this,fe,gh))}remove(){var t;o(this,Ai).remove(),(t=o(this,rn))==null||t.destroy(),b(this,rn,null)}};Ai=new WeakMap,rn=new WeakMap,Qe=new WeakMap,on=new WeakMap,to=new WeakMap,eo=new WeakMap,gc=new WeakSet,yp=function(t){t.stopPropagation()},fe=new WeakSet,wp=function(t){o(this,Qe)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},xp=function(t){o(this,Qe)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},Ml=function(t){const e=o(this,Qe)._uiManager._signal;t.addEventListener("focusin",v(this,fe,wp).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",v(this,fe,xp).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Ye,{signal:e})},kp=function(){const{editorType:t,_uiManager:e}=o(this,Qe),s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",o(Ds,eo)[t]),v(this,fe,Ml).call(this,s),s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),o(this,on).append(s)},gh=function(){const t=document.createElement("div");return t.className="divider",t},A(Ds,gc),A(Ds,eo,null);let fh=Ds;var so,ln,cn,$i,Sp,Cp,Ep;class jb{constructor(t){A(this,$i);A(this,so,null);A(this,ln,null);A(this,cn);b(this,cn,t)}show(t,e,s){const[i,n]=v(this,$i,Cp).call(this,e,s),{style:r}=o(this,ln)||b(this,ln,v(this,$i,Sp).call(this));t.append(o(this,ln)),r.insetInlineEnd=100*i+"%",r.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){o(this,ln).remove()}}so=new WeakMap,ln=new WeakMap,cn=new WeakMap,$i=new WeakSet,Sp=function(){const t=b(this,ln,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ye,{signal:o(this,cn)._signal});const e=b(this,so,document.createElement("div"));return e.className="buttons",t.append(e),v(this,$i,Ep).call(this),t},Cp=function(t,e){let s=0,i=0;for(const n of t){const r=n.y+n.height;if(r<s)continue;const a=n.x+(e?n.width:0);r>s?(i=a,s=r):e?a>i&&(i=a):a<i&&(i=a)}return[e?1-i:i,s]},Ep=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=o(this,cn)._signal;t.addEventListener("contextmenu",Ye,{signal:s}),t.addEventListener("click",()=>{o(this,cn).highlightSelection("floating_button")},{signal:s}),o(this,so).append(t)};function hc(d,t,e){for(const s of e)t.addEventListener(s,d[s].bind(d))}var mc;class Hb{constructor(){A(this,mc,0)}get id(){return"pdfjs_internal_editor_"+ce(this,mc)._++}}mc=new WeakMap;var Sa,io,ie,Ca,Il;const Kd=class Kd{constructor(){A(this,Ca);A(this,Sa,function(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const e=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(e);else for(let s=0;s<32;s++)e[s]=Math.floor(255*Math.random());return _p(e)}());A(this,io,0);A(this,ie,null)}static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',lt(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0)))}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return v(this,Ca,Il).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return v(this,Ca,Il).call(this,t,t)}async getFromBlob(t,e){const s=await e;return v(this,Ca,Il).call(this,t,s)}async getFromId(t){o(this,ie)||b(this,ie,new Map);const e=o(this,ie).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){o(this,ie)||b(this,ie,new Map);let s=o(this,ie).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_${o(this,Sa)}_${ce(this,io)._++}`,refCounter:1,isSvg:!1},o(this,ie).set(t,s),o(this,ie).set(s.id,s),s}getSvgUrl(t){const e=o(this,ie).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;o(this,ie)||b(this,ie,new Map);const e=o(this,ie).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_${o(this,Sa)}_`)}};Sa=new WeakMap,io=new WeakMap,ie=new WeakMap,Ca=new WeakSet,Il=async function(t,e){o(this,ie)||b(this,ie,new Map);let s=o(this,ie).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${o(this,Sa)}_${ce(this,io)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await qc(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const n=Kd._isSVGFittingCanvas,r=new FileReader,a=new Image,c=new Promise((l,h)=>{a.onload=()=>{s.bitmap=a,s.isSvg=!0,l()},r.onload=async()=>{const u=s.svgUrl=r.result;a.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},a.onerror=r.onerror=h});r.readAsDataURL(i),await c}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){console.error(i),s=null}return o(this,ie).set(t,s),s&&o(this,ie).set(s.id,s),s};let mh=Kd;var Gt,_i,no,Vt;class Ub{constructor(t=128){A(this,Gt,[]);A(this,_i,!1);A(this,no);A(this,Vt,-1);b(this,no,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:a=!1}){if(i&&t(),o(this,_i))return;const c={cmd:t,undo:e,post:s,type:n};if(o(this,Vt)===-1){o(this,Gt).length>0&&(o(this,Gt).length=0),b(this,Vt,0),o(this,Gt).push(c);return}if(r&&o(this,Gt)[o(this,Vt)].type===n){a&&(c.undo=o(this,Gt)[o(this,Vt)].undo),o(this,Gt)[o(this,Vt)]=c;return}const l=o(this,Vt)+1;l===o(this,no)?o(this,Gt).splice(0,1):(b(this,Vt,l),l<o(this,Gt).length&&o(this,Gt).splice(l)),o(this,Gt).push(c)}undo(){if(o(this,Vt)===-1)return;b(this,_i,!0);const{undo:t,post:e}=o(this,Gt)[o(this,Vt)];t(),e==null||e(),b(this,_i,!1),b(this,Vt,o(this,Vt)-1)}redo(){if(o(this,Vt)<o(this,Gt).length-1){b(this,Vt,o(this,Vt)+1),b(this,_i,!0);const{cmd:t,post:e}=o(this,Gt)[o(this,Vt)];t(),e==null||e(),b(this,_i,!1)}}hasSomethingToUndo(){return o(this,Vt)!==-1}hasSomethingToRedo(){return o(this,Vt)<o(this,Gt).length-1}destroy(){b(this,Gt,null)}}Gt=new WeakMap,_i=new WeakMap,no=new WeakMap,Vt=new WeakMap;var bc,Tp;class bl{constructor(t){A(this,bc);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=pe.platform;for(const[s,i,n={}]of t)for(const r of s){const a=r.startsWith("mac+");e&&a?(this.callbacks.set(r.slice(4),{callback:i,options:n}),this.allKeys.add(r.split("+").at(-1))):!e&&!a&&(this.callbacks.set(r,{callback:i,options:n}),this.allKeys.add(r.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(v(this,bc,Tp).call(this,e));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:r=[],checker:a=null}}=s;(!a||a(t,e))&&(i.bind(t,...r,e)(),n||(e.stopPropagation(),e.preventDefault()))}}bc=new WeakSet,Tp=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 vc=class vc{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(s){const i=document.createElement("span");i.style.visibility="hidden",document.body.append(i);for(const n of s.keys()){i.style.color=n;const r=window.getComputedStyle(i).color;s.set(n,uh(r))}i.remove()}(t),lt(this,"_colors",t)}convert(t){const e=uh(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((n,r)=>n===e[r]))return vc._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?G.makeHexColor(...e):t}};O(vc,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let bh=vc;var Ea,Se,zt,Qt,Ta,Os,Ra,Je,yi,Ma,hn,us,Ze,dn,ao,ro,Ia,oo,ps,wi,Fa,xi,fs,Ac,ki,lo,Si,un,co,ho,Wt,pt,Bs,pn,uo,po,Ci,gs,zs,fo,Oe,D,Fl,vh,Rp,Mp,Ll,Ip,Fp,Lp,Ah,Pp,_h,yh,Dp,he,mi,Np,Op,wh,Bp,Mr,xh;const ya=class ya{constructor(t,e,s,i,n,r,a,c,l,h,u){A(this,D);A(this,Ea,new AbortController);A(this,Se,null);A(this,zt,new Map);A(this,Qt,new Map);A(this,Ta,null);A(this,Os,null);A(this,Ra,null);A(this,Je,new Ub);A(this,yi,null);A(this,Ma,0);A(this,hn,new Set);A(this,us,null);A(this,Ze,null);A(this,dn,new Set);A(this,ao,!1);A(this,ro,!1);A(this,Ia,!1);A(this,oo,null);A(this,ps,null);A(this,wi,null);A(this,Fa,null);A(this,xi,!1);A(this,fs,null);A(this,Ac,new Hb);A(this,ki,!1);A(this,lo,!1);A(this,Si,null);A(this,un,null);A(this,co,null);A(this,ho,null);A(this,Wt,et.NONE);A(this,pt,new Set);A(this,Bs,null);A(this,pn,null);A(this,uo,null);A(this,po,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});A(this,Ci,[0,0]);A(this,gs,null);A(this,zs,null);A(this,fo,null);A(this,Oe,null);const p=this._signal=o(this,Ea).signal;b(this,zs,t),b(this,fo,e),b(this,Ta,s),this._eventBus=i,i._on("editingaction",this.onEditingAction.bind(this),{signal:p}),i._on("pagechanging",this.onPageChanging.bind(this),{signal:p}),i._on("scalechanging",this.onScaleChanging.bind(this),{signal:p}),i._on("rotationchanging",this.onRotationChanging.bind(this),{signal:p}),i._on("setpreference",this.onSetPreference.bind(this),{signal:p}),i._on("switchannotationeditorparams",f=>this.updateParams(f.type,f.value),{signal:p}),v(this,D,Ip).call(this),v(this,D,Dp).call(this),v(this,D,Ah).call(this),b(this,Os,n.annotationStorage),b(this,oo,n.filterFactory),b(this,pn,r),b(this,Fa,a||null),b(this,ao,c),b(this,ro,l),b(this,Ia,h),b(this,ho,u||null),this.viewParameters={realScale:Yi.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=ya.prototype,e=r=>o(r,zs).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),s=(r,{target:a})=>{if(a instanceof HTMLInputElement){const{type:c}=a;return c!=="text"&&c!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return lt(this,"_keyboardManager",new bl([[["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:(r,{target:a})=>!(a instanceof HTMLButtonElement)&&o(r,zs).contains(a)&&!r.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(r,{target:a})=>!(a instanceof HTMLButtonElement)&&o(r,zs).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;(t=o(this,Oe))==null||t.resolve(),b(this,Oe,null),(e=o(this,Ea))==null||e.abort(),b(this,Ea,null),this._signal=null;for(const n of o(this,Qt).values())n.destroy();o(this,Qt).clear(),o(this,zt).clear(),o(this,dn).clear(),b(this,Se,null),o(this,pt).clear(),o(this,Je).destroy(),(s=o(this,Ta))==null||s.destroy(),(i=o(this,fs))==null||i.hide(),b(this,fs,null),o(this,ps)&&(clearTimeout(o(this,ps)),b(this,ps,null)),o(this,gs)&&(clearTimeout(o(this,gs)),b(this,gs,null))}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return o(this,ho)}get useNewAltTextFlow(){return o(this,ro)}get useNewAltTextWhenAddingImage(){return o(this,Ia)}get hcmFilter(){return lt(this,"hcmFilter",o(this,pn)?o(this,oo).addHCMFilter(o(this,pn).foreground,o(this,pn).background):"none")}get direction(){return lt(this,"direction",getComputedStyle(o(this,zs)).direction)}get highlightColors(){return lt(this,"highlightColors",o(this,Fa)?new Map(o(this,Fa).split(",").map(t=>t.split("=").map(e=>e.trim()))):null)}get highlightColorNames(){return lt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){b(this,co,t)}editAltText(t,e=!1){var s;(s=o(this,Ta))==null||s.editAltText(this,t,e)}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}){t==="enableNewAltTextWhenAddingImage"&&b(this,Ia,e)}onPageChanging({pageNumber:t}){b(this,Ma,t-1)}focusMainContainer(){o(this,zs).focus()}findParent(t,e){for(const s of o(this,Qt).values()){const{x:i,y:n,width:r,height:a}=s.div.getBoundingClientRect();if(t>=i&&t<=i+r&&e>=n&&e<=n+a)return s}return null}disableUserSelect(t=!1){o(this,fo).classList.toggle("noUserSelect",t)}addShouldRescale(t){o(this,dn).add(t)}removeShouldRescale(t){o(this,dn).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Yi.PDF_TO_CSS_UNITS;for(const e of o(this,dn))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:r}=e,a=e.toString(),c=v(this,D,Fl).call(this,e).closest(".textLayer"),l=this.getSelectionBoxes(c);if(!l)return;e.empty();const h=v(this,D,vh).call(this,c),u=o(this,Wt)===et.NONE,p=()=>{h==null||h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:l,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:r,text:a}),u&&this.showAllEditors("highlight",!0,!0)};u?this.switchToMode(et.HIGHLIGHT,p):p()}addToAnnotationStorage(t){t.isEmpty()||!o(this,Os)||o(this,Os).has(t.id)||o(this,Os).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,o(this,xi)&&(b(this,xi,!1),v(this,D,Ll).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of o(this,pt))if(e.div.contains(t)){b(this,un,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!o(this,un))return;const[t,e]=o(this,un);b(this,un,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){v(this,D,Ah).call(this),v(this,D,_h).call(this)}removeEditListeners(){v(this,D,Pp).call(this),v(this,D,yh).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of o(this,Ze))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of o(this,Ze))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=o(this,Se))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of o(this,pt)){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 r of o(this,Ze))if(r.isHandlingMimeForPasting(n.type)){r.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){nt(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const c of s){const l=await i.deserialize(c);if(!l)return;n.push(l)}const r=()=>{for(const c of n)v(this,D,wh).call(this,c);v(this,D,xh).call(this,n)},a=()=>{for(const c of n)c.remove()};this.addCommands({cmd:r,undo:a,mustExec:!0})}catch(n){nt(`paste: "${n.message}".`)}}keydown(t){this.isShiftKeyDown||t.key!=="Shift"||(this.isShiftKeyDown=!0),o(this,Wt)===et.NONE||this.isEditorHandlingKeyboard||ya._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,o(this,xi)&&(b(this,xi,!1),v(this,D,Ll).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")}}setEditingState(t){t?(v(this,D,Fp).call(this),v(this,D,_h).call(this),v(this,D,he).call(this,{isEditing:o(this,Wt)!==et.NONE,isEmpty:v(this,D,Mr).call(this),hasSomethingToUndo:o(this,Je).hasSomethingToUndo(),hasSomethingToRedo:o(this,Je).hasSomethingToRedo(),hasSelectedEditor:!1})):(v(this,D,Lp).call(this),v(this,D,yh).call(this),v(this,D,he).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!o(this,Ze)){b(this,Ze,t);for(const e of o(this,Ze))v(this,D,mi).call(this,e.defaultPropertiesToUpdate)}}getId(){return o(this,Ac).id}get currentLayer(){return o(this,Qt).get(o(this,Ma))}getLayer(t){return o(this,Qt).get(t)}get currentPageIndex(){return o(this,Ma)}addLayer(t){o(this,Qt).set(t.pageIndex,t),o(this,ki)?t.enable():t.disable()}removeLayer(t){o(this,Qt).delete(t.pageIndex)}async updateMode(t,e=null,s=!1){if(o(this,Wt)!==t){if(o(this,Oe)&&(await o(this,Oe).promise,!o(this,Oe)))return;if(b(this,Oe,Promise.withResolvers()),b(this,Wt,t),t!==et.NONE){this.setEditingState(!0),await v(this,D,Np).call(this),this.unselectAll();for(const i of o(this,Qt).values())i.updateMode(t);if(e){for(const i of o(this,zt).values())i.annotationElementId===e?(this.setSelected(i),i.enterInEditMode()):i.unselect();o(this,Oe).resolve()}else s&&this.addNewEditorFromKeyboard(),o(this,Oe).resolve()}else this.setEditingState(!1),v(this,D,Op).call(this),o(this,Oe).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==o(this,Wt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var s;if(o(this,Ze)){switch(t){case Q.CREATE:this.currentLayer.addNewEditor();return;case Q.HIGHLIGHT_DEFAULT_COLOR:(s=o(this,co))==null||s.updateColor(e);break;case Q.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(o(this,uo)||b(this,uo,new Map)).set(t,e),this.showAllEditors("highlight",e)}for(const i of o(this,pt))i.updateParams(t,e);for(const i of o(this,Ze))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var i;for(const n of o(this,zt).values())n.editorType===t&&n.show(e);(((i=o(this,uo))==null?void 0:i.get(Q.HIGHLIGHT_SHOW_ALL))??!0)!==e&&v(this,D,mi).call(this,[[Q.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(o(this,lo)!==t){b(this,lo,t);for(const e of o(this,Qt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of o(this,zt).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return o(this,zt).get(t)}addEditor(t){o(this,zt).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(o(this,ps)&&clearTimeout(o(this,ps)),b(this,ps,setTimeout(()=>{this.focusMainContainer(),b(this,ps,null)},0))),o(this,zt).delete(t.id),this.unselect(t),t.annotationElementId&&o(this,hn).has(t.annotationElementId)||((e=o(this,Os))==null||e.remove(t.id))}addDeletedAnnotationElement(t){o(this,hn).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return o(this,hn).has(t)}removeDeletedAnnotationElement(t){o(this,hn).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){o(this,Se)!==t&&(b(this,Se,t),t&&v(this,D,mi).call(this,t.propertiesToUpdate))}updateUI(t){o(this,D,Bp)===t&&v(this,D,mi).call(this,t.propertiesToUpdate)}toggleSelected(t){o(this,pt).has(t)?(o(this,pt).delete(t),t.unselect(),v(this,D,he).call(this,{hasSelectedEditor:this.hasSelection})):(o(this,pt).add(t),t.select(),v(this,D,mi).call(this,t.propertiesToUpdate),v(this,D,he).call(this,{hasSelectedEditor:!0}))}setSelected(t){for(const e of o(this,pt))e!==t&&e.unselect();o(this,pt).clear(),o(this,pt).add(t),t.select(),v(this,D,mi).call(this,t.propertiesToUpdate),v(this,D,he).call(this,{hasSelectedEditor:!0})}isSelected(t){return o(this,pt).has(t)}get firstSelectedEditor(){return o(this,pt).values().next().value}unselect(t){t.unselect(),o(this,pt).delete(t),v(this,D,he).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return o(this,pt).size!==0}get isEnterHandled(){return o(this,pt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){o(this,Je).undo(),v(this,D,he).call(this,{hasSomethingToUndo:o(this,Je).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:v(this,D,Mr).call(this)})}redo(){o(this,Je).redo(),v(this,D,he).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:o(this,Je).hasSomethingToRedo(),isEmpty:v(this,D,Mr).call(this)})}addCommands(t){o(this,Je).add(t),v(this,D,he).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:v(this,D,Mr).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...o(this,pt)];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)v(this,D,wh).call(this,e)},mustExec:!0})}commitOrRemove(){var t;(t=o(this,Se))==null||t.commitOrRemove()}hasSomethingToControl(){return o(this,Se)||this.hasSelection}selectAll(){for(const t of o(this,pt))t.commit();v(this,D,xh).call(this,o(this,zt).values())}unselectAll(){if(!(o(this,Se)&&(o(this,Se).commitOrRemove(),o(this,Wt)!==et.NONE))&&this.hasSelection){for(const t of o(this,pt))t.unselect();o(this,pt).clear(),v(this,D,he).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;o(this,Ci)[0]+=t,o(this,Ci)[1]+=e;const[i,n]=o(this,Ci),r=[...o(this,pt)];o(this,gs)&&clearTimeout(o(this,gs)),b(this,gs,setTimeout(()=>{b(this,gs,null),o(this,Ci)[0]=o(this,Ci)[1]=0,this.addCommands({cmd:()=>{for(const a of r)o(this,zt).has(a.id)&&a.translateInPage(i,n)},undo:()=>{for(const a of r)o(this,zt).has(a.id)&&a.translateInPage(-i,-n)},mustExec:!1})},1e3));for(const a of r)a.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),b(this,us,new Map);for(const t of o(this,pt))o(this,us).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!o(this,us))return!1;this.disableUserSelect(!1);const t=o(this,us);b(this,us,null);let e=!1;for(const[{x:i,y:n,pageIndex:r},a]of t)a.newX=i,a.newY=n,a.newPageIndex=r,e||(e=i!==a.savedX||n!==a.savedY||r!==a.savedPageIndex);if(!e)return!1;const s=(i,n,r,a)=>{if(o(this,zt).has(i.id)){const c=o(this,Qt).get(a);c?i._setParentAndPosition(c,n,r):(i.pageIndex=a,i.x=n,i.y=r)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:r,newPageIndex:a}]of t)s(i,n,r,a)},undo:()=>{for(const[i,{savedX:n,savedY:r,savedPageIndex:a}]of t)s(i,n,r,a)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(o(this,us))for(const s of o(this,us).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())||o(this,pt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return o(this,Se)===t}getActive(){return o(this,Se)}getMode(){return o(this,Wt)}get imageManager(){return lt(this,"imageManager",new mh)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,h=e.rangeCount;l<h;l++)if(!t.contains(e.getRangeAt(l).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:r}=t.getBoundingClientRect();let a;switch(t.getAttribute("data-main-rotation")){case"90":a=(l,h,u,p)=>({x:(h-i)/r,y:1-(l+u-s)/n,width:p/r,height:u/n});break;case"180":a=(l,h,u,p)=>({x:1-(l+u-s)/n,y:1-(h+p-i)/r,width:u/n,height:p/r});break;case"270":a=(l,h,u,p)=>({x:1-(h+p-i)/r,y:(l-s)/n,width:p/r,height:u/n});break;default:a=(l,h,u,p)=>({x:(l-s)/n,y:(h-i)/r,width:u/n,height:p/r})}const c=[];for(let l=0,h=e.rangeCount;l<h;l++){const u=e.getRangeAt(l);if(!u.collapsed)for(const{x:p,y:f,width:g,height:m}of u.getClientRects())g!==0&&m!==0&&c.push(a(p,f,g,m))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:t,id:e}){(o(this,Ra)||b(this,Ra,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=o(this,Ra))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=o(this,Ra))==null?void 0:i.get(t.data.id);if(!e)return;const s=o(this,Os).getRawValue(e);s&&(o(this,Wt)!==et.NONE||s.hasBeenModified)&&s.renderAnnotationElement(t)}};Ea=new WeakMap,Se=new WeakMap,zt=new WeakMap,Qt=new WeakMap,Ta=new WeakMap,Os=new WeakMap,Ra=new WeakMap,Je=new WeakMap,yi=new WeakMap,Ma=new WeakMap,hn=new WeakMap,us=new WeakMap,Ze=new WeakMap,dn=new WeakMap,ao=new WeakMap,ro=new WeakMap,Ia=new WeakMap,oo=new WeakMap,ps=new WeakMap,wi=new WeakMap,Fa=new WeakMap,xi=new WeakMap,fs=new WeakMap,Ac=new WeakMap,ki=new WeakMap,lo=new WeakMap,Si=new WeakMap,un=new WeakMap,co=new WeakMap,ho=new WeakMap,Wt=new WeakMap,pt=new WeakMap,Bs=new WeakMap,pn=new WeakMap,uo=new WeakMap,po=new WeakMap,Ci=new WeakMap,gs=new WeakMap,zs=new WeakMap,fo=new WeakMap,Oe=new WeakMap,D=new WeakSet,Fl=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},vh=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of o(this,Qt).values())if(s.hasTextLayer(t))return s;return null},Rp=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=v(this,D,Fl).call(this,t).closest(".textLayer"),s=this.getSelectionBoxes(e);s&&(o(this,fs)||b(this,fs,new jb(this)),o(this,fs).show(e,s,this.direction==="ltr"))},Mp=function(){var i,n,r;const t=document.getSelection();if(!t||t.isCollapsed){o(this,Bs)&&((i=o(this,fs))==null||i.hide(),b(this,Bs,null),v(this,D,he).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===o(this,Bs))return;const s=v(this,D,Fl).call(this,t).closest(".textLayer");if(s){if((n=o(this,fs))==null||n.hide(),b(this,Bs,e),v(this,D,he).call(this,{hasSelectedText:!0}),(o(this,Wt)===et.HIGHLIGHT||o(this,Wt)===et.NONE)&&(o(this,Wt)===et.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),b(this,xi,this.isShiftKeyDown),!this.isShiftKeyDown)){const a=o(this,Wt)===et.HIGHLIGHT?v(this,D,vh).call(this,s):null;a==null||a.toggleDrawing();const c=new AbortController,l=this.combinedSignal(c),h=u=>{(u.type!=="pointerup"||u.button===0)&&(c.abort(),a==null||a.toggleDrawing(!0),u.type==="pointerup"&&v(this,D,Ll).call(this,"main_toolbar"))};window.addEventListener("pointerup",h,{signal:l}),window.addEventListener("blur",h,{signal:l})}}else o(this,Bs)&&((r=o(this,fs))==null||r.hide(),b(this,Bs,null),v(this,D,he).call(this,{hasSelectedText:!1}))},Ll=function(t=""){o(this,Wt)===et.HIGHLIGHT?this.highlightSelection(t):o(this,ao)&&v(this,D,Rp).call(this)},Ip=function(){document.addEventListener("selectionchange",v(this,D,Mp).bind(this),{signal:this._signal})},Fp=function(){if(o(this,wi))return;b(this,wi,new AbortController);const t=this.combinedSignal(o(this,wi));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},Lp=function(){var t;(t=o(this,wi))==null||t.abort(),b(this,wi,null)},Ah=function(){if(o(this,Si))return;b(this,Si,new AbortController);const t=this.combinedSignal(o(this,Si));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},Pp=function(){var t;(t=o(this,Si))==null||t.abort(),b(this,Si,null)},_h=function(){if(o(this,yi))return;b(this,yi,new AbortController);const t=this.combinedSignal(o(this,yi));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})},yh=function(){var t;(t=o(this,yi))==null||t.abort(),b(this,yi,null)},Dp=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},he=function(t){Object.entries(t).some(([e,s])=>o(this,po)[e]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(o(this,po),t)}),o(this,Wt)===et.HIGHLIGHT&&t.hasSelectedEditor===!1&&v(this,D,mi).call(this,[[Q.HIGHLIGHT_FREE,!0]]))},mi=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Np=async function(){if(!o(this,ki)){b(this,ki,!0);const t=[];for(const e of o(this,Qt).values())t.push(e.enable());await Promise.all(t);for(const e of o(this,zt).values())e.enable()}},Op=function(){if(this.unselectAll(),o(this,ki)){b(this,ki,!1);for(const t of o(this,Qt).values())t.disable();for(const t of o(this,zt).values())t.disable()}},wh=function(t){const e=o(this,Qt).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},Bp=function(){let t=null;for(t of o(this,pt));return t},Mr=function(){if(o(this,zt).size===0)return!0;if(o(this,zt).size===1)for(const t of o(this,zt).values())return t.isEmpty();return!1},xh=function(t){for(const e of o(this,pt))e.unselect();o(this,pt).clear();for(const e of t)e.isEmpty()||(o(this,pt).add(e),e.select());v(this,D,he).call(this,{hasSelectedEditor:this.hasSelection})},O(ya,"TRANSLATE_SMALL",1),O(ya,"TRANSLATE_BIG",10);let na=ya;var Yt,ms,ts,La,bs,Ce,Pa,vs,ve,js,fn,As,Ei,hs,Ir,Pl;const de=class de{constructor(t){A(this,hs);A(this,Yt,null);A(this,ms,!1);A(this,ts,null);A(this,La,null);A(this,bs,null);A(this,Ce,null);A(this,Pa,!1);A(this,vs,null);A(this,ve,null);A(this,js,null);A(this,fn,null);A(this,As,!1);b(this,ve,t),b(this,As,t._uiManager.useNewAltTextFlow),o(de,Ei)||b(de,Ei,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=b(this,ts,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=b(this,La,document.createElement("span"));t.append(e),o(this,As)?(t.classList.add("new"),t.setAttribute("data-l10n-id",o(de,Ei).missing),e.setAttribute("data-l10n-id",o(de,Ei)["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=o(this,ve)._uiManager._signal;t.addEventListener("contextmenu",Ye,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),o(this,ve)._uiManager.editAltText(o(this,ve)),o(this,As)&&o(this,ve)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:o(this,hs,Ir)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(b(this,Pa,!0),i(n))},{signal:s}),await v(this,hs,Pl).call(this),t}finish(){o(this,ts)&&(o(this,ts).focus({focusVisible:o(this,Pa)}),b(this,Pa,!1))}isEmpty(){return o(this,As)?o(this,Yt)===null:!o(this,Yt)&&!o(this,ms)}hasData(){return o(this,As)?o(this,Yt)!==null||!!o(this,js):this.isEmpty()}get guessedText(){return o(this,js)}async setGuessedText(t){o(this,Yt)===null&&(b(this,js,t),b(this,fn,await de._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),v(this,hs,Pl).call(this))}toggleAltTextBadge(t=!1){var e;if(o(this,As)&&!o(this,Yt)){if(!o(this,vs)){const s=b(this,vs,document.createElement("div"));s.className="noAltTextBadge",o(this,ve).div.append(s)}o(this,vs).classList.toggle("hidden",!t)}else(e=o(this,vs))==null||e.remove(),b(this,vs,null)}serialize(t){let e=o(this,Yt);return t||o(this,js)!==e||(e=o(this,fn)),{altText:e,decorative:o(this,ms),guessedText:o(this,js),textWithDisclaimer:o(this,fn)}}get data(){return{altText:o(this,Yt),decorative:o(this,ms)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(b(this,js,s),b(this,fn,i)),(o(this,Yt)!==t||o(this,ms)!==e)&&(n||(b(this,Yt,t),b(this,ms,e)),v(this,hs,Pl).call(this))}toggle(t=!1){o(this,ts)&&(!t&&o(this,Ce)&&(clearTimeout(o(this,Ce)),b(this,Ce,null)),o(this,ts).disabled=!t)}shown(){o(this,ve)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:o(this,hs,Ir)}})}destroy(){var t,e;(t=o(this,ts))==null||t.remove(),b(this,ts,null),b(this,La,null),b(this,bs,null),(e=o(this,vs))==null||e.remove(),b(this,vs,null)}};Yt=new WeakMap,ms=new WeakMap,ts=new WeakMap,La=new WeakMap,bs=new WeakMap,Ce=new WeakMap,Pa=new WeakMap,vs=new WeakMap,ve=new WeakMap,js=new WeakMap,fn=new WeakMap,As=new WeakMap,Ei=new WeakMap,hs=new WeakSet,Ir=function(){return(o(this,Yt)?"added":o(this,Yt)===null&&this.guessedText&&"review")||"missing"},Pl=async function(){var i,n,r;const t=o(this,ts);if(!t)return;if(o(this,As)){if(t.classList.toggle("done",!!o(this,Yt)),t.setAttribute("data-l10n-id",o(de,Ei)[o(this,hs,Ir)]),(i=o(this,La))==null||i.setAttribute("data-l10n-id",o(de,Ei)[`${o(this,hs,Ir)}-label`]),!o(this,Yt)){(n=o(this,bs))==null||n.remove();return}}else{if(!o(this,Yt)&&!o(this,ms)){t.classList.remove("done"),(r=o(this,bs))==null||r.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=o(this,bs);if(!e){b(this,bs,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${o(this,ve).id}`;const a=100,c=o(this,ve)._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(o(this,Ce)),b(this,Ce,null)},{once:!0}),t.addEventListener("mouseenter",()=>{b(this,Ce,setTimeout(()=>{b(this,Ce,null),o(this,bs).classList.add("show"),o(this,ve)._reportTelemetry({action:"alt_text_tooltip"})},a))},{signal:c}),t.addEventListener("mouseleave",()=>{var l;o(this,Ce)&&(clearTimeout(o(this,Ce)),b(this,Ce,null)),(l=o(this,bs))==null||l.classList.remove("show")},{signal:c})}o(this,ms)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=o(this,Yt)),e.parentNode||t.append(e);const s=o(this,ve).getImageForAltText();s==null||s.setAttribute("aria-describedby",e.id)},A(de,Ei,null),O(de,"_l10n",null);let dc=de;var gn,es,Et,Da,mn,Jt,bn,Ti,go,vn,Ri,mo,An,Hs,_s,Na,Oa,Be,bo,_c,it,kh,vo,Sh,Ch,zp,jp,Eh,Th,Rh,Hp,Mh,Up,qp,Gp,Ih,Fr;const dt=class dt{constructor(t){A(this,it);A(this,gn,null);A(this,es,null);A(this,Et,null);A(this,Da,!1);A(this,mn,!1);A(this,Jt,null);A(this,bn,null);A(this,Ti,null);A(this,go,"");A(this,vn,!1);A(this,Ri,null);A(this,mo,!1);A(this,An,!1);A(this,Hs,!1);A(this,_s,null);A(this,Na,0);A(this,Oa,0);A(this,Be,null);O(this,"_editToolbar",null);O(this,"_initialOptions",Object.create(null));O(this,"_initialData",null);O(this,"_isVisible",!0);O(this,"_uiManager",null);O(this,"_focusEventsAllowed",!0);A(this,bo,!1);A(this,_c,dt._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;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,r];const[a,c]=this.parentDimensions;this.x=t.x/a,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=dt.prototype._resizeWithKeyboard,e=na.TRANSLATE_SMALL,s=na.TRANSLATE_BIG;return lt(this,"_resizerKeyboardManager",new bl([[["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"],dt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return lt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new qb({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(dt._l10n??(dt._l10n=t),dt._l10nResizer||(dt._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"})),dt._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);dt._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 o(this,bo)}set _isDraggable(t){var e;b(this,bo,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/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=o(this,_c)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):v(this,it,Fr).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(o(this,vn)?b(this,vn,!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.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[n,r]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/r,this.fixAndSetPosition()}translate(t,e){v(this,it,kh).call(this,this.parentDimensions,t,e)}translateInPage(t,e){o(this,Ri)||b(this,Ri,[this.x,this.y]),v(this,it,kh).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){o(this,Ri)||b(this,Ri,[this.x,this.y]);const[s,i]=this.parentDimensions;if(this.x+=t/s,this.y+=e/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:l,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,l,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:r}=this;const[a,c]=this.getBaseTranslation();n+=a,r+=c,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!o(this,Ri)&&(o(this,Ri)[0]!==this.x||o(this,Ri)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=dt,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[e,s]=this.pageDimensions;let{x:i,y:n,width:r,height:a}=this;if(r*=e,a*=s,i*=e,n*=s,this._mustFixPosition)switch(t){case 0:i=Math.max(0,Math.min(e-r,i)),n=Math.max(0,Math.min(s-a,n));break;case 90:i=Math.max(0,Math.min(e-a,i)),n=Math.min(s,Math.max(r,n));break;case 180:i=Math.min(e,Math.max(r,i)),n=Math.min(s,Math.max(a,n));break;case 270:i=Math.min(e,Math.max(a,i)),n=Math.max(0,Math.min(s-r,n))}this.x=i/=e,this.y=n/=s;const[c,l]=this.getBaseTranslation();i+=c,n+=l;const{style:h}=this.div;h.left=`${(100*i).toFixed(2)}%`,h.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return v(s=dt,vo,Sh).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return v(s=dt,vo,Sh).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;this.div.style.width=`${(100*t/s).toFixed(2)}%`,o(this,mn)||(this.div.style.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),n=!o(this,mn)&&e.endsWith("%");if(i&&n)return;const[r,a]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/r).toFixed(2)}%`),o(this,mn)||n||(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var t;(t=o(this,Et))==null||t.finish()}async addEditToolbar(){return this._editToolbar||o(this,An)?this._editToolbar:(this._editToolbar=new fh(this),this.div.append(this._editToolbar.render()),o(this,Et)&&await this._editToolbar.addAltText(o(this,Et)),this._editToolbar)}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(t=o(this,Et))==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()}async addAltTextButton(){o(this,Et)||(dc.initialize(dt._l10n),b(this,Et,new dc(this)),o(this,gn)&&(o(this,Et).data=o(this,gn),b(this,gn,null)),await this.addEditToolbar())}get altTextData(){var t;return(t=o(this,Et))==null?void 0:t.data}set altTextData(t){o(this,Et)&&(o(this,Et).data=t)}get guessedAltText(){var t;return(t=o(this,Et))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=o(this,Et))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=o(this,Et))==null?void 0:e.serialize(t)}hasAltText(){return!!o(this,Et)&&!o(this,Et).isEmpty()}hasAltTextData(){var t;return((t=o(this,Et))==null?void 0:t.hasData())??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=o(this,Da)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),v(this,it,Mh).call(this);const[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[s,i]=this.getInitialTranslation();return this.translate(s,i),hc(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=pe.platform;t.button!==0||t.ctrlKey&&e?t.preventDefault():(b(this,vn,!0),this._isDraggable?v(this,it,Hp).call(this,t):v(this,it,Rh).call(this,t))}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){o(this,_s)&&clearTimeout(o(this,_s)),b(this,_s,setTimeout(()=>{var t;b(this,_s,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,r]=this.pageDimensions,[a,c]=this.pageTranslation,l=t/i,h=e/i,u=this.x*n,p=this.y*r,f=this.width*n,g=this.height*r;switch(s){case 0:return[u+l+a,r-p-h-g+c,u+l+f+a,r-p-h+c];case 90:return[u+h+a,r-p+l+c,u+h+g+a,r-p+l+f+c];case 180:return[u-l-f+a,r-p+h+c,u-l+a,r-p+h+g+c];case 270:return[u-h-g+a,r-p-l-f+c,u-h+a,r-p-l+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,r]=t,a=n-s,c=r-i;switch(this.rotation){case 0:return[s,e-r,a,c];case 90:return[s,e-i,c,a];case 180:return[n,e-i,a,c];case 270:return[n,e-r,c,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){b(this,An,!0)}disableEditMode(){b(this,An,!1)}isInEditMode(){return o(this,An)}shouldGetKeyboardEvents(){return o(this,Hs)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){v(this,it,Mh).call(this)}rotate(t){}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});i.rotation=t.rotation,b(i,gn,t.accessibilityData);const[n,r]=i.pageDimensions,[a,c,l,h]=i.getRectInCurrentCoords(t.rect,r);return i.x=a/n,i.y=c/r,i.width=l/n,i.height=h/r,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t;if((t=o(this,Ti))==null||t.abort(),b(this,Ti,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),o(this,_s)&&(clearTimeout(o(this,_s)),b(this,_s,null)),v(this,it,Fr).call(this),this.removeEditToolbar(),o(this,Be)){for(const e of o(this,Be).values())clearTimeout(e);b(this,Be,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(v(this,it,zp).call(this),o(this,Jt).classList.remove("hidden"),hc(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),b(this,bn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=o(this,Jt).children;if(!o(this,es)){b(this,es,Array.from(e));const r=v(this,it,Up).bind(this),a=v(this,it,qp).bind(this),c=this._uiManager._signal;for(const l of o(this,es)){const h=l.getAttribute("data-resizer-name");l.setAttribute("role","spinbutton"),l.addEventListener("keydown",r,{signal:c}),l.addEventListener("blur",a,{signal:c}),l.addEventListener("focus",v(this,it,Gp).bind(this,h),{signal:c}),l.setAttribute("data-l10n-id",dt._l10nResizer[h])}}const s=o(this,es)[0];let i=0;for(const r of e){if(r===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(o(this,es).length/4);if(n!==i){if(n<i)for(let a=0;a<i-n;a++)o(this,Jt).append(o(this,Jt).firstChild);else if(n>i)for(let a=0;a<n-i;a++)o(this,Jt).firstChild.before(o(this,Jt).lastChild);let r=0;for(const a of e){const c=o(this,es)[r++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",dt._l10nResizer[c])}}v(this,it,Ih).call(this,0),b(this,Hs,!0),o(this,Jt).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){o(this,Hs)&&v(this,it,Th).call(this,o(this,go),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){v(this,it,Fr).call(this),this.div.focus()}select(){var t,e,s;this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),this._editToolbar?((e=this._editToolbar)==null||e.show(),(s=o(this,Et))==null||s.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{var i,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())})}unselect(){var t,e,s,i,n;(t=o(this,Jt))==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=o(this,Et))==null||n.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return o(this,mo)}set isEditing(t){b(this,mo,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){b(this,mn,!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){o(this,Be)||b(this,Be,new Map);const{action:s}=t;let i=o(this,Be).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),o(this,Be).delete(s),o(this,Be).size===0&&b(this,Be,null)},dt._telemetryTimeout),o(this,Be).set(s,i)}else 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),b(this,Da,!1)}disable(){this.div&&(this.div.tabIndex=-1),b(this,Da,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if(e.nodeName==="CANVAS"){const s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};gn=new WeakMap,es=new WeakMap,Et=new WeakMap,Da=new WeakMap,mn=new WeakMap,Jt=new WeakMap,bn=new WeakMap,Ti=new WeakMap,go=new WeakMap,vn=new WeakMap,Ri=new WeakMap,mo=new WeakMap,An=new WeakMap,Hs=new WeakMap,_s=new WeakMap,Na=new WeakMap,Oa=new WeakMap,Be=new WeakMap,bo=new WeakMap,_c=new WeakMap,it=new WeakSet,kh=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this.fixAndSetPosition()},vo=new WeakSet,Sh=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]}},Ch=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]}},zp=function(){if(o(this,Jt))return;b(this,Jt,document.createElement("div")),o(this,Jt).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");o(this,Jt).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",v(this,it,jp).bind(this,s),{signal:e}),i.addEventListener("contextmenu",Ye,{signal:e}),i.tabIndex=-1}this.div.prepend(o(this,Jt))},jp=function(t,e){var g;e.preventDefault();const{isMac:s}=pe.platform;if(e.button!==0||e.ctrlKey&&s)return;(g=o(this,Et))==null||g.toggle(!1);const i=this._isDraggable;this._isDraggable=!1;const n=new AbortController,r=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",v(this,it,Th).bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",Ye,{signal:r});const a=this.x,c=this.y,l=this.width,h=this.height,u=this.parent.div.style.cursor,p=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const f=()=>{var m;n.abort(),this.parent.togglePointerEvents(!0),(m=o(this,Et))==null||m.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=u,this.div.style.cursor=p,v(this,it,Eh).call(this,a,c,l,h)};window.addEventListener("pointerup",f,{signal:r}),window.addEventListener("blur",f,{signal:r})},Eh=function(t,e,s,i){const n=this.x,r=this.y,a=this.width,c=this.height;n===t&&r===e&&a===s&&c===i||this.addCommands({cmd:()=>{this.width=a,this.height=c,this.x=n,this.y=r;const[l,h]=this.parentDimensions;this.setDims(l*a,h*c),this.fixAndSetPosition()},undo:()=>{this.width=s,this.height=i,this.x=t,this.y=e;const[l,h]=this.parentDimensions;this.setDims(l*s,h*i),this.fixAndSetPosition()},mustExec:!0})},Th=function(t,e){const[s,i]=this.parentDimensions,n=this.x,r=this.y,a=this.width,c=this.height,l=dt.MIN_SIZE/s,h=dt.MIN_SIZE/i,u=Y=>Math.round(1e4*Y)/1e4,p=v(this,it,Ch).call(this,this.rotation),f=(Y,K)=>[p[0]*Y+p[2]*K,p[1]*Y+p[3]*K],g=v(this,it,Ch).call(this,360-this.rotation);let m,_,y=!1,x=!1;switch(t){case"topLeft":y=!0,m=(Y,K)=>[0,0],_=(Y,K)=>[Y,K];break;case"topMiddle":m=(Y,K)=>[Y/2,0],_=(Y,K)=>[Y/2,K];break;case"topRight":y=!0,m=(Y,K)=>[Y,0],_=(Y,K)=>[0,K];break;case"middleRight":x=!0,m=(Y,K)=>[Y,K/2],_=(Y,K)=>[0,K/2];break;case"bottomRight":y=!0,m=(Y,K)=>[Y,K],_=(Y,K)=>[0,0];break;case"bottomMiddle":m=(Y,K)=>[Y/2,K],_=(Y,K)=>[Y/2,0];break;case"bottomLeft":y=!0,m=(Y,K)=>[0,K],_=(Y,K)=>[Y,0];break;case"middleLeft":x=!0,m=(Y,K)=>[0,K/2],_=(Y,K)=>[Y,K/2]}const w=m(a,c),k=_(a,c);let S=f(...k);const C=u(n+S[0]),E=u(r+S[1]);let T=1,q=1,[j,H]=this.screenToPageTranslation(e.movementX,e.movementY);[j,H]=(Z=j/s,$=H/i,[g[0]*Z+g[2]*$,g[1]*Z+g[3]*$]);var Z,$;if(y){const Y=Math.hypot(a,c);T=q=Math.max(Math.min(Math.hypot(k[0]-w[0]-j,k[1]-w[1]-H)/Y,1/a,1/c),l/a,h/c)}else x?T=Math.max(l,Math.min(1,Math.abs(k[0]-w[0]-j)))/a:q=Math.max(h,Math.min(1,Math.abs(k[1]-w[1]-H)))/c;const W=u(a*T),mt=u(c*q);S=f(..._(W,mt));const ee=C-S[0],le=E-S[1];this.width=W,this.height=mt,this.x=ee,this.y=le,this.setDims(s*W,i*mt),this.fixAndSetPosition()},Rh=function(t){const{isMac:e}=pe.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Hp=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();const s=new AbortController,i=this._uiManager.combinedSignal(s);if(e){this.div.classList.add("moving"),b(this,Na,t.clientX),b(this,Oa,t.clientY);const r=a=>{const{clientX:c,clientY:l}=a,[h,u]=this.screenToPageTranslation(c-o(this,Na),l-o(this,Oa));b(this,Na,c),b(this,Oa,l),this._uiManager.dragSelectedEditors(h,u)};window.addEventListener("pointermove",r,{passive:!0,capture:!0,signal:i})}const n=()=>{s.abort(),e&&this.div.classList.remove("moving"),b(this,vn,!1),this._uiManager.endDragSession()||v(this,it,Rh).call(this,t)};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})},Mh=function(){if(o(this,Ti)||!this.div)return;b(this,Ti,new AbortController);const t=this._uiManager.combinedSignal(o(this,Ti));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},Up=function(t){dt._resizerKeyboardManager.exec(this,t)},qp=function(t){var e;o(this,Hs)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==o(this,Jt)&&v(this,it,Fr).call(this)},Gp=function(t){b(this,go,o(this,Hs)?t:"")},Ih=function(t){if(o(this,es))for(const e of o(this,es))e.tabIndex=t},Fr=function(){if(b(this,Hs,!1),v(this,it,Ih).call(this,-1),o(this,bn)){const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=o(this,bn);v(this,it,Eh).call(this,t,e,s,i),b(this,bn,null)}},A(dt,vo),O(dt,"_l10n",null),O(dt,"_l10nResizer",null),O(dt,"_borderLineWidth",-1),O(dt,"_colorManager",new bh),O(dt,"_zIndex",1),O(dt,"_telemetryTimeout",1e3);let gt=dt;class qb extends gt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const fu=3285377520,Ne=4294901760,gi=65535;class Vp{constructor(t){this.h1=t?4294967295&t:fu,this.h2=t?4294967295&t:fu}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(2*t.length),s=0;for(let m=0,_=t.length;m<_;m++){const y=t.charCodeAt(m);y<=255?e[s++]=y:(e[s++]=y>>>8,e[s++]=255&y)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),s=e.byteLength}const i=s>>2,n=s-4*i,r=new Uint32Array(e.buffer,0,i);let a=0,c=0,l=this.h1,h=this.h2;const u=3432918353,p=461845907,f=11601,g=13715;for(let m=0;m<i;m++)1&m?(a=r[m],a=a*u&Ne|a*f&gi,a=a<<15|a>>>17,a=a*p&Ne|a*g&gi,l^=a,l=l<<13|l>>>19,l=5*l+3864292196):(c=r[m],c=c*u&Ne|c*f&gi,c=c<<15|c>>>17,c=c*p&Ne|c*g&gi,h^=c,h=h<<13|h>>>19,h=5*h+3864292196);switch(a=0,n){case 3:a^=e[4*i+2]<<16;case 2:a^=e[4*i+1]<<8;case 1:a^=e[4*i],a=a*u&Ne|a*f&gi,a=a<<15|a>>>17,a=a*p&Ne|a*g&gi,1&i?l^=a:h^=a}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Ne|36045*t&gi,e=4283543511*e&Ne|(2950163797*(e<<16|t>>>16)&Ne)>>>16,t^=e>>>1,t=444984403*t&Ne|60499*t&gi,e=3301882366*e&Ne|(3120437893*(e<<16|t>>>16)&Ne)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Fh=Object.freeze({map:null,hash:"",transfer:void 0});var _n,yn,Xt,yc,Wp;class Ud{constructor(){A(this,yc);A(this,_n,!1);A(this,yn,null);A(this,Xt,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=o(this,Xt).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return o(this,Xt).get(t)}remove(t){if(o(this,Xt).delete(t),o(this,Xt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of o(this,Xt).values())if(e instanceof gt)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=o(this,Xt).get(t);let i=!1;if(s!==void 0)for(const[n,r]of Object.entries(e))s[n]!==r&&(i=!0,s[n]=r);else i=!0,o(this,Xt).set(t,e);i&&v(this,yc,Wp).call(this),e instanceof gt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return o(this,Xt).has(t)}getAll(){return o(this,Xt).size>0?Od(o(this,Xt)):null}setAll(t){for(const[e,s]of Object.entries(t))this.setValue(e,s)}get size(){return o(this,Xt).size}resetModified(){o(this,_n)&&(b(this,_n,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Yp(this)}get serializable(){if(o(this,Xt).size===0)return Fh;const t=new Map,e=new Vp,s=[],i=Object.create(null);let n=!1;for(const[r,a]of o(this,Xt)){const c=a instanceof gt?a.serialize(!1,i):a;c&&(t.set(r,c),e.update(`${r}:${JSON.stringify(c)}`),n||(n=!!c.bitmap))}if(n)for(const r of t.values())r.bitmap&&s.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:Fh}get editorStats(){let t=null;const e=new Map;for(const s of o(this,Xt).values()){if(!(s instanceof gt))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 r=t[n]||(t[n]=new Map);for(const[a,c]of Object.entries(i)){if(a==="type")continue;let l=r.get(a);l||(l=new Map,r.set(a,l));const h=l.get(c)??0;l.set(c,h+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){b(this,yn,null)}get modifiedIds(){if(o(this,yn))return o(this,yn);const t=[];for(const e of o(this,Xt).values())e instanceof gt&&e.annotationElementId&&e.serialize()&&t.push(e.annotationElementId);return b(this,yn,{ids:new Set(t),hash:t.join(",")})}}_n=new WeakMap,yn=new WeakMap,Xt=new WeakMap,yc=new WeakSet,Wp=function(){o(this,_n)||(b(this,_n,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var Ao;class Yp extends Ud{constructor(e){super();A(this,Ao);const{map:s,hash:i,transfer:n}=e.serializable,r=structuredClone(s,n?{transfer:n}:null);b(this,Ao,{map:r,hash:i,transfer:n})}get print(){xt("Should not call PrintAnnotationStorage.print")}get serializable(){return o(this,Ao)}get modifiedIds(){return lt(this,"modifiedIds",{ids:new Set,hash:""})}}Ao=new WeakMap;var Ba;class Gb{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){A(this,Ba,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(),o(this,Ba).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(t&&!o(this,Ba).has(t.loadedName))if(Ut(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:n}=t,r=new FontFace(s,i,n);this.addNativeFontFace(r);try{await r.load(),o(this,Ba).add(s),e==null||e(t)}catch{nt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}}else 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 nt(`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 t;return lt(this,"isFontLoadingAPISupported",!!((t=this._document)!=null&&t.fonts))}get isSyncFontLoadingSupported(){let t=!1;return(oe||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),lt(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const{loadingRequests:e}=this,s={done:!1,complete:function(){for(Ut(!s.done,"completeRequest() cannot be called twice."),s.done=!0;e.length>0&&e[0].done;){const n=e.shift();setTimeout(n.callback,0)}},callback:t};return e.push(s),s}get _loadTestFont(){return lt(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function s(_,y){return _.charCodeAt(y)<<24|_.charCodeAt(y+1)<<16|_.charCodeAt(y+2)<<8|255&_.charCodeAt(y+3)}function i(_,y,x,w){return _.substring(0,y)+w+_.substring(y+x)}let n,r;const a=this._document.createElement("canvas");a.width=1,a.height=1;const c=a.getContext("2d");let l=0;const h=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=i(u,976,h.length,h);const p=1482184792;let f=s(u,16);for(n=0,r=h.length-3;n<r;n+=4)f=f-p+s(h,n)|0;n<h.length&&(f=f-p+s(h+"XXX",n)|0),u=i(u,16,4,function(y){return String.fromCharCode(y>>24&255,y>>16&255,y>>8&255,255&y)}(f));const g=`@font-face {font-family:"${h}";src:${`url(data:font/opentype;base64,${btoa(u)});`}}`;this.insertRule(g);const m=this._document.createElement("div");m.style.visibility="hidden",m.style.width=m.style.height="10px",m.style.position="absolute",m.style.top=m.style.left="0px";for(const _ of[t.loadedName,h]){const y=this._document.createElement("span");y.textContent="Hi",y.style.fontFamily=_,m.append(y)}this._document.body.append(m),function _(y,x){if(++l>30){nt("Load test font never loaded."),x();return}c.font="30px "+y,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?x():setTimeout(_.bind(null,y,x))}(h,()=>{m.remove(),e.complete()})}}Ba=new WeakMap;class Vb{constructor(t,{disableFontFace:e=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const i in t)this[i]=t[i];this.disableFontFace=e===!0,this._inspectFont=s}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(this.cssFontInfo){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)}else t=new FontFace(this.loadedName,this.data,{});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,${function(n){return Uint8Array.prototype.toBase64?n.toBase64():btoa(_p(n))}(this.data)});`;let e;if(this.cssFontInfo){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}}`}else e=`@font-face {font-family:"${this.loadedName}";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];let s;try{s=t.get(this.loadedName+"_path_"+e)}catch(n){nt(`getPathGenerator - ignoring character: "${n}".`)}if(!Array.isArray(s)||s.length===0)return this.compiledGlyphs[e]=function(n,r){};const i=[];for(let n=0,r=s.length;n<r;)switch(s[n++]){case Tb:{const[a,c,l,h,u,p]=s.slice(n,n+6);i.push(f=>f.bezierCurveTo(a,c,l,h,u,p)),n+=6}break;case Rb:{const[a,c]=s.slice(n,n+2);i.push(l=>l.moveTo(a,c)),n+=2}break;case Mb:{const[a,c]=s.slice(n,n+2);i.push(l=>l.lineTo(a,c)),n+=2}break;case Ib:{const[a,c,l,h]=s.slice(n,n+4);i.push(u=>u.quadraticCurveTo(a,c,l,h)),n+=4}break;case Fb:i.push(a=>a.restore());break;case Lb:i.push(a=>a.save());break;case Pb:Ut(i.length===2,"Scale command is only valid at the third position.");break;case Db:{const[a,c,l,h,u,p]=s.slice(n,n+6);i.push(f=>f.transform(a,c,l,h,u,p)),n+=6}break;case Nb:{const[a,c]=s.slice(n,n+2);i.push(l=>l.translate(a,c)),n+=2}}return this.compiledGlyphs[e]=function(r,a){i[0](r),i[1](r),r.scale(a,-a);for(let c=2,l=i.length;c<l;c++)i[c](r)}}}var _o;class gu{constructor({enableHWA:t=!1}){A(this,_o,!1);b(this,_o,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:!o(this,_o)})}}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.")}}_o=new WeakMap;class Xp{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 $p extends Xp{async _fetch(t){const e=await qc(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Uc(e)}}class mu{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){}}class Kp{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 Qp extends Kp{async _fetch(t){const e=await qc(t,"arraybuffer");return new Uint8Array(e)}}if(oe){var Lh=Promise.withResolvers(),Yr=null;(async()=>{const d=await Al(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),t=await Al(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),e=await Al(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),s=await Al(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);return new Map(Object.entries({fs:d,http:t,https:e,url:s,canvas:void 0,path2d:void 0}))})().then(d=>{Yr=d,Lh.resolve()},d=>{nt(`loadPackages: ${d}`),Yr=new Map,Lh.resolve()})}class Xi{static get promise(){return Lh.promise}static get(t){return Yr==null?void 0:Yr.get(t)}}async function Jp(d){const t=Xi.get("fs"),e=await t.promises.readFile(d);return new Uint8Array(e)}const an="Fill",qd="Stroke",Xr="Shading";function Ph(d,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),d.clip(i)}class Gd{getPattern(){xt("Abstract method `getPattern` called.")}}class Wb extends Gd{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===qd||i===an){const r=e.current.getClippedPathBoundingBox(i,Rt(t))||[0,0,0,0],a=Math.ceil(r[2]-r[0])||1,c=Math.ceil(r[3]-r[1])||1,l=e.cachedCanvases.getCanvas("pattern",a,c),h=l.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(-r[0],-r[1]),s=G.transform(s,[1,0,0,1,r[0],r[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),Ph(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),n=t.createPattern(l.canvas,"no-repeat");const u=new DOMMatrix(s);n.setTransform(u)}else Ph(t,this._bbox),n=this._createGradient(t);return n}}function eh(d,t,e,s,i,n,r,a){const c=t.coords,l=t.colors,h=d.data,u=4*d.width;let p;c[e+1]>c[s+1]&&(p=e,e=s,s=p,p=n,n=r,r=p),c[s+1]>c[i+1]&&(p=s,s=i,i=p,p=r,r=a,a=p),c[e+1]>c[s+1]&&(p=e,e=s,s=p,p=n,n=r,r=p);const f=(c[e]+t.offsetX)*t.scaleX,g=(c[e+1]+t.offsetY)*t.scaleY,m=(c[s]+t.offsetX)*t.scaleX,_=(c[s+1]+t.offsetY)*t.scaleY,y=(c[i]+t.offsetX)*t.scaleX,x=(c[i+1]+t.offsetY)*t.scaleY;if(g>=x)return;const w=l[n],k=l[n+1],S=l[n+2],C=l[r],E=l[r+1],T=l[r+2],q=l[a],j=l[a+1],H=l[a+2],Z=Math.round(g),$=Math.round(x);let W,mt,ee,le,Y,K,Xe,xe;for(let I=Z;I<=$;I++){if(I<_){const U=I<g?0:(g-I)/(g-_);W=f-(f-m)*U,mt=w-(w-C)*U,ee=k-(k-E)*U,le=S-(S-T)*U}else{let U;U=I>x?1:_===x?0:(_-I)/(_-x),W=m-(m-y)*U,mt=C-(C-q)*U,ee=E-(E-j)*U,le=T-(T-H)*U}let R;R=I<g?0:I>x?1:(g-I)/(g-x),Y=f-(f-y)*R,K=w-(w-q)*R,Xe=k-(k-j)*R,xe=S-(S-H)*R;const P=Math.round(Math.min(W,Y)),z=Math.round(Math.max(W,Y));let F=u*I+4*P;for(let U=P;U<=z;U++)R=(W-U)/(W-Y),R<0?R=0:R>1&&(R=1),h[F++]=mt-(mt-K)*R|0,h[F++]=ee-(ee-Xe)*R|0,h[F++]=le-(le-xe)*R|0,h[F++]=255}}function Yb(d,t,e){const s=t.coords,i=t.colors;let n,r;switch(t.type){case"lattice":const a=t.verticesPerRow,c=Math.floor(s.length/a)-1,l=a-1;for(n=0;n<c;n++){let h=n*a;for(let u=0;u<l;u++,h++)eh(d,e,s[h],s[h+1],s[h+a],i[h],i[h+1],i[h+a]),eh(d,e,s[h+a+1],s[h+1],s[h+a],i[h+a+1],i[h+1],i[h+a])}break;case"triangles":for(n=0,r=s.length;n<r;n+=3)eh(d,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 Xb extends Gd{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,s){const i=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-i,a=Math.ceil(this._bounds[3])-n,c=Math.min(Math.ceil(Math.abs(r*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),h=r/c,u=a/l,p={coords:this._coords,colors:this._colors,offsetX:-i,offsetY:-n,scaleX:1/h,scaleY:1/u},f=c+4,g=l+4,m=s.getCanvas("mesh",f,g),_=m.context,y=_.createImageData(c,l);if(e){const x=y.data;for(let w=0,k=x.length;w<k;w+=4)x[w]=e[0],x[w+1]=e[1],x[w+2]=e[2],x[w+3]=255}for(const x of this._figures)Yb(y,x,p);return _.putImageData(y,2,2),{canvas:m.canvas,offsetX:i-2*h,offsetY:n-2*u,scaleX:h,scaleY:u}}getPattern(t,e,s,i){Ph(t,this._bbox);let n;if(i===Xr)n=G.singularValueDecompose2dScale(Rt(t));else if(n=G.singularValueDecompose2dScale(e.baseTransform),this.matrix){const a=G.singularValueDecompose2dScale(this.matrix);n=[n[0]*a[0],n[1]*a[1]]}const r=this._createMeshCanvas(n,i===Xr?null:this._background,e.cachedCanvases);return i!==Xr&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY),t.createPattern(r.canvas,"no-repeat")}}class $b extends Gd{getPattern(){return"hotpink"}}const Kb=1,Qb=2,wc=class wc{constructor(t,e,s,i,n){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=s,this.canvasGraphicsFactory=i,this.baseTransform=n}createPatternCanvas(t){const{bbox:e,operatorList:s,paintType:i,tilingType:n,color:r,canvasGraphicsFactory:a}=this;let{xstep:c,ystep:l}=this;c=Math.abs(c),l=Math.abs(l),jc("TilingType: "+n);const h=e[0],u=e[1],p=e[2],f=e[3],g=p-h,m=f-u,_=G.singularValueDecompose2dScale(this.matrix),y=G.singularValueDecompose2dScale(this.baseTransform),x=_[0]*y[0],w=_[1]*y[1];let k=g,S=m,C=!1,E=!1;const T=Math.ceil(c*x),q=Math.ceil(l*w);T>=Math.ceil(g*x)?k=c:C=!0,q>=Math.ceil(m*w)?S=l:E=!0;const j=this.getSizeAndScale(k,this.ctx.canvas.width,x),H=this.getSizeAndScale(S,this.ctx.canvas.height,w),Z=t.cachedCanvases.getCanvas("pattern",j.size,H.size),$=Z.context,W=a.createCanvasGraphics($);if(W.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(W,i,r),$.translate(-j.scale*h,-H.scale*u),W.transform(j.scale,0,0,H.scale,0,0),$.save(),this.clipBbox(W,h,u,p,f),W.baseTransform=Rt(W.ctx),W.executeOperatorList(s),W.endDrawing(),$.restore(),C||E){const mt=Z.canvas;C&&(k=c),E&&(S=l);const ee=this.getSizeAndScale(k,this.ctx.canvas.width,x),le=this.getSizeAndScale(S,this.ctx.canvas.height,w),Y=ee.size,K=le.size,Xe=t.cachedCanvases.getCanvas("pattern-workaround",Y,K),xe=Xe.context,I=C?Math.floor(g/c):0,R=E?Math.floor(m/l):0;for(let P=0;P<=I;P++)for(let z=0;z<=R;z++)xe.drawImage(mt,Y*P,K*z,Y,K,0,0,Y,K);return{canvas:Xe.canvas,scaleX:ee.scale,scaleY:le.scale,offsetX:h,offsetY:u}}return{canvas:Z.canvas,scaleX:j.scale,scaleY:H.scale,offsetX:h,offsetY:u}}getSizeAndScale(t,e,s){const i=Math.max(wc.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 r=i-e,a=n-s;t.ctx.rect(e,s,r,a),t.current.updateRectMinMax(Rt(t.ctx),[e,s,i,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,n=t.current;switch(e){case Kb:const r=this.ctx;i.fillStyle=r.fillStyle,i.strokeStyle=r.strokeStyle,n.fillColor=r.fillStyle,n.strokeColor=r.strokeStyle;break;case Qb:const a=G.makeHexColor(s[0],s[1],s[2]);i.fillStyle=a,i.strokeStyle=a,n.fillColor=a,n.strokeColor=a;break;default:throw new Cb(`Unsupported paint type: ${e}`)}}getPattern(t,e,s,i){let n=s;i!==Xr&&(n=G.transform(n,e.baseTransform),this.matrix&&(n=G.transform(n,this.matrix)));const r=this.createPatternCanvas(e);let a=new DOMMatrix(n);a=a.translate(r.offsetX,r.offsetY),a=a.scale(1/r.scaleX,1/r.scaleY);const c=t.createPattern(r.canvas,"repeat");return c.setTransform(a),c}};O(wc,"MAX_PATTERN_SIZE",3e3);let Dh=wc;function Jb({src:d,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:r=!1}){const a=pe.isLittleEndian?4278190080:255,[c,l]=r?[n,a]:[a,n],h=s>>3,u=7&s,p=d.length;e=new Uint32Array(e.buffer);let f=0;for(let g=0;g<i;g++){for(const _=t+h;t<_;t++){const y=t<p?d[t]:255;e[f++]=128&y?l:c,e[f++]=64&y?l:c,e[f++]=32&y?l:c,e[f++]=16&y?l:c,e[f++]=8&y?l:c,e[f++]=4&y?l:c,e[f++]=2&y?l:c,e[f++]=1&y?l:c}if(u===0)continue;const m=t<p?d[t++]:255;for(let _=0;_<u;_++)e[f++]=m&1<<7-_?l:c}return{srcPos:t,destPos:f}}const ye=16;class Zb{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 yl(d,t,e,s,i,n,r,a,c,l){const[h,u,p,f,g,m]=Rt(d);if(u===0&&p===0){const _=r*h+g,y=Math.round(_),x=a*f+m,w=Math.round(x),k=(r+c)*h+g,S=Math.abs(Math.round(k)-y)||1,C=(a+l)*f+m,E=Math.abs(Math.round(C)-w)||1;return d.setTransform(Math.sign(h),0,0,Math.sign(f),y,w),d.drawImage(t,e,s,i,n,0,0,S,E),d.setTransform(h,u,p,f,g,m),[S,E]}if(h===0&&f===0){const _=a*p+g,y=Math.round(_),x=r*u+m,w=Math.round(x),k=(a+l)*p+g,S=Math.abs(Math.round(k)-y)||1,C=(r+c)*u+m,E=Math.abs(Math.round(C)-w)||1;return d.setTransform(0,Math.sign(u),Math.sign(p),0,y,w),d.drawImage(t,e,s,i,n,0,0,E,S),d.setTransform(h,u,p,f,g,m),[E,S]}return d.drawImage(t,e,s,i,n,r,a,c,l),[Math.hypot(h,u)*c,Math.hypot(p,f)*l]}class bu{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=bp,this.textMatrixScale=1,this.fontMatrix=lh,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=El,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,s){[e,s]=G.applyTransform([e,s],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(t,e){const s=G.applyTransform(e,t),i=G.applyTransform(e.slice(2),t),n=G.applyTransform([e[0],e[3]],t),r=G.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,s[0],i[0],n[0],r[0]),this.minY=Math.min(this.minY,s[1],i[1],n[1],r[1]),this.maxX=Math.max(this.maxX,s[0],i[0],n[0],r[0]),this.maxY=Math.max(this.maxY,s[1],i[1],n[1],r[1])}updateScalingPathMinMax(t,e){G.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,s,i,n,r,a,c,l,h){const u=G.bezierBoundingBox(e,s,i,n,r,a,c,l,h);h||this.updateRectMinMax(t,u)}getPathBoundingBox(t=an,e=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(t===qd){e||xt("Stroke bounding box must include transform.");const i=G.singularValueDecompose2dScale(e),n=i[0]*this.lineWidth/2,r=i[1]*this.lineWidth/2;s[0]-=n,s[1]-=r,s[2]+=n,s[3]+=r}return s}updateClipFromPath(){const t=G.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=an,e=null){return G.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function vu(d,t){if(typeof ImageData<"u"&&t instanceof ImageData){d.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%ye,n=(e-i)/ye,r=i===0?n:n+1,a=d.createImageData(s,ye);let c,l=0;const h=t.data,u=a.data;let p,f,g,m;if(t.kind===Tl.GRAYSCALE_1BPP){const _=h.byteLength,y=new Uint32Array(u.buffer,0,u.byteLength>>2),x=y.length,w=s+7>>3,k=4294967295,S=pe.isLittleEndian?4278190080:255;for(p=0;p<r;p++){for(g=p<n?ye:i,c=0,f=0;f<g;f++){const C=_-l;let E=0;const T=C>w?s:8*C-7,q=-8&T;let j=0,H=0;for(;E<q;E+=8)H=h[l++],y[c++]=128&H?k:S,y[c++]=64&H?k:S,y[c++]=32&H?k:S,y[c++]=16&H?k:S,y[c++]=8&H?k:S,y[c++]=4&H?k:S,y[c++]=2&H?k:S,y[c++]=1&H?k:S;for(;E<T;E++)j===0&&(H=h[l++],j=128),y[c++]=H&j?k:S,j>>=1}for(;c<x;)y[c++]=0;d.putImageData(a,0,p*ye)}}else if(t.kind===Tl.RGBA_32BPP){for(f=0,m=s*ye*4,p=0;p<n;p++)u.set(h.subarray(l,l+m)),l+=m,d.putImageData(a,0,f),f+=ye;p<r&&(m=s*i*4,u.set(h.subarray(l,l+m)),d.putImageData(a,0,f))}else{if(t.kind!==Tl.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(g=ye,m=s*g,p=0;p<r;p++){for(p>=n&&(g=i,m=s*g),c=0,f=m;f--;)u[c++]=h[l++],u[c++]=h[l++],u[c++]=h[l++],u[c++]=255;d.putImageData(a,0,p*ye)}}}function Au(d,t){if(t.bitmap){d.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%ye,n=(e-i)/ye,r=i===0?n:n+1,a=d.createImageData(s,ye);let c=0;const l=t.data,h=a.data;for(let u=0;u<r;u++){const p=u<n?ye:i;({srcPos:c}=Jb({src:l,srcPos:c,dest:h,width:s,height:p,nonBlackColor:0})),d.putImageData(a,0,u*ye)}}function Er(d,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)d[s]!==void 0&&(t[s]=d[s]);d.setLineDash!==void 0&&(t.setLineDash(d.getLineDash()),t.lineDashOffset=d.lineDashOffset)}function wl(d){if(d.strokeStyle=d.fillStyle="#000000",d.fillRule="nonzero",d.globalAlpha=1,d.lineWidth=1,d.lineCap="butt",d.lineJoin="miter",d.miterLimit=10,d.globalCompositeOperation="source-over",d.font="10px sans-serif",d.setLineDash!==void 0&&(d.setLineDash([]),d.lineDashOffset=0),!oe){const{filter:t}=d;t!=="none"&&t!==""&&(d.filter="none")}}function _u(d,t){if(t)return!0;const e=G.singularValueDecompose2dScale(d);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*Yi.PDF_TO_CSS_UNITS);return e[0]<=s&&e[1]<=s}const tv=["butt","round","square"],ev=["miter","round","bevel"],sv={},yu={};var Ki,Nh,Oh;const Qd=class Qd{constructor(t,e,s,i,n,{optionalContentConfig:r,markedContentStack:a=null},c,l){A(this,Ki);this.ctx=t,this.current=new bu(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.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=a||[],this.optionalContentConfig=r,this.cachedCanvases=new Zb(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,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,r=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=a,s){const c=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...Rt(this.compositeCtx))}this.ctx.save(),wl(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=Rt(this.ctx)}executeOperatorList(t,e,s,i){const n=t.argsArray,r=t.fnArray;let a=e||0;const c=n.length;if(c===a)return a;const l=c-a>10&&typeof s=="function",h=l?Date.now()+15:0;let u=0;const p=this.commonObjs,f=this.objs;let g;for(;;){if(i!==void 0&&a===i.nextBreakPoint)return i.breakIt(a,s),a;if(g=r[a],g!==Ke.dependency)this[g].apply(this,n[a]);else for(const m of n[a]){const _=m.startsWith("g_")?p:f;if(!_.has(m))return _.get(m,s),a}if(a++,a===c)return a;if(l&&++u>10){if(Date.now()>h)return s(),a;u=0}}}endDrawing(){v(this,Ki,Nh).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(),v(this,Ki,Oh).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let n,r,a=Math.max(Math.hypot(e[0],e[1]),1),c=Math.max(Math.hypot(e[2],e[3]),1),l=s,h=i,u="prescale1";for(;a>2&&l>1||c>2&&h>1;){let p=l,f=h;a>2&&l>1&&(p=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),a/=l/p),c>2&&h>1&&(f=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,c/=h/f),n=this.cachedCanvases.getCanvas(u,p,f),r=n.context,r.clearRect(0,0,p,f),r.drawImage(t,0,0,l,h,0,0,p,f),t=n.canvas,l=p,h=f,u=u==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,n=this.current.fillColor,r=this.current.patternFill,a=Rt(e);let c,l,h,u;if((t.bitmap||t.data)&&t.count>1){const T=t.bitmap||t.data.buffer;l=JSON.stringify(r?a:[a.slice(0,4),n]),c=this._cachedBitmapsMap.get(T),c||(c=new Map,this._cachedBitmapsMap.set(T,c));const q=c.get(l);if(q&&!r)return{canvas:q,offsetX:Math.round(Math.min(a[0],a[2])+a[4]),offsetY:Math.round(Math.min(a[1],a[3])+a[5])};h=q}h||(u=this.cachedCanvases.getCanvas("maskCanvas",s,i),Au(u.context,t));let p=G.transform(a,[1/s,0,0,-1/i,0,0]);p=G.transform(p,[1,0,0,1,0,-i]);const[f,g,m,_]=G.getAxialAlignedBoundingBox([0,0,s,i],p),y=Math.round(m-f)||1,x=Math.round(_-g)||1,w=this.cachedCanvases.getCanvas("fillCanvas",y,x),k=w.context,S=f,C=g;k.translate(-S,-C),k.transform(...p),h||(h=this._scaleImage(u.canvas,Ls(k)),h=h.img,c&&r&&c.set(l,h)),k.imageSmoothingEnabled=_u(Rt(k),t.interpolate),yl(k,h,0,0,h.width,h.height,0,0,s,i),k.globalCompositeOperation="source-in";const E=G.transform(Ls(k),[1,0,0,1,-S,-C]);return k.fillStyle=r?n.getPattern(e,this,E,an):n,k.fillRect(0,0,s,i),c&&!r&&(this.cachedCanvases.delete("fillCanvas"),c.set(l,w.canvas)),{canvas:w.canvas,offsetX:Math.round(S),offsetY:Math.round(C)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=tv[t]}setLineJoin(t){this.ctx.lineJoin=ev[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.current.fillAlpha=s,this.ctx.globalAlpha=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)}}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,this.ctx=i.context;const n=this.ctx;n.setTransform(...Rt(this.suspendedCtx)),Er(this.suspendedCtx,n),function(a,c){if(a._removeMirroring)throw new Error("Context is already forwarding operations.");a.__originalSave=a.save,a.__originalRestore=a.restore,a.__originalRotate=a.rotate,a.__originalScale=a.scale,a.__originalTranslate=a.translate,a.__originalTransform=a.transform,a.__originalSetTransform=a.setTransform,a.__originalResetTransform=a.resetTransform,a.__originalClip=a.clip,a.__originalMoveTo=a.moveTo,a.__originalLineTo=a.lineTo,a.__originalBezierCurveTo=a.bezierCurveTo,a.__originalRect=a.rect,a.__originalClosePath=a.closePath,a.__originalBeginPath=a.beginPath,a._removeMirroring=()=>{a.save=a.__originalSave,a.restore=a.__originalRestore,a.rotate=a.__originalRotate,a.scale=a.__originalScale,a.translate=a.__originalTranslate,a.transform=a.__originalTransform,a.setTransform=a.__originalSetTransform,a.resetTransform=a.__originalResetTransform,a.clip=a.__originalClip,a.moveTo=a.__originalMoveTo,a.lineTo=a.__originalLineTo,a.bezierCurveTo=a.__originalBezierCurveTo,a.rect=a.__originalRect,a.closePath=a.__originalClosePath,a.beginPath=a.__originalBeginPath,delete a._removeMirroring},a.save=function(){c.save(),this.__originalSave()},a.restore=function(){c.restore(),this.__originalRestore()},a.translate=function(h,u){c.translate(h,u),this.__originalTranslate(h,u)},a.scale=function(h,u){c.scale(h,u),this.__originalScale(h,u)},a.transform=function(h,u,p,f,g,m){c.transform(h,u,p,f,g,m),this.__originalTransform(h,u,p,f,g,m)},a.setTransform=function(h,u,p,f,g,m){c.setTransform(h,u,p,f,g,m),this.__originalSetTransform(h,u,p,f,g,m)},a.resetTransform=function(){c.resetTransform(),this.__originalResetTransform()},a.rotate=function(h){c.rotate(h),this.__originalRotate(h)},a.clip=function(h){c.clip(h),this.__originalClip(h)},a.moveTo=function(l,h){c.moveTo(l,h),this.__originalMoveTo(l,h)},a.lineTo=function(l,h){c.lineTo(l,h),this.__originalLineTo(l,h)},a.bezierCurveTo=function(l,h,u,p,f,g){c.bezierCurveTo(l,h,u,p,f,g),this.__originalBezierCurveTo(l,h,u,p,f,g)},a.rect=function(l,h,u,p){c.rect(l,h,u,p),this.__originalRect(l,h,u,p)},a.closePath=function(){c.closePath(),this.__originalClosePath()},a.beginPath=function(){c.beginPath(),this.__originalBeginPath()}}(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Er(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],r=i[1],a=i[2]-n,c=i[3]-r;a!==0&&c!==0&&(this.genericComposeSMask(e.context,s,a,c,e.subtype,e.backdrop,e.transferMap,n,r,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,r,a,c,l,h,u){let p=t.canvas,f=c-h,g=l-u;if(r){const _=G.makeHexColor(...r);if(f<0||g<0||f+s>p.width||g+i>p.height){const y=this.cachedCanvases.getCanvas("maskExtension",s,i),x=y.context;x.drawImage(p,-f,-g),x.globalCompositeOperation="destination-atop",x.fillStyle=_,x.fillRect(0,0,s,i),x.globalCompositeOperation="source-over",p=y.canvas,f=g=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const y=new Path2D;y.rect(f,g,s,i),t.clip(y),t.globalCompositeOperation="destination-atop",t.fillStyle=_,t.fillRect(f,g,s,i),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&a?e.filter=this.filterFactory.addAlphaFilter(a):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(a));const m=new Path2D;m.rect(c,l,s,i),e.clip(m),e.globalCompositeOperation="destination-in",e.drawImage(p,f,g,s,i,c,l,s,i),e.restore()}save(){this.inSMaskMode?(Er(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Er(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,s,i,n,r){this.ctx.transform(t,e,s,i,n,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){const i=this.ctx,n=this.current;let r,a,c=n.x,l=n.y;const h=Rt(i),u=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,p=u?s.slice(0):null;for(let f=0,g=0,m=t.length;f<m;f++)switch(0|t[f]){case Ke.rectangle:c=e[g++],l=e[g++];const _=e[g++],y=e[g++],x=c+_,w=l+y;i.moveTo(c,l),_===0||y===0?i.lineTo(x,w):(i.lineTo(x,l),i.lineTo(x,w),i.lineTo(c,w)),u||n.updateRectMinMax(h,[c,l,x,w]),i.closePath();break;case Ke.moveTo:c=e[g++],l=e[g++],i.moveTo(c,l),u||n.updatePathMinMax(h,c,l);break;case Ke.lineTo:c=e[g++],l=e[g++],i.lineTo(c,l),u||n.updatePathMinMax(h,c,l);break;case Ke.curveTo:r=c,a=l,c=e[g+4],l=e[g+5],i.bezierCurveTo(e[g],e[g+1],e[g+2],e[g+3],c,l),n.updateCurvePathMinMax(h,r,a,e[g],e[g+1],e[g+2],e[g+3],c,l,p),g+=6;break;case Ke.curveTo2:r=c,a=l,i.bezierCurveTo(c,l,e[g],e[g+1],e[g+2],e[g+3]),n.updateCurvePathMinMax(h,r,a,c,l,e[g],e[g+1],e[g+2],e[g+3],p),c=e[g+2],l=e[g+3],g+=4;break;case Ke.curveTo3:r=c,a=l,c=e[g+2],l=e[g+3],i.bezierCurveTo(e[g],e[g+1],c,l,c,l),n.updateCurvePathMinMax(h,r,a,e[g],e[g+1],c,l,c,l,p),g+=4;break;case Ke.closePath:i.closePath()}u&&n.updateScalingPathMinMax(h,p),n.setCurrentPoint(c,l)}closePath(){this.ctx.closePath()}stroke(t=!0){const e=this.ctx,s=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof s=="object"&&(s!=null&&s.getPattern)?(e.save(),e.strokeStyle=s.getPattern(e,this,Ls(e),qd),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const e=this.ctx,s=this.current.fillColor;let i=!1;this.current.patternFill&&(e.save(),e.fillStyle=s.getPattern(e,this,Ls(e),an),i=!0);const n=this.current.getClippedPathBoundingBox();this.contentVisible&&n!==null&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),i&&e.restore(),t&&this.consumePath(n)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=sv}eoClip(){this.pendingClip=yu}beginText(){this.current.textMatrix=bp,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){e.save(),e.beginPath();for(const s of t)e.setTransform(...s.transform),e.translate(s.x,s.y),s.addToPath(e,s.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}else e.beginPath()}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var h;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||lh,i.fontMatrix[0]!==0&&i.fontMatrix[3]!==0||nt("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",r=((h=s.systemFontInfo)==null?void 0:h.css)||`"${n}", ${s.fallbackName}`;let a="normal";s.black?a="900":s.bold&&(a="bold");const c=s.italic?"italic":"normal";let l=e;e<16?l=16:e>100&&(l=100),this.current.fontSizeScale=e/l,this.ctx.font=`${c} ${a} ${l}px ${r}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,s,i,n,r){this.current.textMatrix=[t,e,s,i,n,r],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i){const n=this.ctx,r=this.current,a=r.font,c=r.textRenderingMode,l=r.fontSize/r.fontSizeScale,h=c&hu,u=!!(c&Z0),p=r.patternFill&&!a.missingFile;let f;(a.disableFontFace||u||p)&&(f=a.getPathGenerator(this.commonObjs,t)),a.disableFontFace||p?(n.save(),n.translate(e,s),n.beginPath(),f(n,l),i&&n.setTransform(...i),h!==El&&h!==Cr||n.fill(),h!==Jc&&h!==Cr||n.stroke(),n.restore()):(h!==El&&h!==Cr||n.fillText(t,e,s),h!==Jc&&h!==Cr||n.strokeText(t,e,s)),u&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Rt(n),x:e,y:s,fontSize:l,addToPath:f})}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 lt(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,r=e.fontSizeScale,a=e.charSpacing,c=e.wordSpacing,l=e.fontDirection,h=e.textHScale*l,u=t.length,p=s.vertical,f=p?1:-1,g=s.defaultVMetrics,m=i*e.fontMatrix[0],_=e.textRenderingMode===El&&!s.disableFontFace&&!e.patternFill;n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),l>0?n.scale(h,-1):n.scale(h,1);let y;if(e.patternFill){n.save();const C=e.fillColor.getPattern(n,this,Ls(n),an);y=Rt(n),n.restore(),n.fillStyle=C}let x=e.lineWidth;const w=e.textMatrixScale;if(w===0||x===0){const C=e.textRenderingMode&hu;C!==Jc&&C!==Cr||(x=this.getSinglePixelWidth())}else x/=w;if(r!==1&&(n.scale(r,r),x/=r),n.lineWidth=x,s.isInvalidPDFjsFont){const C=[];let E=0;for(const T of t)C.push(T.unicode),E+=T.width;n.fillText(C.join(""),0,0),e.x+=E*m*h,n.restore(),this.compose();return}let k,S=0;for(k=0;k<u;++k){const C=t[k];if(typeof C=="number"){S+=f*C*i/1e3;continue}let E=!1;const T=(C.isSpace?c:0)+a,q=C.fontChar,j=C.accent;let H,Z,$=C.width;if(p){const W=C.vmetric||g,mt=-(C.vmetric?W[1]:.5*$)*m,ee=W[2]*m;$=W?-W[0]:$,H=mt/r,Z=(S+ee)/r}else H=S/r,Z=0;if(s.remeasure&&$>0){const W=1e3*n.measureText(q).width/i*r;if($<W&&this.isFontSubpixelAAEnabled){const mt=$/W;E=!0,n.save(),n.scale(mt,1),H/=mt}else $!==W&&(H+=($-W)/2e3*i/r)}if(this.contentVisible&&(C.isInFont||s.missingFile)){if(_&&!j)n.fillText(q,H,Z);else if(this.paintChar(q,H,Z,y),j){const W=H+i*j.offset.x/r,mt=Z-i*j.offset.y/r;this.paintChar(j.fontChar,W,mt,y)}}S+=p?$*m-T*l:$*m+T*l,E&&n.restore()}p?e.y-=S:e.x+=S*h,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,n=s.fontSize,r=s.fontDirection,a=i.vertical?1:-1,c=s.charSpacing,l=s.wordSpacing,h=s.textHScale*r,u=s.fontMatrix||lh,p=t.length;let f,g,m,_;if(s.textRenderingMode!==J0&&n!==0){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...s.textMatrix),e.translate(s.x,s.y),e.scale(h,r),f=0;f<p;++f){if(g=t[f],typeof g=="number"){_=a*g*n/1e3,this.ctx.translate(_,0),s.x+=_*h;continue}const y=(g.isSpace?l:0)+c,x=i.charProcOperatorList[g.operatorListId];if(!x){nt(`Type3 character "${g.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=g,this.save(),e.scale(n,n),e.transform(...u),this.executeOperatorList(x),this.restore()),m=G.applyTransform([g.width,0],u)[0]*n+y,e.translate(m,0),s.x+=m*h}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,n,r){this.ctx.rect(s,i,n-s,r-i),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const s=t[1],i=this.baseTransform||Rt(this.ctx),n={createCanvasGraphics:r=>new Qd(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Dh(t,s,this.ctx,n,i)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,s){this.ctx.strokeStyle=this.current.strokeColor=G.makeHexColor(t,e,s)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,s){this.ctx.fillStyle=this.current.fillColor=G.makeHexColor(t,e,s),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=function(n){switch(n[0]){case"RadialAxial":return new Wb(n);case"Mesh":return new Xb(n);case"Dummy":return new $b}throw new Error(`Unknown IR type: ${n[0]}`)}(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,Ls(e),Xr);const i=Ls(e);if(i){const{width:n,height:r}=e.canvas,[a,c,l,h]=G.getAxialAlignedBoundingBox([0,0,n,r],i);this.ctx.fillRect(a,c,l-a,h-c)}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=Rt(this.ctx),e)){const s=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],s,i),this.current.updateRectMinMax(Rt(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||jc("TODO: Support non-isolated groups."),t.knockout&&nt("Knockout groups not supported.");const s=Rt(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=G.getAxialAlignedBoundingBox(t.bbox,Rt(e));const n=[0,0,e.canvas.width,e.canvas.height];i=G.intersect(i,n)||[0,0,0,0];const r=Math.floor(i[0]),a=Math.floor(i[1]),c=Math.max(Math.ceil(i[2])-r,1),l=Math.max(Math.ceil(i[3])-a,1);this.current.startNewPathAndClipBox([0,0,c,l]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(h,c,l),p=u.context;p.translate(-r,-a),p.transform(...s),t.smask?this.smaskStack.push({canvas:u.canvas,context:p,offsetX:r,offsetY:a,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(r,a),e.save()),Er(e,p),this.ctx=p,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=Rt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const n=G.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,s,i,n){if(v(this,Ki,Nh).call(this),wl(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const r=e[2]-e[0],a=e[3]-e[1];if(n&&this.annotationCanvasMap){(s=s.slice())[4]-=e[0],s[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=r,e[3]=a;const[c,l]=G.singularValueDecompose2dScale(Rt(this.ctx)),{viewportScale:h}=this,u=Math.ceil(r*this.outputScaleX*h),p=Math.ceil(a*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(u,p);const{canvas:f,context:g}=this.annotationCanvas;this.annotationCanvasMap.set(t,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=g,this.ctx.save(),this.ctx.setTransform(c,0,0,-l,0,a*l),wl(this.ctx)}else wl(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],r,a),this.ctx.clip(),this.ctx.beginPath()}this.current=new bu(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),v(this,Ki,Oh).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)).count=e;const s=this.ctx,i=this.processingType3;if(i&&(i.compiled===void 0&&(i.compiled=function(c){const{width:l,height:h}=c;if(l>1e3||h>1e3)return null;const u=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),p=l+1;let f,g,m,_=new Uint8Array(p*(h+1));const y=l+7&-8;let x=new Uint8Array(y*h),w=0;for(const E of c.data){let T=128;for(;T>0;)x[w++]=E&T?0:255,T>>=1}let k=0;for(w=0,x[w]!==0&&(_[0]=1,++k),g=1;g<l;g++)x[w]!==x[w+1]&&(_[g]=x[w]?2:1,++k),w++;for(x[w]!==0&&(_[g]=2,++k),f=1;f<h;f++){w=f*y,m=f*p,x[w-y]!==x[w]&&(_[m]=x[w]?1:8,++k);let E=(x[w]?4:0)+(x[w-y]?8:0);for(g=1;g<l;g++)E=(E>>2)+(x[w+1]?4:0)+(x[w-y+1]?8:0),u[E]&&(_[m+g]=u[E],++k),w++;if(x[w-y]!==x[w]&&(_[m+g]=x[w]?2:4,++k),k>1e3)return null}for(w=y*(h-1),m=f*p,x[w]!==0&&(_[m]=8,++k),g=1;g<l;g++)x[w]!==x[w+1]&&(_[m+g]=x[w]?4:8,++k),w++;if(x[w]!==0&&(_[m+g]=4,++k),k>1e3)return null;const S=new Int32Array([0,p,-1,0,-p,0,0,0,1]),C=new Path2D;for(f=0;k&&f<=h;f++){let E=f*p;const T=E+l;for(;E<T&&!_[E];)E++;if(E===T)continue;C.moveTo(E%p,f);const q=E;let j=_[E];do{const H=S[j];do E+=H;while(!_[E]);const Z=_[E];Z!==5&&Z!==10?(j=Z,_[E]=0):(j=Z&51*j>>4,_[E]&=j>>2|j<<2),C.lineTo(E%p,E/p|0),_[E]||--k}while(q!==E);--f}return x=null,_=null,function(E){E.save(),E.scale(1/l,-1/h),E.translate(0,-h),E.fill(C),E.beginPath(),E.restore()}}(t)),i.compiled)){i.compiled(s);return}const n=this._createMaskCanvas(t),r=n.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(r,n.offsetX,n.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,n,r){if(!this.contentVisible)return;t=this.getObject(t.data,t);const a=this.ctx;a.save();const c=Rt(a);a.transform(e,s,i,n,0,0);const l=this._createMaskCanvas(t);a.setTransform(1,0,0,1,l.offsetX-c[4],l.offsetY-c[5]);for(let h=0,u=r.length;h<u;h+=2){const p=G.transform(c,[e,s,i,n,r[h],r[h+1]]),[f,g]=G.applyTransform([0,0],p);a.drawImage(l.canvas,f,g)}a.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:r,width:a,height:c,transform:l}=n,h=this.cachedCanvases.getCanvas("maskCanvas",a,c),u=h.context;u.save(),Au(u,this.getObject(r,n)),u.globalCompositeOperation="source-in",u.fillStyle=i?s.getPattern(u,this,Ls(e),an):s,u.fillRect(0,0,a,c),u.restore(),e.save(),e.transform(...l),e.scale(1,-1),yl(e,h.canvas,0,0,a,c,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):nt("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const n=this.getObject(t);if(!n){nt("Dependent image isn't ready yet");return}const r=n.width,a=n.height,c=[];for(let l=0,h=i.length;l<h;l+=2)c.push({transform:[e,0,0,s,i[l],i[l+1]],x:0,y:0,w:r,h:a});this.paintInlineImageXObjectGroup(n,c)}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),r=n.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;if(this.save(),!oe){const{filter:a}=i;a!=="none"&&a!==""&&(i.filter="none")}i.scale(1/e,-1/s);let n;if(t.bitmap)n=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)n=t;else{const a=this.cachedCanvases.getCanvas("inlineImage",e,s).context;vu(a,t),n=this.applyTransferMapsToCanvas(a)}const r=this._scaleImage(n,Ls(i));i.imageSmoothingEnabled=_u(Rt(i),t.interpolate),yl(i,r.img,0,0,r.paintWidth,r.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,r=t.height,a=this.cachedCanvases.getCanvas("inlineImage",n,r).context;vu(a,t),i=this.applyTransferMapsToCanvas(a)}for(const n of e)s.save(),s.transform(...n.transform),s.scale(1,-1),yl(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){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const s=this.ctx;this.pendingClip&&(e||(this.pendingClip===yu?s.clip("evenodd"):s.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),s.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Rt(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 r,a;if(s===0&&i===0){const c=Math.abs(e),l=Math.abs(n);if(c===l)if(t===0)r=a=1/c;else{const h=c*t;r=a=h<1?1/h:1}else if(t===0)r=1/c,a=1/l;else{const h=c*t,u=l*t;r=h<1?1/h:1,a=u<1?1/u:1}}else{const c=Math.abs(e*n-s*i),l=Math.hypot(e,s),h=Math.hypot(i,n);if(t===0)r=h/c,a=l/c;else{const u=t*c;r=h>u?h/u:1,a=l>u?l/u:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:s}=this.current,[i,n]=this.getScaleForStroking();if(e.lineWidth=s||1,i===1&&n===1){e.stroke();return}const r=e.getLineDash();if(t&&e.save(),e.scale(i,n),r.length>0){const a=Math.max(i,n);e.setLineDash(r.map(c=>c/a)),e.lineDashOffset/=a}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Ki=new WeakSet,Nh=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)},Oh=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}}};let xa=Qd;for(const d in Ke)xa.prototype[d]!==void 0&&(xa.prototype[Ke[d]]=xa.prototype[d]);var yo,wo;class oi{static get workerPort(){return o(this,yo)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");b(this,yo,t)}static get workerSrc(){return o(this,wo)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");b(this,wo,t)}}yo=new WeakMap,wo=new WeakMap,A(oi,yo,null),A(oi,wo,"");const wu=1,xu=2,ku=1,sh=2,Su=3,Cu=4,Eu=5,Tu=6,xl=7,ih=8;function ke(d){switch(d instanceof Error||typeof d=="object"&&d!==null||xt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),d.name){case"AbortException":return new ha(d.message);case"MissingPDFException":return new ca(d.message);case"PasswordException":return new ch(d.message,d.code);case"UnexpectedResponseException":return new Hc(d.message,d.status);case"UnknownErrorException":return new hh(d.message,d.details);default:return new hh(d.message,d.toString())}}var za,We,Zp,tf,ef,Dl;class Lr{constructor(t,e,s){A(this,We);A(this,za,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",v(this,We,Zp).bind(this),{signal:o(this,za).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(r){n.reject(r)}return n.promise}sendWithStream(t,e,s,i){const n=this.streamId++,r=this.sourceName,a=this.targetName,c=this.comObj;return new ReadableStream({start:l=>{const h=Promise.withResolvers();return this.streamControllers[n]={controller:l,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:r,targetName:a,action:t,streamId:n,data:e,desiredSize:l.desiredSize},i),h.promise},pull:l=>{const h=Promise.withResolvers();return this.streamControllers[n].pullCall=h,c.postMessage({sourceName:r,targetName:a,stream:Tu,streamId:n,desiredSize:l.desiredSize}),h.promise},cancel:l=>{Ut(l instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[n].cancelCall=h,this.streamControllers[n].isClosed=!0,c.postMessage({sourceName:r,targetName:a,stream:ku,streamId:n,reason:ke(l)}),h.promise}},s)}destroy(){var t;(t=o(this,za))==null||t.abort(),b(this,za,null)}}za=new WeakMap,We=new WeakSet,Zp=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){v(this,We,ef).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===wu)i.resolve(t.data);else{if(t.callback!==xu)throw new Error("Unexpected callback case");i.reject(ke(t.reason))}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;new Promise(function(r){r(e(t.data))}).then(function(r){n.postMessage({sourceName:s,targetName:i,callback:wu,callbackId:t.callbackId,data:r})},function(r){n.postMessage({sourceName:s,targetName:i,callback:xu,callbackId:t.callbackId,reason:ke(r)})})}else t.streamId?v(this,We,tf).call(this,t):e(t.data)},tf=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,r=this,a=this.actionHandler[t.action],c={enqueue(l,h=1,u){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),n.postMessage({sourceName:s,targetName:i,stream:Cu,streamId:e,chunk:l},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Su,streamId:e}),delete r.streamSinks[e])},error(l){Ut(l instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Eu,streamId:e,reason:ke(l)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,new Promise(function(l){l(a(t.data,c))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:ih,streamId:e,success:!0})},function(l){n.postMessage({sourceName:s,targetName:i,stream:ih,streamId:e,reason:ke(l)})})},ef=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,r=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case ih:t.success?r.startCall.resolve():r.startCall.reject(ke(t.reason));break;case xl:t.success?r.pullCall.resolve():r.pullCall.reject(ke(t.reason));break;case Tu:if(!a){n.postMessage({sourceName:s,targetName:i,stream:xl,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,new Promise(function(c){var l;c((l=a.onPull)==null?void 0:l.call(a))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:xl,streamId:e,success:!0})},function(c){n.postMessage({sourceName:s,targetName:i,stream:xl,streamId:e,reason:ke(c)})});break;case Cu:if(Ut(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case Su:if(Ut(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),v(this,We,Dl).call(this,r,e);break;case Eu:Ut(r,"error should have stream controller"),r.controller.error(ke(t.reason)),v(this,We,Dl).call(this,r,e);break;case sh:t.success?r.cancelCall.resolve():r.cancelCall.reject(ke(t.reason)),v(this,We,Dl).call(this,r,e);break;case ku:if(!a)break;new Promise(function(c){var l;c((l=a.onCancel)==null?void 0:l.call(a,ke(t.reason)))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:sh,streamId:e,success:!0})},function(c){n.postMessage({sourceName:s,targetName:i,stream:sh,streamId:e,reason:ke(c)})}),a.sinkCapability.reject(ke(t.reason)),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},Dl=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 wn,xo;class iv{constructor({parsedData:t,rawData:e}){A(this,wn);A(this,xo);b(this,wn,t),b(this,xo,e)}getRaw(){return o(this,xo)}get(t){return o(this,wn).get(t)??null}getAll(){return Od(o(this,wn))}has(t){return o(this,wn).has(t)}}wn=new WeakMap,xo=new WeakMap;const pa=Symbol("INTERNAL");var ko,So,Co,ja;class nv{constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){A(this,ko,!1);A(this,So,!1);A(this,Co,!1);A(this,ja,!0);b(this,ko,!!(t&Nd)),b(this,So,!!(t&cc)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(o(this,Co))return o(this,ja);if(!o(this,ja))return!1;const{print:t,view:e}=this.usage;return o(this,ko)?(e==null?void 0:e.viewState)!=="OFF":!o(this,So)||(t==null?void 0:t.printState)!=="OFF"}_setVisible(t,e,s=!1){t!==pa&&xt("Internal method `_setVisible` called."),b(this,Co,s),b(this,ja,e)}}ko=new WeakMap,So=new WeakMap,Co=new WeakMap,ja=new WeakMap;var Mi,ft,Ha,Ua,Eo,Bh;class av{constructor(t,e=Nd){A(this,Eo);A(this,Mi,null);A(this,ft,new Map);A(this,Ha,null);A(this,Ua,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,b(this,Ua,t.order);for(const s of t.groups)o(this,ft).set(s.id,new nv(e,s));if(t.baseState==="OFF")for(const s of o(this,ft).values())s._setVisible(pa,!1);for(const s of t.on)o(this,ft).get(s)._setVisible(pa,!0);for(const s of t.off)o(this,ft).get(s)._setVisible(pa,!1);b(this,Ha,this.getHash())}}isVisible(t){if(o(this,ft).size===0)return!0;if(!t)return jc("Optional content group not defined."),!0;if(t.type==="OCG")return o(this,ft).has(t.id)?o(this,ft).get(t.id).visible:(nt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return v(this,Eo,Bh).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!o(this,ft).has(e))return nt(`Optional content group not found: ${e}`),!0;if(o(this,ft).get(e).visible)return!0}return!1}if(t.policy==="AllOn"){for(const e of t.ids){if(!o(this,ft).has(e))return nt(`Optional content group not found: ${e}`),!0;if(!o(this,ft).get(e).visible)return!1}return!0}if(t.policy==="AnyOff"){for(const e of t.ids){if(!o(this,ft).has(e))return nt(`Optional content group not found: ${e}`),!0;if(!o(this,ft).get(e).visible)return!0}return!1}if(t.policy==="AllOff"){for(const e of t.ids){if(!o(this,ft).has(e))return nt(`Optional content group not found: ${e}`),!0;if(o(this,ft).get(e).visible)return!1}return!0}return nt(`Unknown optional content policy ${t.policy}.`),!0}return nt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var n;const i=o(this,ft).get(t);if(i){if(s&&e&&i.rbGroups.length)for(const r of i.rbGroups)for(const a of r)a!==t&&((n=o(this,ft).get(a))==null||n._setVisible(pa,!1,!0));i._setVisible(pa,!!e,!0),b(this,Mi,null)}else nt(`Optional content group not found: ${t}`)}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=o(this,ft).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)}}b(this,Mi,null)}get hasInitialVisibility(){return o(this,Ha)===null||this.getHash()===o(this,Ha)}getOrder(){return o(this,ft).size?o(this,Ua)?o(this,Ua).slice():[...o(this,ft).keys()]:null}getGroups(){return o(this,ft).size>0?Od(o(this,ft)):null}getGroup(t){return o(this,ft).get(t)||null}getHash(){if(o(this,Mi)!==null)return o(this,Mi);const t=new Vp;for(const[e,s]of o(this,ft))t.update(`${e}:${s.visible}`);return b(this,Mi,t.hexdigest())}}Mi=new WeakMap,ft=new WeakMap,Ha=new WeakMap,Ua=new WeakMap,Eo=new WeakSet,Bh=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 r;if(Array.isArray(n))r=v(this,Eo,Bh).call(this,n);else{if(!o(this,ft).has(n))return nt(`Optional content group not found: ${n}`),!0;r=o(this,ft).get(n).visible}switch(s){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return s==="And"};class rv{constructor(t,{disableRange:e=!1,disableStream:s=!1}){Ut(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:n,progressiveDone:r,contentDispositionFilename:a}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=a,(n==null?void 0:n.length)>0){const c=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((c,l)=>{this._onReceiveData({begin:c,chunk:l})}),t.addProgressListener((c,l)=>{this._onProgress({loaded:c,total:l})}),t.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),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;t===void 0?this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s):Ut(this._rangeReaders.some(function(i){return i._begin!==t?!1:(i._enqueue(s),!0)}),"_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(){Ut(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new ov(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new lv(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 ov{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=jd(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 lv{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 e of this._requests)e.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 Vd(d,t){const e=new Headers;if(!d||!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 Wd({responseHeaders:d,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(d.get("Content-Length"),10);return!Number.isInteger(n)||(i.suggestedLength=n,n<=2*e)||s||!t||d.get("Accept-Ranges")!=="bytes"||(d.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Yd(d){const t=d.get("Content-Disposition");if(t){let e=function(i){let n=!0,r=a("filename\\*","i").exec(i);if(r){r=r[1];let f=h(r);return f=unescape(f),f=u(f),f=p(f),l(f)}if(r=function(g){const m=[];let _;const y=a("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(_=y.exec(g))!==null;){let[,w,k,S]=_;if(w=parseInt(w,10),w in m){if(w===0)break}else m[w]=[k,S]}const x=[];for(let w=0;w<m.length&&w in m;++w){let[k,S]=m[w];S=h(S),k&&(S=unescape(S),w===0&&(S=u(S))),x.push(S)}return x.join("")}(i),r)return l(p(r));if(r=a("filename","i").exec(i),r){r=r[1];let f=h(r);return f=p(f),l(f)}function a(f,g){return new RegExp("(?:^|;)\\s*"+f+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',g)}function c(f,g){if(f){if(!/^[\x00-\xFF]+$/.test(g))return g;try{const m=new TextDecoder(f,{fatal:!0}),_=Uc(g);g=m.decode(_),n=!1}catch{}}return g}function l(f){return n&&/[\x80-\xff]/.test(f)&&(f=c("utf-8",f),n&&(f=c("iso-8859-1",f))),f}function h(f){if(f.startsWith('"')){const g=f.slice(1).split('\\"');for(let m=0;m<g.length;++m){const _=g[m].indexOf('"');_!==-1&&(g[m]=g[m].slice(0,_),g.length=m+1),g[m]=g[m].replaceAll(/\\(.)/g,"$1")}f=g.join('"')}return f}function u(f){const g=f.indexOf("'");return g===-1?f:c(f.slice(0,g),f.slice(g+1).replace(/^[^']*'/,""))}function p(f){return!f.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(f)?f:f.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(g,m,_,y){if(_==="q"||_==="Q")return c(m,y=(y=y.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(x,w){return String.fromCharCode(parseInt(w,16))}));try{y=atob(y)}catch{}return c(m,y)})}return""}(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(jd(e))return e}return null}function Vc(d,t){return d===404||d===0&&t.startsWith("file:")?new ca('Missing PDF "'+t+'".'):new Hc(`Unexpected server response (${d}) while retrieving PDF "${t}".`,d)}function sf(d){return d===200||d===206}function nf(d,t,e){return{method:"GET",headers:d,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function af(d){return d instanceof Uint8Array?d.buffer:d instanceof ArrayBuffer?d:(nt(`getArrayBuffer - unexpected data format: ${d}`),new Uint8Array(d).buffer)}class Ru{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Vd(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 Ut(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new cv(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new hv(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 cv{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,nf(s,this._withCredentials,this._abortController)).then(n=>{if(!sf(n.status))throw Vc(n.status,i);this._reader=n.body.getReader(),this._headersCapability.resolve();const r=n.headers,{allowRangeRequests:a,suggestedLength:c}=Wd({responseHeaders:r,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=c||this._contentLength,this._filename=Yd(r),!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 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:af(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class hv{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 r=i.url;fetch(r,nf(n,this._withCredentials,this._abortController)).then(a=>{if(!sf(a.status))throw Vc(a.status,r);this._readCapability.resolve(),this._reader=a.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:af(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class dv{constructor({url:t,httpHeaders:e,withCredentials:s}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Vd(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,s){const i={begin:t,end:e};for(const n in s)i[n]=s[n];return this.request(i)}requestFull(t){return this.request(t)}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,r]of this.headers)e.setRequestHeader(n,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=206):i.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(n){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){var a,c,l;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){(a=s.onError)==null||a.call(s,i.status);return}const n=i.status||200;if(!(n===200&&s.expectedStatus===206)&&n!==s.expectedStatus){(c=s.onError)==null||c.call(s,i.status);return}const r=function(u){const p=u.response;return typeof p!="string"?p:Uc(p).buffer}(i);if(n===206){const h=i.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(h);s.onDone({begin:parseInt(u[1],10),chunk:r})}else r?s.onDone({begin:0,chunk:r}):(l=s.onError)==null||l.call(s,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 uv{constructor(t){this._source=t,this._manager=new dv(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 Ut(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new pv(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new fv(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 pv{constructor(t,e){this._manager=t;const s={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(s),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),s=new Headers(e.getAllResponseHeaders().trim().split(/[\r\n]+/).map(r=>{const[a,...c]=r.split(": ");return[a,c.join(": ")]})),{allowRangeRequests:i,suggestedLength:n}=Wd({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=Yd(s),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=Vc(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(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 fv{constructor(t,e,s){this._manager=t;const i={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,s,i),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_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=Vc(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 gv=/^[a-z][a-z0-9\-+.]+:/i;function rf(d,t,e){return d.protocol==="http:"?Xi.get("http").request(d,{headers:t},e):Xi.get("https").request(d,{headers:t},e)}class mv{constructor(t){this.source=t,this.url=function(s){if(gv.test(s))return new URL(s);const i=Xi.get("url");return new URL(i.pathToFileURL(s))}(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.headers=Vd(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 Ut(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new Av(this):new bv(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=this.isFsUrl?new _v(this,t,e):new vv(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 of{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var e;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,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ha("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class lf{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var e;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,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class bv extends of{constructor(t){super(t);const e=Object.fromEntries(t.headers);this._request=rf(this._url,e,s=>{if(s.statusCode===404){const a=new ca(`Missing PDF "${this._url}".`);this._storedError=a,this._headersCapability.reject(a);return}this._headersCapability.resolve(),this._setReadableStream(s);const i=new Headers(this._readableStream.headers),{allowRangeRequests:n,suggestedLength:r}=Wd({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=r||this._contentLength,this._filename=Yd(i)}),this._request.on("error",s=>{this._storedError=s,this._headersCapability.reject(s)}),this._request.end()}}class vv extends lf{constructor(t,e,s){super(t);const i=Object.fromEntries(t.headers);i.Range=`bytes=${e}-${s-1}`,this._request=rf(this._url,i,n=>{if(n.statusCode!==404)this._setReadableStream(n);else{const r=new ca(`Missing PDF "${this._url}".`);this._storedError=r}}),this._request.on("error",n=>{this._storedError=n}),this._request.end()}}class Av extends of{constructor(t){super(t);const e=Xi.get("fs");e.promises.lstat(this._url).then(s=>{this._contentLength=s.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=new ca(`Missing PDF "${this._url}".`)),this._storedError=s,this._headersCapability.reject(s)})}}class _v extends lf{constructor(t,e,s){super(t);const i=Xi.get("fs");this._setReadableStream(i.createReadStream(this._url,{start:e,end:s-1}))}}const me=30;var Uu,Ii,Ae,To,Ro,xn,Us,Mo,Io,kn,qa,Ga,Fi,Va,Fo,Wa,Sn,Lo,Po,Cn,En,Do,Li,Ya,ui,cf,hf,zh,Pe,Nl,jh,df,uf;const Bt=class Bt{constructor({textContentSource:t,container:e,viewport:s}){A(this,ui);A(this,Ii,Promise.withResolvers());A(this,Ae,null);A(this,To,!1);A(this,Ro,!!((Uu=globalThis.FontInspector)!=null&&Uu.enabled));A(this,xn,null);A(this,Us,null);A(this,Mo,0);A(this,Io,0);A(this,kn,null);A(this,qa,null);A(this,Ga,0);A(this,Fi,0);A(this,Va,Object.create(null));A(this,Fo,[]);A(this,Wa,null);A(this,Sn,[]);A(this,Lo,new WeakMap);A(this,Po,null);var c;if(t instanceof ReadableStream)b(this,Wa,t);else{if(typeof t!="object")throw new Error('No "textContentSource" parameter specified.');b(this,Wa,new ReadableStream({start(l){l.enqueue(t),l.close()}}))}b(this,Ae,b(this,qa,e)),b(this,Fi,s.scale*(globalThis.devicePixelRatio||1)),b(this,Ga,s.rotation),b(this,Us,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:n,pageX:r,pageY:a}=s.rawDims;b(this,Po,[1,0,0,-1,-r,a+n]),b(this,Io,i),b(this,Mo,n),v(c=Bt,Pe,df).call(c),ia(e,s),o(this,Ii).promise.finally(()=>{o(Bt,Ya).delete(this),b(this,Us,null),b(this,Va,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=pe.platform;return lt(this,"fontFamilyMap",new Map([["sans-serif",(t&&e?"Calibri, ":"")+"sans-serif"],["monospace",(t&&e?"Lucida Console, ":"")+"monospace"]]))}render(){const t=()=>{o(this,kn).read().then(({value:e,done:s})=>{s?o(this,Ii).resolve():(o(this,xn)??b(this,xn,e.lang),Object.assign(o(this,Va),e.styles),v(this,ui,cf).call(this,e.items),t())},o(this,Ii).reject)};return b(this,kn,o(this,Wa).getReader()),o(Bt,Ya).add(this),t(),o(this,Ii).promise}update({viewport:t,onBefore:e=null}){var n;const s=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==o(this,Ga)&&(e==null||e(),b(this,Ga,i),ia(o(this,qa),{rotation:i})),s!==o(this,Fi)){e==null||e(),b(this,Fi,s);const r={div:null,properties:null,ctx:v(n=Bt,Pe,Nl).call(n,o(this,xn))};for(const a of o(this,Sn))r.properties=o(this,Lo).get(a),r.div=a,v(this,ui,zh).call(this,r)}}cancel(){var e;const t=new ha("TextLayer task cancelled.");(e=o(this,kn))==null||e.cancel(t).catch(()=>{}),b(this,kn,null),o(this,Ii).reject(t)}get textDivs(){return o(this,Sn)}get textContentItemsStr(){return o(this,Fo)}static cleanup(){if(!(o(this,Ya).size>0)){o(this,Cn).clear();for(const{canvas:t}of o(this,En).values())t.remove();o(this,En).clear()}}};Ii=new WeakMap,Ae=new WeakMap,To=new WeakMap,Ro=new WeakMap,xn=new WeakMap,Us=new WeakMap,Mo=new WeakMap,Io=new WeakMap,kn=new WeakMap,qa=new WeakMap,Ga=new WeakMap,Fi=new WeakMap,Va=new WeakMap,Fo=new WeakMap,Wa=new WeakMap,Sn=new WeakMap,Lo=new WeakMap,Po=new WeakMap,Cn=new WeakMap,En=new WeakMap,Do=new WeakMap,Li=new WeakMap,Ya=new WeakMap,ui=new WeakSet,cf=function(t){var i,n;if(o(this,To))return;(n=o(this,Us)).ctx??(n.ctx=v(i=Bt,Pe,Nl).call(i,o(this,xn)));const e=o(this,Sn),s=o(this,Fo);for(const r of t){if(e.length>1e5){nt("Ignoring additional textDivs for performance reasons."),b(this,To,!0);return}if(r.str!==void 0)s.push(r.str),v(this,ui,hf).call(this,r);else if(r.type==="beginMarkedContentProps"||r.type==="beginMarkedContent"){const a=o(this,Ae);b(this,Ae,document.createElement("span")),o(this,Ae).classList.add("markedContent"),r.id!==null&&o(this,Ae).setAttribute("id",`${r.id}`),a.append(o(this,Ae))}else r.type==="endMarkedContent"&&b(this,Ae,o(this,Ae).parentNode)}},hf=function(t){var m;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};o(this,Sn).push(e);const i=G.transform(o(this,Po),t.transform);let n=Math.atan2(i[1],i[0]);const r=o(this,Va)[t.fontName];r.vertical&&(n+=Math.PI/2);let a=o(this,Ro)&&r.fontSubstitution||r.fontFamily;a=Bt.fontFamilyMap.get(a)||a;const c=Math.hypot(i[2],i[3]),l=c*v(m=Bt,Pe,uf).call(m,a,o(this,xn));let h,u;n===0?(h=i[4],u=i[5]-l):(h=i[4]+l*Math.sin(n),u=i[5]-l*Math.cos(n));const p="calc(var(--scale-factor)*",f=e.style;o(this,Ae)===o(this,qa)?(f.left=`${(100*h/o(this,Io)).toFixed(2)}%`,f.top=`${(100*u/o(this,Mo)).toFixed(2)}%`):(f.left=`${p}${h.toFixed(2)}px)`,f.top=`${p}${u.toFixed(2)}px)`),f.fontSize=`${p}${(o(Bt,Li)*c).toFixed(2)}px)`,f.fontFamily=a,s.fontSize=c,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,o(this,Ro)&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let g=!1;if(t.str.length>1)g=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const _=Math.abs(t.transform[0]),y=Math.abs(t.transform[3]);_!==y&&Math.max(_,y)/Math.min(_,y)>1.5&&(g=!0)}if(g&&(s.canvasWidth=r.vertical?t.height:t.width),o(this,Lo).set(e,s),o(this,Us).div=e,o(this,Us).properties=s,v(this,ui,zh).call(this,o(this,Us)),s.hasText&&o(this,Ae).append(e),s.hasEOL){const _=document.createElement("br");_.setAttribute("role","presentation"),o(this,Ae).append(_)}},zh=function(t){var a;const{div:e,properties:s,ctx:i}=t,{style:n}=e;let r="";if(o(Bt,Li)>1&&(r=`scale(${1/o(Bt,Li)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:c}=n,{canvasWidth:l,fontSize:h}=s;v(a=Bt,Pe,jh).call(a,i,h*o(this,Fi),c);const{width:u}=i.measureText(e.textContent);u>0&&(r=`scaleX(${l*o(this,Fi)/u}) ${r}`)}s.angle!==0&&(r=`rotate(${s.angle}deg) ${r}`),r.length>0&&(n.transform=r)},Pe=new WeakSet,Nl=function(t=null){let e=o(this,En).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}),o(this,En).set(t,e),o(this,Do).set(e,{size:0,family:""})}return e},jh=function(t,e,s){const i=o(this,Do).get(t);(e!==i.size||s!==i.family)&&(t.font=`${e}px ${s}`,i.size=e,i.family=s)},df=function(){if(o(this,Li)!==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),b(this,Li,t.getBoundingClientRect().height),t.remove()},uf=function(t,e){const s=o(this,Cn).get(t);if(s)return s;const i=v(this,Pe,Nl).call(this,e);i.canvas.width=i.canvas.height=me,v(this,Pe,jh).call(this,i,me,t);const n=i.measureText("");let r=n.fontBoundingBoxAscent,a=Math.abs(n.fontBoundingBoxDescent);if(r){const h=r/(r+a);return o(this,Cn).set(t,h),i.canvas.width=i.canvas.height=0,h}i.strokeStyle="red",i.clearRect(0,0,me,me),i.strokeText("g",0,0);let c=i.getImageData(0,0,me,me).data;a=0;for(let h=c.length-1-3;h>=0;h-=4)if(c[h]>0){a=Math.ceil(h/4/me);break}i.clearRect(0,0,me,me),i.strokeText("A",0,me),c=i.getImageData(0,0,me,me).data,r=0;for(let h=0,u=c.length;h<u;h+=4)if(c[h]>0){r=me-Math.floor(h/4/me);break}i.canvas.width=i.canvas.height=0;const l=r?r/(r+a):.8;return o(this,Cn).set(t,l),l},A(Bt,Pe),A(Bt,Cn,new Map),A(Bt,En,new Map),A(Bt,Do,new WeakMap),A(Bt,Li,null),A(Bt,Ya,new Set);let Qr=Bt;class Jr{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};return function i(n){var c;if(!n)return;let r=null;const a=n.name;if(a==="#text")r=n.value;else{if(!Jr.shouldBuildText(a))return;(c=n==null?void 0:n.attributes)!=null&&c.textContent?r=n.attributes.textContent:n.value&&(r=n.value)}if(r!==null&&e.push({str:r}),n.children)for(const l of n.children)i(l)}(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const yv=65536,wv=oe?class extends gu{_createCanvas(t,e){return Xi.get("canvas").createCanvas(t,e)}}:class extends gu{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}},xv=oe?class extends Xp{async _fetch(t){return Jp(t)}}:$p;var Tn,Rn,ys,qs,ne,xc,Mn,B,se,fa,ga,Ol,ma,pf,Hh,ba,Pr,Dr,Uh,Nr,qu;const kv=oe?class extends mu{}:(qu=class extends mu{constructor({docId:e,ownerDocument:s=globalThis.document}){super();A(this,B);A(this,Tn);A(this,Rn);A(this,ys);A(this,qs);A(this,ne);A(this,xc);A(this,Mn,0);b(this,qs,e),b(this,ne,s)}addFilter(e){if(!e)return"none";let s=o(this,B,se).get(e);if(s)return s;const[i,n,r]=v(this,B,Ol).call(this,e),a=e.length===1?i:`${i}${n}${r}`;if(s=o(this,B,se).get(a),s)return o(this,B,se).set(e,s),s;const c=`g_${o(this,qs)}_transfer_map_${ce(this,Mn)._++}`,l=v(this,B,ma).call(this,c);o(this,B,se).set(e,l),o(this,B,se).set(a,l);const h=v(this,B,ba).call(this,c);return v(this,B,Dr).call(this,i,n,r,h),l}addHCMFilter(e,s){var g;const i=`${e}-${s}`,n="base";let r=o(this,B,fa).get(n);if((r==null?void 0:r.key)===i||(r?((g=r.filter)==null||g.remove(),r.key=i,r.url="none",r.filter=null):(r={key:i,url:"none",filter:null},o(this,B,fa).set(n,r)),!e||!s))return r.url;const a=v(this,B,Nr).call(this,e);e=G.makeHexColor(...a);const c=v(this,B,Nr).call(this,s);if(s=G.makeHexColor(...c),o(this,B,ga).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return r.url;const l=new Array(256);for(let m=0;m<=255;m++){const _=m/255;l[m]=_<=.03928?_/12.92:((_+.055)/1.055)**2.4}const h=l.join(","),u=`g_${o(this,qs)}_hcm_filter`,p=r.filter=v(this,B,ba).call(this,u);v(this,B,Dr).call(this,h,h,h,p),v(this,B,Hh).call(this,p);const f=(m,_)=>{const y=a[m]/255,x=c[m]/255,w=new Array(_+1);for(let k=0;k<=_;k++)w[k]=y+k/_*(x-y);return w.join(",")};return v(this,B,Dr).call(this,f(0,5),f(1,5),f(2,5),p),r.url=v(this,B,ma).call(this,u),r.url}addAlphaFilter(e){let s=o(this,B,se).get(e);if(s)return s;const[i]=v(this,B,Ol).call(this,[e]),n=`alpha_${i}`;if(s=o(this,B,se).get(n),s)return o(this,B,se).set(e,s),s;const r=`g_${o(this,qs)}_alpha_map_${ce(this,Mn)._++}`,a=v(this,B,ma).call(this,r);o(this,B,se).set(e,a),o(this,B,se).set(n,a);const c=v(this,B,ba).call(this,r);return v(this,B,Uh).call(this,i,c),a}addLuminosityFilter(e){let s,i,n=o(this,B,se).get(e||"luminosity");if(n)return n;if(e?([s]=v(this,B,Ol).call(this,[e]),i=`luminosity_${s}`):i="luminosity",n=o(this,B,se).get(i),n)return o(this,B,se).set(e,n),n;const r=`g_${o(this,qs)}_luminosity_map_${ce(this,Mn)._++}`,a=v(this,B,ma).call(this,r);o(this,B,se).set(e,a),o(this,B,se).set(i,a);const c=v(this,B,ba).call(this,r);return v(this,B,pf).call(this,c),e&&v(this,B,Uh).call(this,s,c),a}addHighlightHCMFilter(e,s,i,n,r){var x;const a=`${s}-${i}-${n}-${r}`;let c=o(this,B,fa).get(e);if((c==null?void 0:c.key)===a||(c?((x=c.filter)==null||x.remove(),c.key=a,c.url="none",c.filter=null):(c={key:a,url:"none",filter:null},o(this,B,fa).set(e,c)),!s||!i))return c.url;const[l,h]=[s,i].map(v(this,B,Nr).bind(this));let u=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),p=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[f,g]=[n,r].map(v(this,B,Nr).bind(this));p<u&&([u,p,f,g]=[p,u,g,f]),o(this,B,ga).style.color="";const m=(w,k,S)=>{const C=new Array(256),E=(p-u)/S,T=w/255,q=(k-w)/(255*S);let j=0;for(let H=0;H<=S;H++){const Z=Math.round(u+H*E),$=T+H*q;for(let W=j;W<=Z;W++)C[W]=$;j=Z+1}for(let H=j;H<256;H++)C[H]=C[j-1];return C.join(",")},_=`g_${o(this,qs)}_hcm_${e}_filter`,y=c.filter=v(this,B,ba).call(this,_);return v(this,B,Hh).call(this,y),v(this,B,Dr).call(this,m(f[0],g[0],5),m(f[1],g[1],5),m(f[2],g[2],5),y),c.url=v(this,B,ma).call(this,_),c.url}destroy(e=!1){(!e||o(this,B,fa).size===0)&&(o(this,ys)&&(o(this,ys).parentNode.parentNode.remove(),b(this,ys,null)),o(this,Rn)&&(o(this,Rn).clear(),b(this,Rn,null)),b(this,Mn,0))}},Tn=new WeakMap,Rn=new WeakMap,ys=new WeakMap,qs=new WeakMap,ne=new WeakMap,xc=new WeakMap,Mn=new WeakMap,B=new WeakSet,se=function(){return o(this,Rn)||b(this,Rn,new Map)},fa=function(){return o(this,xc)||b(this,xc,new Map)},ga=function(){if(!o(this,ys)){const e=o(this,ne).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=o(this,ne).createElementNS(Ps,"svg");i.setAttribute("width",0),i.setAttribute("height",0),b(this,ys,o(this,ne).createElementNS(Ps,"defs")),e.append(i),i.append(o(this,ys)),o(this,ne).body.append(e)}return o(this,ys)},Ol=function(e){if(e.length===1){const l=e[0],h=new Array(256);for(let p=0;p<256;p++)h[p]=l[p]/255;const u=h.join(",");return[u,u,u]}const[s,i,n]=e,r=new Array(256),a=new Array(256),c=new Array(256);for(let l=0;l<256;l++)r[l]=s[l]/255,a[l]=i[l]/255,c[l]=n[l]/255;return[r.join(","),a.join(","),c.join(",")]},ma=function(e){if(o(this,Tn)===void 0){b(this,Tn,"");const s=o(this,ne).URL;s!==o(this,ne).baseURI&&(Gc(s)?nt('#createUrl: ignore "data:"-URL for performance reasons.'):b(this,Tn,s.split("#",1)[0]))}return`url(${o(this,Tn)}#${e})`},pf=function(e){const s=o(this,ne).createElementNS(Ps,"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)},Hh=function(e){const s=o(this,ne).createElementNS(Ps,"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)},ba=function(e){const s=o(this,ne).createElementNS(Ps,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),o(this,B,ga).append(s),s},Pr=function(e,s,i){const n=o(this,ne).createElementNS(Ps,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},Dr=function(e,s,i,n){const r=o(this,ne).createElementNS(Ps,"feComponentTransfer");n.append(r),v(this,B,Pr).call(this,r,"feFuncR",e),v(this,B,Pr).call(this,r,"feFuncG",s),v(this,B,Pr).call(this,r,"feFuncB",i)},Uh=function(e,s){const i=o(this,ne).createElementNS(Ps,"feComponentTransfer");s.append(i),v(this,B,Pr).call(this,i,"feFuncA",e)},Nr=function(e){return o(this,B,ga).style.color=e,uh(getComputedStyle(o(this,B,ga)).getPropertyValue("color"))},qu),Sv=oe?class extends Kp{async _fetch(t){return Jp(t)}}:Qp;function Cv(d={}){typeof d=="string"||d instanceof URL?d={url:d}:(d instanceof ArrayBuffer||ArrayBuffer.isView(d))&&(d={data:d});const t=new qh,{docId:e}=t,s=d.url?function(F){if(F instanceof URL)return F.href;try{return new URL(F,window.location).href}catch{if(oe&&typeof F=="string")return F}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(d.url):null,i=d.data?function(F){if(oe&&typeof Buffer<"u"&&F instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(F instanceof Uint8Array&&F.byteLength===F.buffer.byteLength)return F;if(typeof F=="string")return Uc(F);if(F instanceof ArrayBuffer||ArrayBuffer.isView(F)||typeof F=="object"&&!isNaN(F==null?void 0:F.length))return new Uint8Array(F);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(d.data):null,n=d.httpHeaders||null,r=d.withCredentials===!0,a=d.password??null,c=d.range instanceof ff?d.range:null,l=Number.isInteger(d.rangeChunkSize)&&d.rangeChunkSize>0?d.rangeChunkSize:yv;let h=d.worker instanceof ka?d.worker:null;const u=d.verbosity,p=typeof d.docBaseUrl!="string"||Gc(d.docBaseUrl)?null:d.docBaseUrl,f=typeof d.cMapUrl=="string"?d.cMapUrl:null,g=d.cMapPacked!==!1,m=d.CMapReaderFactory||xv,_=typeof d.standardFontDataUrl=="string"?d.standardFontDataUrl:null,y=d.StandardFontDataFactory||Sv,x=d.stopAtErrors!==!0,w=Number.isInteger(d.maxImageSize)&&d.maxImageSize>-1?d.maxImageSize:-1,k=d.isEvalSupported!==!1,S=typeof d.isOffscreenCanvasSupported=="boolean"?d.isOffscreenCanvasSupported:!oe,C=typeof d.isChrome=="boolean"?d.isChrome:!pe.platform.isFirefox&&typeof window<"u"&&!!(window!=null&&window.chrome),E=Number.isInteger(d.canvasMaxAreaInBytes)?d.canvasMaxAreaInBytes:-1,T=typeof d.disableFontFace=="boolean"?d.disableFontFace:oe,q=d.fontExtraProperties===!0,j=d.enableXfa===!0,H=d.ownerDocument||globalThis.document,Z=d.disableRange===!0,$=d.disableStream===!0,W=d.disableAutoFetch===!0,mt=d.pdfBug===!0,ee=d.CanvasFactory||wv,le=d.FilterFactory||kv,Y=d.enableHWA===!0,K=c?c.length:d.length??NaN,Xe=typeof d.useSystemFonts=="boolean"?d.useSystemFonts:!oe&&!T,xe=typeof d.useWorkerFetch=="boolean"?d.useWorkerFetch:m===$p&&y===Qp&&f&&_&&Rr(f,document.baseURI)&&Rr(_,document.baseURI);d.canvasFactory&&pu("`canvasFactory`-instance option, please use `CanvasFactory` instead."),d.filterFactory&&pu("`filterFactory`-instance option, please use `FilterFactory` instead."),xb(u);const I={canvasFactory:new ee({ownerDocument:H,enableHWA:Y}),filterFactory:new le({docId:e,ownerDocument:H}),cMapReaderFactory:xe?null:new m({baseUrl:f,isCompressed:g}),standardFontDataFactory:xe?null:new y({baseUrl:_})};if(!h){const z={verbosity:u,port:oi.workerPort};h=z.port?ka.fromPort(z):new ka(z),t._worker=h}const R={docId:e,apiVersion:"4.8.69",data:i,password:a,disableAutoFetch:W,rangeChunkSize:l,length:K,docBaseUrl:p,enableXfa:j,evaluatorOptions:{maxImageSize:w,disableFontFace:T,ignoreErrors:x,isEvalSupported:k,isOffscreenCanvasSupported:S,isChrome:C,canvasMaxAreaInBytes:E,fontExtraProperties:q,useSystemFonts:Xe,cMapUrl:xe?f:null,standardFontDataUrl:xe?_:null}},P={disableFontFace:T,fontExtraProperties:q,ownerDocument:H,pdfBug:mt,styleElement:null,loadingParams:{disableAutoFetch:W,enableXfa:j}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const z=h.messageHandler.sendWithPromise("GetDocRequest",R,i?[i.buffer]:null);let F;if(c)F=new rv(c,{disableRange:Z,disableStream:$});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");let U;oe?U=typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&Rr(s)?Ru:mv:U=Rr(s)?Ru:uv,F=new U({url:s,length:K,httpHeaders:n,withCredentials:r,rangeChunkSize:l,disableRange:Z,disableStream:$})}return z.then(U=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const Ft=new Lr(e,U,h.port),Is=new Mv(Ft,t,F,P,I);t._transport=Is,Ft.send("Ready",null)})}).catch(t._capability.reject),t}function Mu(d){return typeof d=="object"&&Number.isInteger(d==null?void 0:d.num)&&d.num>=0&&Number.isInteger(d==null?void 0:d.gen)&&d.gen>=0}var kc;const Sc=class Sc{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+ce(Sc,kc)._++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t,e,s;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(i){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,i}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};kc=new WeakMap,A(Sc,kc,0);let qh=Sc;class ff{constructor(t,e,s=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const s of this._rangeListeners)s(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const s of this._progressListeners)s(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){xt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Ev{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 lt(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({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 Pi,Gs,Ue,va,Bl;class Tv{constructor(t,e,s,i=!1){A(this,Ue);A(this,Pi,null);A(this,Gs,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new uu:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new gf,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new ml({viewBox:this.view,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 lt(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=vi.ENABLE,transform:n=null,background:r=null,optionalContentConfigPromise:a=null,annotationCanvasMap:c=null,pageColors:l=null,printAnnotationStorage:h=null,isEditing:u=!1}){var k,S;(k=this._stats)==null||k.time("Overall");const p=this._transport.getRenderingIntent(s,i,h,u),{renderingIntent:f,cacheKey:g}=p;b(this,Gs,!1),v(this,Ue,Bl).call(this),a||(a=this._transport.getOptionalContentConfig(f));let m=this._intentStates.get(g);m||(m=Object.create(null),this._intentStates.set(g,m)),m.streamReaderCancelTimeout&&(clearTimeout(m.streamReaderCancelTimeout),m.streamReaderCancelTimeout=null);const _=!!(f&cc);m.displayReadyCapability||(m.displayReadyCapability=Promise.withResolvers(),m.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(S=this._stats)==null||S.time("Page Request"),this._pumpOperatorList(p));const y=C=>{var E;m.renderTasks.delete(x),(this._maybeCleanupAfterRender||_)&&b(this,Gs,!0),v(this,Ue,va).call(this,!_),C?(x.capability.reject(C),this._abortOperatorList({intentState:m,reason:C instanceof Error?C:new Error(C)})):x.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(E=globalThis.Stats)!=null&&E.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},x=new Vh({callback:y,params:{canvasContext:t,viewport:e,transform:n,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:m.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!_,pdfBug:this._pdfBug,pageColors:l});(m.renderTasks||(m.renderTasks=new Set)).add(x);const w=x.task;return Promise.all([m.displayReadyCapability.promise,a]).then(([C,E])=>{var T;if(this.destroyed)y();else{if((T=this._stats)==null||T.time("Rendering"),!(E.renderingIntent&f))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:C,optionalContentConfig:E}),x.operatorListChanged()}}).catch(y),w}getOperatorList({intent:t="display",annotationMode:e=vi.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var c;const n=this._transport.getRenderingIntent(t,e,s,i,!0);let r,a=this._intentStates.get(n.cacheKey);return a||(a=Object.create(null),this._intentStates.set(n.cacheKey,a)),a.opListReadCapability||(r=Object.create(null),r.operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(r))},a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||(a.renderTasks=new Set)).add(r),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(c=this._stats)==null||c.time("Page Request"),this._pumpOperatorList(n)),a.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:s=>s.items.length})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Jr.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){const n=e.getReader(),r={items:[],styles:Object.create(null),lang:null};(function a(){n.read().then(function({value:c,done:l}){l?s(r):(r.lang??(r.lang=c.lang),Object.assign(r.styles,c.styles),r.items.push(...c.items),a())},i)})()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),b(this,Gs,!1),v(this,Ue,Bl).call(this),Promise.all(t)}cleanup(t=!1){b(this,Gs,!0);const e=v(this,Ue,va).call(this,!1);return t&&e&&this._stats&&(this._stats=new uu),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&&v(this,Ue,va).call(this,!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:r}=s,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:i},r).getReader(),c=this._intentStates.get(e);c.streamReader=a;const l=()=>{a.read().then(({value:h,done:u})=>{u?c.streamReader=null:this._transport.destroyed||(this._renderPageChunk(h,c),l())},h=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const u of c.renderTasks)u.operatorListChanged();v(this,Ue,va).call(this,!0)}if(c.displayReadyCapability)c.displayReadyCapability.reject(h);else{if(!c.opListReadCapability)throw h;c.opListReadCapability.reject(h)}}})};l()}_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 zd){let i=100;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 ha(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}}Pi=new WeakMap,Gs=new WeakMap,Ue=new WeakSet,va=function(t=!1){if(v(this,Ue,Bl).call(this),!o(this,Gs)||this.destroyed)return!1;if(t)return b(this,Pi,setTimeout(()=>{b(this,Pi,null),v(this,Ue,va).call(this,!1)},5e3)),!1;for(const{renderTasks:e,operatorList:s}of this._intentStates.values())if(e.size>0||!s.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),b(this,Gs,!1),!0},Bl=function(){o(this,Pi)&&(clearTimeout(o(this,Pi)),b(this,Pi,null))};var Vs,Cc;class Rv{constructor(){A(this,Vs,new Map);A(this,Cc,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};o(this,Cc).then(()=>{for(const[i]of o(this,Vs))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){nt("LoopbackPort - cannot use an `aborted` signal.");return}const r=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",r),n.addEventListener("abort",r)}o(this,Vs).set(e,i)}removeEventListener(t,e){const s=o(this,Vs).get(e);s==null||s(),o(this,Vs).delete(e)}terminate(){for(const[,t]of o(this,Vs))t==null||t();o(this,Vs).clear()}}Vs=new WeakMap,Cc=new WeakMap;var Ec,In,Fn,Xa,zl,$a,jl;const kt=class kt{constructor({name:t=null,port:e=null,verbosity:s=kb()}={}){A(this,Xa);var i;if(this.name=t,this.destroyed=!1,this.verbosity=s,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if((i=o(kt,Fn))!=null&&i.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(o(kt,Fn)||b(kt,Fn,new WeakMap)).set(e,this),this._initializeFromPort(e)}else this._initialize()}get promise(){return oe?Promise.all([Xi.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new Lr("main","worker",t),this._messageHandler.on("ready",function(){}),v(this,Xa,zl).call(this)}_initialize(){if(o(kt,In)||o(kt,$a,jl)){this._setupFakeWorker();return}let{workerSrc:t}=kt;try{kt._isSameOrigin(window.location.href,t)||(t=kt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new Lr("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",()=>{this._webWorker||i()},{signal:n.signal}),s.on("test",a=>{n.abort(),!this.destroyed&&a?(this._messageHandler=s,this._port=e,this._webWorker=e,v(this,Xa,zl).call(this)):i()}),s.on("ready",a=>{if(n.abort(),this.destroyed)i();else try{r()}catch{this._setupFakeWorker()}});const r=()=>{const a=new Uint8Array;s.send("test",a,[a.buffer])};r();return}catch{jc("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){o(kt,In)||(nt("Setting up fake worker."),b(kt,In,!0)),kt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new Rv;this._port=e;const s="fake"+ce(kt,Ec)._++,i=new Lr(s+"_worker",s,e);t.setup(i,e),this._messageHandler=new Lr(s,s+"_worker",e),v(this,Xa,zl).call(this)}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(t=o(kt,Fn))==null||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var s;if(!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const e=(s=o(this,Fn))==null?void 0:s.get(t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new kt(t)}static get workerSrc(){if(oi.workerSrc)return oi.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return lt(this,"_setupFakeWorkerGlobal",(async()=>o(this,$a,jl)?o(this,$a,jl):(await import(this.workerSrc)).WorkerMessageHandler)())}};Ec=new WeakMap,In=new WeakMap,Fn=new WeakMap,Xa=new WeakSet,zl=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},$a=new WeakSet,jl=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},A(kt,$a),A(kt,Ec,0),A(kt,In,!1),A(kt,Fn),oe&&(b(kt,In,!0),oi.workerSrc||(oi.workerSrc="./pdf.worker.mjs")),kt._isSameOrigin=(t,e)=>{let s;try{if(s=new URL(t),!s.origin||s.origin==="null")return!1}catch{return!1}const i=new URL(e,s);return s.origin===i.origin},kt._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let ka=kt;var Ws,ws,Ka,Qa,xs,Ln,Or;class Mv{constructor(t,e,s,i,n){A(this,Ln);A(this,Ws,new Map);A(this,ws,new Map);A(this,Ka,new Map);A(this,Qa,new Map);A(this,xs,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new gf,this.fontLoader=new Gb({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.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return lt(this,"annotationStorage",new Ud)}getRenderingIntent(t,e=vi.ENABLE,s=null,i=!1,n=!1){let r=Nd,a=Fh;switch(t){case"any":r=V0;break;case"display":break;case"print":r=cc;break;default:nt(`getRenderingIntent - invalid intent: ${t}`)}const c=r&cc&&s instanceof Yp?s:this.annotationStorage;switch(e){case vi.DISABLE:r+=X0;break;case vi.ENABLE:break;case vi.ENABLE_FORMS:r+=W0;break;case vi.ENABLE_STORAGE:r+=Y0,a=c.serializable;break;default:nt(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(r+=$0),n&&(r+=K0);const{ids:l,hash:h}=c.modifiedIds;return{renderingIntent:r,cacheKey:[r,a.hash,h].join("_"),annotationStorageSerializable:a,modifiedIds:l}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=o(this,xs))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of o(this,ws).values())t.push(i._destroy());o(this,ws).clear(),o(this,Ka).clear(),o(this,Qa).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i;this.commonObjs.clear(),this.fontLoader.clear(),o(this,Ws).clear(),this.filterFactory.destroy(),Qr.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new ha("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{Ut(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:r}){r?i.close():(Ut(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(r=>{if(!this.destroyed)throw r})}}),t.on("ReaderHeadersReady",async s=>{var a;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:r}=this._fullReader;return(!i||!n)&&(this._lastProgress&&((a=e.onProgress)==null||a.call(e,this._lastProgress)),this._fullReader.onProgress=c=>{var l;(l=e.onProgress)==null||l.call(e,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:i,isRangeSupported:n,contentLength:r}}),t.on("GetRangeReader",(s,i)=>{Ut(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(s.begin,s.end);n?(i.onPull=()=>{n.read().then(function({value:r,done:a}){a?i.close():(Ut(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(r),1,[r]))}).catch(r=>{i.error(r)})},i.onCancel=r=>{n.cancel(r),i.ready.catch(a=>{if(!this.destroyed)throw a})}):i.close()}),t.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new Ev(s,this))}),t.on("DocException",function(s){let i;switch(s.name){case"PasswordException":i=new ch(s.message,s.code);break;case"InvalidPDFException":i=new Ap(s.message);break;case"MissingPDFException":i=new ca(s.message);break;case"UnexpectedResponseException":i=new Hc(s.message,s.status);break;case"UnknownErrorException":i=new hh(s.message,s.details);break;default:xt("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",s=>{if(b(this,xs,Promise.withResolvers()),e.onPassword){const i=n=>{n instanceof Error?o(this,xs).reject(n):o(this,xs).resolve({password:n})};try{e.onPassword(i,s.code)}catch(n){o(this,xs).reject(n)}}else o(this,xs).reject(new ch(s.message,s.code));return o(this,xs).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=>{this.destroyed||o(this,ws).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{var r;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":const{disableFontFace:a,fontExtraProperties:c,pdfBug:l}=this._params;if("error"in n){const f=n.error;nt(`Error during font loading: ${f}`),this.commonObjs.resolve(s,f);break}const h=l&&((r=globalThis.FontInspector)!=null&&r.enabled)?(f,g)=>globalThis.FontInspector.fontAdded(f,g):null,u=new Vb(n,{disableFontFace:a,inspectFont:h});this.fontLoader.bind(u).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!c&&u.data&&(u.data=null),this.commonObjs.resolve(s,u)});break;case"CopyLocalImage":const{imageRef:p}=n;Ut(p,"The imageRef must be defined.");for(const f of o(this,ws).values())for(const[,g]of f.objs)if((g==null?void 0:g.ref)===p)return g.dataLen?(this.commonObjs.resolve(s,structuredClone(g)),g.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,r])=>{var c;if(this.destroyed)return;const a=o(this,ws).get(i);if(!a.objs.has(s))if(a._intentStates.size!==0)switch(n){case"Image":a.objs.resolve(s,r),(r==null?void 0:r.dataLen)>1e7&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(s,r);break;default:throw new Error(`Got unknown object type ${n}`)}else(c=r==null?void 0:r.bitmap)==null||c.close()}),t.on("DocProgress",s=>{var i;this.destroyed||((i=e.onProgress)==null||i.call(e,{loaded:s.loaded,total:s.total}))}),t.on("FetchBuiltInCMap",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(s)}),t.on("FetchStandardFontData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&nt("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=o(this,Ka).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&&o(this,Qa).set(n.refStr,t);const r=new Tv(e,n,this,this._params.pdfBug);return o(this,ws).set(e,r),r});return o(this,Ka).set(e,i),i}getPageIndex(t){return Mu(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 v(this,Ln,Or).call(this,"GetFieldObjects")}hasJSActions(){return v(this,Ln,Or).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 v(this,Ln,Or).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 v(this,Ln,Or).call(this,"GetOptionalContentConfig").then(e=>new av(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=o(this,Ws).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var n,r;return{info:i[0],metadata:i[1]?new iv(i[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((r=this._fullReader)==null?void 0:r.contentLength)??null}});return o(this,Ws).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 o(this,ws).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),o(this,Ws).clear(),this.filterFactory.destroy(!0),Qr.cleanup()}}cachedPageNumber(t){if(!Mu(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return o(this,Qa).get(e)??null}}Ws=new WeakMap,ws=new WeakMap,Ka=new WeakMap,Qa=new WeakMap,xs=new WeakMap,Ln=new WeakSet,Or=function(t,e=null){const s=o(this,Ws).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return o(this,Ws).set(t,i),i};const kl=Symbol("INITIAL_DATA");var ss,No,Gh;class gf{constructor(){A(this,No);A(this,ss,Object.create(null))}get(t,e=null){if(e){const i=v(this,No,Gh).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=o(this,ss)[t];if(!s||s.data===kl)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=o(this,ss)[t];return!!e&&e.data!==kl}resolve(t,e=null){const s=v(this,No,Gh).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in o(this,ss)){const{data:s}=o(this,ss)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}b(this,ss,Object.create(null))}*[Symbol.iterator](){for(const t in o(this,ss)){const{data:e}=o(this,ss)[t];e!==kl&&(yield[t,e])}}}ss=new WeakMap,No=new WeakSet,Gh=function(t){var e;return(e=o(this,ss))[t]||(e[t]={...Promise.withResolvers(),data:kl})};var Di;class Iv{constructor(t){A(this,Di,null);b(this,Di,t),this.onContinue=null}get promise(){return o(this,Di).capability.promise}cancel(t=0){o(this,Di).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=o(this,Di).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=o(this,Di);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}Di=new WeakMap;var Ni,Pn;const nn=class nn{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:r,pageIndex:a,canvasFactory:c,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:u=!1,pageColors:p=null}){A(this,Ni,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=a,this.canvasFactory=c,this.filterFactory=l,this._pdfBug=u,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 Iv(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 a,c;if(this.cancelled)return;if(this._canvas){if(o(nn,Pn).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.");o(nn,Pn).add(this._canvas)}this._pdfBug&&((a=globalThis.StepperManager)!=null&&a.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:r}=this.params;this.gfx=new xa(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:r}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(t=null,e=0){var s;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),o(this,Ni)&&(window.cancelAnimationFrame(o(this,Ni)),b(this,Ni,null)),o(nn,Pn).delete(this._canvas),this.callback(t||new zd(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){var t;this.graphicsReady?((t=this.stepper)==null||t.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?b(this,Ni,window.requestAnimationFrame(()=>{b(this,Ni,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(),o(nn,Pn).delete(this._canvas),this.callback())))}};Ni=new WeakMap,Pn=new WeakMap,A(nn,Pn,new WeakSet);let Vh=nn;const Fv="4.8.69",Lv="3634dab10";function Iu(d){return Math.floor(255*Math.max(0,Math.min(1,d))).toString(16).padStart(2,"0")}function Tr(d){return Math.max(0,Math.min(255,255*d))}class Fu{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=Tr(t),t,t]}static G_HTML([t]){const e=Iu(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(Tr)}static RGB_HTML(t){return`#${t.map(Iu).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[Tr(1-Math.min(1,t+i)),Tr(1-Math.min(1,s+i)),Tr(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,r=1-s;return["CMYK",i,n,r,Math.min(i,n,r)]}}class Pv{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 Xd extends Pv{_createSVG(t){return document.createElementNS(Ps,t)}}class mf{static setupStorage(t,e,s,i,n){const r=i.getValue(e,{value:null});switch(s.name){case"textarea":if(r.value!==null&&(t.textContent=r.value),n==="print")break;t.addEventListener("input",a=>{i.setValue(e,{value:a.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(r.value===s.attributes.xfaOn?t.setAttribute("checked",!0):r.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",a=>{i.setValue(e,{value:a.target.checked?a.target.getAttribute("xfaOn"):a.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&t.setAttribute("value",r.value),n==="print")break;t.addEventListener("input",a=>{i.setValue(e,{value:a.target.value})})}break;case"select":if(r.value!==null){t.setAttribute("value",r.value);for(const a of s.children)a.attributes.value===r.value?a.attributes.selected=!0:a.attributes.hasOwnProperty("selected")&&delete a.attributes.selected}t.addEventListener("input",a=>{const c=a.target.options,l=c.selectedIndex===-1?"":c[c.selectedIndex].value;i.setValue(e,{value:l})})}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:r}=e,a=t instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${i}`);for(const[c,l]of Object.entries(r))if(l!=null)switch(c){case"class":l.length&&t.setAttribute(c,l.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",l);break;case"style":Object.assign(t.style,l);break;case"textContent":t.textContent=l;break;default:(!a||c!=="href"&&c!=="newWindow")&&t.setAttribute(c,l)}a&&n.addLinkAttributes(t,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(t,r.dataId,e,s)}static render(t){var u,p;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",r=document.createElement(i.name);i.attributes&&this.setAttributes({html:r,element:i,intent:n,linkService:s});const a=n!=="richText",c=t.div;if(c.append(r),t.viewport){const f=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=f}a&&c.setAttribute("class","xfaLayer xfaFont");const l=[];if(i.children.length===0){if(i.value){const f=document.createTextNode(i.value);r.append(f),a&&Jr.shouldBuildText(i.name)&&l.push(f)}return{textDivs:l}}const h=[[i,-1,r]];for(;h.length>0;){const[f,g,m]=h.at(-1);if(g+1===f.children.length){h.pop();continue}const _=f.children[++h.at(-1)[1]];if(_===null)continue;const{name:y}=_;if(y==="#text"){const w=document.createTextNode(_.value);l.push(w),m.append(w);continue}const x=(u=_==null?void 0:_.attributes)!=null&&u.xmlns?document.createElementNS(_.attributes.xmlns,y):document.createElement(y);if(m.append(x),_.attributes&&this.setAttributes({html:x,element:_,storage:e,intent:n,linkService:s}),((p=_.children)==null?void 0:p.length)>0)h.push([_,-1,x]);else if(_.value){const w=document.createTextNode(_.value);a&&Jr.shouldBuildText(y)&&l.push(w),x.append(w)}}for(const f of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))f.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const vl=1e3,aa=new WeakSet;function li(d){return{width:d[2]-d[0],height:d[3]-d[1]}}class Dv{static create(t){switch(t.data.annotationType){case eb:return new bf(t);case tb:return new Nv(t);case mb:switch(t.data.fieldType){case"Tx":return new Ov(t);case"Btn":return t.data.radioButton?new _f(t):t.data.checkBox?new zv(t):new jv(t);case"Ch":return new Hv(t);case"Sig":return new Bv(t)}return new da(t);case vp:return new Yh(t);case sb:return new Sf(t);case ib:return new qv(t);case nb:return new Gv(t);case ab:return new Vv(t);case ob:return new Cf(t);case pb:return new Yv(t);case fb:return new $d(t);case rb:return new Wv(t);case lb:return new Ef(t);case cb:return new Xv(t);case hb:return new $v(t);case db:return new Kv(t);case ub:return new Tf(t);case gb:return new Qv(t);default:return new Dt(t)}}}var Dn,Ja,Za,Oo,Wh;const Jd=class Jd{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){A(this,Oo);A(this,Dn,null);A(this,Ja,!1);A(this,Za,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({titleObj:t,contentsObj:e,richText:s}){return!!(t!=null&&t.str||e!=null&&e.str||s!=null&&s.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Jd._hasPopupData(this.data)}updateEdited(t){var s;if(!this.container)return;o(this,Dn)||b(this,Dn,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&v(this,Oo,Wh).call(this,e),(s=o(this,Za))==null||s.popup.updateEdited(t)}resetEdited(){var t;o(this,Dn)&&(v(this,Oo,Wh).call(this,o(this,Dn).rect),(t=o(this,Za))==null||t.popup.resetEdited(),b(this,Dn,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 da||(n.tabIndex=vl);const{style:r}=n;if(r.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Yh){const{rotation:m}=e;return e.hasOwnCanvas||m===0||this.setRotation(m,n),n}const{width:a,height:c}=li(e.rect);if(!t&&e.borderStyle.width>0){r.borderWidth=`${e.borderStyle.width}px`;const m=e.borderStyle.horizontalCornerRadius,_=e.borderStyle.verticalCornerRadius;if(m>0||_>0){const x=`calc(${m}px * var(--scale-factor)) / calc(${_}px * var(--scale-factor))`;r.borderRadius=x}else if(this instanceof _f){const x=`calc(${a}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;r.borderRadius=x}switch(e.borderStyle.style){case bb:r.borderStyle="solid";break;case vb:r.borderStyle="dashed";break;case Ab:nt("Unimplemented border style: beveled");break;case _b:nt("Unimplemented border style: inset");break;case yb:r.borderBottomStyle="solid"}const y=e.borderColor||null;y?(b(this,Ja,!0),r.borderColor=G.makeHexColor(0|y[0],0|y[1],0|y[2])):r.borderWidth=0}const l=G.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:h,pageHeight:u,pageX:p,pageY:f}=i.rawDims;r.left=100*(l[0]-p)/h+"%",r.top=100*(l[1]-f)/u+"%";const{rotation:g}=e;return e.hasOwnCanvas||g===0?(r.width=100*a/h+"%",r.height=100*c/u+"%"):this.setRotation(g,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:n,height:r}=li(this.data.rect);let a,c;t%180==0?(a=100*n/s,c=100*r/i):(a=100*r/s,c=100*n/i),e.style.width=`${a}%`,e.style.height=`${c}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const n=i.detail[e],r=n[0],a=n.slice(1);i.target.style[s]=Fu[`${r}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[s]:Fu[`${r}_rgb`](a)})};return lt(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 r=s[i];r&&(r({detail:{[i]:n},target:t}),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(m=>Math.fround(m));if(t.length===8){const[m,_,y,x]=t.subarray(2,6);if(i===m&&n===_&&e===y&&s===x)return}const{style:r}=this.container;let a;if(o(this,Ja)){const{borderColor:m,borderWidth:_}=r;r.borderWidth=0,a=["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="${m}" stroke-width="${_}">`],this.container.classList.add("hasBorder")}const c=i-e,l=n-s,{svgFactory:h}=this,u=h.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const p=h.createElement("defs");u.append(p);const f=h.createElement("clipPath"),g=`clippath_${this.data.id}`;f.setAttribute("id",g),f.setAttribute("clipPathUnits","objectBoundingBox"),p.append(f);for(let m=2,_=t.length;m<_;m+=8){const y=t[m],x=t[m+1],w=t[m+2],k=t[m+3],S=h.createElement("rect"),C=(w-e)/c,E=(n-x)/l,T=(y-w)/c,q=(x-k)/l;S.setAttribute("x",C),S.setAttribute("y",E),S.setAttribute("width",T),S.setAttribute("height",q),f.append(S),a==null||a.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${E}" width="${T}" height="${q}"/>`)}o(this,Ja)&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(u),this.container.style.clipPath=`url(#${g})`}_createPopup(){const{data:t}=this,e=b(this,Za,new Yh({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},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:r,exportValues:a}of i){if(n===-1||r===e)continue;const c=typeof a=="string"?a:null,l=document.querySelector(`[data-element-id="${r}"]`);!l||aa.has(l)?s.push({id:r,exportValue:c,domElement:l}):nt(`_getElementsByName - element not allowed: ${r}`)}return s}for(const i of document.getElementsByName(t)){const{exportValue:n}=i,r=i.getAttribute("data-element-id");r!==e&&aa.has(i)&&s.push({id:r,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})})}};Dn=new WeakMap,Ja=new WeakMap,Za=new WeakMap,Oo=new WeakSet,Wh=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:c}}}}=this;s==null||s.splice(0,4,...t);const{width:l,height:h}=li(t);e.left=100*(t[0]-a)/n+"%",e.top=100*(r-t[3]+c)/r+"%",i===0?(e.width=100*l/n+"%",e.height=100*h/r+"%"):this.setRotation(i)};let Dt=Jd;var Le,Ji,vf,Af;class bf extends Dt{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});A(this,Le);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?(v(this,Le,vf).call(this,i,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(v(this,Le,Af).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==="")&&v(this,Le,Ji).call(this)}_bindNamedAction(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),v(this,Le,Ji).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 r=i.get(n);r&&(e[r]=()=>{var a;return(a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:n}}),!1})}e.onclick||(e.onclick=()=>!1),v(this,Le,Ji).call(this)}_bindResetFormAction(e,s){const i=e.onclick;i||(e.href=this.linkService.getAnchorUrl("")),v(this,Le,Ji).call(this),this._fieldObjects?e.onclick=()=>{var u;i==null||i();const{fields:n,refs:r,include:a}=s,c=[];if(n.length!==0||r.length!==0){const p=new Set(r);for(const f of n){const g=this._fieldObjects[f]||[];for(const{id:m}of g)p.add(m)}for(const f of Object.values(this._fieldObjects))for(const g of f)p.has(g.id)===a&&c.push(g)}else for(const p of Object.values(this._fieldObjects))c.push(...p);const l=this.annotationStorage,h=[];for(const p of c){const{id:f}=p;switch(h.push(f),p.type){case"text":{const m=p.defaultValue||"";l.setValue(f,{value:m});break}case"checkbox":case"radiobutton":{const m=p.defaultValue===p.exportValues;l.setValue(f,{value:m});break}case"combobox":case"listbox":{const m=p.defaultValue||"";l.setValue(f,{value:m});break}default:continue}const g=document.querySelector(`[data-element-id="${f}"]`);g&&(aa.has(g)?g.dispatchEvent(new Event("resetform")):nt(`_bindResetFormAction - element not allowed: ${f}`))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}:(nt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1))}}Le=new WeakSet,Ji=function(){this.container.setAttribute("data-internal-link","")},vf=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},v(this,Le,Ji).call(this)},Af=function(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),v(this,Le,Ji).call(this)};class Nv extends Dt{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 da extends Dt{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 pe.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,r=>{var a;(a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})}):t.addEventListener(s,r=>{var a;if(s==="blur"){if(!e.focused||!r.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}n&&((a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(r)}}))})}_setEventListeners(t,e,s,i){var n,r,a;for(const[c,l]of s)(l==="Action"||(n=this.data.actions)!=null&&n[l])&&(l!=="Focus"&&l!=="Blur"||e||(e={focused:!1}),this._setEventListener(t,e,c,l,i),l!=="Focus"||(r=this.data.actions)!=null&&r.Blur?l!=="Blur"||(a=this.data.actions)!=null&&a.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":G.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,n=t.style;let r;const a=c=>Math.round(10*c)/10;if(this.data.multiLine){const c=Math.abs(this.data.rect[3]-this.data.rect[1]-2),l=c/(Math.round(c/(Qc*i))||1);r=Math.min(i,a(l/Qc))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(i,a(c/Qc))}n.fontSize=`calc(${r}px * var(--scale-factor))`,n.color=G.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 Ov extends da{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,s,i){const n=this.annotationStorage;for(const r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=s),n.setValue(r.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 r=t.getValue(e,{value:this.data.fieldValue});let a=r.value||"";const c=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;c&&a.length>c&&(a=a.slice(0,c));let l=r.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
- `))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const h={userValue:a,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=l??a,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",l??a),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),aa.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=vl,this._setRequired(s,this.data.required),c&&(s.maxLength=c),s.addEventListener("input",p=>{t.setValue(e,{value:p.target.value}),this.setPropertyOnSiblings(s,"value",p.target.value,"value"),h.formattedValue=null}),s.addEventListener("resetform",p=>{const f=this.data.defaultFieldValue??"";s.value=h.userValue=f,h.formattedValue=null});let u=p=>{const{formattedValue:f}=h;f!=null&&(p.target.value=f),p.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",f=>{var m;if(h.focused)return;const{target:g}=f;h.userValue&&(g.value=h.userValue),h.lastCommittedValue=g.value,h.commitKey=1,(m=this.data.actions)!=null&&m.Focus||(h.focused=!0)}),s.addEventListener("updatefromsandbox",f=>{this.showElementAndHideCanvas(f.target);const g={value(m){h.userValue=m.detail.value??"",t.setValue(e,{value:h.userValue.toString()}),m.target.value=h.userValue},formattedValue(m){const{formattedValue:_}=m.detail;h.formattedValue=_,_!=null&&m.target!==document.activeElement&&(m.target.value=_),t.setValue(e,{formattedValue:_})},selRange(m){m.target.setSelectionRange(...m.detail.selRange)},charLimit:m=>{var w;const{charLimit:_}=m.detail,{target:y}=m;if(_===0){y.removeAttribute("maxLength");return}y.setAttribute("maxLength",_);let x=h.userValue;x&&!(x.length<=_)&&(x=x.slice(0,_),y.value=h.userValue=x,t.setValue(e,{value:x}),(w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:x,willCommit:!0,commitKey:1,selStart:y.selectionStart,selEnd:y.selectionEnd}}))}};this._dispatchEventFromSandbox(g,f)}),s.addEventListener("keydown",f=>{var _;h.commitKey=1;let g=-1;if(f.key==="Escape"?g=0:f.key!=="Enter"||this.data.multiLine?f.key==="Tab"&&(h.commitKey=3):g=2,g===-1)return;const{value:m}=f.target;h.lastCommittedValue!==m&&(h.lastCommittedValue=m,h.userValue=m,(_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:m,willCommit:!0,commitKey:g,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}}))});const p=u;u=null,s.addEventListener("blur",f=>{var m,_;if(!h.focused||!f.relatedTarget)return;(m=this.data.actions)!=null&&m.Blur||(h.focused=!1);const{value:g}=f.target;h.userValue=g,h.lastCommittedValue!==g&&((_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:g,willCommit:!0,commitKey:h.commitKey,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}})),p(f)}),(n=this.data.actions)!=null&&n.Keystroke&&s.addEventListener("beforeinput",f=>{var S;h.lastCommittedValue=null;const{data:g,target:m}=f,{value:_,selectionStart:y,selectionEnd:x}=m;let w=y,k=x;switch(f.inputType){case"deleteWordBackward":{const C=_.substring(0,y).match(/\w*[^\w]*$/);C&&(w-=C[0].length);break}case"deleteWordForward":{const C=_.substring(y).match(/^[^\w]*\w*/);C&&(k+=C[0].length);break}case"deleteContentBackward":y===x&&(w-=1);break;case"deleteContentForward":y===x&&(k+=1)}f.preventDefault(),(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,change:g||"",willCommit:!1,selStart:w,selEnd:k}})}),this._setEventListeners(s,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],f=>f.target.value)}if(u&&s.addEventListener("blur",u),this.data.comb){const p=(this.data.rect[2]-this.data.rect[0])/c;s.classList.add("comb"),s.style.letterSpacing=`calc(${p}px * var(--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 Bv extends da{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class zv extends da{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 aa.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=vl,n.addEventListener("change",r=>{const{name:a,checked:c}=r.target;for(const l of this._getElementsByName(a,s)){const h=c&&l.exportValue===e.exportValue;l.domElement&&(l.domElement.checked=h),t.setValue(l.id,{value:h})}t.setValue(s,{value:c})}),n.addEventListener("resetform",r=>{const a=e.defaultFieldValue||"Off";r.target.checked=a===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",r=>{const a={value(c){c.target.checked=c.detail.value!=="Off",t.setValue(s,{value:c.target.checked})}};this._dispatchEventFromSandbox(a,r)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],r=>r.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class _f extends da{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 r of this._getElementsByName(e.fieldName,s))t.setValue(r.id,{value:!1});const n=document.createElement("input");if(aa.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=vl,n.addEventListener("change",r=>{const{name:a,checked:c}=r.target;for(const l of this._getElementsByName(a,s))t.setValue(l.id,{value:!1});t.setValue(s,{value:c})}),n.addEventListener("resetform",r=>{const a=e.defaultFieldValue;r.target.checked=a!=null&&a===e.buttonValue}),this.enableScripting&&this.hasJSActions){const r=e.buttonValue;n.addEventListener("updatefromsandbox",a=>{const c={value:l=>{const h=r===l.detail.value;for(const u of this._getElementsByName(l.target.name)){const p=h&&u.id===s;u.domElement&&(u.domElement.checked=p),t.setValue(u.id,{value:p})}}};this._dispatchEventFromSandbox(c,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)}return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class jv extends bf{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 Hv extends da{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");aa.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=vl;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",h=>{const u=this.data.defaultFieldValue;for(const p of i.options)p.selected=p.value===u});for(const h of this.data.options){const u=document.createElement("option");u.textContent=h.displayValue,u.value=h.exportValue,s.value.includes(h.exportValue)&&(u.setAttribute("selected",!0),n=!1),i.append(u)}let r=null;if(n){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),i.prepend(h),r=()=>{h.remove(),i.removeEventListener("input",r),r=null},i.addEventListener("input",r)}const a=h=>{const u=h?"value":"textContent",{options:p,multiple:f}=i;return f?Array.prototype.filter.call(p,g=>g.selected).map(g=>g[u]):p.selectedIndex===-1?null:p[p.selectedIndex][u]};let c=a(!1);const l=h=>{const u=h.target.options;return Array.prototype.map.call(u,p=>({displayValue:p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",h=>{const u={value(p){r==null||r();const f=p.detail.value,g=new Set(Array.isArray(f)?f:[f]);for(const m of i.options)m.selected=g.has(m.value);t.setValue(e,{value:a(!0)}),c=a(!1)},multipleSelection(p){i.multiple=!0},remove(p){const f=i.options,g=p.detail.remove;f[g].selected=!1,i.remove(g),f.length>0&&Array.prototype.findIndex.call(f,m=>m.selected)===-1&&(f[0].selected=!0),t.setValue(e,{value:a(!0),items:l(p)}),c=a(!1)},clear(p){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),c=a(!1)},insert(p){const{index:f,displayValue:g,exportValue:m}=p.detail.insert,_=i.children[f],y=document.createElement("option");y.textContent=g,y.value=m,_?_.before(y):i.append(y),t.setValue(e,{value:a(!0),items:l(p)}),c=a(!1)},items(p){const{items:f}=p.detail;for(;i.length!==0;)i.remove(0);for(const g of f){const{displayValue:m,exportValue:_}=g,y=document.createElement("option");y.textContent=m,y.value=_,i.append(y)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:a(!0),items:l(p)}),c=a(!1)},indices(p){const f=new Set(p.detail.indices);for(const g of p.target.options)g.selected=f.has(g.index);t.setValue(e,{value:a(!0)}),c=a(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(u,h)}),i.addEventListener("input",h=>{var f;const u=a(!0),p=a(!1);t.setValue(e,{value:u}),h.preventDefault(),(f=this.linkService.eventBus)==null||f.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:p,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"]],h=>h.target.value)):i.addEventListener("input",function(h){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Yh extends Dt{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:Dt._hasPopupData(e)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new Uv({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(const s of this.elements)s.popup=t,s.container.ariaHasPopup="dialog",e.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(s=>`${Bd}${s}`).join(",")),this.container}}var tr,Tc,Rc,er,Nn,Lt,Ys,sr,Bo,zo,ir,Xs,is,$s,jo,Ks,Ho,On,Bn,_t,Hl,Xh,yf,wf,xf,kf,Ul,ql,$h;class Uv{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:r,richText:a,parent:c,rect:l,parentRect:h,open:u}){A(this,_t);A(this,tr,v(this,_t,xf).bind(this));A(this,Tc,v(this,_t,$h).bind(this));A(this,Rc,v(this,_t,ql).bind(this));A(this,er,v(this,_t,Ul).bind(this));A(this,Nn,null);A(this,Lt,null);A(this,Ys,null);A(this,sr,null);A(this,Bo,null);A(this,zo,null);A(this,ir,null);A(this,Xs,!1);A(this,is,null);A(this,$s,null);A(this,jo,null);A(this,Ks,null);A(this,Ho,null);A(this,On,null);A(this,Bn,!1);var p;b(this,Lt,t),b(this,Ho,i),b(this,Ys,r),b(this,Ks,a),b(this,zo,c),b(this,Nn,e),b(this,jo,l),b(this,ir,h),b(this,Bo,s),b(this,sr,Hd.toDateObject(n)),this.trigger=s.flatMap(f=>f.getElementsToTriggerPopup());for(const f of this.trigger)f.addEventListener("click",o(this,er)),f.addEventListener("mouseenter",o(this,Rc)),f.addEventListener("mouseleave",o(this,Tc)),f.classList.add("popupTriggerArea");for(const f of s)(p=f.container)==null||p.addEventListener("keydown",o(this,tr));o(this,Lt).hidden=!0,u&&v(this,_t,Ul).call(this)}render(){if(o(this,is))return;const t=b(this,is,document.createElement("div"));if(t.className="popup",o(this,Nn)){const n=t.style.outlineColor=G.makeHexColor(...o(this,Nn));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`:t.style.backgroundColor=G.makeHexColor(...o(this,Nn).map(a=>Math.floor(.7*(255-a)+a)))}const e=document.createElement("span");e.className="header";const s=document.createElement("h1");if(e.append(s),{dir:s.dir,str:s.textContent}=o(this,Ho),t.append(e),o(this,sr)){const n=document.createElement("span");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:o(this,sr).valueOf()})),e.append(n)}const i=o(this,_t,Hl);if(i)mf.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(o(this,Ys));t.append(n)}o(this,Lt).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,r=i.length;n<r;++n){const a=i[n];s.append(document.createTextNode(a)),n<r-1&&s.append(document.createElement("br"))}return s}updateEdited({rect:t,popupContent:e}){var s;o(this,On)||b(this,On,{contentsObj:o(this,Ys),richText:o(this,Ks)}),t&&b(this,$s,null),e&&(b(this,Ks,v(this,_t,wf).call(this,e)),b(this,Ys,null)),(s=o(this,is))==null||s.remove(),b(this,is,null)}resetEdited(){var t;o(this,On)&&({contentsObj:ce(this,Ys)._,richText:ce(this,Ks)._}=o(this,On),b(this,On,null),(t=o(this,is))==null||t.remove(),b(this,is,null),b(this,$s,null))}forceHide(){b(this,Bn,this.isVisible),o(this,Bn)&&(o(this,Lt).hidden=!0)}maybeShow(){o(this,Bn)&&(o(this,is)||v(this,_t,ql).call(this),b(this,Bn,!1),o(this,Lt).hidden=!1)}get isVisible(){return o(this,Lt).hidden===!1}}tr=new WeakMap,Tc=new WeakMap,Rc=new WeakMap,er=new WeakMap,Nn=new WeakMap,Lt=new WeakMap,Ys=new WeakMap,sr=new WeakMap,Bo=new WeakMap,zo=new WeakMap,ir=new WeakMap,Xs=new WeakMap,is=new WeakMap,$s=new WeakMap,jo=new WeakMap,Ks=new WeakMap,Ho=new WeakMap,On=new WeakMap,Bn=new WeakMap,_t=new WeakSet,Hl=function(){const t=o(this,Ks),e=o(this,Ys);return!(t!=null&&t.str)||e!=null&&e.str&&e.str!==t.str?null:o(this,Ks).html||null},Xh=function(){var t,e,s;return((s=(e=(t=o(this,_t,Hl))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},yf=function(){var t,e,s;return((s=(e=(t=o(this,_t,Hl))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},wf=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:o(this,_t,yf),fontSize:o(this,_t,Xh)?`calc(${o(this,_t,Xh)}px * var(--scale-factor))`:""}};for(const n of t.split(`
- `))e.push({name:"span",value:n,attributes:i});return s},xf=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&o(this,Xs))&&v(this,_t,Ul).call(this)},kf=function(){if(o(this,$s)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=o(this,zo);let r=!!o(this,ir),a=r?o(this,ir):o(this,jo);for(const f of o(this,Bo))if(!a||G.intersect(f.data.rect,a)!==null){a=f.data.rect,r=!0;break}const c=G.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),l=r?a[2]-a[0]+5:0,h=c[0]+l,u=c[1];b(this,$s,[100*(h-i)/e,100*(u-n)/s]);const{style:p}=o(this,Lt);p.left=`${o(this,$s)[0]}%`,p.top=`${o(this,$s)[1]}%`},Ul=function(){b(this,Xs,!o(this,Xs)),o(this,Xs)?(v(this,_t,ql).call(this),o(this,Lt).addEventListener("click",o(this,er)),o(this,Lt).addEventListener("keydown",o(this,tr))):(v(this,_t,$h).call(this),o(this,Lt).removeEventListener("click",o(this,er)),o(this,Lt).removeEventListener("keydown",o(this,tr)))},ql=function(){o(this,is)||this.render(),this.isVisible?o(this,Xs)&&o(this,Lt).classList.add("focused"):(v(this,_t,kf).call(this),o(this,Lt).hidden=!1,o(this,Lt).style.zIndex=parseInt(o(this,Lt).style.zIndex)+1e3)},$h=function(){o(this,Lt).classList.remove("focused"),!o(this,Xs)&&this.isVisible&&(o(this,Lt).hidden=!0,o(this,Lt).style.zIndex=parseInt(o(this,Lt).style.zIndex)-1e3)};class Sf extends Dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=et.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 Uo;class qv extends Dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Uo,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:s,height:i}=li(e.rect),n=this.svgFactory.create(s,i,!0),r=b(this,Uo,this.svgFactory.createElement("svg:line"));return r.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),r.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),r.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),r.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),r.setAttribute("stroke-width",e.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,Uo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Uo=new WeakMap;var qo;class Gv extends Dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,qo,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:s,height:i}=li(e.rect),n=this.svgFactory.create(s,i,!0),r=e.borderStyle.width,a=b(this,qo,this.svgFactory.createElement("svg:rect"));return a.setAttribute("x",r/2),a.setAttribute("y",r/2),a.setAttribute("width",s-r),a.setAttribute("height",i-r),a.setAttribute("stroke-width",r||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 o(this,qo)}addHighlightArea(){this.container.classList.add("highlightArea")}}qo=new WeakMap;var Go;class Vv extends Dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Go,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:s,height:i}=li(e.rect),n=this.svgFactory.create(s,i,!0),r=e.borderStyle.width,a=b(this,Go,this.svgFactory.createElement("svg:ellipse"));return a.setAttribute("cx",s/2),a.setAttribute("cy",i/2),a.setAttribute("rx",s/2-r/2),a.setAttribute("ry",i/2-r/2),a.setAttribute("stroke-width",r||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 o(this,Go)}addHighlightArea(){this.container.classList.add("highlightArea")}}Go=new WeakMap;var Vo;class Cf extends Dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Vo,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}}=this;if(!s)return this.container;const{width:r,height:a}=li(e),c=this.svgFactory.create(r,a,!0);let l=[];for(let u=0,p=s.length;u<p;u+=2){const f=s[u]-e[0],g=e[3]-s[u+1];l.push(`${f},${g}`)}l=l.join(" ");const h=b(this,Vo,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",l),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),c.append(h),this.container.append(c),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,Vo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Vo=new WeakMap;class Wv extends Cf{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Yv extends Dt{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 Wo;class $d extends Dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Wo,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?et.HIGHLIGHT:et.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,inkLists:s,borderStyle:i,popupRef:n}}=this,{width:r,height:a}=li(e),c=this.svgFactory.create(r,a,!0);for(const l of s){let h=[];for(let p=0,f=l.length;p<f;p+=2){const g=l[p]-e[0],m=e[3]-l[p+1];h.push(`${g},${m}`)}h=h.join(" ");const u=this.svgFactory.createElement(this.svgElementName);o(this,Wo).push(u),u.setAttribute("points",h),u.setAttribute("stroke-width",i.width||1),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),c.append(u)}return!n&&this.hasPopupData&&this._createPopup(),this.container.append(c),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return o(this,Wo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Wo=new WeakMap;class Ef extends Dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=et.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class Xv extends Dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class $v extends Dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Kv extends Dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class Tf extends Dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=et.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 Yo,Xo,Kh;class Qv extends Dt{constructor(e){var i;super(e,{isRenderable:!0});A(this,Xo);A(this,Yo,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(100*s.fillAlpha)}%);`)),i.addEventListener("dblclick",v(this,Xo,Kh).bind(this)),b(this,Yo,i);const{isMac:n}=pe.platform;return e.addEventListener("keydown",r=>{r.key==="Enter"&&(n?r.metaKey:r.ctrlKey)&&v(this,Xo,Kh).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return o(this,Yo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Yo=new WeakMap,Xo=new WeakSet,Kh=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var $o,zn,jn,Ko,ra,Rf,Qh;class Jv{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:r,structTreeLayer:a}){A(this,ra);A(this,$o,null);A(this,zn,null);A(this,jn,new Map);A(this,Ko,null);this.div=t,b(this,$o,e),b(this,zn,s),b(this,Ko,a||null),this.page=n,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return o(this,jn).size>0}async render(t){var r;const{annotations:e}=t,s=this.div;ia(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 Xd,annotationStorage:t.annotationStorage||new Ud,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const a of e){if(a.noHTML)continue;const c=a.annotationType===vp;if(c){const u=i.get(a.id);if(!u)continue;n.elements=u}else{const{width:u,height:p}=li(a.rect);if(u<=0||p<=0)continue}n.data=a;const l=Dv.create(n);if(!l.isRenderable)continue;if(!c&&a.popupRef){const u=i.get(a.popupRef);u?u.push(l):i.set(a.popupRef,[l])}const h=l.render();a.hidden&&(h.style.visibility="hidden"),await v(this,ra,Rf).call(this,h,a.id),l._isEditable&&(o(this,jn).set(l.data.id,l),(r=this._annotationEditorUIManager)==null||r.renderAnnotationElement(l))}v(this,ra,Qh).call(this)}update({viewport:t}){const e=this.div;this.viewport=t,ia(e,{rotation:t.rotation}),v(this,ra,Qh).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(o(this,jn).values())}getEditableAnnotation(t){return o(this,jn).get(t)}}$o=new WeakMap,zn=new WeakMap,jn=new WeakMap,Ko=new WeakMap,ra=new WeakSet,Rf=async function(t,e){var r,a;const s=t.firstChild||t,i=s.id=`${Bd}${e}`,n=await((r=o(this,Ko))==null?void 0:r.getAriaAttributes(i));if(n)for(const[c,l]of n)s.setAttribute(c,l);this.div.append(t),(a=o(this,$o))==null||a.moveElementInDOM(this.div,t,s,!1)},Qh=function(){if(!o(this,zn))return;const t=this.div;for(const[e,s]of o(this,zn)){const i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:n}=i;n?n.nodeName==="CANVAS"?n.replaceWith(s):n.classList.contains("annotationContent")?n.after(s):n.before(s):i.append(s)}o(this,zn).clear()};const Sl=/\r\n?|\n/g;var ns,Ee,Qo,Hn,Te,Ot,Mf,If,Ff,Gl,hi,Vl,Wl,Lf,Zh,Pf;const wt=class wt extends gt{constructor(e){super({...e,name:"freeTextEditor"});A(this,Ot);A(this,ns);A(this,Ee,"");A(this,Qo,`${this.id}-editor`);A(this,Hn,null);A(this,Te);b(this,ns,e.color||wt._defaultColor||gt._defaultLineColor),b(this,Te,e.fontSize||wt._defaultFontSize)}static get _keyboardManager(){const e=wt.prototype,s=r=>r.isEmpty(),i=na.TRANSLATE_SMALL,n=na.TRANSLATE_BIG;return lt(this,"_keyboardManager",new bl([[["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){gt.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case Q.FREETEXT_SIZE:wt._defaultFontSize=s;break;case Q.FREETEXT_COLOR:wt._defaultColor=s}}updateParams(e,s){switch(e){case Q.FREETEXT_SIZE:v(this,Ot,Mf).call(this,s);break;case Q.FREETEXT_COLOR:v(this,Ot,If).call(this,s)}}static get defaultPropertiesToUpdate(){return[[Q.FREETEXT_SIZE,wt._defaultFontSize],[Q.FREETEXT_COLOR,wt._defaultColor||gt._defaultLineColor]]}get propertiesToUpdate(){return[[Q.FREETEXT_SIZE,o(this,Te)],[Q.FREETEXT_COLOR,o(this,ns)]]}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-wt._internalPadding*e,-(wt._internalPadding+o(this,Te))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(et.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),b(this,Hn,new AbortController);const e=this._uiManager.combinedSignal(o(this,Hn));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})}disableEditMode(){var e;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",o(this,Qo)),this._isDraggable=!0,(e=o(this,Hn))==null||e.abort(),b(this,Hn,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var e;this.width||(this.enableEditMode(),this.editorDiv.focus(),(e=this._initialOptions)!=null&&e.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=o(this,Ee),s=b(this,Ee,v(this,Ot,Ff).call(this).trimEnd());if(e===s)return;const i=n=>{b(this,Ee,n),n?(v(this,Ot,Wl).call(this),this._uiManager.rebuild(this),v(this,Ot,Gl).call(this)):this.remove()};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),v(this,Ot,Gl).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){wt._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)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",o(this,Qo)),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(${o(this,Te)}px * var(--scale-factor))`,i.color=o(this,ns),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),hc(this,this.div,["dblclick","keydown"]),this.width){const[n,r]=this.parentDimensions;if(this.annotationElementId){const{position:a}=this._initialData;let[c,l]=this.getInitialTranslation();[c,l]=this.pageTranslationToScreen(c,l);const[h,u]=this.pageDimensions,[p,f]=this.pageTranslation;let g,m;switch(this.rotation){case 0:g=e+(a[0]-p)/h,m=s+this.height-(a[1]-f)/u;break;case 90:g=e+(a[0]-p)/h,m=s-(a[1]-f)/u,[c,l]=[l,-c];break;case 180:g=e-this.width+(a[0]-p)/h,m=s-(a[1]-f)/u,[c,l]=[-c,-l];break;case 270:g=e+(a[0]-p-this.height*u)/h,m=s+(a[1]-f-this.width*h)/u,[c,l]=[-l,c]}this.setAt(g*n,m*r,c,l)}else this.setAt(e*n,s*r,this.width*n,this.height*r);v(this,Ot,Wl).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var g,m,_;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const n=v(g=wt,hi,Zh).call(g,s.getData("text")||"").replaceAll(Sl,`
- `);if(!n)return;const r=window.getSelection();if(!r.rangeCount)return;this.editorDiv.normalize(),r.deleteFromDocument();const a=r.getRangeAt(0);if(!n.includes(`
- `)){a.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),r.collapseToStart();return}const{startContainer:c,startOffset:l}=a,h=[],u=[];if(c.nodeType===Node.TEXT_NODE){const y=c.parentElement;if(u.push(c.nodeValue.slice(l).replaceAll(Sl,"")),y!==this.editorDiv){let x=h;for(const w of this.editorDiv.childNodes)w!==y?x.push(v(m=wt,hi,Vl).call(m,w)):x=u}h.push(c.nodeValue.slice(0,l).replaceAll(Sl,""))}else if(c===this.editorDiv){let y=h,x=0;for(const w of this.editorDiv.childNodes)x++===l&&(y=u),y.push(v(_=wt,hi,Vl).call(_,w))}b(this,Ee,`${h.join(`
- `)}${n}${u.join(`
- `)}`),v(this,Ot,Wl).call(this);const p=new Range;let f=h.reduce((y,x)=>y+x.length,0);for(const{firstChild:y}of this.editorDiv.childNodes)if(y.nodeType===Node.TEXT_NODE){const x=y.nodeValue.length;if(f<=x){p.setStart(y,f),p.setEnd(y,f);break}f-=x}r.removeAllRanges(),r.addRange(p)}get contentDiv(){return this.editorDiv}static async deserialize(e,s,i){var a;let n=null;if(e instanceof Sf){const{data:{defaultAppearanceData:{fontSize:c,fontColor:l},rect:h,rotation:u,id:p,popupRef:f},textContent:g,textPosition:m,parent:{page:{pageNumber:_}}}=e;if(!g||g.length===0)return null;n=e={annotationType:et.FREETEXT,color:Array.from(l),fontSize:c,value:g.join(`
- `),position:m,pageIndex:_-1,rect:h.slice(0),rotation:u,id:p,deleted:!1,popupRef:f}}const r=await super.deserialize(e,s,i);return b(r,Te,e.fontSize),b(r,ns,G.makeHexColor(...e.color)),b(r,Ee,v(a=wt,hi,Zh).call(a,e.value)),r.annotationElementId=e.id||null,r._initialData=n,r}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=wt._internalPadding*this.parentScale,i=this.getRect(s,s),n=gt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:o(this,ns)),r={annotationType:et.FREETEXT,color:n,fontSize:o(this,Te),value:v(this,Ot,Lf).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?r:this.annotationElementId&&!v(this,Ot,Pf).call(this,r)?null:(r.id=this.annotationElementId,r)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(this.deleted)return s;const{style:i}=s;i.fontSize=`calc(${o(this,Te)}px * var(--scale-factor))`,i.color=o(this,ns),s.replaceChildren();for(const r of o(this,Ee).split(`
- `)){const a=document.createElement("div");a.append(r?document.createTextNode(r):document.createElement("br")),s.append(a)}const n=wt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(n,n),popupContent:o(this,Ee)}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};ns=new WeakMap,Ee=new WeakMap,Qo=new WeakMap,Hn=new WeakMap,Te=new WeakMap,Ot=new WeakSet,Mf=function(e){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--scale-factor))`,this.translate(0,-(n-o(this,Te))*this.parentScale),b(this,Te,n),v(this,Ot,Gl).call(this)},i=o(this,Te);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Q.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},If=function(e){const s=n=>{b(this,ns,this.editorDiv.style.color=n)},i=o(this,ns);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Q.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Ff=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const n of this.editorDiv.childNodes)((s==null?void 0:s.nodeType)!==Node.TEXT_NODE||n.nodeName!=="BR")&&(e.push(v(i=wt,hi,Vl).call(i,n)),s=n);return e.join(`
- `)},Gl=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:r}=this,a=r.style.display,c=r.classList.contains("hidden");r.classList.remove("hidden"),r.style.display="hidden",n.div.append(this.div),i=r.getBoundingClientRect(),r.remove(),r.style.display=a,r.classList.toggle("hidden",c)}this.rotation%180==this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},hi=new WeakSet,Vl=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Sl,"")},Wl=function(){if(this.editorDiv.replaceChildren(),o(this,Ee))for(const e of o(this,Ee).split(`
- `)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},Lf=function(){return o(this,Ee).replaceAll(" "," ")},Zh=function(e){return e.replaceAll(" "," ")},Pf=function(e){const{value:s,fontSize:i,color:n,pageIndex:r}=this._initialData;return this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((a,c)=>a!==n[c])||e.pageIndex!==r},A(wt,hi),O(wt,"_freeTextDefaultContent",""),O(wt,"_internalPadding",0),O(wt,"_defaultColor",null),O(wt,"_defaultFontSize",10),O(wt,"_type","freetext"),O(wt,"_editorType",et.FREETEXT);let Jh=wt;class Df{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.")}get classNamesForDrawing(){xt("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){xt("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var Re,as,nr,ar,ks,rt,Un,qn,Jo,Zo,rr,or,Oi,tl,Mc,Ic,qt,Br,Nf,Of,Bf,zf,jf,Hf;const Ns=class Ns{constructor({x:t,y:e},s,i,n,r,a=0){A(this,qt);A(this,Re);A(this,as,[]);A(this,nr);A(this,ar);A(this,ks,[]);A(this,rt,new Float64Array(18));A(this,Un);A(this,qn);A(this,Jo);A(this,Zo);A(this,rr);A(this,or);A(this,Oi,[]);b(this,Re,s),b(this,or,n*i),b(this,ar,r),o(this,rt).set([NaN,NaN,NaN,NaN,t,e],6),b(this,nr,a),b(this,Zo,o(Ns,tl)*i),b(this,Jo,o(Ns,Ic)*i),b(this,rr,i),o(this,Oi).push(t,e)}isEmpty(){return isNaN(o(this,rt)[8])}add({x:t,y:e}){var E;b(this,Un,t),b(this,qn,e);const[s,i,n,r]=o(this,Re);let[a,c,l,h]=o(this,rt).subarray(8,12);const u=t-l,p=e-h,f=Math.hypot(u,p);if(f<o(this,Jo))return!1;const g=f-o(this,Zo),m=g/f,_=m*u,y=m*p;let x=a,w=c;a=l,c=h,l+=_,h+=y,(E=o(this,Oi))==null||E.push(t,e);const k=_/g,S=-y/g*o(this,or),C=k*o(this,or);return o(this,rt).set(o(this,rt).subarray(2,8),0),o(this,rt).set([l+S,h+C],4),o(this,rt).set(o(this,rt).subarray(14,18),12),o(this,rt).set([l-S,h-C],16),isNaN(o(this,rt)[6])?(o(this,ks).length===0&&(o(this,rt).set([a+S,c+C],2),o(this,ks).push(NaN,NaN,NaN,NaN,(a+S-s)/n,(c+C-i)/r),o(this,rt).set([a-S,c-C],14),o(this,as).push(NaN,NaN,NaN,NaN,(a-S-s)/n,(c-C-i)/r)),o(this,rt).set([x,w,a,c,l,h],6),!this.isEmpty()):(o(this,rt).set([x,w,a,c,l,h],6),Math.abs(Math.atan2(w-c,x-a)-Math.atan2(y,_))<Math.PI/2?([a,c,l,h]=o(this,rt).subarray(2,6),o(this,ks).push(NaN,NaN,NaN,NaN,((a+l)/2-s)/n,((c+h)/2-i)/r),[a,c,x,w]=o(this,rt).subarray(14,18),o(this,as).push(NaN,NaN,NaN,NaN,((x+a)/2-s)/n,((w+c)/2-i)/r),!0):([x,w,a,c,l,h]=o(this,rt).subarray(0,6),o(this,ks).push(((x+5*a)/6-s)/n,((w+5*c)/6-i)/r,((5*a+l)/6-s)/n,((5*c+h)/6-i)/r,((a+l)/2-s)/n,((c+h)/2-i)/r),[l,h,a,c,x,w]=o(this,rt).subarray(12,18),o(this,as).push(((x+5*a)/6-s)/n,((w+5*c)/6-i)/r,((5*a+l)/6-s)/n,((5*c+h)/6-i)/r,((a+l)/2-s)/n,((c+h)/2-i)/r),!0))}toSVGPath(){if(this.isEmpty())return"";const t=o(this,ks),e=o(this,as);if(isNaN(o(this,rt)[6])&&!this.isEmpty())return v(this,qt,Nf).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]}`);v(this,qt,Bf).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 v(this,qt,Of).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,n,r){return new Uf(t,e,s,i,n,r)}getOutlines(){var u;const t=o(this,ks),e=o(this,as),s=o(this,rt),[i,n,r,a]=o(this,Re),c=new Float64Array((((u=o(this,Oi))==null?void 0:u.length)??0)+2);for(let p=0,f=c.length-2;p<f;p+=2)c[p]=(o(this,Oi)[p]-i)/r,c[p+1]=(o(this,Oi)[p+1]-n)/a;if(c[c.length-2]=(o(this,Un)-i)/r,c[c.length-1]=(o(this,qn)-n)/a,isNaN(s[6])&&!this.isEmpty())return v(this,qt,zf).call(this,c);const l=new Float64Array(o(this,ks).length+24+o(this,as).length);let h=t.length;for(let p=0;p<h;p+=2)isNaN(t[p])?l[p]=l[p+1]=NaN:(l[p]=t[p],l[p+1]=t[p+1]);h=v(this,qt,Hf).call(this,l,h);for(let p=e.length-6;p>=6;p-=6)for(let f=0;f<6;f+=2)isNaN(e[p+f])?(l[h]=l[h+1]=NaN,h+=2):(l[h]=e[p+f],l[h+1]=e[p+f+1],h+=2);return v(this,qt,jf).call(this,l,h),this.newFreeDrawOutline(l,c,o(this,Re),o(this,rr),o(this,nr),o(this,ar))}};Re=new WeakMap,as=new WeakMap,nr=new WeakMap,ar=new WeakMap,ks=new WeakMap,rt=new WeakMap,Un=new WeakMap,qn=new WeakMap,Jo=new WeakMap,Zo=new WeakMap,rr=new WeakMap,or=new WeakMap,Oi=new WeakMap,tl=new WeakMap,Mc=new WeakMap,Ic=new WeakMap,qt=new WeakSet,Br=function(){const t=o(this,rt).subarray(4,6),e=o(this,rt).subarray(16,18),[s,i,n,r]=o(this,Re);return[(o(this,Un)+(t[0]-e[0])/2-s)/n,(o(this,qn)+(t[1]-e[1])/2-i)/r,(o(this,Un)+(e[0]-t[0])/2-s)/n,(o(this,qn)+(e[1]-t[1])/2-i)/r]},Nf=function(){const[t,e,s,i]=o(this,Re),[n,r,a,c]=v(this,qt,Br).call(this);return`M${(o(this,rt)[2]-t)/s} ${(o(this,rt)[3]-e)/i} L${(o(this,rt)[4]-t)/s} ${(o(this,rt)[5]-e)/i} L${n} ${r} L${a} ${c} L${(o(this,rt)[16]-t)/s} ${(o(this,rt)[17]-e)/i} L${(o(this,rt)[14]-t)/s} ${(o(this,rt)[15]-e)/i} Z`},Of=function(t){const e=o(this,as);t.push(`L${e[4]} ${e[5]} Z`)},Bf=function(t){const[e,s,i,n]=o(this,Re),r=o(this,rt).subarray(4,6),a=o(this,rt).subarray(16,18),[c,l,h,u]=v(this,qt,Br).call(this);t.push(`L${(r[0]-e)/i} ${(r[1]-s)/n} L${c} ${l} L${h} ${u} L${(a[0]-e)/i} ${(a[1]-s)/n}`)},zf=function(t){const e=o(this,rt),[s,i,n,r]=o(this,Re),[a,c,l,h]=v(this,qt,Br).call(this),u=new Float64Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/r,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/r,NaN,NaN,NaN,NaN,a,c,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/r,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/r],0),this.newFreeDrawOutline(u,t,o(this,Re),o(this,rr),o(this,nr),o(this,ar))},jf=function(t,e){const s=o(this,as);return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+6},Hf=function(t,e){const s=o(this,rt).subarray(4,6),i=o(this,rt).subarray(16,18),[n,r,a,c]=o(this,Re),[l,h,u,p]=v(this,qt,Br).call(this);return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/a,(s[1]-r)/c,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,u,p,NaN,NaN,NaN,NaN,(i[0]-n)/a,(i[1]-r)/c],e),e+24},A(Ns,tl,8),A(Ns,Mc,2),A(Ns,Ic,o(Ns,tl)+o(Ns,Mc));let uc=Ns;var lr,Gn,Qs,el,Me,sl,Pt,we,zr,jr,qf;class Uf extends Df{constructor(e,s,i,n,r,a){super();A(this,we);A(this,lr);A(this,Gn,null);A(this,Qs);A(this,el);A(this,Me);A(this,sl);A(this,Pt);b(this,Pt,e),b(this,Me,s),b(this,lr,i),b(this,sl,n),b(this,Qs,r),b(this,el,a),v(this,we,qf).call(this,a);const{x:c,y:l,width:h,height:u}=o(this,Gn);for(let p=0,f=e.length;p<f;p+=2)e[p]=(e[p]-c)/h,e[p+1]=(e[p+1]-l)/u;for(let p=0,f=s.length;p<f;p+=2)s[p]=(s[p]-c)/h,s[p+1]=(s[p+1]-l)/u}toSVGPath(){const e=[`M${o(this,Pt)[4]} ${o(this,Pt)[5]}`];for(let s=6,i=o(this,Pt).length;s<i;s+=6)isNaN(o(this,Pt)[s])?e.push(`L${o(this,Pt)[s+4]} ${o(this,Pt)[s+5]}`):e.push(`C${o(this,Pt)[s]} ${o(this,Pt)[s+1]} ${o(this,Pt)[s+2]} ${o(this,Pt)[s+3]} ${o(this,Pt)[s+4]} ${o(this,Pt)[s+5]}`);return e.push("Z"),e.join(" ")}serialize([e,s,i,n],r){const a=i-e,c=n-s;let l,h;switch(r){case 0:l=v(this,we,zr).call(this,o(this,Pt),e,n,a,-c),h=v(this,we,zr).call(this,o(this,Me),e,n,a,-c);break;case 90:l=v(this,we,jr).call(this,o(this,Pt),e,s,a,c),h=v(this,we,jr).call(this,o(this,Me),e,s,a,c);break;case 180:l=v(this,we,zr).call(this,o(this,Pt),i,s,-a,c),h=v(this,we,zr).call(this,o(this,Me),i,s,-a,c);break;case 270:l=v(this,we,jr).call(this,o(this,Pt),i,n,-a,-c),h=v(this,we,jr).call(this,o(this,Me),i,n,-a,-c)}return{outline:Array.from(l),points:[Array.from(h)]}}get box(){return o(this,Gn)}newOutliner(e,s,i,n,r,a=0){return new uc(e,s,i,n,r,a)}getNewOutline(e,s){const{x:i,y:n,width:r,height:a}=o(this,Gn),[c,l,h,u]=o(this,lr),p=r*h,f=a*u,g=i*h+c,m=n*u+l,_=this.newOutliner({x:o(this,Me)[0]*p+g,y:o(this,Me)[1]*f+m},o(this,lr),o(this,sl),e,o(this,el),s??o(this,Qs));for(let y=2;y<o(this,Me).length;y+=2)_.add({x:o(this,Me)[y]*p+g,y:o(this,Me)[y+1]*f+m});return _.getOutlines()}get mustRemoveSelfIntersections(){return!0}}lr=new WeakMap,Gn=new WeakMap,Qs=new WeakMap,el=new WeakMap,Me=new WeakMap,sl=new WeakMap,Pt=new WeakMap,we=new WeakSet,zr=function(e,s,i,n,r){const a=new Float64Array(e.length);for(let c=0,l=e.length;c<l;c+=2)a[c]=s+e[c]*n,a[c+1]=i+e[c+1]*r;return a},jr=function(e,s,i,n,r){const a=new Float64Array(e.length);for(let c=0,l=e.length;c<l;c+=2)a[c]=s+e[c+1]*n,a[c+1]=i+e[c]*r;return a},qf=function(e){const s=o(this,Pt);let i=s[4],n=s[5],r=i,a=n,c=i,l=n,h=i,u=n;const p=e?Math.max:Math.min;for(let y=6,x=s.length;y<x;y+=6){if(isNaN(s[y]))r=Math.min(r,s[y+4]),a=Math.min(a,s[y+5]),c=Math.max(c,s[y+4]),l=Math.max(l,s[y+5]),u<s[y+5]?(h=s[y+4],u=s[y+5]):u===s[y+5]&&(h=p(h,s[y+4]));else{const w=G.bezierBoundingBox(i,n,...s.slice(y,y+6));r=Math.min(r,w[0]),a=Math.min(a,w[1]),c=Math.max(c,w[2]),l=Math.max(l,w[3]),u<w[3]?(h=w[2],u=w[3]):u===w[3]&&(h=p(h,w[2]))}i=s[y+4],n=s[y+5]}const f=r-o(this,Qs),g=a-o(this,Qs),m=c-r+2*o(this,Qs),_=l-a+2*o(this,Qs);b(this,Gn,{x:f,y:g,width:m,height:_,lastPoint:[h,u]})};var il,Bi,rs,ge,Gf,Yl,Vf,Wf,td;class Lu{constructor(t,e=0,s=0,i=!0){A(this,ge);A(this,il);A(this,Bi,[]);A(this,rs,[]);let n=1/0,r=-1/0,a=1/0,c=-1/0;const l=10**-4;for(const{x:_,y,width:x,height:w}of t){const k=Math.floor((_-e)/l)*l,S=Math.ceil((_+x+e)/l)*l,C=Math.floor((y-e)/l)*l,E=Math.ceil((y+w+e)/l)*l,T=[k,C,E,!0],q=[S,C,E,!1];o(this,Bi).push(T,q),n=Math.min(n,k),r=Math.max(r,S),a=Math.min(a,C),c=Math.max(c,E)}const h=r-n+2*s,u=c-a+2*s,p=n-s,f=a-s,g=o(this,Bi).at(i?-1:-2),m=[g[0],g[2]];for(const _ of o(this,Bi)){const[y,x,w]=_;_[0]=(y-p)/h,_[1]=(x-f)/u,_[2]=(w-f)/u}b(this,il,{x:p,y:f,width:h,height:u,lastPoint:m})}getOutlines(){o(this,Bi).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of o(this,Bi))e[3]?(t.push(...v(this,ge,td).call(this,e)),v(this,ge,Vf).call(this,e)):(v(this,ge,Wf).call(this,e),t.push(...v(this,ge,td).call(this,e)));return v(this,ge,Gf).call(this,t)}}il=new WeakMap,Bi=new WeakMap,rs=new WeakMap,ge=new WeakSet,Gf=function(t){const e=[],s=new Set;for(const r of t){const[a,c,l]=r;e.push([a,c,r],[a,l,r])}e.sort((r,a)=>r[1]-a[1]||r[0]-a[0]);for(let r=0,a=e.length;r<a;r+=2){const c=e[r][2],l=e[r+1][2];c.push(l),l.push(c),s.add(c),s.add(l)}const i=[];let n;for(;s.size>0;){const r=s.values().next().value;let[a,c,l,h,u]=r;s.delete(r);let p=a,f=c;for(n=[a,l],i.push(n);;){let g;if(s.has(h))g=h;else{if(!s.has(u))break;g=u}s.delete(g),[a,c,l,h,u]=g,p!==a&&(n.push(p,f,a,f===c?c:l),p=a),f=f===c?l:c}n.push(p,f)}return new Zv(i,o(this,il))},Yl=function(t){const e=o(this,rs);let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,r=e[n][0];if(r===t)return n;r<t?s=n+1:i=n-1}return i+1},Vf=function([,t,e]){const s=v(this,ge,Yl).call(this,t);o(this,rs).splice(s,0,[t,e])},Wf=function([,t,e]){const s=v(this,ge,Yl).call(this,t);for(let i=s;i<o(this,rs).length;i++){const[n,r]=o(this,rs)[i];if(n!==t)break;if(n===t&&r===e){o(this,rs).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,r]=o(this,rs)[i];if(n!==t)break;if(n===t&&r===e){o(this,rs).splice(i,1);return}}},td=function(t){const[e,s,i]=t,n=[[e,s,i]],r=v(this,ge,Yl).call(this,i);for(let a=0;a<r;a++){const[c,l]=o(this,rs)[a];for(let h=0,u=n.length;h<u;h++){const[,p,f]=n[h];if(!(l<=p||f<=c))if(p>=c)if(f>l)n[h][1]=l;else{if(u===1)return[];n.splice(h,1),h--,u--}else n[h][2]=c,f>l&&n.push([e,l,f])}}return n};var nl,cr;class Zv extends Df{constructor(e,s){super();A(this,nl);A(this,cr);b(this,cr,e),b(this,nl,s)}toSVGPath(){const e=[];for(const s of o(this,cr)){let[i,n]=s;e.push(`M${i} ${n}`);for(let r=2;r<s.length;r+=2){const a=s[r],c=s[r+1];a===i?(e.push(`V${c}`),n=c):c===n&&(e.push(`H${a}`),i=a)}e.push("Z")}return e.join(" ")}serialize([e,s,i,n],r){const a=[],c=i-e,l=n-s;for(const h of o(this,cr)){const u=new Array(h.length);for(let p=0;p<h.length;p+=2)u[p]=e+h[p]*c,u[p+1]=n-h[p+1]*l;a.push(u)}return a}get box(){return o(this,nl)}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}nl=new WeakMap,cr=new WeakMap;class ed extends uc{newFreeDrawOutline(t,e,s,i,n,r){return new tA(t,e,s,i,n,r)}get classNamesForDrawing(){return["highlight","free"]}}class tA extends Uf{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,s,i,n,r=0){return new ed(t,e,s,i,n,r)}}var os,Vn,hr,jt,al,dr,rl,ol,zi,ls,ur,ll,bt,sd,id,nd,Zi,Yf,bi;const be=class be{constructor({editor:t=null,uiManager:e=null}){A(this,bt);A(this,os,null);A(this,Vn,null);A(this,hr);A(this,jt,null);A(this,al,!1);A(this,dr,!1);A(this,rl,null);A(this,ol);A(this,zi,null);A(this,ls,null);A(this,ur);var s;t?(b(this,dr,!1),b(this,ur,Q.HIGHLIGHT_COLOR),b(this,rl,t)):(b(this,dr,!0),b(this,ur,Q.HIGHLIGHT_DEFAULT_COLOR)),b(this,ls,(t==null?void 0:t._uiManager)||e),b(this,ol,o(this,ls)._eventBus),b(this,hr,(t==null?void 0:t.color)||((s=o(this,ls))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),o(be,ll)||b(be,ll,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 lt(this,"_keyboardManager",new bl([[["Escape","mac+Escape"],be.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],be.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],be.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],be.prototype._moveToPrevious],[["Home","mac+Home"],be.prototype._moveToBeginning],[["End","mac+End"],be.prototype._moveToEnd]]))}renderButton(){const t=b(this,os,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=o(this,ls)._signal;t.addEventListener("click",v(this,bt,Zi).bind(this),{signal:e}),t.addEventListener("keydown",v(this,bt,nd).bind(this),{signal:e});const s=b(this,Vn,document.createElement("span"));return s.className="swatch",s.setAttribute("aria-hidden",!0),s.style.backgroundColor=o(this,hr),t.append(s),t}renderMainDropdown(){const t=b(this,jt,v(this,bt,sd).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===o(this,os)){v(this,bt,Zi).call(this,t);return}const e=t.target.getAttribute("data-color");e&&v(this,bt,id).call(this,e,t)}_moveToNext(t){var e,s;o(this,bt,bi)?t.target!==o(this,os)?(e=t.target.nextSibling)==null||e.focus():(s=o(this,jt).firstChild)==null||s.focus():v(this,bt,Zi).call(this,t)}_moveToPrevious(t){var e,s;t.target!==((e=o(this,jt))==null?void 0:e.firstChild)&&t.target!==o(this,os)?(o(this,bt,bi)||v(this,bt,Zi).call(this,t),(s=t.target.previousSibling)==null||s.focus()):o(this,bt,bi)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;o(this,bt,bi)?(e=o(this,jt).firstChild)==null||e.focus():v(this,bt,Zi).call(this,t)}_moveToEnd(t){var e;o(this,bt,bi)?(e=o(this,jt).lastChild)==null||e.focus():v(this,bt,Zi).call(this,t)}hideDropdown(){var t,e;(t=o(this,jt))==null||t.classList.add("hidden"),(e=o(this,zi))==null||e.abort(),b(this,zi,null)}_hideDropdownFromKeyboard(){var t;o(this,dr)||(o(this,bt,bi)?(this.hideDropdown(),o(this,os).focus({preventScroll:!0,focusVisible:o(this,al)})):(t=o(this,rl))==null||t.unselect())}updateColor(t){if(o(this,Vn)&&(o(this,Vn).style.backgroundColor=t),!o(this,jt))return;const e=o(this,ls).highlightColors.values();for(const s of o(this,jt).children)s.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;(t=o(this,os))==null||t.remove(),b(this,os,null),b(this,Vn,null),(e=o(this,jt))==null||e.remove(),b(this,jt,null)}};os=new WeakMap,Vn=new WeakMap,hr=new WeakMap,jt=new WeakMap,al=new WeakMap,dr=new WeakMap,rl=new WeakMap,ol=new WeakMap,zi=new WeakMap,ls=new WeakMap,ur=new WeakMap,ll=new WeakMap,bt=new WeakSet,sd=function(){const t=document.createElement("div"),e=o(this,ls)._signal;t.addEventListener("contextmenu",Ye,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[s,i]of o(this,ls).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",o(be,ll)[s]);const r=document.createElement("span");n.append(r),r.className="swatch",r.style.backgroundColor=i,n.setAttribute("aria-selected",i===o(this,hr)),n.addEventListener("click",v(this,bt,id).bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",v(this,bt,nd).bind(this),{signal:e}),t},id=function(t,e){e.stopPropagation(),o(this,ol).dispatch("switchannotationeditorparams",{source:this,type:o(this,ur),value:t})},nd=function(t){be._keyboardManager.exec(this,t)},Zi=function(t){if(o(this,bt,bi)){this.hideDropdown();return}if(b(this,al,t.detail===0),o(this,zi)||(b(this,zi,new AbortController),window.addEventListener("pointerdown",v(this,bt,Yf).bind(this),{signal:o(this,ls).combinedSignal(o(this,zi))})),o(this,jt)){o(this,jt).classList.remove("hidden");return}const e=b(this,jt,v(this,bt,sd).call(this));o(this,os).append(e)},Yf=function(t){var e;(e=o(this,jt))!=null&&e.contains(t.target)||this.hideDropdown()},bi=function(){return o(this,jt)&&!o(this,jt).classList.contains("hidden")},A(be,ll,null);let pc=be;var pr,cl,Js,Wn,fr,ze,hl,dl,Yn,cs,ae,_e,gr,Zs,Ht,mr,je,ul,tt,ad,Xl,Xf,$f,Kf,rd,tn,qe,Aa,Qf,$l,Hr,Jf,Zf,tg,eg,sg;const ht=class ht extends gt{constructor(e){super({...e,name:"highlightEditor"});A(this,tt);A(this,pr,null);A(this,cl,0);A(this,Js);A(this,Wn,null);A(this,fr,null);A(this,ze,null);A(this,hl,null);A(this,dl,0);A(this,Yn,null);A(this,cs,null);A(this,ae,null);A(this,_e,!1);A(this,gr,null);A(this,Zs);A(this,Ht,null);A(this,mr,"");A(this,je);A(this,ul,"");this.color=e.color||ht._defaultColor,b(this,je,e.thickness||ht._defaultThickness),b(this,Zs,e.opacity||ht._defaultOpacity),b(this,Js,e.boxes||null),b(this,ul,e.methodOfCreation||""),b(this,mr,e.text||""),this._isDraggable=!1,e.highlightId>-1?(b(this,_e,!0),v(this,tt,Xl).call(this,e),v(this,tt,tn).call(this)):o(this,Js)&&(b(this,pr,e.anchorNode),b(this,cl,e.anchorOffset),b(this,hl,e.focusNode),b(this,dl,e.focusOffset),v(this,tt,ad).call(this),v(this,tt,tn).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const e=ht.prototype;return lt(this,"_keyboardManager",new bl([[["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:o(this,_e)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:o(this,je),methodOfCreation:o(this,ul)}}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;gt.initialize(e,s),ht._defaultColor||(ht._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,s){switch(e){case Q.HIGHLIGHT_DEFAULT_COLOR:ht._defaultColor=s;break;case Q.HIGHLIGHT_THICKNESS:ht._defaultThickness=s}}translateInPage(e,s){}get toolbarPosition(){return o(this,gr)}updateParams(e,s){switch(e){case Q.HIGHLIGHT_COLOR:v(this,tt,Xf).call(this,s);break;case Q.HIGHLIGHT_THICKNESS:v(this,tt,$f).call(this,s)}}static get defaultPropertiesToUpdate(){return[[Q.HIGHLIGHT_DEFAULT_COLOR,ht._defaultColor],[Q.HIGHLIGHT_THICKNESS,ht._defaultThickness]]}get propertiesToUpdate(){return[[Q.HIGHLIGHT_COLOR,this.color||ht._defaultColor],[Q.HIGHLIGHT_THICKNESS,o(this,je)||ht._defaultThickness],[Q.HIGHLIGHT_FREE,o(this,_e)]]}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(b(this,fr,new pc({editor:this})),e.addColorPicker(o(this,fr))),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(v(this,tt,Hr).call(this))}getBaseTranslation(){return[0,0]}getRect(e,s){return super.getRect(e,s,v(this,tt,Hr).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){v(this,tt,rd).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(v(this,tt,tn).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?v(this,tt,rd).call(this):e&&(v(this,tt,tn).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,r,a;const{drawLayer:s}=this.parent;let i;o(this,_e)?(e=(e-this.rotation+360)%360,i=v(n=ht,qe,Aa).call(n,o(this,cs).box,e)):i=v(r=ht,qe,Aa).call(r,this,e),s.rotate(o(this,ae),e),s.rotate(o(this,Ht),e),s.updateBox(o(this,ae),i),s.updateBox(o(this,Ht),v(a=ht,qe,Aa).call(a,o(this,ze).box,e))}render(){if(this.div)return this.div;const e=super.render();o(this,mr)&&(e.setAttribute("aria-label",o(this,mr)),e.setAttribute("role","mark")),o(this,_e)?e.classList.add("free"):this.div.addEventListener("keydown",v(this,tt,Qf).bind(this),{signal:this._uiManager._signal});const s=b(this,Yn,document.createElement("div"));e.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=o(this,Wn);const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),hc(this,o(this,Yn),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent.drawLayer.addClass(o(this,Ht),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(o(this,Ht),"hovered")}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:v(this,tt,$l).call(this,!0);break;case 1:case 3:v(this,tt,$l).call(this,!1)}}select(){var e,s;super.select(),o(this,Ht)&&((e=this.parent)==null||e.drawLayer.removeClass(o(this,Ht),"hovered"),(s=this.parent)==null||s.drawLayer.addClass(o(this,Ht),"selected"))}unselect(){var e;super.unselect(),o(this,Ht)&&((e=this.parent)==null||e.drawLayer.removeClass(o(this,Ht),"selected"),o(this,_e)||v(this,tt,$l).call(this,!1))}get _mustFixPosition(){return!o(this,_e)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(o(this,ae),e),this.parent.drawLayer.show(o(this,Ht),e))}static startHighlighting(e,s,{target:i,x:n,y:r}){const{x:a,y:c,width:l,height:h}=i.getBoundingClientRect(),u=new AbortController,p=e.combinedSignal(u),f=g=>{u.abort(),v(this,qe,eg).call(this,e,g)};window.addEventListener("blur",f,{signal:p}),window.addEventListener("pointerup",f,{signal:p}),window.addEventListener("pointerdown",g=>{g.preventDefault(),g.stopPropagation()},{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",Ye,{signal:p}),i.addEventListener("pointermove",v(this,qe,tg).bind(this,e),{signal:p}),this._freeHighlight=new ed({x:n,y:r},[a,c,l,h],e.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static async deserialize(e,s,i){var m,_,y,x;let n=null;if(e instanceof Ef){const{data:{quadPoints:w,rect:k,rotation:S,id:C,color:E,opacity:T,popupRef:q},parent:{page:{pageNumber:j}}}=e;n=e={annotationType:et.HIGHLIGHT,color:Array.from(E),opacity:T,quadPoints:w,boxes:null,pageIndex:j-1,rect:k.slice(0),rotation:S,id:C,deleted:!1,popupRef:q}}else if(e instanceof $d){const{data:{inkLists:w,rect:k,rotation:S,id:C,color:E,borderStyle:{rawWidth:T},popupRef:q},parent:{page:{pageNumber:j}}}=e;n=e={annotationType:et.HIGHLIGHT,color:Array.from(E),thickness:T,inkLists:w,boxes:null,pageIndex:j-1,rect:k.slice(0),rotation:S,id:C,deleted:!1,popupRef:q}}const{color:r,quadPoints:a,inkLists:c,opacity:l}=e,h=await super.deserialize(e,s,i);h.color=G.makeHexColor(...r),b(h,Zs,l||1),c&&b(h,je,e.thickness),h.annotationElementId=e.id||null,h._initialData=n;const[u,p]=h.pageDimensions,[f,g]=h.pageTranslation;if(a){const w=b(h,Js,[]);for(let k=0;k<a.length;k+=8)w.push({x:(a[k]-f)/u,y:1-(a[k+1]-g)/p,width:(a[k+2]-a[k])/u,height:(a[k+1]-a[k+5])/p});v(m=h,tt,ad).call(m),v(_=h,tt,tn).call(_),h.rotate(h.rotation)}else if(c){b(h,_e,!0);const w=c[0],k={x:w[0]-f,y:p-(w[1]-g)},S=new ed(k,[0,0,u,p],1,o(h,je)/2,!0,.001);for(let T=0,q=w.length;T<q;T+=2)k.x=w[T]-f,k.y=p-(w[T+1]-g),S.add(k);const{id:C,clipPathId:E}=s.drawLayer.draw(S,h.color,h._defaultOpacity,!0);v(y=h,tt,Xl).call(y,{highlightOutlines:S.getOutlines(),highlightId:C,clipPathId:E}),v(x=h,tt,tn).call(x)}return h}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const s=this.getRect(0,0),i=gt._colorManager.convert(this.color),n={annotationType:et.HIGHLIGHT,color:i,opacity:o(this,Zs),thickness:o(this,je),quadPoints:v(this,tt,Jf).call(this),outlines:v(this,tt,Zf).call(this,s),pageIndex:this.pageIndex,rect:s,rotation:v(this,tt,Hr).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!v(this,tt,sg).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};pr=new WeakMap,cl=new WeakMap,Js=new WeakMap,Wn=new WeakMap,fr=new WeakMap,ze=new WeakMap,hl=new WeakMap,dl=new WeakMap,Yn=new WeakMap,cs=new WeakMap,ae=new WeakMap,_e=new WeakMap,gr=new WeakMap,Zs=new WeakMap,Ht=new WeakMap,mr=new WeakMap,je=new WeakMap,ul=new WeakMap,tt=new WeakSet,ad=function(){const e=new Lu(o(this,Js),.001);b(this,cs,e.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=o(this,cs).box;const s=new Lu(o(this,Js),.0025,.001,this._uiManager.direction==="ltr");b(this,ze,s.getOutlines());const{lastPoint:i}=o(this,ze).box;b(this,gr,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},Xl=function({highlightOutlines:e,highlightId:s,clipPathId:i}){var h,u;if(b(this,cs,e),b(this,ze,e.getNewOutline(o(this,je)/2+1.5,.0025)),s>=0)b(this,ae,s),b(this,Wn,i),this.parent.drawLayer.finalizeLine(s,e),b(this,Ht,this.parent.drawLayer.drawOutline(o(this,ze)));else if(this.parent){const p=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(o(this,ae),e),this.parent.drawLayer.updateBox(o(this,ae),v(h=ht,qe,Aa).call(h,o(this,cs).box,(p-this.rotation+360)%360)),this.parent.drawLayer.updateLine(o(this,Ht),o(this,ze)),this.parent.drawLayer.updateBox(o(this,Ht),v(u=ht,qe,Aa).call(u,o(this,ze).box,p))}const{x:n,y:r,width:a,height:c}=e.box;switch(this.rotation){case 0:this.x=n,this.y=r,this.width=a,this.height=c;break;case 90:{const[p,f]=this.parentDimensions;this.x=r,this.y=1-n,this.width=a*f/p,this.height=c*p/f;break}case 180:this.x=1-n,this.y=1-r,this.width=a,this.height=c;break;case 270:{const[p,f]=this.parentDimensions;this.x=1-r,this.y=n,this.width=a*f/p,this.height=c*p/f;break}}const{lastPoint:l}=o(this,ze).box;b(this,gr,[(l[0]-n)/a,(l[1]-r)/c])},Xf=function(e){const s=(r,a)=>{var c,l,h;this.color=r,(c=this.parent)==null||c.drawLayer.changeColor(o(this,ae),r),(l=o(this,fr))==null||l.updateColor(r),b(this,Zs,a),(h=this.parent)==null||h.drawLayer.changeOpacity(o(this,ae),a)},i=this.color,n=o(this,Zs);this.addCommands({cmd:s.bind(this,e,ht._defaultOpacity),undo:s.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Q.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},$f=function(e){const s=o(this,je),i=n=>{b(this,je,n),v(this,tt,Kf).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:Q.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Kf=function(e){if(!o(this,_e))return;v(this,tt,Xl).call(this,{highlightOutlines:o(this,cs).getNewOutline(e/2)}),this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)},rd=function(){o(this,ae)!==null&&this.parent&&(this.parent.drawLayer.remove(o(this,ae)),b(this,ae,null),this.parent.drawLayer.remove(o(this,Ht)),b(this,Ht,null))},tn=function(e=this.parent){o(this,ae)===null&&({id:ce(this,ae)._,clipPathId:ce(this,Wn)._}=e.drawLayer.draw(o(this,cs),this.color,o(this,Zs)),b(this,Ht,e.drawLayer.drawOutline(o(this,ze))),o(this,Yn)&&(o(this,Yn).style.clipPath=o(this,Wn)))},qe=new WeakSet,Aa=function({x:e,y:s,width:i,height:n},r){switch(r){case 90:return{x:1-s-n,y:e,width:n,height:i};case 180:return{x:1-e-i,y:1-s-n,width:i,height:n};case 270:return{x:s,y:1-e-i,width:n,height:i}}return{x:e,y:s,width:i,height:n}},Qf=function(e){ht._keyboardManager.exec(this,e)},$l=function(e){if(!o(this,pr))return;const s=window.getSelection();e?s.setPosition(o(this,pr),o(this,cl)):s.setPosition(o(this,hl),o(this,dl))},Hr=function(){return o(this,_e)?this.rotation:0},Jf=function(){if(o(this,_e))return null;const[e,s]=this.pageDimensions,[i,n]=this.pageTranslation,r=o(this,Js),a=new Float32Array(8*r.length);let c=0;for(const{x:l,y:h,width:u,height:p}of r){const f=l*e+i,g=(1-h-p)*s+n;a[c]=a[c+4]=f,a[c+1]=a[c+3]=g,a[c+2]=a[c+6]=f+u*e,a[c+5]=a[c+7]=g+p*s,c+=8}return a},Zf=function(e){return o(this,cs).serialize(e,v(this,tt,Hr).call(this))},tg=function(e,s){this._freeHighlight.add(s)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},eg=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=""},sg=function(e){const{color:s}=this._initialData;return e.color.some((i,n)=>i!==s[n])},A(ht,qe),O(ht,"_defaultColor",null),O(ht,"_defaultOpacity",1),O(ht,"_defaultThickness",12),O(ht,"_type","highlight"),O(ht,"_editorType",et.HIGHLIGHT),O(ht,"_freeHighlightId",-1),O(ht,"_freeHighlight",null),O(ht,"_freeHighlightClipId","");let fc=ht;var Xn,$n,Ss,ti,He,Kn,Qn,Jn,ei,br,Zn,ta,ji,L,ig,ng,ag,rg,ld,og,cd,lg,cg,hg,dg,ug,en,hd,dd,ud,Kl,Ql,_a,pd,Jl,pi,pg,fd,fg,gg,gd,Zl,Ur;const Ct=class Ct extends gt{constructor(e){super({...e,name:"inkEditor"});A(this,L);A(this,Xn,0);A(this,$n,0);A(this,Ss,null);A(this,ti,new Path2D);A(this,He,!1);A(this,Kn,null);A(this,Qn,!1);A(this,Jn,!1);A(this,ei,null);A(this,br,null);A(this,Zn,0);A(this,ta,0);A(this,ji,null);this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e,s){gt.initialize(e,s)}static updateDefaultParams(e,s){switch(e){case Q.INK_THICKNESS:Ct._defaultThickness=s;break;case Q.INK_COLOR:Ct._defaultColor=s;break;case Q.INK_OPACITY:Ct._defaultOpacity=s/100}}updateParams(e,s){switch(e){case Q.INK_THICKNESS:v(this,L,ig).call(this,s);break;case Q.INK_COLOR:v(this,L,ng).call(this,s);break;case Q.INK_OPACITY:v(this,L,ag).call(this,s)}}static get defaultPropertiesToUpdate(){return[[Q.INK_THICKNESS,Ct._defaultThickness],[Q.INK_COLOR,Ct._defaultColor||gt._defaultLineColor],[Q.INK_OPACITY,Math.round(100*Ct._defaultOpacity)]]}get propertiesToUpdate(){return[[Q.INK_THICKNESS,this.thickness||Ct._defaultThickness],[Q.INK_COLOR,this.color||Ct._defaultColor||gt._defaultLineColor],[Q.INK_OPACITY,Math.round(100*(this.opacity??Ct._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(v(this,L,Kl).call(this),v(this,L,Ql).call(this)),this.isAttachedToDOM||(this.parent.add(this),v(this,L,_a).call(this)),v(this,L,Ur).call(this)))}remove(){var e;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,o(this,Ss)&&(clearTimeout(o(this,Ss)),b(this,Ss,null)),(e=o(this,ei))==null||e.disconnect(),b(this,ei,null),super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,s]=this.parentDimensions,i=this.width*e,n=this.height*s;this.setDimensions(i,n)}enableEditMode(){!o(this,He)&&this.canvas!==null&&(super.enableEditMode(),this._isDraggable=!1,v(this,L,hd).call(this))}disableEditMode(){this.isInEditMode()&&this.canvas!==null&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),v(this,L,dd).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){o(this,He)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),b(this,He,!0),this.div.classList.add("disabled"),v(this,L,Ur).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button===0&&this.isInEditMode()&&!o(this,He)&&(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),v(this,L,og).call(this,e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),v(this,L,cd).call(this,e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),v(this,L,ud).call(this,e)}canvasPointerleave(e){v(this,L,ud).call(this,e)}get isResizable(){return!this.isEmpty()&&o(this,He)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,n,r,a]=v(this,L,rg).call(this);if(this.setAt(i,n,0,0),this.setDims(r,a),v(this,L,Kl).call(this),this.width){const[c,l]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*l),this.setAt(e*c,s*l,this.width*c,this.height*l),b(this,Jn,!0),v(this,L,_a).call(this),this.setDims(this.width*c,this.height*l),v(this,L,en).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return v(this,L,Ql).call(this),this.div}setDimensions(e,s){const i=Math.round(e),n=Math.round(s);if(o(this,Zn)===i&&o(this,ta)===n)return;b(this,Zn,i),b(this,ta,n),this.canvas.style.visibility="hidden";const[r,a]=this.parentDimensions;this.width=e/r,this.height=s/a,this.fixAndSetPosition(),o(this,He)&&v(this,L,pd).call(this,e,s),v(this,L,_a).call(this),v(this,L,en).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(e,s,i){var _,y,x;if(e instanceof $d)return null;const n=await super.deserialize(e,s,i);n.thickness=e.thickness,n.color=G.makeHexColor(...e.color),n.opacity=e.opacity;const[r,a]=n.pageDimensions,c=n.width*r,l=n.height*a,h=n.parentScale,u=e.thickness/2;b(n,He,!0),b(n,Zn,Math.round(c)),b(n,ta,Math.round(l));const{paths:p,rect:f,rotation:g}=e;for(let{bezier:w}of p){w=v(_=Ct,pi,fg).call(_,w,f,g);const k=[];n.paths.push(k);let S=h*(w[0]-u),C=h*(w[1]-u);for(let T=2,q=w.length;T<q;T+=6){const j=h*(w[T]-u),H=h*(w[T+1]-u),Z=h*(w[T+2]-u),$=h*(w[T+3]-u),W=h*(w[T+4]-u),mt=h*(w[T+5]-u);k.push([[S,C],[j,H],[Z,$],[W,mt]]),S=W,C=mt}const E=v(this,pi,pg).call(this,k);n.bezierPath2D.push(E)}const m=v(y=n,L,gd).call(y);return b(n,$n,Math.max(gt.MIN_SIZE,m[2]-m[0])),b(n,Xn,Math.max(gt.MIN_SIZE,m[3]-m[1])),v(x=n,L,pd).call(x,c,l),n}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),s=gt._colorManager.convert(this.ctx.strokeStyle);return{annotationType:et.INK,color:s,thickness:this.thickness,opacity:this.opacity,paths:v(this,L,gg).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};Xn=new WeakMap,$n=new WeakMap,Ss=new WeakMap,ti=new WeakMap,He=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,ei=new WeakMap,br=new WeakMap,Zn=new WeakMap,ta=new WeakMap,ji=new WeakMap,L=new WeakSet,ig=function(e){const s=n=>{this.thickness=n,v(this,L,Ur).call(this)},i=this.thickness;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Q.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},ng=function(e){const s=n=>{this.color=n,v(this,L,en).call(this)},i=this.color;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Q.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},ag=function(e){const s=n=>{this.opacity=n,v(this,L,en).call(this)};e/=100;const i=this.opacity;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Q.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},rg=function(){const{parentRotation:e,parentDimensions:[s,i]}=this;switch(e){case 90:return[0,i,i,s];case 180:return[s,i,s,i];case 270:return[s,0,i,s];default:return[0,0,s,i]}},ld=function(){const{ctx:e,color:s,opacity:i,thickness:n,parentScale:r,scaleFactor:a}=this;e.lineWidth=n*r/a,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${s}${function(l){return Math.round(Math.min(255,Math.max(1,255*l))).toString(16).padStart(2,"0")}(i)}`},og=function(e,s){this.canvas.addEventListener("contextmenu",Ye,{signal:this._uiManager._signal}),v(this,L,dd).call(this),b(this,Kn,new AbortController);const i=this._uiManager.combinedSignal(o(this,Kn));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,o(this,Jn)||(b(this,Jn,!0),v(this,L,_a).call(this),this.thickness||(this.thickness=Ct._defaultThickness),this.color||(this.color=Ct._defaultColor||gt._defaultLineColor),this.opacity??(this.opacity=Ct._defaultOpacity)),this.currentPath.push([e,s]),b(this,Qn,!1),v(this,L,ld).call(this),b(this,ji,()=>{v(this,L,hg).call(this),o(this,ji)&&window.requestAnimationFrame(o(this,ji))}),window.requestAnimationFrame(o(this,ji))},cd=function(e,s){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&s===n)return;const r=this.currentPath;let a=o(this,ti);r.push([e,s]),b(this,Qn,!0),r.length<=2?(a.moveTo(...r[0]),a.lineTo(e,s)):(r.length===3&&(b(this,ti,a=new Path2D),a.moveTo(...r[0])),v(this,L,dg).call(this,a,...r.at(-3),...r.at(-2),e,s))},lg=function(){if(this.currentPath.length===0)return;const e=this.currentPath.at(-1);o(this,ti).lineTo(...e)},cg=function(e,s){b(this,ji,null),e=Math.min(Math.max(e,0),this.canvas.width),s=Math.min(Math.max(s,0),this.canvas.height),v(this,L,cd).call(this,e,s),v(this,L,lg).call(this);let i;if(this.currentPath.length!==1)i=v(this,L,ug).call(this);else{const a=[e,s];i=[[a,a.slice(),a.slice(),a]]}const n=o(this,ti),r=this.currentPath;this.currentPath=[],b(this,ti,new Path2D),this.addCommands({cmd:()=>{this.allRawPaths.push(r),this.paths.push(i),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(v(this,L,Kl).call(this),v(this,L,Ql).call(this)),v(this,L,Ur).call(this))},mustExec:!0})},hg=function(){if(!o(this,Qn))return;b(this,Qn,!1),Math.ceil(this.thickness*this.parentScale);const e=this.currentPath.slice(-3),s=e.map(r=>r[0]),i=e.map(r=>r[1]),{ctx:n}=(Math.min(...s),Math.max(...s),Math.min(...i),Math.max(...i),this);n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const r of this.bezierPath2D)n.stroke(r);n.stroke(o(this,ti)),n.restore()},dg=function(e,s,i,n,r,a,c){const l=(s+n)/2,h=(i+r)/2,u=(n+a)/2,p=(r+c)/2;e.bezierCurveTo(l+2*(n-l)/3,h+2*(r-h)/3,u+2*(n-u)/3,p+2*(r-p)/3,u,p)},ug=function(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const s=[];let i,[n,r]=e[0];for(i=1;i<e.length-2;i++){const[f,g]=e[i],[m,_]=e[i+1],y=(f+m)/2,x=(g+_)/2,w=[n+2*(f-n)/3,r+2*(g-r)/3],k=[y+2*(f-y)/3,x+2*(g-x)/3];s.push([[n,r],w,k,[y,x]]),[n,r]=[y,x]}const[a,c]=e[i],[l,h]=e[i+1],u=[n+2*(a-n)/3,r+2*(c-r)/3],p=[l+2*(a-l)/3,h+2*(c-h)/3];return s.push([[n,r],u,p,[l,h]]),s},en=function(){if(this.isEmpty()){v(this,L,Jl).call(this);return}v(this,L,ld).call(this);const{canvas:e,ctx:s}=this;s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,e.width,e.height),v(this,L,Jl).call(this);for(const i of this.bezierPath2D)s.stroke(i)},hd=function(){if(o(this,br))return;b(this,br,new AbortController);const e=this._uiManager.combinedSignal(o(this,br));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:e})},dd=function(){var e;(e=this.pointerdownAC)==null||e.abort(),this.pointerdownAC=null},ud=function(e){var s;(s=o(this,Kn))==null||s.abort(),b(this,Kn,null),v(this,L,hd).call(this),o(this,Ss)&&clearTimeout(o(this,Ss)),b(this,Ss,setTimeout(()=>{b(this,Ss,null),this.canvas.removeEventListener("contextmenu",Ye)},10)),v(this,L,cg).call(this,e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()},Kl=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Ql=function(){b(this,ei,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&this.setDimensions(s.width,s.height)})),o(this,ei).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=o(this,ei))==null||e.disconnect(),b(this,ei,null)},{once:!0})},_a=function(){if(!o(this,Jn))return;const[e,s]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*s),v(this,L,Jl).call(this)},pd=function(e,s){const i=v(this,L,Zl).call(this),n=(e-i)/o(this,$n),r=(s-i)/o(this,Xn);this.scaleFactor=Math.min(n,r)},Jl=function(){const e=v(this,L,Zl).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)},pi=new WeakSet,pg=function(e){const s=new Path2D;for(let i=0,n=e.length;i<n;i++){const[r,a,c,l]=e[i];i===0&&s.moveTo(...r),s.bezierCurveTo(a[0],a[1],c[0],c[1],l[0],l[1])}return s},fd=function(e,s,i){const[n,r,a,c]=s;switch(i){case 0:for(let l=0,h=e.length;l<h;l+=2)e[l]+=n,e[l+1]=c-e[l+1];break;case 90:for(let l=0,h=e.length;l<h;l+=2){const u=e[l];e[l]=e[l+1]+n,e[l+1]=u+r}break;case 180:for(let l=0,h=e.length;l<h;l+=2)e[l]=a-e[l],e[l+1]+=r;break;case 270:for(let l=0,h=e.length;l<h;l+=2){const u=e[l];e[l]=a-e[l+1],e[l+1]=c-u}break;default:throw new Error("Invalid rotation")}return e},fg=function(e,s,i){const[n,r,a,c]=s;switch(i){case 0:for(let l=0,h=e.length;l<h;l+=2)e[l]-=n,e[l+1]=c-e[l+1];break;case 90:for(let l=0,h=e.length;l<h;l+=2){const u=e[l];e[l]=e[l+1]-r,e[l+1]=u-n}break;case 180:for(let l=0,h=e.length;l<h;l+=2)e[l]=a-e[l],e[l+1]-=r;break;case 270:for(let l=0,h=e.length;l<h;l+=2){const u=e[l];e[l]=c-e[l+1],e[l+1]=a-u}break;default:throw new Error("Invalid rotation")}return e},gg=function(e,s,i,n){var h,u;const r=[],a=this.thickness/2,c=e*s+a,l=e*i+a;for(const p of this.paths){const f=[],g=[];for(let m=0,_=p.length;m<_;m++){const[y,x,w,k]=p[m];if(y[0]===k[0]&&y[1]===k[1]&&_===1){const $=e*y[0]+c,W=e*y[1]+l;f.push($,W),g.push($,W);break}const S=e*y[0]+c,C=e*y[1]+l,E=e*x[0]+c,T=e*x[1]+l,q=e*w[0]+c,j=e*w[1]+l,H=e*k[0]+c,Z=e*k[1]+l;m===0&&(f.push(S,C),g.push(S,C)),f.push(E,T,q,j,H,Z),g.push(E,T),m===_-1&&g.push(H,Z)}r.push({bezier:v(h=Ct,pi,fd).call(h,f,n,this.rotation),points:v(u=Ct,pi,fd).call(u,g,n,this.rotation)})}return r},gd=function(){let e=1/0,s=-1/0,i=1/0,n=-1/0;for(const r of this.paths)for(const[a,c,l,h]of r){const u=G.bezierBoundingBox(...a,...c,...l,...h);e=Math.min(e,u[0]),i=Math.min(i,u[1]),s=Math.max(s,u[2]),n=Math.max(n,u[3])}return[e,i,s,n]},Zl=function(){return o(this,He)?Math.ceil(this.thickness*this.parentScale):0},Ur=function(e=!1){if(this.isEmpty())return;if(!o(this,He)){v(this,L,en).call(this);return}const s=v(this,L,gd).call(this),i=v(this,L,Zl).call(this);b(this,$n,Math.max(gt.MIN_SIZE,s[2]-s[0])),b(this,Xn,Math.max(gt.MIN_SIZE,s[3]-s[1]));const n=Math.ceil(i+o(this,$n)*this.scaleFactor),r=Math.ceil(i+o(this,Xn)*this.scaleFactor),[a,c]=this.parentDimensions;this.width=n/a,this.height=r/c,this.setAspectRatio(n,r);const l=this.translationX,h=this.translationY;this.translationX=-s[0],this.translationY=-s[1],v(this,L,_a).call(this),v(this,L,en).call(this),b(this,Zn,n),b(this,ta,r),this.setDims(n,r);const u=e?i/this.scaleFactor/2:0;this.translate(l-this.translationX-u,h-this.translationY-u)},A(Ct,pi),O(Ct,"_defaultColor",null),O(Ct,"_defaultOpacity",1),O(Ct,"_defaultThickness",1),O(Ct,"_type","ink"),O(Ct,"_editorType",et.INK);let od=Ct;var Tt,Zt,Hi,si,Ui,vr,Cs,ii,Es,Ie,Ar,ot,qr,Gr,tc,bd,mg,ec,vd,sc,bg,vg;const $r=class $r extends gt{constructor(e){super({...e,name:"stampEditor"});A(this,ot);A(this,Tt,null);A(this,Zt,null);A(this,Hi,null);A(this,si,null);A(this,Ui,null);A(this,vr,"");A(this,Cs,null);A(this,ii,null);A(this,Es,null);A(this,Ie,!1);A(this,Ar,!1);b(this,si,e.bitmapUrl),b(this,Ui,e.bitmapFile)}static initialize(e,s){gt.initialize(e,s)}static get supportedTypes(){return lt(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(e=>`image/${e}`))}static get supportedTypesStr(){return lt(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,s){s.pasteEditor(et.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:r,height:a}=e||this.copyCanvas(null,null,!0).imageData,c=await i.guess({name:"altText",request:{data:n,width:r,height:a,channels:n.length/(r*a)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const l=c.output;return await this.setGuessedAltText(l),s&&!this.hasAltTextData()&&(this.altTextData={alt:l,decorative:!1}),l}remove(){var e,s;o(this,Zt)&&(b(this,Tt,null),this._uiManager.imageManager.deleteId(o(this,Zt)),(e=o(this,Cs))==null||e.remove(),b(this,Cs,null),(s=o(this,ii))==null||s.disconnect(),b(this,ii,null),o(this,Es)&&(clearTimeout(o(this,Es)),b(this,Es,null))),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(o(this,Zt)&&o(this,Cs)===null&&v(this,ot,tc).call(this),this.isAttachedToDOM||this.parent.add(this))):o(this,Zt)&&v(this,ot,tc).call(this)}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(o(this,Hi)||o(this,Tt)||o(this,si)||o(this,Ui)||o(this,Zt))}get isResizable(){return!0}render(){if(this.div)return this.div;let e,s;if(this.width&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),o(this,Tt)?v(this,ot,bd).call(this):v(this,ot,tc).call(this),this.width&&!this.annotationElementId){const[i,n]=this.parentDimensions;this.setAt(e*i,s*n,this.width*i,this.height*n)}return this.div}copyCanvas(e,s,i=!1){var f;e||(e=224);const{width:n,height:r}=o(this,Tt),a=new ph;let c=o(this,Tt),l=n,h=r,u=null;if(s){if(n>s||r>s){const T=Math.min(s/n,s/r);l=Math.floor(n*T),h=Math.floor(r*T)}u=document.createElement("canvas");const g=u.width=Math.ceil(l*a.sx),m=u.height=Math.ceil(h*a.sy);o(this,Ie)||(c=v(this,ot,ec).call(this,g,m));const _=u.getContext("2d");_.filter=this._uiManager.hcmFilter;let y="white",x="#cfcfd8";this._uiManager.hcmFilter!=="none"?x="black":(f=window.matchMedia)!=null&&f.call(window,"(prefers-color-scheme: dark)").matches&&(y="#8f8f9d",x="#42414d");const w=15,k=w*a.sx,S=w*a.sy,C=new OffscreenCanvas(2*k,2*S),E=C.getContext("2d");E.fillStyle=y,E.fillRect(0,0,2*k,2*S),E.fillStyle=x,E.fillRect(0,0,k,S),E.fillRect(k,S,k,S),_.fillStyle=_.createPattern(C,"repeat"),_.fillRect(0,0,g,m),_.drawImage(c,0,0,c.width,c.height,0,0,g,m)}let p=null;if(i){let g,m;if(a.symmetric&&c.width<e&&c.height<e)g=c.width,m=c.height;else if(c=o(this,Tt),n>e||r>e){const y=Math.min(e/n,e/r);g=Math.floor(n*y),m=Math.floor(r*y),o(this,Ie)||(c=v(this,ot,ec).call(this,g,m))}const _=new OffscreenCanvas(g,m).getContext("2d",{willReadFrequently:!0});_.drawImage(c,0,0,c.width,c.height,0,0,g,m),p={width:g,height:m,data:_.getImageData(0,0,g,m).data}}return{canvas:u,width:l,height:h,imageData:p}}getImageForAltText(){return o(this,Cs)}static async deserialize(e,s,i){var m;let n=null;if(e instanceof Tf){const{data:{rect:_,rotation:y,id:x,structParent:w,popupRef:k},container:S,parent:{page:{pageNumber:C}}}=e,E=S.querySelector("canvas"),T=i.imageManager.getFromCanvas(S.id,E);E.remove();const q=((m=await s._structTree.getAriaAttributes(`${Bd}${x}`))==null?void 0:m.get("aria-label"))||"";n=e={annotationType:et.STAMP,bitmapId:T.id,bitmap:T.bitmap,pageIndex:C-1,rect:_.slice(0),rotation:y,id:x,deleted:!1,accessibilityData:{decorative:!1,altText:q},isSvg:!1,structParent:w,popupRef:k}}const r=await super.deserialize(e,s,i),{rect:a,bitmap:c,bitmapUrl:l,bitmapId:h,isSvg:u,accessibilityData:p}=e;h&&i.imageManager.isValidId(h)?(b(r,Zt,h),c&&b(r,Tt,c)):b(r,si,l),b(r,Ie,u);const[f,g]=r.pageDimensions;return r.width=(a[2]-a[0])/f,r.height=(a[3]-a[1])/g,r.annotationElementId=e.id||null,p&&(r.altTextData=p),r._initialData=n,b(r,Ar,!!n),r}serialize(e=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:et.STAMP,bitmapId:o(this,Zt),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:o(this,Ie),structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=v(this,ot,sc).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i;const{decorative:n,altText:r}=this.serializeAltText(!1);if(!n&&r&&(i.accessibilityData={type:"Figure",alt:r}),this.annotationElementId){const c=v(this,ot,vg).call(this,i);if(c.isSame)return null;c.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 a=o(this,Ie)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(s.stamps.has(o(this,Zt))){if(o(this,Ie)){const c=s.stamps.get(o(this,Zt));a>c.area&&(c.area=a,c.serialized.bitmap.close(),c.serialized.bitmap=v(this,ot,sc).call(this,!1))}}else s.stamps.set(o(this,Zt),{area:a,serialized:i}),i.bitmap=v(this,ot,sc).call(this,!1);return i}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}};Tt=new WeakMap,Zt=new WeakMap,Hi=new WeakMap,si=new WeakMap,Ui=new WeakMap,vr=new WeakMap,Cs=new WeakMap,ii=new WeakMap,Es=new WeakMap,Ie=new WeakMap,Ar=new WeakMap,ot=new WeakSet,qr=function(e,s=!1){e?(b(this,Tt,e.bitmap),s||(b(this,Zt,e.id),b(this,Ie,e.isSvg)),e.file&&b(this,vr,e.file.name),v(this,ot,bd).call(this)):this.remove()},Gr=function(){if(b(this,Hi,null),this._uiManager.enableWaiting(!1),o(this,Cs))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&o(this,Tt))this._editToolbar.hide(),this._uiManager.editAltText(this,!0);else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&o(this,Tt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},tc=function(){if(o(this,Zt)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(o(this,Zt)).then(i=>v(this,ot,qr).call(this,i,!0)).finally(()=>v(this,ot,Gr).call(this));return}if(o(this,si)){const i=o(this,si);b(this,si,null),this._uiManager.enableWaiting(!0),b(this,Hi,this._uiManager.imageManager.getFromUrl(i).then(n=>v(this,ot,qr).call(this,n)).finally(()=>v(this,ot,Gr).call(this)));return}if(o(this,Ui)){const i=o(this,Ui);b(this,Ui,null),this._uiManager.enableWaiting(!0),b(this,Hi,this._uiManager.imageManager.getFromFile(i).then(n=>v(this,ot,qr).call(this,n)).finally(()=>v(this,ot,Gr).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=$r.supportedTypesStr;const s=this._uiManager._signal;b(this,Hi,new Promise(i=>{e.addEventListener("change",async()=>{if(e.files&&e.files.length!==0){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}}),v(this,ot,qr).call(this,n)}else this.remove();i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>v(this,ot,Gr).call(this))),e.click()},bd=function(){const{div:e}=this;let{width:s,height:i}=o(this,Tt);const[n,r]=this.pageDimensions,a=.75;if(this.width)s=this.width*n,i=this.height*r;else if(s>a*n||i>a*r){const u=Math.min(a*n/s,a*r/i);s*=u,i*=u}const[c,l]=this.parentDimensions;this.setDims(s*c/n,i*l/r),this._uiManager.enableWaiting(!1);const h=b(this,Cs,document.createElement("canvas"));h.setAttribute("role","img"),this.addContainer(h),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),v(this,ot,vd).call(this,s,i),v(this,ot,bg).call(this),o(this,Ar)||(this.parent.addUndoableEditor(this),b(this,Ar,!0)),this._reportTelemetry({action:"inserted_image"}),o(this,vr)&&h.setAttribute("aria-label",o(this,vr))},mg=function(e,s){var r;const[i,n]=this.parentDimensions;this.width=e/i,this.height=s/n,(r=this._initialOptions)!=null&&r.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,o(this,Es)!==null&&clearTimeout(o(this,Es)),b(this,Es,setTimeout(()=>{b(this,Es,null),v(this,ot,vd).call(this,e,s)},200))},ec=function(e,s){const{width:i,height:n}=o(this,Tt);let r=i,a=n,c=o(this,Tt);for(;r>2*e||a>2*s;){const l=r,h=a;r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2)),a>2*s&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const u=new OffscreenCanvas(r,a);u.getContext("2d").drawImage(c,0,0,l,h,0,0,r,a),c=u.transferToImageBitmap()}return c},vd=function(e,s){const i=new ph,n=Math.ceil(e*i.sx),r=Math.ceil(s*i.sy),a=o(this,Cs);if(!a||a.width===n&&a.height===r)return;a.width=n,a.height=r;const c=o(this,Ie)?o(this,Tt):v(this,ot,ec).call(this,n,r),l=a.getContext("2d");l.filter=this._uiManager.hcmFilter,l.drawImage(c,0,0,c.width,c.height,0,0,n,r)},sc=function(e){if(e){if(o(this,Ie)){const i=this._uiManager.imageManager.getSvgUrl(o(this,Zt));if(i)return i}const s=document.createElement("canvas");return{width:s.width,height:s.height}=o(this,Tt),s.getContext("2d").drawImage(o(this,Tt),0,0),s.toDataURL()}if(o(this,Ie)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*Yi.PDF_TO_CSS_UNITS),r=Math.round(this.height*i*Yi.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(n,r);return a.getContext("2d").drawImage(o(this,Tt),0,0,o(this,Tt).width,o(this,Tt).height,0,0,n,r),a.transferToImageBitmap()}return structuredClone(o(this,Tt))},bg=function(){this._uiManager._signal&&(b(this,ii,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&v(this,ot,mg).call(this,s.width,s.height)})),o(this,ii).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=o(this,ii))==null||e.disconnect(),b(this,ii,null)},{once:!0}))},vg=function(e){var l;const{rect:s,pageIndex:i,accessibilityData:{altText:n}}=this._initialData,r=e.rect.every((h,u)=>Math.abs(h-s[u])<1),a=e.pageIndex===i,c=(((l=e.accessibilityData)==null?void 0:l.alt)||"")===n;return{isSame:r&&a&&c,isSameAltText:c}},O($r,"_type","stamp"),O($r,"_editorType",et.STAMP);let md=$r;var ea,_r,Ts,qi,ni,Fe,Gi,yr,wr,re,ai,V,Vi,te,Ag,_d,yd,wd,ic;const $e=class $e{constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:r,drawLayer:a,textLayer:c,viewport:l,l10n:h}){A(this,te);A(this,ea);A(this,_r,!1);A(this,Ts,null);A(this,qi,null);A(this,ni,null);A(this,Fe,new Map);A(this,Gi,!1);A(this,yr,!1);A(this,wr,!1);A(this,re,null);A(this,ai,null);A(this,V);const u=[...o($e,Vi).values()];if(!$e._initialized){$e._initialized=!0;for(const p of u)p.initialize(h,t)}t.registerEditorTypes(u),b(this,V,t),this.pageIndex=e,this.div=s,b(this,ea,n),b(this,Ts,r),this.viewport=l,b(this,re,c),this.drawLayer=a,this._structTree=i,o(this,V).addLayer(this)}get isEmpty(){return o(this,Fe).size===0}get isInvisible(){return this.isEmpty&&o(this,V).getMode()===et.NONE}updateToolbar(t){o(this,V).updateToolbar(t)}updateMode(t=o(this,V).getMode()){switch(v(this,te,ic).call(this),t){case et.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case et.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case et.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 o($e,Vi).values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=o(this,re))==null?void 0:e.div)}addInkEditorIfNeeded(t){if(o(this,V).getMode()===et.INK){if(!t){for(const e of o(this,Fe).values())if(e.isEmpty()){e.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){o(this,V).setEditingState(t)}addCommands(t){o(this,V).addCommands(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=o(this,Ts))==null||e.div.classList.toggle("disabled",!t)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const s of o(this,Fe).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(o(this,V).removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!o(this,Ts))return;const e=o(this,Ts).getEditableAnnotations();for(const s of e){if(s.hide(),o(this,V).isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const i=await this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;b(this,wr,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of o(this,Fe).values())n.disableEditing(),n.annotationElementId&&(n.serialize()===null?(e.set(n.annotationElementId,n),(i=this.getEditableAnnotation(n.annotationElementId))==null||i.show(),n.remove()):t.set(n.annotationElementId,n));if(o(this,Ts)){const n=o(this,Ts).getEditableAnnotations();for(const r of n){const{id:a}=r.data;if(o(this,V).isDeletedAnnotationElement(a))continue;let c=e.get(a);c?(c.resetAnnotationElement(r),c.show(!1),r.show()):(c=t.get(a),c&&(o(this,V).addChangedExistingAnnotation(c),c.renderAnnotationElement(r)&&c.show(!1)),r.show())}}v(this,te,ic).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of o($e,Vi).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),b(this,wr,!1)}getEditableAnnotation(t){var e;return((e=o(this,Ts))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){o(this,V).getActive()!==t&&o(this,V).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=o(this,re))!=null&&t.div&&!o(this,ai)){b(this,ai,new AbortController);const e=o(this,V).combinedSignal(o(this,ai));o(this,re).div.addEventListener("pointerdown",v(this,te,Ag).bind(this),{signal:e}),o(this,re).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=o(this,re))!=null&&t.div&&o(this,ai)&&(o(this,ai).abort(),b(this,ai,null),o(this,re).div.classList.remove("highlighting"))}enableClick(){if(o(this,qi))return;b(this,qi,new AbortController);const t=o(this,V).combinedSignal(o(this,qi));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){var t;(t=o(this,qi))==null||t.abort(),b(this,qi,null)}attach(t){o(this,Fe).set(t.id,t);const{annotationElementId:e}=t;e&&o(this,V).isDeletedAnnotationElement(e)&&o(this,V).removeDeletedAnnotationElement(t)}detach(t){var e;o(this,Fe).delete(t.id),(e=o(this,ea))==null||e.removePointerInTextLayer(t.contentDiv),!o(this,wr)&&t.annotationElementId&&o(this,V).addDeletedAnnotationElement(t)}remove(t){this.detach(t),o(this,V).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,o(this,yr)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(o(this,V).addDeletedAnnotationElement(t.annotationElementId),gt.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),o(this,V).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),o(this,V).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!o(this,ni)&&(t._focusEventsAllowed=!1,b(this,ni,setTimeout(()=>{b(this,ni,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:o(this,V)._signal}),e.focus())},0))),t._structTreeParentId=(s=o(this,ea))==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){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return o(this,V).getId()}combinedSignal(t){return o(this,V).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=o(this,te,_d))==null?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){o(this,V).updateToolbar(t),o(this,V).updateMode(t);const{offsetX:s,offsetY:i}=v(this,te,wd).call(this),n=this.getNextId(),r=v(this,te,yd).call(this,{parent:this,id:n,x:s,y:i,uiManager:o(this,V),isCentered:!0,...e});r&&this.add(r)}async deserialize(t){var e;return await((e=o($e,Vi).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,o(this,V)))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=v(this,te,yd).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:o(this,V),isCentered:e,...s});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor(v(this,te,wd).call(this),!0)}setSelected(t){o(this,V).setSelected(t)}toggleSelected(t){o(this,V).toggleSelected(t)}unselect(t){o(this,V).unselect(t)}pointerup(t){const{isMac:e}=pe.platform;!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&o(this,Gi)&&(b(this,Gi,!1),o(this,_r)?o(this,V).getMode()!==et.STAMP?this.createAndAddNewEditor(t,!1):o(this,V).unselectAll():b(this,_r,!0))}pointerdown(t){if(o(this,V).getMode()===et.HIGHLIGHT&&this.enableTextSelection(),o(this,Gi)){b(this,Gi,!1);return}const{isMac:e}=pe.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;b(this,Gi,!0);const s=o(this,V).getActive();b(this,_r,!s||s.isEmpty())}findNewParent(t,e,s){const i=o(this,V).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}destroy(){var t,e;((t=o(this,V).getActive())==null?void 0:t.parent)===this&&(o(this,V).commitOrRemove(),o(this,V).setActiveEditor(null)),o(this,ni)&&(clearTimeout(o(this,ni)),b(this,ni,null));for(const s of o(this,Fe).values())(e=o(this,ea))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,o(this,Fe).clear(),o(this,V).removeLayer(this)}render({viewport:t}){this.viewport=t,ia(this.div,t);for(const e of o(this,V).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){o(this,V).commitOrRemove(),v(this,te,ic).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,ia(this.div,{rotation:s}),e!==s)for(const i of o(this,Fe).values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return o(this,V).viewParameters.realScale}};ea=new WeakMap,_r=new WeakMap,Ts=new WeakMap,qi=new WeakMap,ni=new WeakMap,Fe=new WeakMap,Gi=new WeakMap,yr=new WeakMap,wr=new WeakMap,re=new WeakMap,ai=new WeakMap,V=new WeakMap,Vi=new WeakMap,te=new WeakSet,Ag=function(t){o(this,V).unselectAll();const{target:e}=t;if(e===o(this,re).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&o(this,re).div.contains(e)){const{isMac:s}=pe.platform;if(t.button!==0||t.ctrlKey&&s)return;o(this,V).showAllEditors("highlight",!0,!0),o(this,re).div.classList.add("free"),this.toggleDrawing(),fc.startHighlighting(this,o(this,V).direction==="ltr",{target:o(this,re).div,x:t.x,y:t.y}),o(this,re).div.addEventListener("pointerup",()=>{o(this,re).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:o(this,V)._signal}),t.preventDefault()}},_d=function(){return o($e,Vi).get(o(this,V).getMode())},yd=function(t){const e=o(this,te,_d);return e?new e.prototype.constructor(t):null},wd=function(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),r=Math.max(0,e),a=(n+Math.min(window.innerWidth,t+s))/2-t,c=(r+Math.min(window.innerHeight,e+i))/2-e,[l,h]=this.viewport.rotation%180==0?[a,c]:[c,a];return{offsetX:l,offsetY:h}},ic=function(){b(this,yr,!0);for(const t of o(this,Fe).values())t.isEmpty()&&t.remove();b(this,yr,!1)},O($e,"_initialized",!1),A($e,Vi,new Map([Jh,od,md,fc].map(t=>[t._editorType,t])));let Ad=$e;var Rs,pl,Nt,ri,fl,kd,oa,Sd,_g;const Kt=class Kt{constructor({pageIndex:t}){A(this,oa);A(this,Rs,null);A(this,pl,0);A(this,Nt,new Map);A(this,ri,new Map);this.pageIndex=t}setParent(t){if(o(this,Rs)){if(o(this,Rs)!==t){if(o(this,Nt).size>0)for(const e of o(this,Nt).values())e.remove(),t.append(e);b(this,Rs,t)}}else b(this,Rs,t)}static get _svgFactory(){return lt(this,"_svgFactory",new Xd)}draw(t,e,s,i=!1){const n=ce(this,pl)._++,r=v(this,oa,Sd).call(this,t.box);r.classList.add(...t.classNamesForDrawing);const a=Kt._svgFactory.createElement("defs");r.append(a);const c=Kt._svgFactory.createElement("path");a.append(c);const l=`path_p${this.pageIndex}_${n}`;c.setAttribute("id",l),c.setAttribute("d",t.toSVGPath()),i&&o(this,ri).set(n,c);const h=v(this,oa,_g).call(this,a,l),u=Kt._svgFactory.createElement("use");return r.append(u),r.setAttribute("fill",e),r.setAttribute("fill-opacity",s),u.setAttribute("href",`#${l}`),o(this,Nt).set(n,r),{id:n,clipPathId:`url(#${h})`}}drawOutline(t){const e=ce(this,pl)._++,s=v(this,oa,Sd).call(this,t.box);s.classList.add(...t.classNamesForOutlining);const i=Kt._svgFactory.createElement("defs");s.append(i);const n=Kt._svgFactory.createElement("path");i.append(n);const r=`path_p${this.pageIndex}_${e}`;n.setAttribute("id",r),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let a;if(t.mustRemoveSelfIntersections){const h=Kt._svgFactory.createElement("mask");i.append(h),a=`mask_p${this.pageIndex}_${e}`,h.setAttribute("id",a),h.setAttribute("maskUnits","objectBoundingBox");const u=Kt._svgFactory.createElement("rect");h.append(u),u.setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","white");const p=Kt._svgFactory.createElement("use");h.append(p),p.setAttribute("href",`#${r}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const c=Kt._svgFactory.createElement("use");s.append(c),c.setAttribute("href",`#${r}`),a&&c.setAttribute("mask",`url(#${a})`);const l=c.cloneNode();return s.append(l),c.classList.add("mainOutline"),l.classList.add("secondaryOutline"),o(this,Nt).set(e,s),e}finalizeLine(t,e){const s=o(this,ri).get(t);o(this,ri).delete(t),this.updateBox(t,e.box),s.setAttribute("d",e.toSVGPath())}updateLine(t,e){o(this,Nt).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){o(this,ri).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){var s;v(s=Kt,fl,kd).call(s,o(this,Nt).get(t),e)}show(t,e){o(this,Nt).get(t).classList.toggle("hidden",!e)}rotate(t,e){o(this,Nt).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){o(this,Nt).get(t).setAttribute("fill",e)}changeOpacity(t,e){o(this,Nt).get(t).setAttribute("fill-opacity",e)}addClass(t,e){o(this,Nt).get(t).classList.add(e)}removeClass(t,e){o(this,Nt).get(t).classList.remove(e)}getSVGRoot(t){return o(this,Nt).get(t)}remove(t){o(this,ri).delete(t),o(this,Rs)!==null&&(o(this,Nt).get(t).remove(),o(this,Nt).delete(t))}destroy(){b(this,Rs,null);for(const t of o(this,Nt).values())t.remove();o(this,Nt).clear(),o(this,ri).clear()}};Rs=new WeakMap,pl=new WeakMap,Nt=new WeakMap,ri=new WeakMap,fl=new WeakSet,kd=function(t,{x:e=0,y:s=0,width:i=1,height:n=1}={}){const{style:r}=t;r.top=100*s+"%",r.left=100*e+"%",r.width=100*i+"%",r.height=100*n+"%"},oa=new WeakSet,Sd=function(t){var s;const e=Kt._svgFactory.create(1,1,!0);return o(this,Rs).append(e),e.setAttribute("aria-hidden",!0),v(s=Kt,fl,kd).call(s,e,t),e},_g=function(t,e){const s=Kt._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=Kt._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i},A(Kt,fl);let xd=Kt;var eA=J.AbortException,sA=J.AnnotationEditorLayer,iA=J.AnnotationEditorParamsType,nA=J.AnnotationEditorType,aA=J.AnnotationEditorUIManager,rA=J.AnnotationLayer,oA=J.AnnotationMode,lA=J.ColorPicker,cA=J.DOMSVGFactory,hA=J.DrawLayer,dA=J.FeatureTest,yg=J.GlobalWorkerOptions,uA=J.ImageKind,pA=J.InvalidPDFException,fA=J.MissingPDFException,gA=J.OPS,mA=J.OutputScale,bA=J.PDFDataRangeTransport,vA=J.PDFDateString,AA=J.PDFWorker,_A=J.PasswordResponses,yA=J.PermissionFlag,wA=J.PixelsPerInch,xA=J.RenderingCancelledException,kA=J.TextLayer,SA=J.UnexpectedResponseException,CA=J.Util,EA=J.VerbosityLevel,TA=J.XfaLayer,RA=J.build,MA=J.createValidAbsoluteUrl,IA=J.fetchData,FA=J.getDocument,LA=J.getFilenameFromUrl,PA=J.getPdfFilenameFromUrl,DA=J.getXfaPageViewport,NA=J.isDataScheme,OA=J.isPdfFile,BA=J.noContextMenu,zA=J.normalizeUnicode,jA=J.setLayerDimensions,HA=J.shadow,UA=J.version;const qA=Object.freeze(Object.defineProperty({__proto__:null,AbortException:eA,AnnotationEditorLayer:sA,AnnotationEditorParamsType:iA,AnnotationEditorType:nA,AnnotationEditorUIManager:aA,AnnotationLayer:rA,AnnotationMode:oA,ColorPicker:lA,DOMSVGFactory:cA,DrawLayer:hA,FeatureTest:dA,GlobalWorkerOptions:yg,ImageKind:uA,InvalidPDFException:pA,MissingPDFException:fA,OPS:gA,OutputScale:mA,PDFDataRangeTransport:bA,PDFDateString:vA,PDFWorker:AA,PasswordResponses:_A,PermissionFlag:yA,PixelsPerInch:wA,RenderingCancelledException:xA,TextLayer:kA,UnexpectedResponseException:SA,Util:CA,VerbosityLevel:EA,XfaLayer:TA,build:RA,createValidAbsoluteUrl:MA,fetchData:IA,getDocument:FA,getFilenameFromUrl:LA,getPdfFilenameFromUrl:PA,getXfaPageViewport:DA,isDataScheme:NA,isPdfFile:OA,noContextMenu:BA,normalizeUnicode:zA,setLayerDimensions:jA,shadow:HA,version:UA},Symbol.toStringTag,{value:"Module"}));yg.workerSrc="/pdfjs-dist/pdf.worker.min.js";const GA={key:0,class:"loading-pdf-box"},VA={class:"loading-spin"},WA={key:1,class:"loading-pdf-box"},YA={__name:"PDFViewer",props:{url:String,doc_width:Number,positions:Array},setup(d,{expose:t}){const e=d,s=Fg("box");let i=null;const n=[];let r=[],a=1,c=[];const l=st(1),h=st(""),u=(()=>{const m={};return e.positions.forEach((_,y)=>{const x=_[0],w=_[1],k=_[2],S=_[3],C=_[4];x in m?m[x].push({x1:w,x2:k,y1:S,y2:C}):m[x]=[{x1:w,x2:k,y1:S,y2:C}]}),m})();function p(m,_,y,x,w){m.fillStyle="rgba(255, 255, 0, 0.5)";const k=y-_,S=w-x;m.fillRect(_,x,k,S)}fi(()=>{l.value=2,h.value="loading",qA.getDocument(e.url).promise.then(async m=>{i=m;const _=m.numPages;let y=-1,x=0;n.length=0,r.length=0;for(let w=1;w<=_;w++){const k=document.createElement("canvas");k.addEventListener("contextmenu",function(Z){Z.preventDefault()}),r[w]=k.getContext("2d");const S=await m.getPage(w),C=S.getViewport({scale:1}),E=C.width,T=C.height,q=e.doc_width,j=q/(E/T);a=q/E;const H=S.getViewport({scale:a});if(n.push(x),k.width=q,k.height=j,x=x+k.height,await S.render({viewport:H,canvasContext:r[w]}).promise,w in u){const Z=u[w];y===-1&&(y=w),Z.forEach($=>{p(r[w],$.x1*a,$.x2*a,$.y1*a,$.y2*a)})}s.value&&s.value.appendChild(k)}l.value=3,h.value="success",y!==-1&&setTimeout(()=>{s.value&&(s.value.scrollTop=n[y-1])})}).catch(m=>{console.log(m,"PDF加载出错"),l.value=4,h.value=`PDF文档 ${e.url} 加载出错。 ERROR: :${m.message}`})});const f=m=>{const _={};return m.forEach((y,x)=>{const w=y[0],k=y[1],S=y[2],C=y[3],E=y[4];w in _?_[w].push({x1:k,x2:S,y1:C,y2:E}):_[w]=[{x1:k,x2:S,y1:C,y2:E}]}),_},g=async(m,_)=>{var y;i&&(setTimeout(()=>{s.value.scrollTop=n[m-1]}),c.includes(m)||(y=f(_)[m])==null||y.forEach(w=>{p(r[m],w.x1*a,w.x2*a,w.y1*a,w.y2*a),c.push(m)}))};return Lg(()=>{r.forEach(m=>{m.clearRect(0,0,m.canvas.width,m.canvas.height)}),r.length=0,n.length=0,i=null}),t({toPageIndex:g}),(m,_)=>{const y=It("a-spin"),x=It("a-result");return N(),X(Ms,null,[M("div",{class:"pdf-container",id:"pdfContainer",ref_key:"box",ref:s},null,512),l.value===2?(N(),X("div",GA,[M("div",VA,[at(y,{size:36})])])):St("",!0),l.value===4?(N(),X("div",WA,[at(x,{status:"error",title:"文档加载出错"},{subtitle:ut(()=>[Wi($t(h.value),1)]),_:1})])):St("",!0)],64)}}},wg=ct(YA,[["__scopeId","data-v-4f355ea3"]]),XA={class:"image-aisde-btn-container"},$A=["src"],KA=["src"],QA={__name:"AsideImage",props:{src:String},setup(d){return(t,e)=>{const s=It("a-popover");return N(),At(s,null,{content:ut(()=>[M("img",{src:d.src,class:"image-large-view"},null,8,KA)]),default:ut(()=>[M("div",XA,[M("img",{src:d.src,class:"image-aside-btn"},null,8,$A)])]),_:1})}}},JA=ct(QA,[["__scopeId","data-v-762938fd"]]),Pu="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='13px'%20height='16px'%20viewBox='0%200%2013%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e编组备份%205%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='智能对话切图'%20transform='translate(-47,%20-481)'%3e%3crect%20fill='%23E6E6E6'%20x='0'%20y='0'%20width='428'%20height='564'%3e%3c/rect%3e%3cg%20id='编组备份-5'%20transform='translate(47,%20481)'%20fill-rule='nonzero'%3e%3cpath%20d='M8.72857143,0%20C8.8763349,0%209.01804637,0.0588038179%209.12253092,0.163475285%20L12.8368166,3.88440552%20C12.9413012,3.98907698%2013,4.13104196%2013,4.27906977%20L13,14.6976744%20C13,15.4169403%2012.4179815,16%2011.7,16%20L1.3,16%20C0.582027083,16%200,15.4169378%200,14.6976744%20L0,1.30232558%20C0,0.583070837%200.582029639,0%201.3,0%20L8.72857143,0%20Z'%20id='路径'%20fill='%23FFC34C'%3e%3c/path%3e%3cg%20id='w'%20transform='translate(2.05,%206.45)'%20fill='%23FFFFFF'%3e%3cpolygon%20id='路径'%20points='1.81%205.64%200%200%201.38%200%202.48%204.03%202.53%204.03%203.63%200%204.96%200%206.07%204.03%206.12%204.03%207.21%200%208.59%200%206.79%205.64%205.45%205.64%204.32%201.63%204.27%201.63%203.14%205.64'%3e%3c/polygon%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ZA="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204A3.25%203.25%200%200%201%2011%20.75h16c.121%200%20.238.048.323.134l10.793%2010.793a.457.457%200%200%201%20.134.323v24A3.25%203.25%200%200%201%2035%2039.25H11A3.25%203.25%200%200%201%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'/%3e%3cpath%20d='M27%20.5V8a4%204%200%200%200%204%204h7.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'/%3e%3crect%20x='1'%20y='18'%20width='26'%20height='16'%20rx='2'%20fill='%23D92D20'/%3e%3cpath%20d='M4.832%2030v-7.273h2.87c.551%200%201.021.106%201.41.316.388.209.684.499.887.87.206.37.31.796.31%201.279%200%20.483-.105.909-.313%201.278-.209.37-.51.657-.906.863-.393.206-.869.309-1.427.309h-1.83V26.41h1.581c.296%200%20.54-.051.732-.153.194-.104.338-.247.433-.43.097-.184.145-.396.145-.635%200-.242-.048-.452-.145-.632a.972.972%200%200%200-.433-.423c-.195-.102-.44-.153-.74-.153H6.37V30H4.832Zm9.053%200h-2.578v-7.273h2.6c.73%200%201.36.146%201.889.437.527.289.934.704%201.218%201.246.286.543.43%201.191.43%201.947%200%20.757-.144%201.408-.43%201.953a2.953%202.953%200%200%201-1.226%201.253c-.53.291-1.164.437-1.903.437Zm-1.04-1.317h.976c.455%200%20.837-.081%201.147-.242.313-.163.547-.415.703-.756.159-.344.238-.786.238-1.328%200-.538-.08-.977-.238-1.318a1.541%201.541%200%200%200-.7-.753c-.31-.16-.692-.241-1.146-.241h-.98v4.637ZM18.581%2030v-7.273h4.816v1.268H20.12v1.733h2.958v1.268H20.12V30h-1.538Z'%20fill='%23fff'/%3e%3c/svg%3e",t_={class:"file-name-icon"},e_=["src"],s_={class:"file-name-label"},i_={__name:"FileNameDisplay",props:{file_name:String,file_id:String},setup(d){const t=d,e=function(){const r=t.file_name.split(".");return r[r.length-1]}(),s=e==="pdf",n={docx:Pu,doc:Pu,pdf:ZA}[e];return(r,a)=>(N(),X("div",{class:Kr(["file-name-display",{"file-name-pdf":s,"file-name-others":!s}])},[M("span",t_,[M("img",{src:wa(n)},null,8,e_)]),M("span",s_,$t(d.file_name),1)],2))}},n_=ct(i_,[["__scopeId","data-v-2e7e0bf8"]]),nc=d=>`${Fc("REFFERENCE_ASSETS_FILE_URL")}/v1/document/get/${d}`,a_=d=>`${Fc("REFFERENCE_ASSETS_FILE_URL")}/v1/document/image/${d}`,r_={class:"refference-container"},o_={class:"refference-content"},l_={class:"refference-description"},c_={class:"ref-text-content"},h_={__name:"RefferenceFlag",props:{img:String,image_id:String,text:String,doc_id:String,doc_name:String,positions:Array},setup(d){const t=d,e=window.innerWidth/2,s=nc(t.doc_id),i=a_(t.image_id),n=st(!1),r=()=>{const l=t.doc_name;l&&l.indexOf(".pdf")===l.length-4&&(n.value=!0)},a=()=>{n.value=!1},c=()=>{n.value=!1};return fi(()=>{}),(l,h)=>{const u=It("a-popover"),p=It("a-drawer");return N(),X("span",r_,[at(u,null,{title:ut(()=>h[0]||(h[0]=[])),content:ut(()=>[M("div",o_,[wa(i)?(N(),At(JA,{key:0,src:wa(i)},null,8,["src"])):St("",!0),M("div",l_,[M("div",c_,$t(d.text),1),at(n_,{onClick:r,file_name:d.doc_name,file_id:d.doc_id},null,8,["file_name","file_id"])])])]),default:ut(()=>[h[1]||(h[1]=M("span",{class:"refference-flag-circle"},null,-1))]),_:1}),at(p,{ref:"drawer",width:e,visible:n.value,onOk:a,onCancel:c,unmountOnClose:"","data-flag":"doc-ref-effect-contaienr",footer:!1},{title:ut(()=>[Wi($t(d.doc_name),1)]),default:ut(()=>[at(wg,{url:wa(s),doc_width:e,positions:d.positions},null,8,["url","positions"])]),_:1},8,["visible"])])}}},d_=ct(h_,[["__scopeId","data-v-ba44ff05"]]);function u_(d,t={}){const e=Vu(d_,{img:t.refference.img_id||"",image_id:t.refference.img_id,text:t.refference.content_with_weight||"",doc_id:t.refference.doc_id,doc_name:t.refference.docnm_kwd,positions:t.refference.positions});return e.use(Wu),e.use(Yu),e.mount(d),()=>{e.unmount()}}function p_(d,t){let e=()=>{};setTimeout(()=>{const i=document.querySelectorAll(`.${d} .client-formated-markdown-doc-refference-flag`);s(i)},0);function s(i){i.forEach((n,r)=>{const a=n.getAttribute("data-ref-index");if(t){const c=t.chunks;if(c){const l=c[a],h={refference:{chunk_id:l.chunk_id,content_ltks:l.content_ltks,content_with_weight:l.content_with_weight,doc_id:l.doc_id,docnm_kwd:l.docnm_kwd,img_id:l.img_id,important_kwd:l.important_kwd,kb_id:l.kb_id,positions:l.positions,similarity:l.similarity,term_similarity:l.term_similarity,vector_similarity:l.vector_similarity}};e=u_(n,h)}}})}return()=>{typeof e=="function"&&e()}}const f_={class:"doc-ref-index"},g_={class:"doc-ref-label"},m_={class:"knowledge-detail"},b_={class:"knowledge-content"},v_={class:"knowledge-footer"},A_=["onClick"],__={__name:"RefferenceFileNameItem",props:{knowledge:Object,knowledgeIndex:Number},emits:["showDocument"],setup(d,{emit:t}){const e=t,s=i=>{e("showDocument",i)};return(i,n)=>{const r=It("a-popover");return N(),X("div",null,[at(r,{title:d.knowledge.doc_name,position:"left"},{content:ut(()=>[M("div",m_,[M("div",b_,$t(d.knowledge.content_ltks),1),M("div",v_,[n[2]||(n[2]=M("p",null,"检索片段",-1)),M("p",null,[(N(!0),X(Ms,null,di(d.knowledge.content_ltks,(a,c)=>(N(),X("span",{key:c,class:Kr({active:d.knowledge.page===c}),onClick:()=>{d.knowledge.page=c}},$t(c+1),11,A_))),128))]),M("p",{onClick:n[1]||(n[1]=a=>s(d.knowledge))},"查看详情>")])])]),default:ut(()=>[M("div",{class:"doc-ref-container",onClick:n[0]||(n[0]=a=>s(i.doc.doc_name))},[M("span",f_,$t(d.knowledgeIndex+1),1),M("span",g_,$t(d.knowledge.doc_name),1)])]),_:1},8,["title"])])}}},y_=ct(__,[["__scopeId","data-v-96070c01"]]),w_={__name:"RefferenceFileNameList",props:{doc_aggs:Array},emits:["showDocDetail"],setup(d,{emit:t}){const e=t,s=i=>{e("showDocDetail",i)};return(i,n)=>(N(!0),X(Ms,null,di(d.doc_aggs,(r,a)=>(N(),At(y_,{knowledge:r,key:a,knowledgeIndex:a,onShowDocument:c=>s(r)},null,8,["knowledge","knowledgeIndex","onShowDocument"]))),128))}},x_="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='13px'%20height='16px'%20viewBox='0%200%2013%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e编组备份%205%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='智能对话切图'%20transform='translate(-47,%20-481)'%3e%3crect%20fill='%23E6E6E6'%20x='0'%20y='0'%20width='428'%20height='564'%3e%3c/rect%3e%3cg%20id='编组备份-5'%20transform='translate(47,%20481)'%20fill-rule='nonzero'%3e%3cpath%20d='M8.72857143,0%20C8.8763349,0%209.01804637,0.0588038179%209.12253092,0.163475285%20L12.8368166,3.88440552%20C12.9413012,3.98907698%2013,4.13104196%2013,4.27906977%20L13,14.6976744%20C13,15.4169403%2012.4179815,16%2011.7,16%20L1.3,16%20C0.582027083,16%200,15.4169378%200,14.6976744%20L0,1.30232558%20C0,0.583070837%200.582029639,0%201.3,0%20L8.72857143,0%20Z'%20id='路径'%20fill='%23FFC34C'%3e%3c/path%3e%3cg%20id='w'%20transform='translate(2.05,%206.45)'%20fill='%23FFFFFF'%3e%3cpolygon%20id='路径'%20points='1.81%205.64%200%200%201.38%200%202.48%204.03%202.53%204.03%203.63%200%204.96%200%206.07%204.03%206.12%204.03%207.21%200%208.59%200%206.79%205.64%205.45%205.64%204.32%201.63%204.27%201.63%203.14%205.64'%3e%3c/polygon%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",k_={class:"left"},S_={style:{"background-color":"rgb(255, 110, 110)"}},C_=["onClick"],E_=["onClick"],T_={__name:"RefferenceDocDetail",props:{targetDocument:Object},setup(d){const t=d,e=st("当前登录的用户名"),s=st([]),i=st(!0),n=st([]),r=st(null),a=st(1100),c=st("");let l=st(t.targetDocument.id),h=st("");c.value=nc(l.value);const u=st(null),p=t.targetDocument;s.value=p.doc_aggs.map(y=>{var x;return{...y,fragments:p.chunks.filter(w=>w.docnm_kwd===y.doc_name),desc:(x=p.chunks.filter(w=>w.docnm_kwd===y.doc_name)[0])==null?void 0:x.content_ltks}});const f=()=>{emit("go-back")},g=y=>{y.doc_id!==l.value&&(c.value=nc(y.doc_id),l.value=y.doc_id,h.value="",_())},m=y=>{h.value=y.chunk_id,y.doc_id!==l.value&&(c.value=nc(y.doc_id),l.value=y.doc_id,_()),n.value=[...y.positions],y.positions&&y.positions.length&&u.value.toPageIndex(n.value[0][0],n.value)},_=()=>{n.value=[],i.value=!1,setTimeout(()=>{i.value=!0})};return fi(()=>{a.value=r.value.getBoundingClientRect().width}),(y,x)=>{var k;const w=It("icon-left");return N(),X("main",null,[M("div",k_,[M("header",null,[M("div",{onClick:f},[at(w,{style:{"margin-right":"5px"}}),x[0]||(x[0]=Wi("返回知识问答"))])]),M("div",null,[M("div",S_,$t((k=e.value)==null?void 0:k.slice(0,1)),1),M("p",null,$t(d.targetDocument.question),1)]),M("p",null,[x[1]||(x[1]=M("span",null,"以下是根据您的提问搜索到的相关文档",-1)),M("span",null,"共 "+$t(s.value.length)+" 条",1)]),M("section",null,[(N(!0),X(Ms,null,di(s.value,(S,C)=>(N(),X("div",{class:Kr([S.doc_id===wa(l)?"activeBox":""]),key:C,onClick:E=>g(S)},[x[3]||(x[3]=M("div",null,[M("img",{src:x_})],-1)),M("div",null,[M("p",null,$t(S.doc_name),1),M("p",null,$t(S.desc),1),x[2]||(x[2]=M("span",null,[M("b",null,"检索片段"),M("em")],-1)),(N(!0),X(Ms,null,di(S.fragments,(E,T)=>(N(),X("div",{class:Kr([E.chunk_id===wa(h)?"activeLink":""]),key:T,onClick:Gu(q=>m(E),["stop"])},[M("span",null,$t(T+1)+".",1),Wi(" "+$t(E.content_with_weight),1)],10,E_))),128))])],10,C_))),128))])]),M("div",{class:"right",ref_key:"pdfFather",ref:r},[i.value?(N(),At(wg,{key:0,ref_key:"pdfViewer",ref:u,class:"pdf-viewer",url:c.value,doc_width:a.value,positions:n.value},null,8,["url","doc_width","positions"])):St("",!0)],512)])}}},R_=ct(T_,[["__scopeId","data-v-abdded2c"]]),M_={__name:"RefferenceFileBlocks",props:{doc_aggs:Array,chunks:Array},setup(d){const t=d,e=st(!1),s=st("right"),i=st({doc_aggs:t.doc_aggs,chunks:t.chunks}),n=()=>{e.value=!0},r=()=>{e.value=!1},a=()=>{e.value=!1},c=l=>{n()};return(l,h)=>{const u=It("a-drawer");return N(),X("div",null,[h[1]||(h[1]=M("header",{class:"client-formated-markdown-element-item client-formated-markdown-refference-header"},[M("div",null,"来源"),M("div",null,"查看全部关联")],-1)),at(w_,{doc_aggs:d.doc_aggs,onShowDocDetail:c},null,8,["doc_aggs"]),at(u,{width:"90%",height:340,visible:e.value,placement:s.value,onOk:r,onCancel:a,unmountOnClose:""},{title:ut(()=>h[0]||(h[0]=[Wi(" 文档详情 ")])),default:ut(()=>[M("div",null,[at(R_,{targetDocument:i.value},null,8,["targetDocument"])])]),_:1},8,["visible","placement"])])}}},I_=ct(M_,[["__scopeId","data-v-8eb1bf69"]]);function Du(d,t={}){const e=Vu(I_,{doc_aggs:t.doc_aggs,chunks:t.chunks,total:t.total});return e.use(Wu),e.use(Yu),e.mount(d),()=>{e.unmount()}}function F_(d,t){let e=()=>{};setTimeout(()=>{const i=document.querySelector(`.${d} .client-formated-markdown-doc-refference-container`);s(i)},0);function s(i){i&&Array.isArray(i)?i.forEach((n,r)=>{e=Du(n,t)}):e=Du(i,t)}return()=>{typeof e=="function"&&e()}}var xg={exports:{}};/*!
- * clipboard.js v2.0.11
- * https://clipboardjs.com/
- *
- * Licensed MIT © Zeno Rocha
- */(function(d,t){(function(s,i){d.exports=i()})(Pg,function(){return function(){var e={686:function(n,r,a){a.d(r,{default:function(){return xe}});var c=a(279),l=a.n(c),h=a(370),u=a.n(h),p=a(817),f=a.n(p);function g(I){try{return document.execCommand(I)}catch{return!1}}var m=function(R){var P=f()(R);return g("cut"),P},_=m;function y(I){var R=document.documentElement.getAttribute("dir")==="rtl",P=document.createElement("textarea");P.style.fontSize="12pt",P.style.border="0",P.style.padding="0",P.style.margin="0",P.style.position="absolute",P.style[R?"right":"left"]="-9999px";var z=window.pageYOffset||document.documentElement.scrollTop;return P.style.top="".concat(z,"px"),P.setAttribute("readonly",""),P.value=I,P}var x=function(R,P){var z=y(R);P.container.appendChild(z);var F=f()(z);return g("copy"),z.remove(),F},w=function(R){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},z="";return typeof R=="string"?z=x(R,P):R instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(R==null?void 0:R.type)?z=x(R.value,P):(z=f()(R),g("copy")),z},k=w;function S(I){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?S=function(P){return typeof P}:S=function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},S(I)}var C=function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},P=R.action,z=P===void 0?"copy":P,F=R.container,U=R.target,Ft=R.text;if(z!=="copy"&&z!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(U!==void 0)if(U&&S(U)==="object"&&U.nodeType===1){if(z==="copy"&&U.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(z==="cut"&&(U.hasAttribute("readonly")||U.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Ft)return k(Ft,{container:F});if(U)return z==="cut"?_(U):k(U,{container:F})},E=C;function T(I){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?T=function(P){return typeof P}:T=function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},T(I)}function q(I,R){if(!(I instanceof R))throw new TypeError("Cannot call a class as a function")}function j(I,R){for(var P=0;P<R.length;P++){var z=R[P];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(I,z.key,z)}}function H(I,R,P){return R&&j(I.prototype,R),P&&j(I,P),I}function Z(I,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(R&&R.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),R&&$(I,R)}function $(I,R){return $=Object.setPrototypeOf||function(z,F){return z.__proto__=F,z},$(I,R)}function W(I){var R=le();return function(){var z=Y(I),F;if(R){var U=Y(this).constructor;F=Reflect.construct(z,arguments,U)}else F=z.apply(this,arguments);return mt(this,F)}}function mt(I,R){return R&&(T(R)==="object"||typeof R=="function")?R:ee(I)}function ee(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}function le(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Y(I){return Y=Object.setPrototypeOf?Object.getPrototypeOf:function(P){return P.__proto__||Object.getPrototypeOf(P)},Y(I)}function K(I,R){var P="data-clipboard-".concat(I);if(R.hasAttribute(P))return R.getAttribute(P)}var Xe=function(I){Z(P,I);var R=W(P);function P(z,F){var U;return q(this,P),U=R.call(this),U.resolveOptions(F),U.listenClick(z),U}return H(P,[{key:"resolveOptions",value:function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof F.action=="function"?F.action:this.defaultAction,this.target=typeof F.target=="function"?F.target:this.defaultTarget,this.text=typeof F.text=="function"?F.text:this.defaultText,this.container=T(F.container)==="object"?F.container:document.body}},{key:"listenClick",value:function(F){var U=this;this.listener=u()(F,"click",function(Ft){return U.onClick(Ft)})}},{key:"onClick",value:function(F){var U=F.delegateTarget||F.currentTarget,Ft=this.action(U)||"copy",Is=E({action:Ft,container:this.container,target:this.target(U),text:this.text(U)});this.emit(Is?"success":"error",{action:Ft,text:Is,trigger:U,clearSelection:function(){U&&U.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(F){return K("action",F)}},{key:"defaultTarget",value:function(F){var U=K("target",F);if(U)return document.querySelector(U)}},{key:"defaultText",value:function(F){return K("text",F)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(F){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return k(F,U)}},{key:"cut",value:function(F){return _(F)}},{key:"isSupported",value:function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],U=typeof F=="string"?[F]:F,Ft=!!document.queryCommandSupported;return U.forEach(function(Is){Ft=Ft&&!!document.queryCommandSupported(Is)}),Ft}}]),P}(l()),xe=Xe},828:function(n){var r=9;if(typeof Element<"u"&&!Element.prototype.matches){var a=Element.prototype;a.matches=a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector}function c(l,h){for(;l&&l.nodeType!==r;){if(typeof l.matches=="function"&&l.matches(h))return l;l=l.parentNode}}n.exports=c},438:function(n,r,a){var c=a(828);function l(p,f,g,m,_){var y=u.apply(this,arguments);return p.addEventListener(g,y,_),{destroy:function(){p.removeEventListener(g,y,_)}}}function h(p,f,g,m,_){return typeof p.addEventListener=="function"?l.apply(null,arguments):typeof g=="function"?l.bind(null,document).apply(null,arguments):(typeof p=="string"&&(p=document.querySelectorAll(p)),Array.prototype.map.call(p,function(y){return l(y,f,g,m,_)}))}function u(p,f,g,m){return function(_){_.delegateTarget=c(_.target,f),_.delegateTarget&&m.call(p,_)}}n.exports=h},879:function(n,r){r.node=function(a){return a!==void 0&&a instanceof HTMLElement&&a.nodeType===1},r.nodeList=function(a){var c=Object.prototype.toString.call(a);return a!==void 0&&(c==="[object NodeList]"||c==="[object HTMLCollection]")&&"length"in a&&(a.length===0||r.node(a[0]))},r.string=function(a){return typeof a=="string"||a instanceof String},r.fn=function(a){var c=Object.prototype.toString.call(a);return c==="[object Function]"}},370:function(n,r,a){var c=a(879),l=a(438);function h(g,m,_){if(!g&&!m&&!_)throw new Error("Missing required arguments");if(!c.string(m))throw new TypeError("Second argument must be a String");if(!c.fn(_))throw new TypeError("Third argument must be a Function");if(c.node(g))return u(g,m,_);if(c.nodeList(g))return p(g,m,_);if(c.string(g))return f(g,m,_);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function u(g,m,_){return g.addEventListener(m,_),{destroy:function(){g.removeEventListener(m,_)}}}function p(g,m,_){return Array.prototype.forEach.call(g,function(y){y.addEventListener(m,_)}),{destroy:function(){Array.prototype.forEach.call(g,function(y){y.removeEventListener(m,_)})}}}function f(g,m,_){return l(document.body,g,m,_)}n.exports=h},817:function(n){function r(a){var c;if(a.nodeName==="SELECT")a.focus(),c=a.value;else if(a.nodeName==="INPUT"||a.nodeName==="TEXTAREA"){var l=a.hasAttribute("readonly");l||a.setAttribute("readonly",""),a.select(),a.setSelectionRange(0,a.value.length),l||a.removeAttribute("readonly"),c=a.value}else{a.hasAttribute("contenteditable")&&a.focus();var h=window.getSelection(),u=document.createRange();u.selectNodeContents(a),h.removeAllRanges(),h.addRange(u),c=h.toString()}return c}n.exports=r},279:function(n){function r(){}r.prototype={on:function(a,c,l){var h=this.e||(this.e={});return(h[a]||(h[a]=[])).push({fn:c,ctx:l}),this},once:function(a,c,l){var h=this;function u(){h.off(a,u),c.apply(l,arguments)}return u._=c,this.on(a,u,l)},emit:function(a){var c=[].slice.call(arguments,1),l=((this.e||(this.e={}))[a]||[]).slice(),h=0,u=l.length;for(h;h<u;h++)l[h].fn.apply(l[h].ctx,c);return this},off:function(a,c){var l=this.e||(this.e={}),h=l[a],u=[];if(h&&c)for(var p=0,f=h.length;p<f;p++)h[p].fn!==c&&h[p].fn._!==c&&u.push(h[p]);return u.length?l[a]=u:delete l[a],this}},n.exports=r,n.exports.TinyEmitter=r}},s={};function i(n){if(s[n])return s[n].exports;var r=s[n]={exports:{}};return e[n](r,r.exports,i),r.exports}return function(){i.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(r,{a:r}),r}}(),function(){i.d=function(n,r){for(var a in r)i.o(r,a)&&!i.o(n,a)&&Object.defineProperty(n,a,{enumerable:!0,get:r[a]})}}(),function(){i.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)}}(),i(686)}().default})})(xg);var L_=xg.exports;const P_=Xu(L_);function D_(d){P_.copy(d)}const N_={class:"dialog-main answer-main"},O_={class:"dialog-icon answer-icon"},B_=["src"],z_={class:"dialog-content answer-content"},j_={__name:"DialogAnswer",props:{show_select:!0,answer:Object},emits:["stop","retry","select"],setup(d,{emit:t}){const e=d,s=t,i=Mt(()=>e.show_select===!0),n=Mt(()=>e.answer.client_custom_chat_status),r=Mt(()=>n.value===0),a=Mt(()=>{const g=e.answer,m=g.content;let _=q0(m);if(g.client_custom_linked_code&&(_=_+g.client_custom_linked_code),g.client_custom_linked_sql&&(_=_+g.client_custom_linked_sql),g.client_custom_linked_image){const y=Ed(g.client_custom_linked_image);_=_+`<img src="${y}" />`}if(g.client_custom_linked_download_files){const y=g.client_custom_linked_download_files.file_name,x=g.client_custom_linked_download_files.file_url,w=G0(y,x);_=_+w}return _}),c=Mt(()=>`${e.answer.client_custom_unique_id}-answer-content`),l=()=>{s("select")},h=()=>{s("stop")},u=()=>{D_(a.value),$u.success("已复制")},p=()=>{},f=()=>{s("retry")};return fi(()=>{const g=c.value,m=e.answer;p_(g,m.client_custom_linked_refference_full_content),F_(g,m.client_custom_linked_refference_full_content)}),(g,m)=>(N(),X("div",{class:Kr(["dialog-item dialog-anwser",c.value])},[i.value?(N(),At(tp,{key:0,onChange:l})):St("",!0),M("div",N_,[M("div",O_,[M("img",{src:d.answer.client_custom_icon},null,8,B_)]),M("div",z_,[M("div",null,[at(ep,{content:a.value,is_loading:r.value},{default:ut(()=>[n.value===2?(N(),At(l0,{key:0,class:"answer-actions-btns",onCopy:u,onShare:p,onRetry:f})):St("",!0)]),_:1},8,["content","is_loading"]),n.value===1?(N(),At(h0,{key:0,onStop:h})):St("",!0)])])])],2))}},H_=ct(j_,[["__scopeId","data-v-e9be0f19"]]),U_={class:"dialog-item-container"},q_={__name:"DialogItem",props:{dialog:Object},emits:["stop","retry","select"],setup(d,{emit:t}){const e=d,s=t,i=Mt(()=>e.dialog.client_custom_item_type),n=Mt(()=>({content:e.dialog.question,client_custom_icon:e.dialog.client_custom_icon,client_custom_upload_file_list:e.dialog.client_custom_upload_file_list})),r=Mt(()=>{const h=e.dialog,u={};return h.answer&&(u.content=h.answer),u.client_custom_chat_status=h.client_custom_chat_status,u.client_custom_icon=h.client_custom_icon,u.client_custom_linked_sql=h.client_custom_linked_sql||"",u.client_custom_linked_code=h.client_custom_linked_code||"",u.client_custom_linked_refference_full_content=h.client_custom_linked_refference_full_content||"",u.client_custom_linked_image=h.client_custom_linked_image||"",u.client_custom_linked_download_files=h.client_custom_linked_download_files||"",u.client_custom_linked_refference_full_content=h.client_custom_linked_refference_full_content,u}),a=()=>{s("stop")},c=()=>{s("retry")},l=()=>{s("select")};return(h,u)=>(N(),X("div",U_,[i.value==="q"?(N(),At(n0,{key:0,question:n.value,onSelect:l},null,8,["question"])):St("",!0),i.value==="a"?(N(),At(H_,{key:1,answer:r.value,onStop:a,onRetry:c,onSelect:l},null,8,["answer"])):St("",!0)]))}},G_=ct(q_,[["__scopeId","data-v-8a7d8872"]]),V_={class:"dialog-suggestion"},W_={__name:"DialogSuggestion",props:{suggestion:Object},setup(d){return(t,e)=>(N(),X("div",V_,e[0]||(e[0]=[M("div",null,"对话推荐项,当一轮对话结束后,可能有其他推荐的内容项目,在对话结束处进行展示。",-1)])))}},Y_=ct(W_,[["__scopeId","data-v-c9a060e3"]]);function X_(d){const{proxy:t}=xr();return e=>{t.$refs[d].scrollTop(e)}}const $_={class:"dialog-list dialog-markdown-container"},K_={__name:"DialogList",props:{height:Number,agent_id:String,list:Array,suggestion:Array},setup(d,{expose:t}){const e=d,s=X_("scroll_container"),i=Mt(()=>({height:e.height+"px",overflow:"auto"})),n=r=>{};return t({scroll2Bottom:()=>{s(1e6)}}),(r,a)=>{const c=It("a-scrollbar");return N(),At(c,{type:"track",style:Cl(i.value),ref:"scroll_container"},{default:ut(()=>[M("div",$_,[(N(!0),X(Ms,null,di(d.list,(l,h)=>(N(),At(G_,{dialog:l,index:h,key:l.client_custom_unique_id,onSelect:u=>n(l)},null,8,["dialog","index","onSelect"]))),128)),d.suggestion.length!==0?(N(),At(Y_,{key:0,suggestion:d.suggestion},null,8,["suggestion"])):St("",!0)])]),_:1},8,["style"])}}},Q_=ct(K_,[["__scopeId","data-v-4eda8ec7"]]),J_="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAL0SURBVHgB7Vc7ctswEF19ipRKqVER5gbUrw5dpop9AtsnSG4g+QSJTiDmBJFPEKbWZ+gb0I2kLiyVGX3ylsEyCC1KICVNGr4ZDgEQu3j7wQIkKlCgQIGLomQyybZti/Ij9H0/pJxIJQhSTqVS6XETT41Og7/b7Qbb7dYD2SCLYGkPMQvEhmg6dH4E5XL5Zjwe+6YC/xBU5L6jaXEfVoelUomt/0E5AXkL8u/4rY1dTSYTz0he77Tbbfbcnep6m83mPmtI0tDpdPog2lPdELrfmuRmRRqcc3D/F25DUTCbzZrL5TJ3cicxn8+9RqPBDnHwvIIXfy0WC++YXFkaCO2ttJHMV3QBIKx9vDxug+BHE5mq1rbV2zcJqyo97HWLDACjXdaL6DyCnIOhGnTYvBhlJPhMh4lJ+XEoA6rVqodXAHKBNna0fJW1tuTbz7TJrVarp3a5Q2cGexOb9DY5rnvQVwtf47mnPeRgfV8bGqA/ghcCMsBqtRIHfJCx9Xod8FsRizZot9t90utkTJBrneQGBK6n0+mINOuEHO9w5NPNsdzZB8lb0SO5jvZr6I/CDd3fMK8pJSgOMT6wBWLlUD9/EdbP2ry85GrqhLLU0IN8Q0njtQeqa2Hj3cm3mCAzhiUiVJNJrJj+5txjTnIOUkHPXR+kXH0OCneflIPgzTgN9ByMLEF4LUwIEeK+6JfvMMBTC9q6Vw+AjbP4DVnREaVIciI7CGvLPrD2EmSA2CdKgVYidK9mAd9o+mlHHL49I3J0kOAexMpgfU0b88gMfOF4wo51jx0AIPcmuaYJwUAaWIjLgavy8KzHob7D6U/Ji1A+JqjC4amug1uJQxcAvBcXaUTqazxuIgzPPWjCwxN/AV5APwTUTcqN1zZVkrjPMVyUBrY0oPxw1C3KkQHobOqlzJhgCsmzgW/v/DuQvGlXMuiILp31ep1vO7YcTWeChxLzHqF9cQhk8qAOHOo2lPL/hk35wJsvhI7RKb+lBQoUKFDgP+M3zC1vWE7HoR8AAAAASUVORK5CYII=",Z_={class:"dialog-input-actions"},ty={class:"dialog-input-action-left"},ey={class:"dialog-input-action-right"},sy={__name:"InputActions",props:{disabled:{type:Boolean,default:!1,required:!1},enable_file_upload:{type:Boolean,default:!0,required:!1},enable_frequent_question:{type:Boolean,default:!0,required:!1},enable_voice_recognition:{type:Boolean,default:!1,required:!1},file_upload_type:{type:String,default:"*",required:!1},file_upload_limit:{type:Number,default:0,required:!1}},emits:["fileUpload","questionDefine","voiceRecognize","submit"],setup(d,{emit:t}){const e=t,s=()=>{e("fileUpload")},i=()=>{e("submit")};return(n,r)=>{const a=It("a-tooltip");return N(),X("div",Z_,[M("div",ty,[at(a,{content:"文件上传",position:"top"},{default:ut(()=>[d.enable_file_upload?(N(),X("div",{key:0,class:"action-left-item-btn",onClick:s},r[0]||(r[0]=[M("img",{src:J_},null,-1)]))):St("",!0)]),_:1})]),M("div",ey,[at(a,{content:"请输入您的问题",position:"top"},{default:ut(()=>[M("div",{class:"action-right-item-btn submit-input-btn",onClick:i},"发送")]),_:1})])])}}},iy=ct(sy,[["__scopeId","data-v-4c099028"]]),ny={class:"file-upload-preview-area"},ay={class:"file-doc-preview-container"},ry={class:"file-image-preview-container"},oy={__name:"FileUploadPreviewV1",props:{file_list:Array,enable_remove:Boolean},emits:["delete"],setup(d,{emit:t}){const e=d,s=t,i=Mt(()=>{const a=[];return e.file_list.forEach((c,l)=>{const h=c.file.name;ac(h)&&a.push(c)}),a}),n=Mt(()=>{const a=[];return e.file_list.forEach((c,l)=>{const h=c.file.name;ac(h)||a.push(c)}),a}),r=a=>{s("delete",a)};return(a,c)=>(N(),X("div",ny,[M("div",ay,[(N(!0),X(Ms,null,di(n.value,(l,h)=>(N(),At(ip,{class:"file-preview-item",key:l.id+l.index,file:l.file,enable_remove:d.enable_remove,onDelete:u=>r(l)},null,8,["file","enable_remove","onDelete"]))),128))]),M("div",ry,[(N(!0),X(Ms,null,di(i.value,(l,h)=>(N(),At(np,{class:"file-preview-item",key:l.id+l.index,file:l.file,enable_remove:d.enable_remove,onDelete:u=>r(l)},null,8,["file","enable_remove","onDelete"]))),128))])]))}},ly=ct(oy,[["__scopeId","data-v-089f5788"]]);function cy(d){const t=[];let e=0;return{select(s){const i=Date.now(),n=document.createElement("input");n.type="file",n.id=`9d75142a66eb4e23b7d403efe4584915-${i}-${e}`,n.setAttribute("multiple",!0),n.setAttribute("style","display: none;"),document.body.appendChild(n),e=e+1,n.click(),n.onchange=r=>{typeof s=="function"&&s(r)},t.push(n)},remove(){t.forEach(s=>{document.body.removeChild(s)})}}}function hy(d,t){const e=st(0),s=st(0),{proxy:i}=xr(),n=()=>{const r=i.$refs[d];e.value=r.offsetHeight,s.value=r.offsetWidth,typeof t=="function"&&t({width:s.value,height:e.value})};return Ku(()=>{if(typeof ResizeObserver<"u"){let r=new ResizeObserver(c=>{for(let l of c){let h=l.contentRect.width,u=l.contentRect.height;e.value=u,s.value=h,typeof t=="function"&&t({width:s.value,height:e.value})}});const a=i.$refs[d];r.observe(a)}else console.log("ResizeObserver is not supported in this browser.");n()}),fi(()=>{n(),window.addEventListener("resize",n)}),Lc(()=>{window.removeEventListener("resize",n)}),{height:e,width:s}}const dy={ref:"input_area_container"},uy={class:"dialog-input-area-container"},py={class:"textarea-container"},fy={__name:"DialogInput",props:{disabled:{type:Boolean,default:!1,required:!1},agent_info:{type:Object},agent_config:{type:Object},enable_file_upload:{type:Boolean,default:!0,required:!1},enable_frequent_question:{type:Boolean,default:!0,required:!1},enable_voice_recognition:{type:Boolean,default:!1,required:!1},file_upload_type:{type:String,default:"*",required:!1},file_upload_limit:{type:Number,default:0,required:!1},text_placeholder:{type:String},text_limit:{type:Number,default:0,required:!1},show_text_count:{type:Boolean,default:!1,required:!1}},emits:["submit","sizeChange"],setup(d,{expose:t,emit:e}){const s=d,i=st(""),n=st([]),r=e,{select:a,remove:c}=cy();hy("input_area_container",x=>{x.width,x.height,r("sizeChange",x)});const l=()=>{if(s.disabled)return;const x=[];n.value.forEach(w=>{x.push(w.file)}),r("submit",{text:i.value,files:x})},h=()=>{i.value="",n.value=[]},u=()=>{a(x=>{const w=x.target.files,k=x.target.id,S=w.length;if(S===1&&n.value.push({type:1,id:k,index:0,file:w[0]}),S>1)for(let C=0;C<S;C++){const E=w[C],T=C;n.value.push({type:2,id:k,index:T,file:E})}})},p=x=>{const w=[];x.index;const k=x.id;n.value.forEach(S=>{S.id===k||w.push(S)}),n.value=w},f=()=>{},g=()=>{},m=()=>{i.value=i.value.replace(/\n/,"")},_=(x,w)=>{s.disabled||(i.value=x)},y=x=>{if(s.disabled){x.keyCode===13&&m();return}x.keyCode===13&&(x.ctrlKey||(m(),l()))};return Lc(()=>{c()}),t({clear:h}),(x,w)=>{const k=It("a-textarea");return N(),X("div",dy,[M("div",uy,[ah(x.$slots,"top",{},void 0,!0),M("div",py,[at(k,{class:"textarea-input",placeholder:"输入文本内容","model-value":i.value,"allow-clear":"","auto-size":{minRows:2,maxRows:4},onInput:_,onKeyup:y},null,8,["model-value"])]),at(iy,{disabled:d.disabled,enable_file_upload:d.enable_file_upload,enable_frequent_question:d.enable_frequent_question,enable_voice_recognition:d.enable_voice_recognition,file_upload_type:d.file_upload_type,file_upload_limit:d.file_upload_limit,onFileUpload:u,onQuestionDefine:f,onVoiceRecognize:g,onSubmit:l},null,8,["disabled","enable_file_upload","enable_frequent_question","enable_voice_recognition","file_upload_type","file_upload_limit"]),ah(x.$slots,"bottom",{},void 0,!0),n.value.length!==0?(N(),At(ly,{key:0,class:"file-upload-preview-container",file_list:n.value,enable_remove:!0,onDelete:p},null,8,["file_list"])):St("",!0)])],512)}}},gy=ct(fy,[["__scopeId","data-v-5eef7ff7"]]),my={class:"dialog-input-area-top-container"},by="对上传的文档进行清洗,输出生成清洗后的文档",vy="对上传的(经过清洗的)文档生成报告,输出生成的报告文档",Ay={__name:"DialogInputTop",props:{disabled:Boolean},setup(d,{expose:t}){const e=st(1),s=r=>{e.value=r/1};return t({clear:()=>{},getOptions:()=>({workflow:e.value})}),(r,a)=>{const c=It("a-radio"),l=It("a-tooltip"),h=It("a-space");return N(),X("div",my,[at(h,{size:"large"},{default:ut(()=>[at(l,{content:by},{default:ut(()=>[at(c,{value:1,"model-value":e.value,onClick:a[0]||(a[0]=u=>s(1))},{default:ut(()=>a[2]||(a[2]=[Wi("文档清洗")])),_:1},8,["model-value"])]),_:1}),at(l,{content:vy},{default:ut(()=>[at(c,{value:2,"model-value":e.value,onClick:a[1]||(a[1]=u=>s(2))},{default:ut(()=>a[3]||(a[3]=[Wi("报告生成")])),_:1},8,["model-value"])]),_:1})]),_:1})])}}},_y=ct(Ay,[["__scopeId","data-v-cd777bd3"]]),yy={},wy={class:"dialog-footer"};function xy(d,t){return N(),X("div",wy,t[0]||(t[0]=[M("div",null,"内容由 AI 大模型生成,请仔细甄别",-1)]))}const ky=ct(yy,[["render",xy],["__scopeId","data-v-a73a920d"]]),Sy={},Cy={class:"dialog-aside-right"};function Ey(d,t){return N(),X("div",Cy,t[0]||(t[0]=[M("div",null,null,-1)]))}const Ty=ct(Sy,[["render",Ey],["__scopeId","data-v-dea2ba14"]]),Nu={"9d75142a-66eb-4e23-b7d4-03efe4584915":{text_limit:250,file_upload:!0,file_accept:".jpg,.png",file_limit:1,file_message:"支持上传 .png, .jpg,大小不超过10M"}};function Ry(d){return d&&d in Nu?Nu[d]:null}function My(d){const e=Ju().getInfo(d);if(e){const s=Ry(d);return s?{id:d,config:s,agent:e}:{id:d,config:{},agent:e}}else return{id:d,config:{},agent:{}}}function Iy(d,t,e){const s=Dg.get(),i=Fc("WEBSOCKET_BASE_URL");return d==="report"?`ws://${i}/api/${d}/ws/${t}/${e}?token=${s}`:d==="chat"?`ws://${i}/api/${d}/ws/${t}/${e}?token=${s}`:d==="excel"?`ws://${i}/api/document/ws/excel`:`ws://${i}/api/chat/ws/${t}/${e}?token=${s}`}function nh(d){return typeof d=="function"?d:Function.prototype}function Fy(d){let t=[];const e=nh(d.onMessage),s=nh(d.onClose),i=nh(d.onError);st(-1);function n(h,u,p){const f=Iy(p,h,u),g=new WebSocket(f);return g.onopen=function(m){t.forEach(_=>{g.send(_)}),t=[]},g.onclose=function(m){s(m)},g.onerror=function(m){i(m)},g.onmessage=m=>{e(m)},g}let r=null,a=null,c=null,l=null;return{initWSConnection(h,u,p){return r=h,a=u,c=p,l===null&&(l=n(r,a,c)),l},sendWSMessage(h){l===null&&(l=n(r,a,c)),l.readyState===0&&t.push(h),l.readyState===1&&l.send(h),l.readyState===2&&console.log("web socket正在关闭"),l.readyState===3&&(t.push(h),l=n(r,a,c))},getWSInstance(){return l},closeWSConnect(){l!==null&&l.close()}}}const Ly=(d,t,e)=>Pc.post(`/api/files/upload/${d}?chat_id=${t}`,e,{headers:{"Content-Type":"multipart/form-data"}}),Py=d=>Pc.post("/api/document/excel/upload",d,{headers:{"Content-Type":"multipart/form-data"}}),Ou=(d,t)=>{const e=new FormData;return d.forEach(s=>{e.append(t,s)}),e},Dy=async(d,t,e,s)=>{const n=s.agent.menuId/1;let r=null;if(n===1){const a=Ou(e,"files"),c=await Py(a);if(c.code/1===200){const l=c.data;return l.files?r=l.files:Array.isArray(l)?r=l:r=[l],{code:200,data:null}}else return c}else{const a=Ou(e,"file"),c=await Ly(d,t,a);if(c.code/1===200){const l=c.data;return l.files?r=l.files:Array.isArray(l)?r=l:r=[l],{code:200,data:r}}else return c}},Ny=d=>Pc.get(`/api/agent/get-chat-id/${d}`),Oy=(d,t)=>Pc.get(`/api/agent/${d}/${t}/session_log`);function By(d,t,e){const s=e.agent||{};e.id;const i=s.menuId/1;let n={message:d};switch(i){case 1:n="合并Excel";break;case 2:break;case 3:if(n={message:d},t&&Array.isArray(t)){const r=[],a=t.length;for(let c=0;c<a;c++){const l=t[c];r.push(l.id)}n.upload_file_id=r}break;case 4:break;case 5:break;case 6:if(n={message:d},t&&Array.isArray(t)){const r=[],a=t.length;for(let c=0;c<a;c++){const l=t[c];r.push(l.id)}n.upload_file_id=r[0]}break;case 7:break;case 8:break;case 9:if(n={title:d},t&&Array.isArray(t)){const r=[],a=t.length;for(let c=0;c<a;c++){const l=t[c];r.push(l.id)}n.upload_files=r}break}return n}var kg={exports:{}},Sg={exports:{}};(function(){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t={rotl:function(e,s){return e<<s|e>>>32-s},rotr:function(e,s){return e<<32-s|e>>>s},endian:function(e){if(e.constructor==Number)return t.rotl(e,8)&16711935|t.rotl(e,24)&4278255360;for(var s=0;s<e.length;s++)e[s]=t.endian(e[s]);return e},randomBytes:function(e){for(var s=[];e>0;e--)s.push(Math.floor(Math.random()*256));return s},bytesToWords:function(e){for(var s=[],i=0,n=0;i<e.length;i++,n+=8)s[n>>>5]|=e[i]<<24-n%32;return s},wordsToBytes:function(e){for(var s=[],i=0;i<e.length*32;i+=8)s.push(e[i>>>5]>>>24-i%32&255);return s},bytesToHex:function(e){for(var s=[],i=0;i<e.length;i++)s.push((e[i]>>>4).toString(16)),s.push((e[i]&15).toString(16));return s.join("")},hexToBytes:function(e){for(var s=[],i=0;i<e.length;i+=2)s.push(parseInt(e.substr(i,2),16));return s},bytesToBase64:function(e){for(var s=[],i=0;i<e.length;i+=3)for(var n=e[i]<<16|e[i+1]<<8|e[i+2],r=0;r<4;r++)i*8+r*6<=e.length*8?s.push(d.charAt(n>>>6*(3-r)&63)):s.push("=");return s.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/ig,"");for(var s=[],i=0,n=0;i<e.length;n=++i%4)n!=0&&s.push((d.indexOf(e.charAt(i-1))&Math.pow(2,-2*n+8)-1)<<n*2|d.indexOf(e.charAt(i))>>>6-n*2);return s}};Sg.exports=t})();var zy=Sg.exports,Cd={utf8:{stringToBytes:function(d){return Cd.bin.stringToBytes(unescape(encodeURIComponent(d)))},bytesToString:function(d){return decodeURIComponent(escape(Cd.bin.bytesToString(d)))}},bin:{stringToBytes:function(d){for(var t=[],e=0;e<d.length;e++)t.push(d.charCodeAt(e)&255);return t},bytesToString:function(d){for(var t=[],e=0;e<d.length;e++)t.push(String.fromCharCode(d[e]));return t.join("")}}},Bu=Cd;/*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */var jy=function(d){return d!=null&&(Cg(d)||Hy(d)||!!d._isBuffer)};function Cg(d){return!!d.constructor&&typeof d.constructor.isBuffer=="function"&&d.constructor.isBuffer(d)}function Hy(d){return typeof d.readFloatLE=="function"&&typeof d.slice=="function"&&Cg(d.slice(0,0))}(function(){var d=zy,t=Bu.utf8,e=jy,s=Bu.bin,i=function(n,r){n.constructor==String?r&&r.encoding==="binary"?n=s.stringToBytes(n):n=t.stringToBytes(n):e(n)?n=Array.prototype.slice.call(n,0):!Array.isArray(n)&&n.constructor!==Uint8Array&&(n=n.toString());for(var a=d.bytesToWords(n),c=n.length*8,l=1732584193,h=-271733879,u=-1732584194,p=271733878,f=0;f<a.length;f++)a[f]=(a[f]<<8|a[f]>>>24)&16711935|(a[f]<<24|a[f]>>>8)&4278255360;a[c>>>5]|=128<<c%32,a[(c+64>>>9<<4)+14]=c;for(var g=i._ff,m=i._gg,_=i._hh,y=i._ii,f=0;f<a.length;f+=16){var x=l,w=h,k=u,S=p;l=g(l,h,u,p,a[f+0],7,-680876936),p=g(p,l,h,u,a[f+1],12,-389564586),u=g(u,p,l,h,a[f+2],17,606105819),h=g(h,u,p,l,a[f+3],22,-1044525330),l=g(l,h,u,p,a[f+4],7,-176418897),p=g(p,l,h,u,a[f+5],12,1200080426),u=g(u,p,l,h,a[f+6],17,-1473231341),h=g(h,u,p,l,a[f+7],22,-45705983),l=g(l,h,u,p,a[f+8],7,1770035416),p=g(p,l,h,u,a[f+9],12,-1958414417),u=g(u,p,l,h,a[f+10],17,-42063),h=g(h,u,p,l,a[f+11],22,-1990404162),l=g(l,h,u,p,a[f+12],7,1804603682),p=g(p,l,h,u,a[f+13],12,-40341101),u=g(u,p,l,h,a[f+14],17,-1502002290),h=g(h,u,p,l,a[f+15],22,1236535329),l=m(l,h,u,p,a[f+1],5,-165796510),p=m(p,l,h,u,a[f+6],9,-1069501632),u=m(u,p,l,h,a[f+11],14,643717713),h=m(h,u,p,l,a[f+0],20,-373897302),l=m(l,h,u,p,a[f+5],5,-701558691),p=m(p,l,h,u,a[f+10],9,38016083),u=m(u,p,l,h,a[f+15],14,-660478335),h=m(h,u,p,l,a[f+4],20,-405537848),l=m(l,h,u,p,a[f+9],5,568446438),p=m(p,l,h,u,a[f+14],9,-1019803690),u=m(u,p,l,h,a[f+3],14,-187363961),h=m(h,u,p,l,a[f+8],20,1163531501),l=m(l,h,u,p,a[f+13],5,-1444681467),p=m(p,l,h,u,a[f+2],9,-51403784),u=m(u,p,l,h,a[f+7],14,1735328473),h=m(h,u,p,l,a[f+12],20,-1926607734),l=_(l,h,u,p,a[f+5],4,-378558),p=_(p,l,h,u,a[f+8],11,-2022574463),u=_(u,p,l,h,a[f+11],16,1839030562),h=_(h,u,p,l,a[f+14],23,-35309556),l=_(l,h,u,p,a[f+1],4,-1530992060),p=_(p,l,h,u,a[f+4],11,1272893353),u=_(u,p,l,h,a[f+7],16,-155497632),h=_(h,u,p,l,a[f+10],23,-1094730640),l=_(l,h,u,p,a[f+13],4,681279174),p=_(p,l,h,u,a[f+0],11,-358537222),u=_(u,p,l,h,a[f+3],16,-722521979),h=_(h,u,p,l,a[f+6],23,76029189),l=_(l,h,u,p,a[f+9],4,-640364487),p=_(p,l,h,u,a[f+12],11,-421815835),u=_(u,p,l,h,a[f+15],16,530742520),h=_(h,u,p,l,a[f+2],23,-995338651),l=y(l,h,u,p,a[f+0],6,-198630844),p=y(p,l,h,u,a[f+7],10,1126891415),u=y(u,p,l,h,a[f+14],15,-1416354905),h=y(h,u,p,l,a[f+5],21,-57434055),l=y(l,h,u,p,a[f+12],6,1700485571),p=y(p,l,h,u,a[f+3],10,-1894986606),u=y(u,p,l,h,a[f+10],15,-1051523),h=y(h,u,p,l,a[f+1],21,-2054922799),l=y(l,h,u,p,a[f+8],6,1873313359),p=y(p,l,h,u,a[f+15],10,-30611744),u=y(u,p,l,h,a[f+6],15,-1560198380),h=y(h,u,p,l,a[f+13],21,1309151649),l=y(l,h,u,p,a[f+4],6,-145523070),p=y(p,l,h,u,a[f+11],10,-1120210379),u=y(u,p,l,h,a[f+2],15,718787259),h=y(h,u,p,l,a[f+9],21,-343485551),l=l+x>>>0,h=h+w>>>0,u=u+k>>>0,p=p+S>>>0}return d.endian([l,h,u,p])};i._ff=function(n,r,a,c,l,h,u){var p=n+(r&a|~r&c)+(l>>>0)+u;return(p<<h|p>>>32-h)+r},i._gg=function(n,r,a,c,l,h,u){var p=n+(r&c|a&~c)+(l>>>0)+u;return(p<<h|p>>>32-h)+r},i._hh=function(n,r,a,c,l,h,u){var p=n+(r^a^c)+(l>>>0)+u;return(p<<h|p>>>32-h)+r},i._ii=function(n,r,a,c,l,h,u){var p=n+(a^(r|~c))+(l>>>0)+u;return(p<<h|p>>>32-h)+r},i._blocksize=16,i._digestsize=16,kg.exports=function(n,r){if(n==null)throw new Error("Illegal argument "+n);var a=d.wordsToBytes(i(n,r));return r&&r.asBytes?a:r&&r.asString?s.bytesToString(a):d.bytesToHex(a)}})();var Uy=kg.exports;const qy=Xu(Uy);function Wc(d){return d?qy(d):Date.now()+""}function Gy(d,t){var s;return(s=t==null?void 0:t.agent)!=null&&s.icon,{client_custom_chat_type:0,client_custom_item_type:"q",client_custom_chat_status:2,client_custom_icon:Zu(),client_custom_unique_id:Wc(d.question),question:d.question}}const Eg=d=>`
- <pre><code class="hljs language-python">
- ${d}</code></pre>`,Tg=d=>`
- <pre><code class="hljs language-sql">
- ${d}</code></pre>`;function Vy(d,t){const s={client_custom_chat_type:0,client_custom_item_type:"a",client_custom_chat_status:2,client_custom_icon:Dc(t),client_custom_unique_id:Wc(d.answer),answer:d.answer};d.type,d.message;const i=d.reference;d.step_message;const n=d.files;d.message_files;const r=d.download_url,a=d.file_url,c=d.file_name,l=d.image_url,h=d.excel_url,u=d.excel_name,p=d.code,f=d.sql;if(h&&u&&(s.client_custom_linked_download_files={file_name:u,file_url:h}),a&&c&&(s.client_custom_linked_download_files={file_name:c,file_url:a}),r){const g=decodeURIComponent(r),m=decodeURIComponent(r).split("/"),_=m[m.length-1];s.client_custom_linked_download_files={file_name:_,file_url:g}}if(p){const g=Eg(p);s.client_custom_linked_code=g}if(f){const g=Tg(f);s.client_custom_linked_sql=g}if(l&&(s.client_custom_linked_image=l),n&&n[0]&&(s.client_custom_linked_download_files={file_name:n[0].file_name,file_url:n[0].file_url}),s.answer=mp(s.answer),i){const g=gp(i);g&&(s.answer=s.answer+`
- ${g}
- `),s.client_custom_linked_refference_full_content=i}return s}function Wy(d,t){const e=[];return d.forEach(s=>{const i=Gy(s,t),n=Vy(s,t);e.push(i),e.push(n)}),e}function Yy(d,t,e){const s=Date.now(),i=Zu();return{client_custom_item_type:"q",client_custom_create_time:s,client_custom_unique_id:Wc(d+s),client_custom_upload_file_list:t,client_custom_icon:i,question:d}}function Xy(d){return{client_custom_chat_type:2,client_custom_item_type:"a",client_custom_chat_status:0,client_custom_icon:Dc(d),client_custom_unique_id:"loading_"+Date.now(),question:"",answer:""}}function $y(d,t){return{client_custom_chat_type:1,client_custom_item_type:"a",client_custom_chat_status:2,client_custom_icon:Dc(d),client_custom_unique_id:"exception_"+Date.now(),question:"",answer:`<div style="color: red;">${t.message}</div>`}}function Ky(d,t,e){const s=tu(d),i=tu(Qu(t)),n=Dc(e),r=s.type,a=s.message,c=s.reference;s.step_message;const l=s.files,h=s.message_files,u=s.download_url,p=s.file_url,f=s.file_name,g=s.image_url,m=s.excel_url,_=s.excel_name,y=s.code,x=s.sql,w={client_custom_chat_type:2,client_custom_item_type:"a",client_custom_chat_status:1,client_custom_icon:n,question:s.question};for(let C in i)C==="client_custom_chat_type"||C==="client_custom_chat_status"||(w[C]=i[C]);let k=0,S="";if(r==="message"){if(k=1,w.answer=a,m&&_&&(w.client_custom_linked_download_files={file_name:_,file_url:m}),p&&f&&(w.client_custom_linked_download_files={file_name:f,file_url:p}),u){const C=decodeURIComponent(u),E=decodeURIComponent(u).split("/"),T=E[E.length-1];w.client_custom_linked_download_files={file_name:T,file_url:C}}if(y){const C=Eg(y);w.client_custom_linked_code=C}if(x){const C=Tg(x);w.client_custom_linked_sql=C}if(g&&(w.client_custom_linked_image=g),w.answer=mp(w.answer),c){const C=gp(c);C&&(w.answer=w.answer+`
- ${C}
- `),w.client_custom_linked_refference_full_content=c}}return r==="stream"&&(k=1,t&&t.answer?w.answer=t.answer+a:w.answer=a,l&&(l[0].file_name,l[0]&&(w.client_custom_linked_download_files={file_name:l[0].file_name,file_url:l[0].file_url}))),r==="system"&&(k=1,w.answer=a),r==="close"&&(k=2,w.client_custom_chat_status=2,w.client_custom_chat_type=1,h&&Array.isArray(h)&&h.forEach((C,E)=>{}),a&&(w.answer=a)),r==="error"&&(k=3,w.client_custom_chat_status=2,w.client_custom_chat_type=1,w.answer=a),w.client_custom_unique_id=Wc(w.answer),{status:k,message:S,data:w}}function Qy(d){const t=st(0),e=st(0),{proxy:s}=xr(),i=()=>{const n=s.$refs[d];t.value=n.offsetHeight,e.value=n.offsetWidth};return fi(()=>{i(),window.addEventListener("resize",i)}),Lc(()=>{window.removeEventListener("resize",i)}),{height:t,width:e}}function zu(d){const{proxy:t}=xr();return()=>{const e=t.$refs[d];e&&e.clear&&typeof e.clear=="function"&&e.clear()}}function Jy(d){const{proxy:t}=xr();return()=>{const e=t.$refs[d];return e&&e.getOptions&&typeof e.getOptions=="function"?e.getOptions():null}}function Zy(d){const{proxy:t}=xr();return e=>{const s=t.$refs[d];s&&s.scroll2Bottom&&typeof s.scroll2Bottom=="function"&&s.scroll2Bottom(e)}}const tw={class:"conversation-chat-container"},ew={class:"conversation-chat-left"},sw={class:"conversation-chat-main",ref:"chat_main"},iw={class:"conversation-chat-content"},nw={class:"conversation-chat-right"},ju=30,Hu=30,aw={__name:"ConversationChatContainer",props:{agent_id:String,session_id:String,chat_type:String},setup(d){const t=d,e=st({agent:{},config:{}}),s=st(100),{width:i,height:n}=Qy("chat_main"),r=zu("dialog_input"),a=zu("dialog_input_top"),c=Jy("dialog_input_top"),l=Zy("list_scroller"),h=()=>{Ku(()=>{l()})},u=Mt(()=>({})),p=Mt(()=>n.value-ju-Hu-s.value-20),f=st([]),g=st([]),m=st([]);st(0);const _=st(null),y=st({}),x=Mt(()=>[].concat(f.value,g.value)),w=Mt(()=>e.value.agent.menuId/1===1?"excel":""),k=st(!0),S=Mt(()=>{const I=e.value;return!I||!I.agent?!1:I.agent.menuId/1===9}),C=I=>{},E=I=>{},T=I=>{$u.error({content:I,position:"top"})},q=st(!1),j=I=>{const R=$y(e.value,I);g.value.pop(),g.value.push(R),q.value=!1,h()},H=I=>{I.width,s.value=I.height},Z=async I=>{const R=I.text,P=I.files;if(!R){T("请输入文字");return}const z=c(),F=Yy(R,P,e.value);y.value=F,g.value.push(y.value);const U=Xy(e.value);g.value.push(U),k.value=!1,r(),a(),m.value=[],y.value=null,q.value=!0,h();const Ft=t.agent_id;if(_.value===null)try{const De=await Ny(Ft);if(De.code/1===200){const Fs=De.data;_.value=Fs.chat_id}else{j({message:`code: ${De.code} message: ${De.msg}`});return}}catch(De){console.log("err-nfsdnakiuwirea7",De),j({message:De.message});return}let Is=null;if(P.length!==0){const De=_.value;try{const Fs=await Dy(Ft,De,P,e.value);if(Fs.code/1===200)Is=Fs.data;else{j({message:`code: ${Fs.code}
- message: ${Fs.msg}`});return}}catch(Fs){console.log("err-fhskafhakfjslkfjl",Fs),j({message:Fs.message});return}}const Yc=By(R,Is,e.value);if(z&&typeof z=="object")for(let De in z)Yc[De]=z[De];const Rg=Qu(Yc);Y(_.value,Rg)},$={onMessage:K,onError:Xe,onClose:xe},{initWSConnection:W,sendWSMessage:mt,getWSInstance:ee,closeWSConnect:le}=Fy($);function Y(I,R){W(t.agent_id,I,w.value),mt(R)}function K(I){const R=I.data,P=g.value[g.value.length-1],z=Ky(R,P,e.value),F=z.status,U=()=>{const Ft=z.data;g.value.pop(),g.value.push(Ft),h()};if(F===1&&U(),F===2){U();const Ft=z.suggest;Ft&&(m.value=Ft),q.value=!1}F===3&&(U(),q.value=!1)}function Xe(I){console.log("socket-error-8jfdksagjsfdjaklnfsdajkl",I),j({message:`对话无法继续:WebSocket Error: ${I.target.url}`})}function xe(I){}return fi(()=>{const I=t.agent_id,R=t.session_id;e.value=My(I),R&&Oy(I,R).then(P=>{if(P.code/1===200){const z=P.data,F=Wy(z,e.value);F.length!==0&&(k.value=!1,h()),f.value=F}else k.value=!1,j({message:P.msg})}).catch(P=>{console.log("err-mfsjakfjsdkalfjs",P),k.value=!1,j({message:P.message})})}),Lc(()=>{le()}),(I,R)=>(N(),X("div",tw,[M("div",ew,[at(Vg)]),M("div",sw,[at(Xg,{class:"conversation-chat-header",agent_info:e.value,style:Cl({height:ju+"px"})},null,8,["agent_info","style"]),M("div",iw,[k.value?(N(),At(Qg,{key:0,class:"conversation-chat-area",agent_info:e.value},null,8,["agent_info"])):St("",!0),k.value?St("",!0):(N(),At(Q_,{key:1,ref:"list_scroller",class:"conversation-chat-area",height:p.value,agent_id:d.agent_id,list:x.value,suggestion:m.value,onShare:C,onSubmit:E},null,8,["height","agent_id","list","suggestion"])),at(gy,{ref:"dialog_input",class:"conversation-chat-input",style:Cl(u.value),agent_info:e.value.agent,agent_config:e.value.config,disabled:q.value,onSizeChange:H,onSubmit:Z},Ng({_:2},[S.value?{name:"top",fn:ut(()=>[at(_y,{agent_info:e.value,ref:"dialog_input_top"},null,8,["agent_info"])]),key:"0"}:void 0]),1032,["style","agent_info","agent_config","disabled"])]),at(ky,{class:"conversation-chat-footer",style:Cl({height:Hu+"px"})},null,8,["style"])],512),M("div",nw,[at(Ty)])]))}},rw=ct(aw,[["__scopeId","data-v-fac9a8bb"]]),Cw={__name:"ConversationQA",setup(d){const t=Og(),e=Bg(),s=Ju(),i=st(""),n=st(""),r=st(1),a=st(""),c=()=>{e.back()};async function l(h){if(!h)return!1;const u=s.getList();return u.length===0?!0:!!u.find(f=>f.id===h)}return fi(async()=>{const h=t.query,u=h.agent,p=h.session;if(u){if(!await l(u)){r.value=3,a.value="非法操作:参数异常";return}i.value=u,n.value=p,r.value=2,a.value="success"}else{let f=null;const g=s.getList(),m=g.length;if(m>1){for(let _=0;_<m;_++){const y=g[_];if(y.name==="知识问答"){f=y.id;break}}f||(f=g[0].id)}else m===1?f=g[0].id:f=Fc("DEFAULT_CHAT_AGENT_ID");i.value=f,r.value=2,a.value="success"}}),(h,u)=>{const p=It("a-button"),f=It("a-space"),g=It("a-result");return N(),At(zg,null,{default:ut(()=>[at(jg,null,{default:ut(()=>[at(Hg),r.value===2?(N(),At(rw,{key:0,agent_id:i.value,session_id:n.value},null,8,["agent_id","session_id"])):St("",!0),r.value===3?(N(),At(g,{key:1,status:"error",title:a.value},{extra:ut(()=>[at(f,null,{default:ut(()=>[at(p,{type:"primary",onClick:c},{default:ut(()=>u[0]||(u[0]=[Wi("返回")])),_:1})]),_:1})]),_:1},8,["title"])):St("",!0)]),_:1})]),_:1})}}};export{Cw as default};
|