(() => {
var __pluginModule=(()=>{var be=Object.defineProperty;var Br=Object.getOwnPropertyDescriptor;var $r=Object.getOwnPropertyNames;var Fr=Object.prototype.hasOwnProperty;var jr=(n,c)=>{for(var i in c)be(n,i,{get:c[i],enumerable:!0})},Vr=(n,c,i,d)=>{if(c&&typeof c=="object"||typeof c=="function")for(let r of $r(c))!Fr.call(n,r)&&r!==i&&be(n,r,{get:()=>c[r],enumerable:!(d=Br(c,r))||d.enumerable});return n};var Gr=n=>Vr(be({},"__esModule",{value:!0}),n);var wo={};jr(wo,{default:()=>bo});function qr(n){return[1,3,5].map(c=>Math.round(parseInt(n.slice(c,c+2),16)/255*1e3)/1e3)}var Yt=[["coral","Coral","#F2998C",12],["peach","Peach","#F9B68D",13],["yellow","Yellow","#F3DE6C",14],["green","Green","#BBE077",15],["mint","Mint","#65D2AA",16],["sky","Sky","#87D7E4",17],["blue","Blue","#84B6D9",18],["purple","Purple","#B49EE2",19],["orchid","Orchid","#DA99E0",20],["pink","Pink","#E893BD",21],["grey","Grey","#DFDFDF",22]].map(([n,c,i,d])=>({id:n,label:c,hex:i,cycleIndex:d,rgb:qr(i)})),Mt=["coral","yellow","green","blue"],tn=4,Xt="Highlight colors",Wt="yellow",Et=[["highlight","Highlight","Highlight"],["underline","Underline","Underline"],["strike","Strikethrough","StrikeOut"]].map(([n,c,i])=>({id:n,label:c,pdfSubtype:i})),Pt=Et[0].id,St="Annotate and Highlight PDFs",Jt=`${St} data`,Yr=["PDF Annotator data"],st=[Jt,...Yr],en="Highlights",nn="attachment://",rn=1,on=14,an=.35,ln=1.2,Nt={pdfJs:"https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js",pdfJsWorker:"https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js",pdfViewerCss:"https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf_viewer.min.css",pdfLib:"https://cdnjs.cloudflare.com/ajax/libs/pdf-lib/1.17.1/pdf-lib.min.js",robotoCss:"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"},Xr="https://plugins.amplenote.com/cors-proxy";function cn(n){let c=new URL(Xr);return c.searchParams.set("apiurl",n),c.toString()}var Wr="application/pdf";function Jr(n){return Array.isArray(n)?n.filter(c=>c&&c.type===Wr&&c.uuid):[]}async function dn(n,c){let i=await n.getNoteAttachments({uuid:c}),d=Jr(i);if(d.length===0)return null;if(d.length===1)return d[0];let r=await n.prompt("Which PDF do you want to annotate?",{inputs:[{label:"PDF",type:"radio",options:d.map(l=>({label:l.name,value:l.uuid})),value:d[0].uuid}]});if(r==null)return null;let p=Array.isArray(r)?r[0]:r;return d.find(l=>l.uuid===p)||null}async function sn(n,c){if(!c)throw new Error("fetchableAttachmentURL: attachmentUUID required");let i=await n.getAttachmentURL(c);if(!i)throw new Error(`No URL returned for attachment ${c}`);return cn(i)}function _t(n){let c=typeof n=="string"?Number(n):n;return!Number.isFinite(c)||c<an||c>ln?null:Math.round(c*100)/100}function pn(n,c){return n?on:_t(c)||rn}function zt(n){let c={attachmentUUID:null,page:null,x:null,y:null,highlightId:null,noteUUID:null,collapsed:!1,attachmentName:"",aspectRatio:null};if(!n||typeof n!="string")return c;let i;try{i=new URLSearchParams(n.replace(/^\?/,""))}catch{return c}let d=p=>{let l=i.get(p);if(l===null||l.trim()==="")return null;let w=Number(l);return Number.isFinite(w)?w:null},r=d("page");return{attachmentUUID:i.get("att")||null,page:r!==null&&r>=1?Math.floor(r):null,x:d("x"),y:d("y"),highlightId:i.get("hl")||null,noteUUID:i.get("note")||null,collapsed:i.get("c")==="1",attachmentName:i.get("n")||"",aspectRatio:_t(i.get("ar"))}}function un({attachmentUUID:n,page:c,x:i,y:d,highlightId:r,collapsed:p,attachmentName:l,aspectRatio:w}={}){let N=new URLSearchParams;n&&N.set("att",n),p&&N.set("c","1");let _=_t(w);return _&&N.set("ar",String(_)),l&&N.set("n",l),Number.isFinite(c)&&c>=1&&N.set("page",String(Math.floor(c))),Number.isFinite(i)&&N.set("x",String(i)),Number.isFinite(d)&&N.set("y",String(d)),r&&N.set("hl",r),N.toString()}function fn(n,c={},i=null){if(!n)throw new Error("buildEmbedMarkup: pluginUUID required");i===null&&(i=pn(c.collapsed,c.aspectRatio));let d=un(c);return`<object data="${d?`plugin://${n}?${d}`:`plugin://${n}`}" data-aspect-ratio="${i}" />`}function hn(n,c,i){if(!n||!c||!i)return null;let d=n.split(`
`),r=d.findIndex(l=>l.includes(`${nn}${c}`));if(r===-1)return null;let p=d.slice();return d[r+1]===""?p.splice(r+2,0,i.trim(),""):p.splice(r+1,0,"",i.trim(),""),p.join(`
`)}function gn(n,c,i){let d=`plugin://${c}`;return n.findIndex(r=>r.includes("<object")&&r.includes(d)&&r.includes(`att=${i}`))}function mn(n,c,i=null){if(!n||!c)return!1;let d=`plugin://${c}`;return String(n).split(`
`).some(r=>r.includes("<object")&&r.includes(d)&&(!i||r.includes(`att=${i}`)))}function Kt(n,c,i){if(!n||!c||!i)return null;let d=n.split(`
`),r=gn(d,c,i);if(r===-1)return null;let p=d.slice();return p.splice(r,1),p[r]===""&&p[r-1]===""&&p.splice(r,1),p.join(`
`)}function It(n,c,i,d={}){if(!n||!c||!i)return null;let r=n.split(`
`),p=gn(r,c,i);if(p===-1)return null;let l=r[p],w=l.match(/data="(plugin:\/\/[^"]*)"/);if(!w)return null;let N=w[1],_=N.indexOf("?"),D=_===-1?"":N.slice(_+1),R={...zt(D),attachmentUUID:i,...d},x=un(R),I=x?`plugin://${c}?${x}`:`plugin://${c}`,T=r.slice(),H=l.replace(w[0],`data="${I}"`),U=pn(R.collapsed,R.aspectRatio),u=H.match(/data-aspect-ratio="[^"]*"/);return H=u?H.replace(u[0],`data-aspect-ratio="${U}"`):H.replace(/\s*\/>\s*$/,` data-aspect-ratio="${U}" />`),T[p]=H,T.join(`
`)}function vn(n,c,i,d){return It(n,c,i,{collapsed:!!d})}async function xn(n,c,i){let d=await dn(n,c);if(!d){let w=await n.getNoteAttachments({uuid:c});return(!(Array.isArray(w)&&w.length>0)||!w.some(_=>_&&_.type==="application/pdf"))&&await n.alert(`No PDF attachments on this note.
Attach a PDF to this note, then run this again.`),null}let r=await n.getNoteContent({uuid:c});if(mn(r,i,d.uuid))return await n.alert(`"${d.name}" is already open in this note - scroll to the viewer.`),d.uuid;let p=fn(i,{attachmentUUID:d.uuid,attachmentName:d.name}),l=hn(r,d.uuid,p);return l!==null?(await n.replaceNoteContent({uuid:c},l),d.uuid):(await n.insertNoteContent({uuid:c},`
${p}
`,{atEnd:!0}),d.uuid)}var Kr=n=>`https://www.amplenote.com/notes/${n}`;async function Qr(n,c,i,d){let r={uuid:c},p=Kt(i,n.context.pluginUUID,d);if(p!==null)try{await n.replaceNoteContent(r,p)}catch{}try{await n.replaceNoteContent(r,i)}catch{await n.replaceNoteContent(r,i)}}async function bn(n,c){let{noteUUID:i,attachmentUUID:d,page:r,highlightId:p}=zt(c);if(!i){await n.alert("This link doesn't say which note the PDF lives on - it was likely exported by an older version of this plugin. Re-export the highlight to get a working link.");return}let l=!!(n.context&&n.context.noteUUID===i);try{let w=await n.getNoteContent({uuid:i}),N=It(w,n.context.pluginUUID,d,{page:r,highlightId:p,collapsed:!1});N!==null&&(l?await Qr(n,i,N,d):await n.replaceNoteContent({uuid:i},N))}catch{}await n.navigate(Kr(i))}function Ot(n){if(!n)return null;let c=String(n).trim().toLowerCase(),i=c.startsWith("#")?c:"#"+c;return Yt.find(d=>d.id===c||d.hex.toLowerCase()===i||d.label.toLowerCase()===c)||null}function wn(){return Ot(Wt)}function Qt(n){let c=[];for(let i of String(n??"").split(/[,;\s]+/)){let d=Ot(i);if(d&&c.indexOf(d.id)===-1&&c.push(d.id),c.length===tn)break}return c.length?c:Mt.slice()}function yn(n){let c=n&&n.length?n:Mt;return c.indexOf(Wt)!==-1?Wt:c[0]}function Zr(n){if(!n)return Pt;let c=String(n).trim().toLowerCase(),i=Et.find(d=>d.id===c||d.label.toLowerCase()===c);return i?i.id:Pt}function to(){return"hl-"+Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,8)}function Zt({page:n,color:c,rects:i,quoteText:d,note:r=null,id:p=null,style:l=null}){if(!Number.isInteger(n)||n<1)throw new Error(`createHighlight: page must be a positive integer, got ${n}`);if(!Array.isArray(i)||i.length===0)throw new Error("createHighlight: rects must be a non-empty array");for(let N of i)if(![N.x,N.y,N.width,N.height].every(Number.isFinite))throw new Error(`createHighlight: malformed rect ${JSON.stringify(N)}`);let w=Ot(c)||wn();return{id:p||to(),page:n,color:w.id,style:Zr(l),rects:i.map(N=>({x:N.x,y:N.y,width:N.width,height:N.height})),quoteText:String(d||""),note:r?String(r):null}}function Cn(n,c){let i=c==null?null:String(c).trim();return{...n,note:i||null}}function En(n,c){let i=Ot(c);if(!i)throw new Error(`withColor: unknown color "${c}"`);return{...n,color:i.id}}function Sn(n,c){let i=Et.find(d=>d.id===c);if(!i)throw new Error(`withStyle: unknown mark style "${c}"`);return{...n,style:i.id}}function Nn(n,c){return(n||[]).filter(i=>i.id!==c)}function te(n,c,i){let d=!1,r=(n||[]).map(p=>p.id!==c?p:(d=!0,i(p)));return d?r:n}var eo="json",Ut="__exportNotes",In=`*Managed automatically by the ${St} plugin - safe to ignore, don't edit.*`,no=["*Managed automatically by the PDF Annotator plugin - safe to ignore, don't edit.*"];function ro(n){let c=JSON.stringify(n,null,0).replace(/`/g,"\\u0060");return`${In}
\`\`\`${eo}
${c}
\`\`\``}function ee(n){if(!n)return null;let c=n.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/),i=!c&&n.match(/<!--\s*PDFA-DATA\s*\n?([\s\S]*?)-->/),d=(c?c[1]:i?i[1]:n).trim();if(!d)return null;try{return JSON.parse(d)}catch{return null}}function oo(n){if(!Array.isArray(n))return[];let c=[];for(let i of n)try{c.push(Zt(i))}catch{}return c}async function ne(n,c,i){let d=await n.getNoteContent({uuid:c}),r=oe(d,st),p=ee(r);return!p||typeof p!="object"?[]:oo(p[i])}async function we(n,c,i){let d={uuid:c},r=await n.getNoteContent(d);po(r);let p=oe(r,st),l=ao(r),w=ee(p)||{},N=i(w);if(N===null)return;let _=ro(N);p===null&&await n.insertNoteContent(d,`
# ${Jt}
`,{atEnd:!0});let D=uo(r,_);if(D!==null){await n.replaceNoteContent(d,D);return}await n.replaceNoteContent(d,_,{section:{heading:{text:l,level:1}}})}async function Un(n,c,i,d){await we(n,c,r=>({...r,[i]:d}))}async function Tn(n,c,i){await we(n,c,d=>{let r=d[Ut],p=r&&typeof r=="object"&&i in r;if(!(i in d)&&!p)return null;let l={...d};if(delete l[i],p){let w={...r};delete w[i],Object.keys(w).length?l[Ut]=w:delete l[Ut]}return l})}async function An(n,c,i){let d=await n.getNoteContent({uuid:c}),r=ee(oe(d,st));if(!r||typeof r!="object")return null;let p=r[Ut];if(!p||typeof p!="object")return null;let l=p[i];return typeof l=="string"&&l?l:null}async function kn(n,c,i,d){await we(n,c,r=>{let p=r[Ut],l=p&&typeof p=="object"?p:{};return l[i]===d?null:{...r,[Ut]:{...l,[i]:d}}})}async function Dn(n,c,i,d){let r={uuid:c},p=await n.getNoteContent(r);if(oe(p,i)===null){let l=p&&p.trim()?`
`:"";await n.insertNoteContent(r,`${l}# ${i}
`,{atEnd:!0})}await n.replaceNoteContent(r,d,{section:{heading:{text:i,level:1}}})}function Rn(n,c){let i=[].concat(c),d=/^#\s+(.*)$/,r=[];for(let p=0;p<n.length;p++){let l=n[p].match(d);!l||!i.includes(l[1].trim())||(r.length&&(r[r.length-1].end=p),r.push({start:p,end:n.length,text:l[1].trim()}))}for(let p of r)for(let l=p.start+1;l<p.end;l++)if(/^#\s+/.test(n[l])){p.end=l;break}return r}function re(n,c){let i=Rn(n,c);return i.length?i.find(r=>ee(n.slice(r.start+1,r.end).join(`
`).trim()))||i[0]:null}function ao(n){let c=re((n||"").split(`
`),st);return c?c.text:Jt}function ye(n){let c=String(n).match(/^#\s+(.*)$/);return!!c&&st.includes(c[1].trim())}function oe(n,c){if(!n)return null;let i=n.split(`
`),d=re(i,c);return d?i.slice(d.start+1,d.end).join(`
`).trim():null}function io(n){if(!n)return"";let c=n,i=c.match(/```(?:json)?\s*\n?[\s\S]*?\n?```/);i&&(c=c.replace(i[0],"")),c=c.replace(/<!--\s*PDFA-DATA[\s\S]*?-->/,"");for(let d of[In,...no])c=c.replace(d,"");return c.trim()}function lo(n){return String(n).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function co(n,c){return c?new RegExp("\\]\\(plugin://"+lo(c)+"[^)]*[?&]hl=").test(n):n.includes("](plugin://")}function so(n){let c=n.split(`
`),i=c.findIndex(ye);i===-1&&(i=c.length);for(let d=i-1;d>=0;d--){let r=c[d].trim();if(r!=="")return r==="---"}return!0}function Ln(n,c,i){let d=String(n||"");return co(d,i)||so(d)?c:`---
${c}`}function Hn(n,c){let i=(n||"").split(`
`),d=re(i,st);if(!d)return null;let r=i.slice(0,d.start).join(`
`).replace(/\s+$/,""),p=i.slice(d.start).join(`
`);return`${r?r+`
`:""}${c}
${p}`}function po(n){let c=Rn((n||"").split(`
`),st),i=c.length;if(i<2)return;let d=[...new Set(c.map(r=>`"${r.text}"`))].join(" and ");throw new Error(`this note has ${i} ${d} headings, so highlights cannot be saved reliably. Delete the empty one - keep the heading whose code block holds the JSON - and try again.`)}function uo(n,c){let i=(n||"").split(`
`),d=re(i,st);if(!d)return null;let r=io(i.slice(d.start+1,d.end).join(`
`).trim());if(!r)return null;let p=i.slice(0,d.start).join(`
`).replace(/\s+$/,""),l=i.slice(d.end).join(`
`).replace(/^\s+/,"");return`${p?p+`
`:""}${r}
${i[d.start]}
${c}${l?`
`+l:""}`}function Mn(n){return/^\s*>/.test(n)}function Pn(n,c,i,d){if(!n||!c||!d)return null;for(let r=0;r<n.length;r++){let p=n[r];if(!p.includes(`](plugin://${c}`)||i&&!p.includes(`att=${i}`)||!new RegExp(`hl=${fo(d)}(?![\\w-])`).test(p))continue;let l=r+1;for(l<n.length&&n[l].trim()===""&&l+1<n.length&&Mn(n[l+1])&&l++;l<n.length&&Mn(n[l]);)l++;return{start:r,end:l}}return null}function fo(n){return String(n).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ho(n,c,i){if(!n||!c)return[];let d=[],r=String(n).split(`
`);for(let p of r){if(!p.includes(`](plugin://${c}`)||i&&!p.includes(`att=${i}`))continue;let l=p.match(/[?&]hl=([^&)\s]+)/);l&&d.indexOf(l[1])===-1&&d.push(l[1])}return d}function _n(n,c,i,d){let r=String(n||"").split(`
`),p=Pn(r,c,i,d);if(!p)return null;let{start:l,end:w}=p;w<r.length&&r[w].trim()===""&&w++;let N=r.slice(0,l).concat(r.slice(w));return ho(N.join(`
`),c,i).length?N.join(`
`):go(N).join(`
`)}function go(n){let c=n.findIndex(ye);c===-1&&(c=n.length);for(let i=c-1;i>=0;i--){let d=n[i].trim();if(d==="")continue;if(d!=="---")return n;let r=n.slice(0,i).concat(n.slice(i+1)),p=i;for(;p<r.length&&r[p].trim()===""&&(p===0||r[p-1].trim()==="");)r.splice(p,1);return r}return n}function ae(n,c,i,d,r){let p=String(n||"").split(`
`),l=Pn(p,c,i,d);return l?p.slice(0,l.start).concat(String(r).split(`
`),p.slice(l.end)).join(`
`):null}function et(n,c){return c.noteUUID||n.context.noteUUID}async function zn(n,c,i){try{let d=await n.getNoteAttachments({uuid:c}),r=Array.isArray(d)&&d.find(p=>p&&p.uuid===i);return r?r.name:""}catch{return""}}async function Bt(n,c,i,d){let r=await ne(n,c,i),p=d(r);return p!==r&&await Un(n,c,i,p),{highlights:p}}async function Ce(n,c,i,d){if(i.pluginUUID)try{let r=await n.getNoteContent({uuid:c}),p=d(r);p!==null&&p!==r&&await n.replaceNoteContent({uuid:c},p)}catch{}}function On(n){if(n&&typeof n=="object")return n;if(typeof n!="string")return{};let c=n.trim();if(!c.startsWith("{"))return{action:c};try{return JSON.parse(c)}catch{return{action:c}}}async function Bn(n,c){return JSON.stringify(await mo(n,On(c)))}async function mo(n,c){let i=On(c);switch(i.action){case"getPdfUrl":{let d=i.attachmentUUID;if(!d)return{error:"No attachment specified for this viewer."};try{return{url:await sn(n,d),name:await zn(n,et(n,i),d)}}catch(r){return{error:`Could not load the PDF: ${r.message}`}}}case"loadHighlights":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let d=et(n,i);return{highlights:await ne(n,d,i.attachmentUUID)}}catch(d){return{error:`Could not load highlights: ${d.message}`}}}case"addHighlight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let d=Zt(i.highlight||{});return await Bt(n,et(n,i),i.attachmentUUID,r=>r.concat([d]))}catch(d){return{error:`Could not save the highlight: ${d.message}`}}}case"recolorHighlight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let d=et(n,i),r=await Bt(n,d,i.attachmentUUID,p=>te(p,i.id,l=>En(l,i.color)));return i.exportBlock&&await Ce(n,d,i,p=>ae(p,i.pluginUUID,i.attachmentUUID,i.id,i.exportBlock)),r}catch(d){return{error:`Could not change the highlight color: ${d.message}`}}}case"restyleHighlight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let d=et(n,i),r=await Bt(n,d,i.attachmentUUID,p=>te(p,i.id,l=>Sn(l,i.style)));return i.exportBlock&&await Ce(n,d,i,p=>ae(p,i.pluginUUID,i.attachmentUUID,i.id,i.exportBlock)),r}catch(d){return{error:`Could not change the mark: ${d.message}`}}}case"setHighlightNote":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{return await Bt(n,et(n,i),i.attachmentUUID,d=>te(d,i.id,r=>Cn(r,i.note)))}catch(d){return{error:`Could not save the note: ${d.message}`}}}case"removeHighlight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let d=et(n,i),r=await Bt(n,d,i.attachmentUUID,p=>Nn(p,i.id));return await Ce(n,d,i,p=>_n(p,i.pluginUUID,i.attachmentUUID,i.id)),r}catch(d){return{error:`Could not remove the highlight: ${d.message}`}}}case"sendToNote":{if(!i.content)return{error:"Nothing to send."};try{let d={uuid:et(n,i)},r=await n.getNoteContent(d);if(i.highlightId){let w=ae(r,i.pluginUUID,i.attachmentUUID,i.highlightId,i.content);if(w!==null)return await n.replaceNoteContent(d,w),{ok:!0,replaced:!0}}let p=Ln(r,i.content,i.pluginUUID),l=Hn(r,p);return l===null?await n.insertNoteContent(d,`
`+p+`
`,{atEnd:!0}):await n.replaceNoteContent(d,l),{ok:!0}}catch(d){return{error:`Could not add this to the note: ${d.message}`}}}case"removeViewer":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};if(!i.pluginUUID)return{error:"Missing plugin id - cannot locate this viewer."};try{let d=et(n,i),r=await n.getNoteContent({uuid:d}),p=Kt(r,i.pluginUUID,i.attachmentUUID);return p===null?{error:"Could not find this viewer's block in the note - it may already be removed."}:(await n.replaceNoteContent({uuid:d},p),await Tn(n,d,i.attachmentUUID),{ok:!0})}catch(d){return{error:`Could not remove this viewer: ${d.message}`}}}case"getViewerSummary":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};let d=et(n,i),r=await zn(n,d,i.attachmentUUID);try{let p=await ne(n,d,i.attachmentUUID);return{name:r,count:p.length}}catch{return{name:r,count:0}}}case"setCollapsed":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};if(!i.pluginUUID)return{error:"Missing plugin id - cannot locate this viewer."};try{let d=et(n,i),r=await n.getNoteContent({uuid:d}),p=vn(r,i.pluginUUID,i.attachmentUUID,i.collapsed);return p===null?{ok:!1}:(await n.replaceNoteContent({uuid:d},p),{ok:!0})}catch(d){return{error:`Could not resize this viewer: ${d.message}`}}}case"setViewerHeight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};if(!i.pluginUUID)return{error:"Missing plugin id - cannot locate this viewer."};try{let d=et(n,i),r=await n.getNoteContent({uuid:d}),p=_t(i.aspectRatio),l=It(r,i.pluginUUID,i.attachmentUUID,{aspectRatio:p});return l===null?{ok:!1}:(await n.replaceNoteContent({uuid:d},l),{ok:!0,aspectRatio:p})}catch(d){return{error:`Could not resize this viewer: ${d.message}`}}}case"clearDeepLink":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};if(!i.pluginUUID)return{error:"Missing plugin id - cannot locate this viewer."};try{let d=et(n,i),r=await n.getNoteContent({uuid:d}),p=It(r,i.pluginUUID,i.attachmentUUID,{page:null,highlightId:null});return p===null?{ok:!1}:(await n.replaceNoteContent({uuid:d},p),{ok:!0})}catch(d){return{error:`Could not clear this viewer's deep link: ${d.message}`}}}case"exportAll":{if(!i.noteName)return{error:"Missing destination note name."};let d=et(n,i);try{let r=null;if(i.attachmentUUID){let p=await An(n,d,i.attachmentUUID);p&&await n.findNote({uuid:p})&&(r=p)}if(!r){let p=await n.findNote({name:i.noteName});r=p?p.uuid:await n.createNote(i.noteName)}if(await Dn(n,r,en,i.content||""),i.attachmentUUID)try{await kn(n,d,i.attachmentUUID,r)}catch{}return{ok:!0,noteUUID:r}}catch(r){return{error:`Could not export highlights: ${r.message}`}}}case"setToolbarColors":{let d=Qt(Array.isArray(i.colorIds)?i.colorIds.join(","):i.colorIds),r=d.join(", ");try{return typeof n.setSetting!="function"?{ids:d,saved:!1,error:"This Amplenote version can't save plugin settings."}:(await n.setSetting(Xt,r),{ids:d,saved:!0})}catch(p){return{ids:d,saved:!1,error:`Could not save your colors: ${p.message}`}}}case"ping":return{ok:!0};default:return{error:`Unknown embed action: ${String(i.action)}`}}}var $n=`*{box-sizing:border-box}body{margin:0;background:transparent;font:13px Roboto,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}#pdfa-root{display:flex;flex-direction:column;height:100vh;background:var(--pdfa-bg);color:var(--pdfa-fg);position:relative;border-radius:10px;overflow:hidden}#pdfa-root:after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;box-shadow:inset 0 0 0 1px var(--pdfa-border)}#pdfa-root.pdfa-collapsed-mode{height:auto}#pdfa-root.pdfa-collapsed-mode .pdfa-toolbar,#pdfa-root.pdfa-collapsed-mode .pdfa-status,#pdfa-root.pdfa-collapsed-mode .pdfa-body{display:none}.pdfa-collapsed{display:none;align-items:center;gap:8px;padding:10px 12px;background:var(--pdfa-toolbar);border-bottom:1px solid var(--pdfa-border)}#pdfa-root.pdfa-collapsed-mode .pdfa-collapsed{border-bottom:none}#pdfa-root.pdfa-collapsed-mode .pdfa-collapsed{display:flex}.pdfa-collapsed-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.85}.pdfa-collapsed-count{opacity:.6;font-size:12px;white-space:nowrap}.pdfa-body{position:relative;flex:1 1 auto;display:flex;min-height:0}.pdfa-toolbar{display:flex;align-items:center;gap:4px;padding:5px 8px;min-height:38px;background:var(--pdfa-toolbar);border-bottom:1px solid var(--pdfa-border);flex:0 0 auto;flex-wrap:wrap}.pdfa-toolbar button{font:inherit;padding:5px 9px;border:1px solid transparent;background:transparent;color:inherit;border-radius:6px;cursor:pointer;line-height:1.2}.pdfa-toolbar button:hover{background:var(--pdfa-btn-hover)}.pdfa-toolbar button:disabled{opacity:.4;cursor:default;background:transparent}.pdfa-toolbar button[aria-pressed=true]:not(.pdfa-color){background:var(--pdfa-btn-hover)}.pdfa-toolbar button.pdfa-icon-btn{display:inline-flex;align-items:center;justify-content:center;gap:5px;padding:6px}.pdfa-icon{display:block;width:18px;height:18px;fill:currentColor;opacity:.78}.pdfa-toolbar button:hover .pdfa-icon,.pdfa-toolbar button[aria-pressed=true] .pdfa-icon{opacity:1}.pdfa-toolbar button.pdfa-notes-btn{padding:6px 8px}.pdfa-notes-btn .pdfa-count{font-size:12px;opacity:.85;font-variant-numeric:tabular-nums}.pdfa-label{min-width:62px;text-align:center;opacity:.85;font-variant-numeric:tabular-nums}.pdfa-zoom-field{font:inherit;width:62px;padding:5px 4px;border:1px solid transparent;border-radius:6px;background:transparent;color:inherit;cursor:text}.pdfa-zoom-field:hover{background:var(--pdfa-btn-hover)}.pdfa-zoom-field:focus{outline:none;opacity:1;background:var(--pdfa-toolbar);border-color:var(--pdfa-accent)}.pdfa-page-field{font:inherit;width:34px;padding:5px 2px;border:1px solid transparent;border-radius:6px;background:transparent;color:inherit;cursor:text;text-align:center}.pdfa-page-field:hover{background:var(--pdfa-btn-hover)}.pdfa-page-field:focus{outline:none;opacity:1;background:var(--pdfa-toolbar);border-color:var(--pdfa-accent)}.pdfa-page-total{min-width:0;padding-left:2px}.pdfa-sep{width:1px;height:20px;align-self:center;background:var(--pdfa-border);margin:0 5px}.pdfa-break,.pdfa-toolbar #pdfa-fit{display:none}.pdfa-brand{font-weight:500;font-size:12px;letter-spacing:.01em;color:var(--pdfa-accent);white-space:nowrap;padding-right:2px}.pdfa-spacer{flex:1 1 auto}.pdfa-scroll{flex:1 1 auto;overflow:auto;padding:12px;display:flex;flex-direction:column;gap:12px;overscroll-behavior:contain}.pdfa-page{position:relative;box-shadow:0 1px 6px #00000047;background:#fff;flex:0 0 auto;margin:0 auto}.pdfa-page canvas{display:block}.pdfa-status{padding:10px 12px;text-align:center;opacity:.8}.pdfa-error{color:var(--pdfa-error);opacity:1;white-space:pre-wrap}.textLayer{position:absolute;inset:0;overflow:hidden;line-height:1;opacity:.3;forced-color-adjust:none}.textLayer>span{color:transparent;position:absolute;white-space:pre;cursor:text;transform-origin:0% 0%}.textLayer>span{padding-block:.35em;margin-top:-.35em}.textLayer ::selection{background:#1a73e8}.textLayer>span::selection{background:#1a73e8}.textLayer{z-index:2}.pdfa-highlights{position:absolute;inset:0;overflow:hidden;pointer-events:none;mix-blend-mode:multiply;isolation:isolate}.pdfa-hl-group{position:absolute;inset:0}.pdfa-hl{position:absolute;border-radius:2px}.pdfa-hl-band{border-radius:1px}@keyframes pdfa-flash{0%,to{outline-color:transparent}15%,60%{outline-color:var(--pdfa-accent)}}.pdfa-hl-flash .pdfa-hl{outline:2px solid transparent;outline-offset:1px;animation:pdfa-flash 1.3s ease-in-out 2}#pdfa-root:focus{outline:none}.pdfa-color,.pdfa-toolbar .pdfa-color{width:20px;height:20px;padding:0;border-radius:50%;border:1px solid rgba(0,0,0,.28);cursor:pointer;font:inherit}.pdfa-color:hover,.pdfa-toolbar .pdfa-color:hover{background-clip:padding-box}.pdfa-color[aria-pressed=true],.pdfa-toolbar .pdfa-color[aria-pressed=true]{border:2px solid var(--pdfa-accent);box-shadow:inset 0 0 0 2px var(--pdfa-toolbar)}.pdfa-spill-hint{flex:0 0 100%;font-size:11px;opacity:.75;padding:0 2px 4px;text-align:center}.pdfa-popover{position:fixed;display:none;gap:5px;align-items:center;padding:6px 8px;z-index:20;background:var(--pdfa-toolbar);color:var(--pdfa-fg);max-width:320px;flex-wrap:wrap;max-height:calc(100vh - 8px);overflow-x:hidden;overflow-y:auto;border:1px solid var(--pdfa-border);border-radius:10px;box-shadow:0 6px 20px #00000024,0 1px 4px #0000001a}.pdfa-popover.pdfa-open{display:flex}.pdfa-popover.pdfa-editing,.pdfa-popover.pdfa-exporting,.pdfa-popover.pdfa-palette,.pdfa-popover.pdfa-menu{flex-wrap:nowrap}.pdfa-popover.pdfa-editing{flex-direction:column;align-items:stretch;width:274px}.pdfa-popover.pdfa-exporting{flex-direction:column;align-items:stretch;width:220px}.pdfa-popover.pdfa-palette{flex-direction:column;align-items:stretch;width:274px}.pdfa-popover.pdfa-menu{flex-direction:column;align-items:stretch;width:216px;gap:0;padding:5px}.pdfa-popover.pdfa-menu .pdfa-btn{justify-content:flex-start;text-align:left;padding:8px 10px}.pdfa-popover.pdfa-menu>*{flex:0 0 auto}.pdfa-popover.pdfa-menu .pdfa-btn:hover{background:var(--pdfa-btn-hover)}.pdfa-menu-tools{display:flex;align-items:center;justify-content:center;gap:4px;padding:2px 0}.pdfa-menu-tools .pdfa-label{min-width:52px}.pdfa-menu-tools .pdfa-btn[aria-pressed=true]{background:var(--pdfa-btn-hover)}.pdfa-menu-tools .pdfa-btn[aria-pressed=true] .pdfa-icon{opacity:1}.pdfa-menu-rule{height:1px;margin:5px 2px;background:var(--pdfa-border)}.pdfa-popover.pdfa-mark{flex-direction:column;flex-wrap:nowrap;align-items:stretch;width:270px;gap:6px;padding:6px}.pdfa-mark-row{display:flex;align-items:center;gap:6px;flex:0 0 auto}.pdfa-mark-row>*{flex:0 0 auto}.pdfa-mark-row.pdfa-mark-top{justify-content:space-between}.pdfa-mark-colors{display:flex;align-items:center;gap:7px}.pdfa-mark-row .pdfa-spacer{flex:1 1 auto}.pdfa-vrule{width:1px;align-self:stretch;background:var(--pdfa-border)}.pdfa-hrule{height:1px;flex:0 0 auto;background:var(--pdfa-border)}.pdfa-shape-row{display:flex;gap:2px}.pdfa-more-colors{padding:5px;border:1px solid transparent;background:transparent;color:inherit;border-radius:6px;cursor:pointer;display:inline-flex}.pdfa-more-colors:hover{background:var(--pdfa-btn-hover)}.pdfa-more-dot{width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;border:1px dashed var(--pdfa-border)}.pdfa-more-colors .pdfa-icon{width:14px;height:14px;opacity:.7}.pdfa-more-colors:hover .pdfa-icon{opacity:1}.pdfa-drawer{display:none;grid-template-columns:repeat(7,20px);gap:8px;justify-content:center;padding-top:2px}.pdfa-drawer.pdfa-open{display:grid}.pdfa-btn.pdfa-icon-only,.pdfa-btn.pdfa-shape-btn{padding:6px}.pdfa-shape-btn[aria-pressed=true]{background:var(--pdfa-btn-hover)}.pdfa-shape-btn[aria-pressed=true] .pdfa-icon{opacity:1}.pdfa-export-colors{display:flex;gap:6px;padding:2px 0 8px}.pdfa-export-hint{font-size:12px;opacity:.75;padding-bottom:6px}.pdfa-catalog-row{flex-wrap:wrap;gap:8px}.pdfa-catalog-row .pdfa-taken{opacity:.3}.pdfa-slot-row{display:flex;gap:12px;align-items:center;padding:2px 0 10px}.pdfa-slot-row .pdfa-slot{width:24px;height:24px}.pdfa-slot-empty{width:24px;height:24px;border-radius:50%;border:1px dashed var(--pdfa-border)}.pdfa-scope-hint{padding-top:2px}.pdfa-note-input{font:inherit;font-size:12px;width:100%;resize:vertical;padding:6px;border:1px solid var(--pdfa-border);border-radius:5px;background:var(--pdfa-bg);color:inherit}.pdfa-note-actions{display:flex;gap:5px;margin-top:6px;align-items:center}.pdfa-note-actions .pdfa-spacer{flex:1 1 auto}.pdfa-btn{font:inherit;font-size:13px;padding:6px 10px;line-height:1.25;display:inline-flex;align-items:center;gap:7px;border:1px solid transparent;background:transparent;color:inherit;border-radius:6px;cursor:pointer;white-space:nowrap}.pdfa-btn:hover{background:var(--pdfa-btn-hover)}.pdfa-btn:hover .pdfa-icon{opacity:1}.pdfa-btn-primary{border-color:var(--pdfa-accent);color:var(--pdfa-accent)}.pdfa-remove{color:var(--pdfa-error)}.pdfa-remove .pdfa-icon{opacity:.9}.pdfa-panel{position:absolute;top:8px;right:8px;bottom:8px;width:292px;max-width:calc(100% - 16px);background:var(--pdfa-toolbar);border:1px solid var(--pdfa-border);border-radius:10px;box-shadow:0 6px 20px #00000024,0 1px 4px #0000001a;overflow:hidden;display:none;z-index:15}.pdfa-panel.pdfa-open{display:block}.pdfa-panel-scroll{height:100%;overflow:auto;padding:8px}.pdfa-thumbs{position:absolute;top:8px;left:8px;bottom:8px;width:124px;max-width:calc(100% - 16px);background:var(--pdfa-toolbar);border:1px solid var(--pdfa-border);border-radius:10px;box-shadow:0 6px 20px #00000024,0 1px 4px #0000001a;overflow:hidden;display:none;z-index:15}.pdfa-thumbs.pdfa-open{display:block}.pdfa-thumbs-scroll{height:100%;overflow:auto;overflow-x:hidden;padding:8px 6px}.pdfa-thumb{display:block;width:100%;padding:0;margin-bottom:10px;background:transparent;border:none;font:inherit;color:inherit;cursor:pointer;border-radius:4px}.pdfa-thumb:last-child{margin-bottom:0}.pdfa-thumb-sheet{width:100%;background:#fff;border:1px solid var(--pdfa-border);border-radius:2px;display:block;overflow:hidden}.pdfa-thumb canvas{display:block;width:100%;height:100%}.pdfa-thumb-num{font-size:11px;opacity:.65;text-align:center;padding-top:3px;font-variant-numeric:tabular-nums}.pdfa-thumb:hover .pdfa-thumb-sheet{border-color:var(--pdfa-accent)}.pdfa-thumb:focus-visible{outline:2px solid var(--pdfa-accent);outline-offset:2px}.pdfa-thumb[aria-current=true] .pdfa-thumb-sheet{border-color:var(--pdfa-accent);box-shadow:0 0 0 2px var(--pdfa-accent)}.pdfa-thumb[aria-current=true] .pdfa-thumb-num{opacity:1;font-weight:600;color:var(--pdfa-accent)}.pdfa-panel-title{display:flex;justify-content:space-between;align-items:center;font-weight:600;padding:2px 4px 8px}.pdfa-panel-empty{opacity:.7;padding:6px 4px;font-size:12px;line-height:1.4}.pdfa-hl-row{display:flex;gap:8px;padding:7px 6px;border-radius:6px;cursor:pointer;align-items:flex-start}.pdfa-hl-row:hover{background:var(--pdfa-btn-hover)}.pdfa-chip{width:11px;height:11px;border-radius:3px;flex:0 0 auto;margin-top:3px;background:var(--pdfa-chip-color)}.pdfa-chip-band{background:none;border-radius:0;position:relative}.pdfa-chip-band:after{content:"";position:absolute;left:0;right:0;height:3px;border-radius:1px;background:var(--pdfa-chip-color)}.pdfa-chip-underline:after{bottom:1px}.pdfa-chip-strike:after{top:4px}.pdfa-hl-page{font-size:11px;opacity:.6;margin-bottom:2px}.pdfa-hl-quote{font-size:12px;line-height:1.35}.pdfa-hl-note{font-size:12px;line-height:1.35;opacity:.85;font-style:italic;margin-top:4px;padding-left:7px;border-left:2px solid var(--pdfa-border)}.pdfa-scrollnav{display:none;position:absolute;right:6px;top:50%;transform:translateY(-50%);flex-direction:column;gap:8px;z-index:16}.pdfa-scrollnav button{width:40px;height:40px;border-radius:50%;font:inherit;font-size:13px;line-height:1;cursor:pointer;color:inherit;padding:0;border:1px solid var(--pdfa-border);background:var(--pdfa-btn);opacity:.85;box-shadow:0 1px 4px #00000040;display:flex;align-items:center;justify-content:center}.pdfa-scrollnav .pdfa-icon{width:24px;height:24px;opacity:1}.pdfa-scrollnav button:disabled{opacity:.35}@media (max-width: 520px){.pdfa-sep,.pdfa-toolbar .pdfa-spacer{display:none}.pdfa-toolbar{gap:4px;padding:5px 6px;justify-content:center}.pdfa-label{min-width:44px}.pdfa-zoom-field{width:46px;padding:5px 2px}.pdfa-page-field{width:26px;padding:5px 1px}.pdfa-page-total{min-width:0}}@media (max-width: 420px){#pdfa-zoom-out,#pdfa-zoom-in,.pdfa-zoom-field,.pdfa-toolbar button.pdfa-notes-btn{display:none}.pdfa-break{display:block;flex:0 0 100%;height:0;order:1}.pdfa-toolbar #pdfa-styles,.pdfa-toolbar #pdfa-colors{order:2}.pdfa-toolbar #pdfa-fit{display:inline-flex}.pdfa-toolbar .pdfa-spacer{display:block}.pdfa-panel{left:8px;width:auto;max-width:none}}@media (pointer: coarse){.pdfa-scrollnav{display:flex}.pdfa-panel.pdfa-open .pdfa-panel-scroll{padding-right:54px}.pdfa-toolbar button:not(.pdfa-color){min-height:40px;padding:8px 12px}.pdfa-zoom-field,.pdfa-page-field{min-height:40px}.pdfa-toolbar button.pdfa-icon-btn{min-width:40px;padding:8px}.pdfa-btn{min-height:38px}.pdfa-hl-row{padding:11px 8px}.pdfa-color,.pdfa-toolbar .pdfa-color{position:relative}.pdfa-color:after{content:"";position:absolute;inset:-10px -5px}#pdfa-colors{display:inline-flex;gap:10px;vertical-align:middle}#pdfa-styles{display:inline-flex;align-items:center;gap:0}.pdfa-popover.pdfa-mark{width:285px}.pdfa-mark-colors{gap:12px}.pdfa-drawer{gap:12px;padding-top:14px}.pdfa-btn.pdfa-icon-only{min-width:38px;justify-content:center}.pdfa-collapsed{cursor:pointer}}@media (max-height: 34px){.pdfa-collapsed{padding:0 8px;gap:6px;font-size:12px;height:100%}.pdfa-collapsed .pdfa-btn{padding:0 8px;min-height:0;font-size:11px}.pdfa-collapsed-count{display:none}}
`;var at={chevronLeft:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z",chevronRight:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",remove:"M19 13H5v-2h14v2z",add:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",moreVert:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z",listBulleted:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z",arrowUp:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z",arrowDown:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z",fitScreen:"M21 11V3h-8l3.29 3.29-10 10L3 13v8h8l-3.29-3.29 10-10z",sidebar:"M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 19H4V5h5v14z"},Fn={note:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-3 9h-4v4h-2v-4H7V9h4V5h2v4h4v2z",copy:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",send:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z",remove:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",download:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",postAdd:"M17 19.22H5V7h7V5H5c-1.1 0-2 .9-2 2v12.22c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-7h-2v7.22zM19 2h-2v3h-3v2h3v3h2V7h3V5h-3V2zM7 9h8v2H7zm0 3v2h8v-2H7zm0 3h5v2H7z",collapse:"M7.41 18.59 8.83 20 12 16.83 15.17 20l1.41-1.41L12 14l-4.59 4.59zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.42 5.41 12 10l4.59-4.59z",highlight:"M17.75 7 14 3.25l-10 10V17h3.75l10-10zm2.96-2.96a.996.996 0 0 0 0-1.41L18.37.29a.996.996 0 0 0-1.41 0L15 2.25 18.75 6l1.96-1.96zM2 20h20v3H2z",underline:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z",strike:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z",list:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z",fitScreen:"M21 11V3h-8l3.29 3.29-10 10L3 13v8h8l-3.29-3.29 10-10z",restoreHeight:"M22 3.41 16.71 8.7 20 12h-8V4l3.29 3.29L20.59 2 22 3.41zM3.41 22l5.29-5.29L12 20v-8H4l3.29 3.29L2 20.59 3.41 22z",add:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",minus:"M19 13H5v-2h14v2z",palette:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5zm0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5a.54.54 0 0 0-.14-.35c-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7zM6.5 11.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm3-4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm3 4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"};function it(n){return'<svg class="pdfa-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="'+n+'"></path></svg>'}function Ee(){function n(u,h){return{x:u.left-h.left,y:u.top-h.top,width:u.width,height:u.height}}function c(u,h){return{x:Math.min(u[0],h[0]),y:Math.min(u[1],h[1]),width:Math.abs(h[0]-u[0]),height:Math.abs(h[1]-u[1])}}function i(u,h){var b=Math.pow(10,h===void 0?2:h),g=function(m){return Math.round(m*b)/b};return{x:g(u.x),y:g(u.y),width:g(u.width),height:g(u.height)}}function d(u){return u.width>.01&&u.height>.01}function r(u,h,b){for(var g=String(u??""),m=Math.max(0,h===void 0?0:h),S=Math.min(g.length,b===void 0?g.length:b),C=function(W){return W===""||/\s/.test(W)},A=[],E=m;E<S;){for(;E<S&&C(g.charAt(E));)E++;if(E>=S)break;for(var P=E;E<S&&!C(g.charAt(E));)E++;A.push({start:P,end:E})}return A}function p(u){for(var h="",b=!1,g=null,m=0,S=null,C=!1,A=!1,E=0;E<u.length;E++){var P=u[E];if(P.line!==null&&P.line!==void 0){var W=P.lineSize||m||0,O=Math.max(W/2,.5);if(g!==null&&Math.abs(P.line-g)>O){var nt=S===null||P.x===null||P.x===void 0?!0:S-P.x>Math.max(W*2,1);nt?C=!0:P.line>g&&P.lineSize&&m&&P.lineSize<m&&!w(u,E)?A=!0:b=!0}g=P.line,m=P.lineSize||m}P.xEnd!==null&&P.xEnd!==void 0&&(S=P.xEnd);for(var B=r(P.text,P.from,P.to),q=0;q<B.length;q++){var J=h.length>0&&q===0&&C,rt=!J&&h.length>0&&q===0&&A,K=!J&&!rt&&h.length>0&&(q>0||b||B[q].start>P.from);h+=(J?`
`:rt?"^":K?" ":"")+P.text.slice(B[q].start,B[q].end),C=!1,A=!1}b=B.length?P.to>B[B.length-1].end:P.to>P.from?!0:b}return h}function l(u,h){if(!h||!h.length)return null;for(var b=null,g=1/0,m=1/0,S=0;S<h.length;S++){var C=h[S],A=u.y<C.top?C.top-u.y:u.y>C.bottom?u.y-C.bottom:0,E=u.x<C.left?C.left-u.x:u.x>C.right?u.x-C.right:0;if(A===0&&E===0)return{x:u.x,y:u.y};(A<g||A===g&&E<m)&&(g=A,m=E,b=C)}return{x:Math.min(Math.max(u.x,b.left+.5),b.right-.5),y:Math.min(Math.max(u.y,b.top+.5),b.bottom-.5)}}function w(u,h){var b=u[h];if(b.xEnd===null||b.xEnd===void 0)return!1;for(var g=h+1;g<u.length;g++){var m=u[g];if(!(m.line===null||m.line===void 0))return m.line>=b.line||m.x===null||m.x===void 0?!1:m.x<b.xEnd}return!1}function N(u){for(var h=1/0,b=1/0,g=-1/0,m=-1/0,S=0;S<(u?u.length:0);S++){var C=u[S];d(C)&&(h=Math.min(h,C.left),b=Math.min(b,C.top),g=Math.max(g,C.left+C.width),m=Math.max(m,C.top+C.height))}return isFinite(h)?{left:h,top:b,width:g-h,height:m-b}:null}function _(u,h,b){for(var g=[],m=0;m<u.length;m++){var S=n(u[m],h);if(d(S)){var C=b(S.x,S.y),A=b(S.x+S.width,S.y+S.height),E=i(c(C,A));d(E)&&g.push(E)}}return g}function D(u,h){var b=h(u.x,u.y),g=h(u.x+u.width,u.y+u.height);return c(b,g)}function $(u,h,b){var g=h.right-h.left,m=h.bottom-h.top;if(g<=0||m<=0)return null;var S=u.x2-u.x1,C=u.y2-u.y1,A=u.x1+(b.left-h.left)/g*S,E=u.x2-(h.right-b.right)/g*S,P=u.y1+(b.bottom-h.bottom)/m*C,W=u.y2-(h.top-b.top)/m*C;return{x:A,y:P,width:E-A,height:W-P}}function R(u,h){var b=Math.min(u.y+u.height,h.y+h.height)-Math.max(u.y,h.y);return b>.5*Math.min(u.height,h.height)}function x(u,h){var b=h===void 0?.6:h;if(!u||u.length<2)return(u||[]).slice();for(var g=u.slice().sort(function(K,ot){return ot.y-K.y||K.x-ot.x}),m=[],S=0;S<g.length;S++){for(var C=!1,A=0;A<m.length;A++)if(R(m[A][0],g[S])){m[A].push(g[S]),C=!0;break}C||m.push([g[S]])}for(var E=[],P=0;P<m.length;P++){for(var W=m[P].slice().sort(function(K,ot){return K.x-ot.x}),O=null,nt=0;nt<W.length;nt++){var B=W[nt];if(O===null){O={x:B.x,y:B.y,width:B.width,height:B.height};continue}var q=B.x-(O.x+O.width);if(q<=b*Math.max(O.height,B.height)){var J=Math.max(O.x+O.width,B.x+B.width),rt=Math.max(O.y+O.height,B.y+B.height);O.x=Math.min(O.x,B.x),O.y=Math.min(O.y,B.y),O.width=J-O.x,O.height=rt-O.y}else E.push(O),O={x:B.x,y:B.y,width:B.width,height:B.height}}O!==null&&E.push(O)}return E.map(function(K){return i(K)})}function I(u,h,b,g){var m=g===void 0?0:g;return h>=u.x-m&&h<=u.x+u.width+m&&b>=u.y-m&&b<=u.y+u.height+m}function T(u,h,b,g,m){for(var S=u||[],C=S.length-1;C>=0;C--){var A=S[C];if(!(!A||A.page!==h||!A.rects)){for(var E=0;E<A.rects.length;E++)if(I(A.rects[E],b,g,m===void 0?1:m))return A}}return null}function H(u){return String(u??"").replace(/\r\n?/g,`
`).replace(/[^\S\n]+/g," ").replace(/ ?\n ?/g,`
`).replace(/\n+/g,`
`).trim()}function U(u,h){if(!u||!h||!h.length)return u;for(var b=u.y+u.height/2,g=u.x,m=u.x+u.width,S=null,C=null,A=0;A<h.length;A++){var E=h[A];b<E.top||b>E.bottom||E.right<=g||E.left>=m||(S=S===null?E.top:Math.min(S,E.top),C=C===null?E.bottom:Math.max(C,E.bottom))}return S===null?u:{x:u.x,y:S,width:u.width,height:C-S}}return{clientRectToLocal:n,rectFromCorners:c,roundRect:i,isVisibleRect:d,textTokenRanges:r,joinSelectionSlices:p,unionClientRects:N,clientRectsToPdfRects:_,pdfRectToViewportRect:D,itemRelativeRect:$,mergeLineRects:x,rectContainsPoint:I,hitTestHighlights:T,normalizeQuoteText:H,expandRectToLineBox:U,snapPointToLineBox:l}}var Q=Ee(),Qo=Q.clientRectToLocal,Zo=Q.rectFromCorners,ta=Q.roundRect,ea=Q.isVisibleRect,na=Q.textTokenRanges,ra=Q.joinSelectionSlices,oa=Q.unionClientRects,aa=Q.clientRectsToPdfRects,ia=Q.pdfRectToViewportRect,la=Q.expandRectToLineBox,ca=Q.itemRelativeRect,da=Q.mergeLineRects,sa=Q.rectContainsPoint,pa=Q.hitTestHighlights,ua=Q.normalizeQuoteText,fa=Q.snapPointToLineBox;function Se(){var n=[.957,.871,.424],c={highlight:"Highlight",underline:"Underline",strike:"StrikeOut"},i=.77,d=.15,r=.12,p=.6,l=1;function w(x,I){if(I!=="underline"&&I!=="strike")return x;for(var T=[],H=0;H<x.length;H++){var U=x[H],u=Math.max(p,U.height*r),h=I==="underline"?U.y-Math.max(p,U.height*d)-u:U.y+(U.height-U.height*i)-u/2;T.push({x:U.x,y:h,width:U.width,height:u})}return T}function N(x,I,T,H,U){var u=I.context.register(I.context.obj({Type:x.PDFName.of("ExtGState"),BM:x.PDFName.of("Multiply"),ca:x.PDFNumber.of(l)})),h=[x.pushGraphicsState(),x.setGraphicsState("GS0")];h.push(x.setFillingColor(x.rgb(H[0],H[1],H[2])));for(var b=0;b<T.length;b++){var g=T[b];h.push(x.moveTo(g.x,g.y)),h.push(x.lineTo(g.x,g.y+g.height)),h.push(x.lineTo(g.x+g.width,g.y+g.height)),h.push(x.lineTo(g.x+g.width,g.y)),h.push(x.closePath())}h.push(x.fill()),h.push(x.popGraphicsState());var m=I.context.formXObject(h,{BBox:U,Resources:{ExtGState:{GS0:u}}});return I.context.register(m)}function _(x,I,T,H){for(var U=8,u=220,h=String(x||""),b=0,g=h.split(/\r?\n/),m=0;m<g.length;m++)b+=Math.max(1,Math.ceil(g[m].length/45));var S=Math.max(72,Math.min(22+b*14,260)),C=I.maxX+U;C+u>T-U&&(C=T-U-u),C<U&&(C=U);var A=I.maxY;A>H-U&&(A=H-U);var E=A-S;return E<U&&(E=U,A=Math.min(E+S,H-U)),[C,E,C+u,A]}function D(x,I,T,H,U){for(var u=T.rects,h=c[T.style]?T.style:"highlight",b=[],g=u[0].x,m=u[0].y,S=u[0].x+u[0].width,C=u[0].y+u[0].height,A=0;A<u.length;A++){var E=u[A],P=E.x,W=E.x+E.width,O=E.y,nt=E.y+E.height;b.push(P,nt,W,nt,P,O,W,O),g=Math.min(g,P),m=Math.min(m,O),S=Math.max(S,W),C=Math.max(C,nt)}for(var B=w(u,h),q=g,J=m,rt=S,K=C,ot=0;ot<B.length;ot++){var pt=B[ot];q=Math.min(q,pt.x),J=Math.min(J,pt.y),rt=Math.max(rt,pt.x+pt.width),K=Math.max(K,pt.y+pt.height)}var ht=I.context.obj({Type:x.PDFName.of("Annot"),Subtype:x.PDFName.of(c[h]),Rect:I.context.obj([q,J,rt,K]),QuadPoints:I.context.obj(b),C:I.context.obj(H),F:x.PDFNumber.of(4),T:x.PDFString.of("Annotate and Highlight PDFs"),M:x.PDFString.of(new Date().toISOString()),CA:x.PDFNumber.of(l)});T.note&&ht.set(x.PDFName.of("Contents"),x.PDFString.of(T.note));var yt=N(x,I,B,H,[q,J,rt,K]);ht.set(x.PDFName.of("AP"),I.context.obj({N:yt}));var $t=I.context.register(ht),gt=[$t];if(T.note){var Ft=I.context.register(I.context.obj({Type:x.PDFName.of("Annot"),Subtype:x.PDFName.of("Popup"),Rect:I.context.obj(_(T.note,{maxX:S,maxY:C},U&&U.width||612,U&&U.height||792)),Parent:$t,Open:!1}));ht.set(x.PDFName.of("Popup"),Ft),gt.push(Ft)}return gt}function $(x,I,T){var H=I.node.get(x.PDFName.of("Annots"));if(H instanceof x.PDFArray)for(var U=0;U<T.length;U++)H.push(T[U]);else I.node.set(x.PDFName.of("Annots"),I.doc.context.obj(T))}async function R(x,I,T,H){for(var U=await x.PDFDocument.load(I),u=U.getPages(),h=T||[],b=0;b<h.length;b++){var g=h[b];if(!(!g||!g.rects||!g.rects.length)){var m=u[g.page-1];if(m){var S=H&&H[g.color]||n,C=D(x,U,g,S,m.getSize());$(x,m,C)}}}return U.save()}return{writeHighlightsIntoPdf:R,buildHighlightAnnotation:D,appendAnnotationRefs:$,paintedRects:w}}var ie=Se(),ga=ie.writeHighlightsIntoPdf,ma=ie.buildHighlightAnnotation,va=ie.appendAnnotationRefs,xa=ie.paintedRects;function Ne(){function n(D){return String(D??"").replace(/\]/g,"\\]").replace(/</g,"<")}function c(D,$,R,x,I){var T=new URLSearchParams;$&&T.set("att",$),Number.isFinite(R)&&R>=1&&T.set("page",String(Math.floor(R))),x&&T.set("hl",x),I&&T.set("note",I);var H=T.toString();return"plugin://"+D+(H?"?"+H:"")}function i(D,$){return String(D??"").split(/\r?\n/).map(function(R){return($+" "+R).replace(/[ \t]+$/,"")})}function d(D,$,R){if(!$)return D;var x=R!=null?'<!-- {"backgroundCycleColor":"'+R+'"} -->':"";return'<mark style="background-color:'+$+';">'+D+x+"</mark>"}function r(D,$,R,x,I,T,H){var U=c($,R,x.page,x.id,H),u=d(n(D||"PDF"),I,T),h="["+u+"]("+U+")",b=[h].concat(i(x.quoteText,x.note?"> >":">"));return x.note&&(b.push(">"),b=b.concat(i(x.note,">"))),b.join(`
`)}function p(D){return String(D??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function l(D){return"<p>"+p(D).replace(/\r?\n/g,"<br>")+"</p>"}function w(D,$,R,x,I,T,H){var U=c($,R,x.page,x.id,H),u=p(D||"PDF"),h=T!=null?' data-background-color="'+p(T)+'"':"",b=I?"<mark"+h+' style="background-color: '+p(I)+';">'+u+"</mark>":u,g='<p><a href="'+p(U)+'">'+b+"</a></p>",m=l(x.quoteText);return x.note?g+"<blockquote><blockquote>"+m+"</blockquote>"+l(x.note)+"</blockquote>":g+"<blockquote>"+m+"</blockquote>"}function N(D){return D.slice().sort(function($,R){if($.page!==R.page)return $.page-R.page;var x=$.rects&&$.rects[0]?$.rects[0].y:0,I=R.rects&&R.rects[0]?R.rects[0].y:0;return I-x})}function _(D,$,R,x,I,T,H){var U=T&&T.length?T:null,u=(x||[]).filter(function(g){return g&&(!U||U.indexOf(g.color)!==-1)}),h=N(u),b=h.map(function(g){var m=I&&I[g.color]||{};return r(D,$,R,g,m.hex,m.cycleIndex,H)});return b.join(`
`)}return{buildDeepLink:c,buildHighlightBlock:r,buildHighlightHtml:w,buildExportAllContent:_}}var le=Ne(),wa=le.buildDeepLink,ya=le.buildHighlightBlock,Ca=le.buildHighlightHtml,Ea=le.buildExportAllContent;function jn(){var n=window.__PDFA_CONFIG||{},c=window.__PDFA_GEOM||{},i=window.__PDFA_ANNOTATIONS||{},d=window.__PDFA_EXPORT||{},r={root:document.getElementById("pdfa-root"),pages:document.getElementById("pdfa-pages"),status:document.getElementById("pdfa-status"),pageInput:document.getElementById("pdfa-page-input"),pageTotal:document.getElementById("pdfa-page-total"),zoomLabel:document.getElementById("pdfa-zoom-label"),colors:document.getElementById("pdfa-colors"),styles:document.getElementById("pdfa-styles"),popover:document.getElementById("pdfa-popover"),panel:document.getElementById("pdfa-panel"),listToggle:document.getElementById("pdfa-list-toggle"),thumbs:document.getElementById("pdfa-thumbs"),thumbsToggle:document.getElementById("pdfa-thumbs-toggle"),panelScroll:document.getElementById("pdfa-panel-scroll"),thumbsScroll:document.getElementById("pdfa-thumbs-scroll"),count:document.getElementById("pdfa-count"),more:document.getElementById("pdfa-more"),fit:document.getElementById("pdfa-fit"),open:document.getElementById("pdfa-open"),scrollUp:document.getElementById("pdfa-scroll-up"),scrollDown:document.getElementById("pdfa-scroll-down"),collapsedCount:document.getElementById("pdfa-collapsed-count"),collapsedName:document.querySelector(".pdfa-collapsed-name"),name:document.querySelector(".pdfa-name")};function p(t){t&&(l.attachmentName=t,r.name&&(r.name.textContent=t),r.collapsedName&&(r.collapsedName.textContent=t))}var l={doc:null,scale:1.25,pageCount:0,current:1,rendering:!1,textSpans:0,viewports:{},rendered:{},lineBoxes:{},renderingPage:{},thumbDrawn:{},thumbRendering:!1,thumbQueue:[],highlights:[],pdfBytes:null,attachmentName:n.attachmentName||"",activeColorId:n.defaultColorId||((n.colors||[{}])[0]||{}).id,activeStyle:n.defaultMarkStyle||((n.markStyles||[{}])[0]||{}).id||"highlight",pendingSelection:null,lastCapturedText:"",noteEditing:null,aspectRatio:null,popoverOwner:null,popoverClosedFrom:null,popoverPlacement:null};function w(t,e){r.status.textContent=t||"",r.status.style.display=t?"block":"none",r.status.className=e?"pdfa-status pdfa-error":"pdfa-status"}function N(t){var e=Object.assign({noteUUID:n.noteUUID},t);return new Promise(function(a,o){try{if(typeof window.callAmplenotePlugin!="function")throw new Error("Plugin bridge unavailable (callAmplenotePlugin missing)");a(window.callAmplenotePlugin(JSON.stringify(e)))}catch(s){o(s)}}).then(function(a){if(a&&typeof a=="object")return a;if(typeof a!="string")throw new Error("Empty reply from the plugin");try{return JSON.parse(a)}catch{throw new Error("Unreadable reply from the plugin: "+String(a).slice(0,120))}})}function _(){return n.colors||[]}function D(){for(var t=n.toolbarColorIds||[],e=_(),a=[],o=0;o<t.length;o++)for(var s=0;s<e.length;s++)if(e[s].id===t[o]){a.push(e[s]);break}return a.length?a:e.slice(0,4)}function $(){for(var t={},e=0;e<l.highlights.length;e++)t[l.highlights[e].color]=!0;var a=_().filter(function(o){return t[o.id]});return a.length?a:D()}function R(t){for(var e=_(),a=0;a<e.length;a++)if(e[a].id===t)return e[a].hex;return e.length?e[0].hex:"#F4DE6C"}function x(){var t=n.markStyles||[];return t.length?t:[{id:"highlight",label:"Highlight"}]}function I(t){var e=t&&t.style;if(!e)return"highlight";for(var a=x(),o=0;o<a.length;o++)if(a[o].id===e)return e;return"highlight"}function T(t){for(var e=x(),a=0;a<e.length;a++)if(e[a].id===t)return e[a].label;return"Highlight"}var H=.77,U=.15,u=.12;function h(t,e){if(e!=="underline"&&e!=="strike")return t;var a=Math.max(1.5,t.height*u),o=e==="underline"?t.y+t.height+Math.max(1,t.height*U):t.y+t.height*H-a/2;return{x:t.x,y:o,width:t.width,height:a}}function b(t){for(var e=0;e<l.highlights.length;e++)if(l.highlights[e].id===t)return l.highlights[e];return null}function g(t){var e=(n.icons||{})[t];if(!e)return null;var a="http://www.w3.org/2000/svg",o=document.createElementNS(a,"svg");o.setAttribute("class","pdfa-icon"),o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("aria-hidden","true");var s=document.createElementNS(a,"path");return s.setAttribute("d",e),o.appendChild(s),o}function m(t,e,a,o){var s=document.createElement("button");s.className="pdfa-btn"+(e?" "+e:"");var f=o?g(o):null;if(f){s.appendChild(f);var v=document.createElement("span");v.textContent=t,s.appendChild(v)}else s.textContent=t;return s.onclick=function(y){y.stopPropagation(),a()},s}function S(t,e,a,o){var s=m(t,"pdfa-icon-only"+(e?" "+e:""),a,o),f=s.querySelector("span");return f&&s.removeChild(f),s.title=t,s.setAttribute("aria-label",t),s}function C(t,e,a,o){var s=document.createElement("button");return s.className="pdfa-color",s.dataset.color=t.id,s.style.background=t.hex,s.title=o+" "+t.label,s.setAttribute("aria-label",o+" "+t.label),s.setAttribute("aria-pressed",String(!!e)),s.onclick=function(f){f.stopPropagation(),a(t.id)},s}function A(){for(var t=D(),e=0;e<t.length;e++)r.colors.appendChild(C(t[e],t[e].id===l.activeColorId,function(a){l.activeColorId=a,E(),l.pendingSelection&&De(l.pendingSelection,a)},T(l.activeStyle)))}function E(){for(var t=T(l.activeStyle),e=r.colors.querySelectorAll(".pdfa-color"),a=0;a<e.length;a++){var o=e[a].dataset.color;e[a].setAttribute("aria-pressed",String(o===l.activeColorId));var s=t+" "+P(o);e[a].title=s,e[a].setAttribute("aria-label",s)}}function P(t){for(var e=_(),a=0;a<e.length;a++)if(e[a].id===t)return e[a].label;return t}function W(){for(var t=x(),e=0;e<t.length;e++)(function(a){var o=document.createElement("button");o.className="pdfa-icon-btn",o.dataset.style=a.id,o.title=a.label,o.setAttribute("aria-label",a.label);var s=g(a.id);s?o.appendChild(s):o.textContent=a.label,o.onclick=function(f){f.stopPropagation(),l.activeStyle=a.id,O(),E()},r.styles.appendChild(o)})(t[e]);O()}function O(){for(var t=r.styles.querySelectorAll("button"),e=0;e<t.length;e++)t[e].setAttribute("aria-pressed",String(t[e].dataset.style===l.activeStyle))}function nt(){for(var t=[],e=1;e<=l.pageCount;e++)(function(a){t.push(l.doc.getPage(a).then(function(o){l.viewports[a]=o.getViewport({scale:l.scale})}))})(e);return Promise.all(t)}function B(t){var e=l.viewports[t],a=document.createElement("div");return a.className="pdfa-page",a.dataset.page=String(t),a.style.width=e.width+"px",a.style.height=e.height+"px",a}function q(t,e){if(l.rendered[e]||l.renderingPage[e])return Promise.resolve();l.renderingPage[e]=!0;var a=l.viewports[e],o=document.createElement("canvas"),s=window.devicePixelRatio||1;o.width=Math.floor(a.width*s),o.height=Math.floor(a.height*s),o.style.width=a.width+"px",o.style.height=a.height+"px",t.appendChild(o);var f=document.createElement("div");f.className="pdfa-highlights",t.appendChild(f);var v=document.createElement("div");v.className="textLayer",v.style.width=a.width+"px",v.style.height=a.height+"px",v.style.setProperty("--scale-factor",String(l.scale)),t.appendChild(v);var y=o.getContext("2d");y.scale(s,s);var k=null;return l.doc.getPage(e).then(function(M){return k=M,M.render({canvasContext:y,viewport:a}).promise}).then(function(){return k.getTextContent()}).then(function(M){var z=[];return window.pdfjsLib.renderTextLayer({textContent:M,container:v,viewport:a,textDivs:z}).promise.then(function(){l.textSpans+=z.length;for(var L=0;L<z.length;L++)z[L].__pdfaItem=M.items[L];l.rendered[e]=!0,l.renderingPage[e]=!1,ht(e),rt()})}).catch(function(M){l.renderingPage[e]=!1,w("Failed to render page "+e+": "+(M.message||M),!0)})}function J(){var t=ut();if(!t||!l.doc)return Promise.resolve();for(var e=t.getBoundingClientRect(),a=t.clientHeight,o=r.pages.querySelectorAll(".pdfa-page"),s=[],f=0;f<o.length;f++){var v=o[f],y=Number(v.dataset.page);if(!(l.rendered[y]||l.renderingPage[y])){var k=v.getBoundingClientRect(),M=k.top-e.top,z=k.bottom-e.top;z<-a||M>t.clientHeight+a||s.push(q(v,y))}}return Promise.all(s)}function rt(){var t=0;for(var e in l.rendered)l.rendered[e]&&t++;if(t){var a=l.textSpans===0;w(a?"No selectable text found - this PDF may be a scan.":"",a)}}function K(){if(l.rendering)return Promise.resolve();l.rendering=!0,Re(!0),w("Rendering...");var t=ut(),e=t?t.scrollHeight-t.clientHeight:0,a=e>0?t.scrollTop/e:0;return r.pages.innerHTML="",l.viewports={},l.rendered={},l.renderingPage={},l.textSpans=0,nt().then(function(){for(var o=1;o<=l.pageCount;o++)r.pages.appendChild(B(o));if(t){var s=t.scrollHeight-t.clientHeight;t.scrollTop=a*(s>0?s:0)}l.rendering=!1,Rt(),bt(),J()}).catch(function(o){l.rendering=!1,w("Failed to render: "+(o.message||o),!0)})}function ot(t){return function(e,a){return t.convertToViewportPoint(e,a)}}function pt(t,e){var a=t.querySelector(".textLayer");if(!a)return null;var o=l.lineBoxes[e];if(o&&o.scale===l.scale&&o.layer===a)return o.boxes;for(var s=t.getBoundingClientRect(),f=a.querySelectorAll("span"),v=[],y=document.createRange(),k=0;k<f.length;k++){y.selectNodeContents(f[k]);for(var M=y.getClientRects(),z=0;z<M.length;z++){var L=M[z];!L.width||!L.height||v.push({top:L.top-s.top,bottom:L.bottom-s.top,left:L.left-s.left,right:L.right-s.left})}}return l.lineBoxes[e]={scale:l.scale,layer:a,boxes:v},v}function ht(t){for(var e=t?'.pdfa-page[data-page="'+t+'"]':".pdfa-page",a=r.pages.querySelectorAll(e),o=0;o<a.length;o++){var s=a[o],f=Number(s.dataset.page),v=s.querySelector(".pdfa-highlights"),y=l.viewports[f];if(!(!v||!y)){v.innerHTML="";for(var k=ot(y),M=null,z=!1,L=0;L<l.highlights.length;L++){var F=l.highlights[L];if(!(!F||F.page!==f||!F.rects||!F.rects.length)){var X=document.createElement("div");X.className="pdfa-hl-group",X.dataset.id=F.id||"";var V=I(F);V==="highlight"&&!z&&(M=pt(s,f),z=!0);for(var G=0;G<F.rects.length;G++){var tt=c.pdfRectToViewportRect(F.rects[G],k),Y=V==="highlight"?c.expandRectToLineBox(tt,M):h(tt,V),Z=document.createElement("div");Z.className="pdfa-hl"+(V==="highlight"?"":" pdfa-hl-band"),Z.style.left=Y.x+"px",Z.style.top=Y.y+"px",Z.style.width=Y.width+"px",Z.style.height=Y.height+"px",Z.style.background=R(F.color),X.appendChild(Z)}v.appendChild(X)}}}}}function yt(){ht(),gt(),r.count.textContent=String(l.highlights.length)}function $t(){return l.highlights.slice().sort(function(t,e){return t.page!==e.page?t.page-e.page:(e.rects[0]?e.rects[0].y:0)-(t.rects[0]?t.rects[0].y:0)})}function gt(){r.panelScroll.innerHTML="";var t=document.createElement("div");t.className="pdfa-panel-title";var e=document.createElement("span");e.textContent="Highlights",t.appendChild(e),t.appendChild(m("Close","",function(){Tt(!1)})),r.panelScroll.appendChild(t);var a=$t();if(!a.length){var o=document.createElement("div");o.className="pdfa-panel-empty",o.textContent="No highlights yet. Select some text in the PDF and pick a color.",r.panelScroll.appendChild(o);return}for(var s=0;s<a.length;s++)r.panelScroll.appendChild(Ft(a[s]))}function Ft(t){var e=document.createElement("div");e.className="pdfa-hl-row",e.dataset.id=t.id||"",e.title="Jump to this highlight";var a=I(t),o=document.createElement("span");o.className="pdfa-chip"+(a==="highlight"?"":" pdfa-chip-band pdfa-chip-"+a),o.style.setProperty("--pdfa-chip-color",R(t.color)),o.title=T(a),e.appendChild(o);var s=document.createElement("div"),f=document.createElement("div");f.className="pdfa-hl-page",f.textContent="Page "+t.page,s.appendChild(f);var v=document.createElement("div");if(v.className="pdfa-hl-quote",v.textContent=t.quoteText.length>160?t.quoteText.slice(0,160)+"...":t.quoteText,s.appendChild(v),t.note){var y=document.createElement("div");y.className="pdfa-hl-note",y.textContent=t.note,s.appendChild(y)}return e.appendChild(s),e.onclick=function(){Pe(t)},e}function Ie(){r.thumbsScroll.innerHTML="";for(var t=1;t<=l.pageCount;t++)(function(e){var a=l.viewports[e],o=document.createElement("button");o.className="pdfa-thumb",o.type="button",o.dataset.page=String(e),o.title="Go to page "+e,o.setAttribute("aria-label","Go to page "+e),o.setAttribute("aria-current",String(e===l.current));var s=document.createElement("div");s.className="pdfa-thumb-sheet",a&&a.width&&a.height&&(s.style.aspectRatio=a.width+" / "+a.height),o.appendChild(s);var f=document.createElement("div");f.className="pdfa-thumb-num",f.textContent=String(e),o.appendChild(f),o.onclick=function(){Lt(e)},r.thumbsScroll.appendChild(o)})(t)}function ce(){if(!(!l.doc||!r.thumbs.classList.contains("pdfa-open"))){for(var t=r.thumbsScroll.getBoundingClientRect(),e=r.thumbsScroll.clientHeight,a=r.thumbsScroll.querySelectorAll(".pdfa-thumb"),o=0;o<a.length;o++){var s=Number(a[o].dataset.page);if(!l.thumbDrawn[s]){var f=a[o].getBoundingClientRect(),v=f.top-t.top,y=f.bottom-t.top;y<-e||v>r.thumbsScroll.clientHeight+e||(l.thumbDrawn[s]=!0,l.thumbQueue.push(s))}}Ue()}}function Ue(){if(!(l.thumbRendering||!l.thumbQueue.length)){l.thumbRendering=!0;var t=l.thumbQueue.shift();Yn(t).catch(function(){l.thumbDrawn[t]=!1}).then(function(){l.thumbRendering=!1,Ue()})}}function Yn(t){var e=r.thumbsScroll.querySelector('.pdfa-thumb[data-page="'+t+'"]'),a=e&&e.querySelector(".pdfa-thumb-sheet");return a?l.doc.getPage(t).then(function(o){var s=a.clientWidth||96,f=Math.min(window.devicePixelRatio||1,2),v=o.getViewport({scale:1}),y=o.getViewport({scale:s*f/v.width}),k=document.createElement("canvas");return k.width=Math.max(1,Math.floor(y.width)),k.height=Math.max(1,Math.floor(y.height)),o.render({canvasContext:k.getContext("2d"),viewport:y}).promise.then(function(){a.appendChild(k)})}):Promise.resolve()}function Te(){if(!r.thumbsScroll.childNodes.length&&r.thumbs.classList.contains("pdfa-open")&&l.doc&&l.pageCount&&(Ie(),ce()),!!r.thumbsScroll.childNodes.length)for(var t=r.thumbsScroll.querySelectorAll(".pdfa-thumb"),e=0;e<t.length;e++)t[e].setAttribute("aria-current",String(Number(t[e].dataset.page)===l.current))}function de(t){var e=t===void 0?!r.thumbs.classList.contains("pdfa-open"):t;e&&r.panel.classList.contains("pdfa-open")&&Tt(!1),r.thumbs.classList.toggle("pdfa-open",e),r.thumbsToggle.setAttribute("aria-pressed",String(e)),e&&(r.thumbsScroll.childNodes.length||Ie(),Te(),Xn(),ce()),bt()}function Xn(){var t=r.thumbsScroll.querySelector('.pdfa-thumb[data-page="'+l.current+'"]');if(t){var e=t.getBoundingClientRect().top-r.thumbsScroll.getBoundingClientRect().top;r.thumbsScroll.scrollTop+=e-r.thumbsScroll.clientHeight/2+t.offsetHeight/2}}function Tt(t){var e=t===void 0?!r.panel.classList.contains("pdfa-open"):t;e&&r.thumbs.classList.contains("pdfa-open")&&de(!1),r.panel.classList.toggle("pdfa-open",e),r.listToggle.setAttribute("aria-pressed",String(e)),e&>(),bt()}function At(t){for(var e=t&&t.nodeType===1?t:t&&t.parentElement;e;){if(e.classList&&e.classList.contains("textLayer"))return e;e=e.parentElement}return null}function Wn(t,e){for(var a=[],o=null,s=[],f=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),v;v=f.nextNode();)if(t.intersectsNode(v)){var y=v.nodeValue||"",k=v===t.startContainer?t.startOffset:0,M=v===t.endContainer?t.endOffset:y.length,z=v.parentElement,L=z&&z.__pdfaItem;if(s.push({text:y,from:k,to:M,line:L?L.transform[5]:null,lineSize:L?L.height:null,x:L?L.transform[4]:null,xEnd:L?L.transform[4]+L.width:null}),!!L)for(var F={x1:L.transform[4],y1:L.transform[5],x2:L.transform[4]+L.width,y2:L.transform[5]+L.height},X=z.getBoundingClientRect(),V=c.textTokenRanges(y,k,M),G=0;G<V.length;G++){var tt=document.createRange();tt.setStart(v,V[G].start),tt.setEnd(v,V[G].end);var Y=c.unionClientRects(tt.getClientRects());if(Y){var Z={left:Y.left,top:Y.top,width:Y.width,height:Y.height,right:Y.left+Y.width,bottom:Y.top+Y.height},ft=c.itemRelativeRect(F,X,Z);ft&&(a.push(ft),o=Z)}}}return{rects:a,text:c.joinSelectionSlices(s),lastCssRect:o}}function mt(t){l.pendingSelection=t,l.lastCapturedText=t&&t.rawText||""}function Ae(t){if(!l.noteEditing){var e=window.getSelection();if(!e||e.isCollapsed||e.rangeCount===0){mt(null),j();return}var a=e.getRangeAt(0),o=At(a.startContainer);if(!o)return mt(null);var s=o.parentElement;if(!s||!s.dataset||!s.dataset.page)return mt(null);var f=Number(s.dataset.page);if(!l.rendered[f])return mt(null);var v=At(a.endContainer)!==o,y=Wn(a,o),k=c.mergeLineRects(y.rects);if(!k.length)return mt(null);var M=y.lastCssRect||s.getBoundingClientRect(),z=t&&t.clientX?t.clientX:M.left+M.width/2,L=t&&t.clientY?t.clientY:M.top+M.height,F={page:f,rects:k,quoteText:c.normalizeQuoteText(y.text),spilled:v,anchorX:z,anchorY:L,rawText:String(e)};mt(F),or(F)}}var Jn=300,vt=null;function Kn(){l.noteEditing||(vt&&clearTimeout(vt),vt=setTimeout(ke,Jn))}function ke(){if(vt=null,!l.noteEditing){var t=window.getSelection();!t||t.isCollapsed||t.rangeCount===0||At(t.getRangeAt(0).startContainer)&&String(t)!==l.lastCapturedText&&Ae(null)}}function kt(t,e){var a=l.highlights;return l.highlights=t,yt(),N(e).then(function(o){if(!o||o.error)throw new Error(o&&o.error||"The plugin did not confirm the change.");return l.highlights=o.highlights||t,yt(),w(""),!0}).catch(function(o){return l.highlights=a,yt(),w(o.message||String(o),!0),!1})}function De(t,e){var a={id:null,page:t.page,color:e,style:l.activeStyle,rects:t.rects,quoteText:t.quoteText,note:null},o=t.anchorX,s=t.anchorY;mt(null),j(!0);var f=window.getSelection();f&&f.removeAllRanges&&f.removeAllRanges(),kt(l.highlights.concat([a]),{action:"addHighlight",attachmentUUID:n.attachmentUUID,highlight:a}).then(function(v){if(v){var y=l.highlights[l.highlights.length-1];y&&y.id&&ue(y,o,s,!0)}})}function Qn(t,e){j(!0);for(var a=l.highlights.map(function(f){return f.id===t?Object.assign({},f,{color:e}):f}),o=null,s=0;s<a.length;s++)a[s].id===t&&(o=a[s]);kt(a,{action:"recolorHighlight",attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID,id:t,color:e,exportBlock:o?Vt(o):null})}function Zn(t,e){j(!0);for(var a=l.highlights.map(function(f){return f.id===t?Object.assign({},f,{style:e}):f}),o=null,s=0;s<a.length;s++)a[s].id===t&&(o=a[s]);kt(a,{action:"restyleHighlight",attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID,id:t,style:e,exportBlock:o?Vt(o):null})}function tr(t){j(!0),kt(l.highlights.filter(function(e){return e.id!==t}),{action:"removeHighlight",attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID,id:t})}function se(t,e){var a=String(e??"").trim();l.noteEditing=null,j(!0),kt(l.highlights.map(function(o){return o.id===t?Object.assign({},o,{note:a||null}):o}),{action:"setHighlightNote",attachmentUUID:n.attachmentUUID,id:t,note:a})}var er=9;function nr(t){var e=r.root.querySelector(".pdfa-toolbar");return{right:t.getBoundingClientRect().right,bottom:(e||t).getBoundingClientRect().bottom}}function xt(t,e,a,o,s){r.popover.innerHTML="",r.popover.classList.toggle("pdfa-editing",o==="editing"),r.popover.classList.toggle("pdfa-exporting",o==="exporting"),r.popover.classList.toggle("pdfa-menu",o==="menu"),r.popover.classList.toggle("pdfa-palette",o==="palette"),r.popover.classList.toggle("pdfa-mark",o==="mark");for(var f=0;f<t.length;f++)r.popover.appendChild(t[f]);r.popover.classList.add("pdfa-open"),l.popoverPlacement={clientX:e,clientY:a,anchor:s||null},pe()}function pe(){var t=l.popoverPlacement;if(t){var e=t.clientX,a=t.clientY,o=t.anchor,s=r.popover.offsetWidth,f=r.popover.offsetHeight,v,y;o?(v=Math.min(o.right-s,window.innerWidth-s-er),y=o.bottom+8):(v=e-s/2,y=a+12,y+f>window.innerHeight-4&&(y=Math.max(4,a-f-12))),v=Math.max(4,Math.min(v,window.innerWidth-s-4)),y=Math.max(4,Math.min(y,window.innerHeight-f-4)),r.popover.style.left=v+"px",r.popover.style.top=y+"px"}}function Re(t){l.popoverPlacement&&l.popoverPlacement.anchor||j(t)}function rr(t){var e=l.popoverClosedFrom;return l.popoverClosedFrom=null,e===t}function j(t){l.noteEditing&&!t||(l.noteEditing=null,l.popoverPlacement=null,l.popoverOwner=null,r.popover.classList.remove("pdfa-open","pdfa-editing","pdfa-exporting","pdfa-menu","pdfa-palette","pdfa-mark"),r.popover.innerHTML="")}function or(t){var e=D(),a=[];if(t.spilled){var o=document.createElement("div");o.className="pdfa-spill-hint",o.textContent="Page "+t.page+" only",o.title="A selection that crosses a page break is marked on the page it started on.",a.push(o)}for(var s=0;s<e.length;s++)a.push(C(e[s],e[s].id===l.activeColorId,function(f){l.activeColorId=f,E(),De(t,f)},T(l.activeStyle)));xt(a,t.anchorX,t.anchorY)}function ue(t,e,a,o){var s=[],f=document.createElement("div");f.className="pdfa-mark-row pdfa-mark-top";var v=x(),y=I(t);if(v.length>1){var k=document.createElement("span");k.className="pdfa-shape-row";for(var M=0;M<v.length;M++)(function(dt){var ct=document.createElement("button");ct.className="pdfa-btn pdfa-shape-btn",ct.dataset.style=dt.id,ct.title="Change to "+dt.label.toLowerCase(),ct.setAttribute("aria-label",ct.title),ct.setAttribute("aria-pressed",String(dt.id===y));var Ze=g(dt.id);Ze?ct.appendChild(Ze):ct.textContent=dt.label,ct.onclick=function(Or){if(Or.stopPropagation(),dt.id===y)return j(!0);Zn(t.id,dt.id)},k.appendChild(ct)})(v[M]);f.appendChild(k);var z=document.createElement("span");z.className="pdfa-vrule",f.appendChild(z)}function L(dt){Qn(t.id,dt)}for(var F=D().slice(),X=!1,V=0;V<F.length;V++)F[V].id===t.color&&(X=!0);if(!X&&F.length)for(var G=_(),tt=0;tt<G.length;tt++)G[tt].id===t.color&&(F[F.length-1]=G[tt]);var Y=document.createElement("span");Y.className="pdfa-mark-colors";for(var Z=0;Z<F.length;Z++)Y.appendChild(C(F[Z],F[Z].id===t.color,L,"Change to"));f.appendChild(Y);for(var ft=[],ve=_(),Gt=0;Gt<ve.length;Gt++){for(var We=!1,xe=0;xe<F.length;xe++)F[xe].id===ve[Gt].id&&(We=!0);We||ft.push(ve[Gt])}if(ft.length){var Ht=document.createElement("div");Ht.className="pdfa-drawer",Ht.id="pdfa-color-drawer";for(var qt=0;qt<ft.length;qt++)Ht.appendChild(C(ft[qt],ft[qt].id===t.color,L,"Change to"));f.appendChild(ar(Ht)),s.push(f),s.push(Ht)}else s.push(f);var Je=document.createElement("div");Je.className="pdfa-hrule",s.push(Je);var wt=document.createElement("div");wt.className="pdfa-mark-row";var Ke=!!t.note;wt.appendChild(m(Ke?"Edit note":"Add note",o&&!Ke?"pdfa-btn-primary":"",function(){sr(t,e,a)},"note"));var Qe=document.createElement("span");Qe.className="pdfa-spacer",wt.appendChild(Qe),wt.appendChild(S("Copy","",function(){Er(t)},"copy")),wt.appendChild(S("Send to note","",function(){Sr(t)},"send")),wt.appendChild(S("Remove","pdfa-remove",function(){tr(t.id)},"remove")),s.push(wt),xt(s,e,a,"mark")}function ar(t){var e=document.createElement("button");e.className="pdfa-more-colors",e.setAttribute("aria-controls",t.id);var a=document.createElement("span");a.className="pdfa-more-dot",e.appendChild(a);function o(s){a.innerHTML="";var f=g(s?"minus":"add");f?a.appendChild(f):a.textContent=s?"-":"+",e.title=s?"Fewer colors":"More colors",e.setAttribute("aria-label",e.title),e.setAttribute("aria-expanded",String(s))}return o(!1),e.onclick=function(s){s.stopPropagation();var f=!t.classList.contains("pdfa-open");t.classList.toggle("pdfa-open",f),o(f),pe()},e}function ir(t){for(var e=$(),a={},o=0;o<e.length;o++)a[e[o].id]=!0;var s=document.createElement("div");s.className="pdfa-export-hint",s.textContent="Export highlights to a note";var f=document.createElement("div");f.className="pdfa-export-colors";for(var v=0;v<e.length;v++)(function(k){var M=C(k,!0,function(z){a[z]=!a[z],M.setAttribute("aria-pressed",String(a[z]))},"Toggle");f.appendChild(M)})(e[v]);var y=document.createElement("div");y.className="pdfa-note-actions",y.appendChild(m("Create / update note","pdfa-btn-primary",function(){for(var k=[],M=0;M<e.length;M++)a[e[M].id]&&k.push(e[M].id);Nr(k.length===e.length?null:k)})),xt([s,f,y],0,0,"exporting",t)}function lr(t){var e=D().map(function(z){return z.id}),a=document.createElement("div");a.className="pdfa-slot-row";var o=document.createElement("div");o.className="pdfa-export-colors pdfa-catalog-row";function s(){a.innerHTML="";for(var z=0;z<4;z++)(function(X){var V=e[X];if(!V){var G=document.createElement("span");G.className="pdfa-slot-empty",G.title="Empty slot - pick a color below",a.appendChild(G);return}var tt=C(cr(V),!0,function(){e.splice(X,1),s()},"Remove");tt.classList.add("pdfa-slot"),a.appendChild(tt)})(z);o.innerHTML="";for(var L=_(),F=0;F<L.length;F++)(function(X){var V=e.indexOf(X.id)!==-1,G=C(X,!1,function(){V?e.splice(e.indexOf(X.id),1):e.length<4&&e.push(X.id),s()},V?"Remove":"Add");V&&G.classList.add("pdfa-taken"),o.appendChild(G)})(L[F])}s();var f=document.createElement("div");f.className="pdfa-export-hint",f.textContent="Your toolbar - click a color below to fill a slot";var v=document.createElement("div");v.className="pdfa-export-hint",v.textContent="All "+_().length+" Amplenote colors";var y=document.createElement("div");y.className="pdfa-export-hint pdfa-scope-hint",y.textContent="Applies to every PDF, on every device.";var k=document.createElement("div");k.className="pdfa-note-actions",k.appendChild(m("Save","pdfa-btn-primary",function(){dr(e)})),k.appendChild(m("Cancel","",function(){j(!0)}));var M=document.createElement("span");M.className="pdfa-spacer",k.appendChild(M),k.appendChild(m("Reset","",function(){e=[],s()})),xt([f,a,v,o,y,k],0,0,"palette",t)}function cr(t){for(var e=_(),a=0;a<e.length;a++)if(e[a].id===t)return e[a];return e[0]}function dr(t){N({action:"setToolbarColors",colorIds:t}).then(function(e){n.toolbarColorIds=e&&e.ids||t,n.toolbarColorIds.indexOf(l.activeColorId)===-1&&(l.activeColorId=n.toolbarColorIds[0]),r.colors.innerHTML="",A(),E(),j(!0),w(e&&e.error?e.error:"Highlight colors updated.",!!(e&&e.error))}).catch(function(e){w("Could not save your colors: "+e.message,!0)})}function sr(t,e,a){l.noteEditing=t.id;var o=document.createElement("textarea");o.className="pdfa-note-input",o.rows=3,o.value=t.note||"",o.placeholder="Note for this highlight";var s=document.createElement("div");s.className="pdfa-note-actions",t.note&&s.appendChild(m("Delete note","",function(){se(t.id,"")}));var f=document.createElement("span");f.className="pdfa-spacer",s.appendChild(f),s.appendChild(m("Cancel","",function(){Le(t,e,a)})),s.appendChild(m("Save","pdfa-btn-primary",function(){se(t.id,o.value)})),o.onkeydown=function(v){v.key==="Enter"&&(v.ctrlKey||v.metaKey)?(v.preventDefault(),v.stopPropagation(),se(t.id,o.value)):v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),Le(t,e,a))},xt([o,s],e,a,"editing"),o.focus(),o.setSelectionRange(o.value.length,o.value.length)}function Le(t,e,a){l.noteEditing=null;var o=b(t.id)||t;ue(o,e,a)}function pr(t){if(!l.noteEditing){var e=window.getSelection();if(!(e&&!e.isCollapsed)){for(var a=t.target,o=null;a&&a!==r.pages;){if(a.classList&&a.classList.contains("pdfa-page")){o=a;break}a=a.parentElement}if(!o)return j();var s=Number(o.dataset.page),f=l.viewports[s];if(!f)return j();var v=o.getBoundingClientRect(),y=f.convertToPdfPoint(t.clientX-v.left,t.clientY-v.top),k=c.hitTestHighlights(l.highlights,s,y[0],y[1],1);k&&k.id?ue(k,t.clientX,t.clientY):j()}}}function Dt(){return Math.round(l.scale*100)+"%"}function Rt(){document.activeElement!==r.pageInput&&(r.pageInput.value=l.current),r.pageTotal.textContent="/ "+l.pageCount,Te(),document.activeElement!==r.zoomLabel&&(r.zoomLabel.value=Dt())}function ut(){return r.root.querySelector(".pdfa-scroll")}function He(){return r.panel&&r.panel.classList.contains("pdfa-open")?r.panelScroll:r.thumbs&&r.thumbs.classList.contains("pdfa-open")?r.thumbsScroll:ut()}function Me(t){var e=r.pages.querySelector('.pdfa-page[data-page="'+t+'"]');e&&q(e,t)}function Lt(t){var e=Math.min(Math.max(1,t),l.pageCount),a=r.pages.querySelector('.pdfa-page[data-page="'+e+'"]');Me(e);var o=ut();a&&o&&(o.scrollTop+=a.getBoundingClientRect().top-o.getBoundingClientRect().top),J(),l.current=e,Rt()}function Pe(t){var e=r.pages.querySelector('.pdfa-page[data-page="'+t.page+'"]'),a=l.viewports[t.page];if(!(!e||!a||!t.rects||!t.rects.length)){var o=c.pdfRectToViewportRect(t.rects[0],ot(a)),s=ut(),f=e.getBoundingClientRect().top+o.y;s.scrollTop+=f-s.getBoundingClientRect().top-s.clientHeight/3,Me(t.page),J(),l.current=t.page,Rt()}}function ur(){try{r.root.setAttribute("tabindex","-1"),r.root.focus(),r.root.scrollIntoView&&r.root.scrollIntoView({block:"nearest"})}catch{}}function fr(t){if(!(!t||!t.id)){var e=r.pages.querySelector('.pdfa-hl-group[data-id="'+t.id+'"]');e&&(e.classList.add("pdfa-hl-flash"),setTimeout(function(){e.classList.remove("pdfa-hl-flash")},2600))}}function fe(t){return Math.min(Math.max(.4,t),4)}function jt(t){return l.scale=fe(t),K()}function _e(){var t=String(r.zoomLabel.value).replace(/[\s%]/g,""),e=/^\d*\.?\d+$/.test(t)?parseFloat(t):NaN;if(e>0){var a=fe(e/100);a!==l.scale&&jt(a)}r.zoomLabel.value=Dt()}function ze(){var t=String(r.pageInput.value).trim(),e=/^\d+$/.test(t)?parseInt(t,10):NaN;e>0&&Lt(e),r.pageInput.value=l.current}function hr(){return l.doc?l.doc.getPage(1).then(function(t){var e=ut();if(e){var a=window.getComputedStyle(e),o=e.clientWidth-(parseFloat(a.paddingLeft)||0)-(parseFloat(a.paddingRight)||0),s=t.getViewport({scale:1}).width;if(!(!(o>0)||!(s>0))){var f=fe(o/s);f<l.scale&&(l.scale=f,Rt())}}}).catch(function(){}):Promise.resolve()}function Oe(t){var e=He();e&&(e.scrollTop+=t*Math.max(80,e.clientHeight*.85),bt(),J())}function Be(t,e){var a=null,o=null,s=!1,f=function(){a&&clearTimeout(a),o&&clearInterval(o),a=o=null};t.addEventListener("pointerdown",function(){f(),s=!1,a=setTimeout(function(){s=!0,o=setInterval(function(){if(t.disabled)return f();Oe(e*.25)},120)},320)}),["pointerup","pointercancel","pointerleave"].forEach(function(v){t.addEventListener(v,f)}),t.onclick=function(){if(s){s=!1;return}Oe(e)}}function bt(){var t=He();if(!(!t||!r.scrollUp)){var e=t.scrollHeight-t.clientHeight;r.scrollUp.disabled=t.scrollTop<=1,r.scrollDown.disabled=t.scrollTop>=e-1}}function gr(){bt(),J(),Re();for(var t=r.pages.querySelectorAll(".pdfa-page"),e=l.current,a=1/0,o=0;o<t.length;o++){var s=Math.abs(t[o].getBoundingClientRect().top-60);s<a&&(a=s,e=Number(t[o].dataset.page))}e!==l.current&&(l.current=e,Rt())}function mr(){return new Promise(function(t,e){if(window.pdfjsLib)return t(window.pdfjsLib);var a=document.createElement("script");a.src=n.pdfJsSrc,a.onload=function(){window.pdfjsLib?t(window.pdfjsLib):e(new Error("PDF.js loaded but did not register itself."))},a.onerror=function(){e(new Error("Could not load PDF.js from the CDN."))},document.head.appendChild(a)})}function vr(){return new Promise(function(t,e){if(window.PDFLib)return t(window.PDFLib);var a=document.createElement("script");a.src=n.pdfLibSrc,a.onload=function(){window.PDFLib?t(window.PDFLib):e(new Error("pdf-lib loaded but did not register itself."))},a.onerror=function(){e(new Error("Could not load pdf-lib from the CDN."))},document.head.appendChild(a)})}function xr(){for(var t={},e=_(),a=0;a<e.length;a++)e[a].rgb&&(t[e[a].id]=e[a].rgb);return t}function br(){var t=(l.attachmentName||"annotated").replace(/\.pdf$/i,"");return t+"-annotated.pdf"}function he(){for(var t={},e=_(),a=0;a<e.length;a++)t[e[a].id]={hex:e[a].hex,cycleIndex:e[a].cycleIndex};return t}function $e(){var t=(l.attachmentName||"PDF").replace(/\.pdf$/i,"");return t+" - Highlights"}function Vt(t){var e=he()[t.color]||{};return d.buildHighlightBlock(l.attachmentName,n.pluginUUID,n.attachmentUUID,t,e.hex,e.cycleIndex,n.noteUUID)}function wr(t){if(!d.buildHighlightHtml)return null;var e=he()[t.color]||{};return d.buildHighlightHtml(l.attachmentName,n.pluginUUID,n.attachmentUUID,t,e.hex,e.cycleIndex,n.noteUUID)}function yr(t,e){var a=function(f){var v=f.clipboardData||window.clipboardData;v&&(v.setData("text/plain",t),e&&v.setData("text/html",e),f.preventDefault())},o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.left="-9999px",document.body.appendChild(o),o.focus(),o.select(),document.addEventListener("copy",a,!0);var s=!1;try{s=document.execCommand("copy")}catch{s=!1}return document.removeEventListener("copy",a,!0),document.body.removeChild(o),s}function Cr(t,e){var a=function(){return!navigator.clipboard||!navigator.clipboard.writeText?o():navigator.clipboard.writeText(t).then(function(){return"plain"},o)},o=function(){return yr(t,e)?Promise.resolve(e?"rich":"plain"):Promise.reject(new Error("every clipboard route was refused"))};if(e&&navigator.clipboard&&navigator.clipboard.write&&typeof ClipboardItem=="function")try{var s=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});return navigator.clipboard.write([s]).then(function(){return"rich"},a)}catch{return a()}return a()}function Er(t){j(!0);var e,a;try{e=Vt(t),a=wr(t)}catch(o){w("Could not build the copy: "+(o.message||o),!0);return}Cr(e,a).then(function(o){w(o==="rich"?"Highlight copied - paste it into any note.":"Highlight copied as plain text - this browser would not allow a formatted copy.")}).catch(function(o){w("Could not copy: "+(o.message||o),!0)})}function Sr(t){j(!0),N({action:"sendToNote",content:Vt(t),highlightId:t.id,attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).then(function(e){if(!e||e.error)throw new Error(e&&e.error||"Could not send this to the note.");gt(),w(e.replaced?"Updated this highlight where it already sits in the note.":"Added to this note, below the text.")}).catch(function(e){w(e.message||String(e),!0)})}function Nr(t){j(!0);var e=d.buildExportAllContent(l.attachmentName,n.pluginUUID,n.attachmentUUID,l.highlights,he(),t,n.noteUUID);if(!e){w(t?"No highlights match those colors.":"No highlights to export yet.",!0);return}N({action:"exportAll",attachmentUUID:n.attachmentUUID,noteName:$e(),content:e}).then(function(a){if(!a||a.error)throw new Error(a&&a.error||"Could not export highlights.");w('Exported to "'+$e()+'".')}).catch(function(a){w(a.message||String(a),!0)})}var Ir=420;function Fe(){return window.innerWidth<=Ir}function je(){var t=document.createElement("div");return t.className="pdfa-menu-rule",t}function Ur(){var t=document.createElement("div");t.className="pdfa-menu-tools";var e=document.createElement("span");e.className="pdfa-label",e.textContent=Dt();function a(o){return function(s){s.stopPropagation(),jt(l.scale+o),e.textContent=Dt()}}return t.appendChild(Ve("minus","Zoom out",a(-.25))),t.appendChild(e),t.appendChild(Ve("add","Zoom in",a(.25))),t}function Ve(t,e,a){var o=document.createElement("button");o.className="pdfa-btn pdfa-icon-only",o.title=e,o.setAttribute("aria-label",e);var s=g(t);return s?o.appendChild(s):o.textContent=e,o.onclick=a,o}function Tr(){var t=window.innerWidth,e=window.screen&&Number(window.screen.height);if(!t||!Number.isFinite(e)||e<200)return .55;var a=t/(e*.85);return Math.round(a*100)/100}function Ar(){return Fe()||!l.aspectRatio?null:m("Restore height","",function(){j(!0),Ge(null)},"restoreHeight")}function Ge(t){l.aspectRatio=t,ge(),N({action:"setViewerHeight",aspectRatio:t,attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).then(function(e){e&&e.ok&&(l.aspectRatio=e.aspectRatio||null),ge()}).catch(function(){})}function ge(){if(r.fit){var t=!!l.aspectRatio;r.fit.title=t?"Restore height":"Fit to this screen",r.fit.setAttribute("aria-label",r.fit.title),r.fit.setAttribute("aria-pressed",String(t)),r.fit.innerHTML="";var e=g(t?"restoreHeight":"fitScreen");e?r.fit.appendChild(e):r.fit.textContent=t?"Restore":"Fit"}}function kr(t){r.panel.classList.contains("pdfa-open")&&Tt(!1),r.thumbs.classList.contains("pdfa-open")&&de(!1);var e=[];Fe()&&(e.push(Ur(),je()),e.push(m("Highlights ("+l.highlights.length+")","",function(){j(!0),Tt(!0)},"list"),je()));var a=Ar();a&&e.push(a),e.push(m("Collapse","",function(){j(!0),Pr()},"collapse"),m("Download","",function(){j(!0),Lr()},"download"),m("Export...","",function(){ir(t)},"postAdd"),m("Highlight colors...","",function(){lr(t)},"palette"),m("Remove viewer...","pdfa-remove",function(){Dr(t)},"remove")),xt(e,0,0,"menu",t)}function Dr(t){var e=document.createElement("div");e.className="pdfa-export-hint",e.textContent="Remove this viewer and all its highlights from this note? This cannot be undone.";var a=document.createElement("div");a.className="pdfa-note-actions",a.appendChild(m("Cancel","",function(){j(!0)}));var o=document.createElement("span");o.className="pdfa-spacer",a.appendChild(o),a.appendChild(m("Remove","pdfa-remove",Rr)),xt([e,a],0,0,"exporting",t)}function Rr(){j(!0),w("Removing this viewer..."),N({action:"removeViewer",attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).then(function(t){if(!t||t.error)throw new Error(t&&t.error||"Could not remove this viewer.");document.body.innerHTML='<div style="padding:16px;font:13px sans-serif;opacity:.75">Removed - this block will disappear once the note refreshes.</div>'}).catch(function(t){w(t.message||String(t),!0)})}function Lr(){l.pdfBytes&&(w("Preparing the download..."),vr().then(function(t){return i.writeHighlightsIntoPdf(t,l.pdfBytes,l.highlights,xr())}).then(function(t){return Hr(t,br())}).catch(function(t){w("Could not prepare the download: "+(t.message||t),!0)}))}function Hr(t,e){var a=new Blob([t],{type:"application/pdf"}),o=null;try{o=new File([a],e,{type:"application/pdf"})}catch{}return o&&navigator.share&&navigator.canShare&&navigator.canShare({files:[o]})?navigator.share({files:[o],title:e}).then(function(){w("")}).catch(function(s){return s&&s.name==="AbortError"?w(""):qe(a,e)}):qe(a,e)}function qe(t,e){var a=URL.createObjectURL(t),o=document.createElement("a");o.href=a,o.download=e,document.body.appendChild(o),o.click(),o.remove(),setTimeout(function(){URL.revokeObjectURL(a)},4e3);var s=window.matchMedia&&window.matchMedia("(pointer: coarse)").matches;return w(s?"If no file appeared, this host blocked it - on iPhone or iPad use the Amplenote app, on Android use a browser.":""),Promise.resolve()}function Mr(){return N({action:"loadHighlights",attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).then(function(t){if(!t||t.error)throw new Error(t&&t.error||"No answer from the plugin");l.highlights=t.highlights||[]}).catch(function(t){l.highlights=[],w("Could not load saved highlights: "+(t.message||t),!0)})}function Pr(){var t=l.highlights.length;r.collapsedCount.textContent=t?t+(t===1?" highlight":" highlights"):"",r.root.classList.add("pdfa-collapsed-mode"),Ye(!0)}function Ye(t){N({action:"setCollapsed",collapsed:t,attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).catch(function(){})}function _r(){N({action:"clearDeepLink",attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).catch(function(){})}function zr(){r.root.classList.remove("pdfa-collapsed-mode"),l.doc||Xe(),Ye(!1)}function Xe(){w("Loading PDF..."),(n.highlightId||n.page)&&(ur(),_r()),mr().then(function(t){return t.GlobalWorkerOptions.workerSrc=n.workerSrc,N({action:"getPdfUrl",attachmentUUID:n.attachmentUUID})}).then(function(t){if(!t||!t.url)throw new Error(t&&t.error||"Could not resolve the PDF URL");return p(t.name),fetch(t.url)}).then(function(t){if(!t.ok)throw new Error("Download failed (HTTP "+t.status+")");return t.arrayBuffer()}).then(function(t){return l.pdfBytes=t.slice(0),window.pdfjsLib.getDocument({data:t}).promise}).then(function(t){return l.doc=t,l.pageCount=t.numPages,Mr()}).then(function(){return hr()}).then(function(){return K()}).then(function(){yt();var t=n.highlightId?b(n.highlightId):null;t?(Pe(t),fr(t)):n.page&&Lt(n.page)}).catch(function(t){w(t.message||String(t),!0)})}try{let t=function(o){for(var s=[],f=o.querySelectorAll("span"),v=0;v<f.length;v++)if((f[v].textContent||"").trim()){var y=f[v].getBoundingClientRect();y.width>0&&y.height>0&&s.push({left:y.left,top:y.top,right:y.right,bottom:y.bottom})}return s},e=function(o,s){if(document.caretRangeFromPoint)return document.caretRangeFromPoint(o,s);if(document.caretPositionFromPoint){var f=document.caretPositionFromPoint(o,s);if(!f)return null;var v=document.createRange();return v.setStart(f.offsetNode,f.offset),v}return null},a=function(){if(!(!lt||!Ct)){var o=c.snapPointToLineBox(Ct,lt.boxes);if(!(!o||o.x===Ct.x&&o.y===Ct.y)){var s=window.getSelection();if(!(!s||!s.rangeCount||!s.anchorNode)){var f=e(o.x,o.y);if(!(!f||At(f.startContainer)!==lt.layer)&&!(s.focusNode===f.startContainer&&s.focusOffset===f.startOffset)){me=!0;try{s.extend(f.startContainer,f.startOffset)}catch{}me=!1}}}}};document.getElementById("pdfa-prev").onclick=function(){Lt(l.current-1)},document.getElementById("pdfa-next").onclick=function(){Lt(l.current+1)},document.getElementById("pdfa-zoom-in").onclick=function(){jt(l.scale+.25)},document.getElementById("pdfa-zoom-out").onclick=function(){jt(l.scale-.25)},r.zoomLabel.addEventListener("focus",function(){r.zoomLabel.value=String(Math.round(l.scale*100)),setTimeout(function(){document.activeElement===r.zoomLabel&&r.zoomLabel.select()},0)}),r.zoomLabel.addEventListener("blur",_e),r.zoomLabel.addEventListener("keydown",function(o){o.key==="Enter"?(o.preventDefault(),_e(),r.zoomLabel.blur()):o.key==="Escape"&&(o.preventDefault(),r.zoomLabel.value=Dt(),r.zoomLabel.blur())}),r.pageInput.addEventListener("focus",function(){setTimeout(function(){document.activeElement===r.pageInput&&r.pageInput.select()},0)}),r.pageInput.addEventListener("blur",ze),r.pageInput.addEventListener("keydown",function(o){o.key==="Enter"?(o.preventDefault(),ze(),r.pageInput.blur()):o.key==="Escape"&&(o.preventDefault(),r.pageInput.value=l.current,r.pageInput.blur())}),Be(r.scrollUp,-1),Be(r.scrollDown,1),r.listToggle.onclick=function(){Tt()},r.thumbsToggle.onclick=function(){de()},r.fit&&(r.fit.onclick=function(){Ge(l.aspectRatio?null:Tr())}),r.more.onclick=function(){rr(r.more)||(kr(nr(r.more)),l.popoverOwner=r.more)},ut().addEventListener("scroll",gr),r.panelScroll.addEventListener("scroll",bt),r.thumbsScroll.addEventListener("scroll",function(){bt(),ce()}),r.pages.addEventListener("mouseup",Ae),r.pages.addEventListener("click",pr);var lt=null,Ct=null,me=!1;r.pages.addEventListener("pointerdown",function(o){if(lt=null,!(o.pointerType!=="mouse"||o.button!==0)){var s=At(o.target);s&&(lt={layer:s,boxes:t(s)})}}),ut().addEventListener("scroll",function(){lt&&(lt.boxes=t(lt.layer))}),r.pages.addEventListener("pointermove",function(o){!lt||!(o.buttons&1)||(Ct={x:o.clientX,y:o.clientY},a())}),document.addEventListener("selectionchange",function(){me||a()}),["pointerup","pointercancel"].forEach(function(o){r.pages.addEventListener(o,function(){lt=null,Ct=null})}),document.addEventListener("selectionchange",Kn),r.pages.addEventListener("touchend",function(){vt&&clearTimeout(vt),vt=null,ke()}),document.addEventListener("keydown",function(o){o.key==="Escape"&&!l.noteEditing&&j()}),document.addEventListener("mousedown",function(o){if(l.popoverClosedFrom=null,!!r.popover.classList.contains("pdfa-open")&&!r.popover.contains(o.target)){var s=l.popoverOwner;j(),s&&!r.popover.classList.contains("pdfa-open")&&o.target&&o.target.closest&&o.target.closest("button")===s&&(l.popoverClosedFrom=s)}}),window.addEventListener("resize",function(){r.popover.classList.contains("pdfa-open")&&pe()}),W(),A(),l.aspectRatio=n.aspectRatio||null,ge(),gt(),r.root.querySelector(".pdfa-collapsed").onclick=zr,n.collapsed?N({action:"getViewerSummary",attachmentUUID:n.attachmentUUID}).then(function(o){if(!(!o||o.error)){p(o.name);var s=o.count||0;r.collapsedCount.textContent=s?s+(s===1?" highlight":" highlights"):""}}).catch(function(){}):Xe()}catch(t){w("Viewer failed to start: "+(t&&t.message?t.message:t),!0)}}function Vn(n){return String(n??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function vo(n){return JSON.stringify(n).replace(/</g,"\\u003c")}var Gn={light:"--pdfa-bg:#f6f7f9; --pdfa-fg:#1c1e21; --pdfa-toolbar:#fff; --pdfa-border:#b0b5bd; --pdfa-btn:#fff; --pdfa-btn-hover:#eceef1; --pdfa-error:#b3261e; --pdfa-accent:#1a6fb5;",dark:"--pdfa-bg:#1e2126; --pdfa-fg:#e6e8ea; --pdfa-toolbar:#252930; --pdfa-border:#3a3f47; --pdfa-btn:#2d323a; --pdfa-btn-hover:#3a4049; --pdfa-error:#f2b8b5; --pdfa-accent:#79b8ef;"};function qn({attachmentUUID:n,attachmentName:c="",page:i=null,highlightId:d=null,lightDarkMode:r="light",pluginUUID:p=null,noteUUID:l=null,collapsed:w=!1,aspectRatio:N=null,toolbarColorIds:_=Mt}={}){let D=Gn[r]||Gn.light,$={attachmentUUID:n,page:i,highlightId:d,pluginUUID:p,noteUUID:l,aspectRatio:N,pdfJsSrc:Nt.pdfJs,workerSrc:Nt.pdfJsWorker,pdfLibSrc:Nt.pdfLib,colors:Yt.map(R=>({id:R.id,label:R.label,hex:R.hex,rgb:R.rgb,cycleIndex:R.cycleIndex})),toolbarColorIds:_,defaultColorId:yn(_),markStyles:Et.map(R=>({id:R.id,label:R.label})),defaultMarkStyle:Pt,icons:Fn,collapsed:w,attachmentName:c};return`<link rel="stylesheet" href="${Nt.pdfViewerCss}">
<link rel="stylesheet" href="${Vn(Nt.robotoCss)}">
<style>:root{${D}}${$n}</style>
<div id="pdfa-root"${w?' class="pdfa-collapsed-mode"':""}>
<div class="pdfa-collapsed">
<span class="pdfa-brand" title="${St} plugin">${St}</span>
<span class="pdfa-collapsed-name">${Vn(c)}</span>
<span class="pdfa-spacer"></span>
<span class="pdfa-collapsed-count" id="pdfa-collapsed-count"></span>
<button id="pdfa-open" class="pdfa-btn pdfa-btn-primary">Expand</button>
</div>
<div class="pdfa-toolbar">
<button id="pdfa-thumbs-toggle" class="pdfa-icon-btn" title="Show page thumbnails"
aria-label="Show page thumbnails">${it(at.sidebar)}</button>
<button id="pdfa-prev" class="pdfa-icon-btn" title="Previous page"
aria-label="Previous page">${it(at.chevronLeft)}</button>
<input id="pdfa-page-input" class="pdfa-label pdfa-page-field" type="text"
inputmode="numeric" autocomplete="off" spellcheck="false"
aria-label="Page number" title="Page number - type a page and press Enter" value="-">
<span class="pdfa-label pdfa-page-total" id="pdfa-page-total">/ -</span>
<button id="pdfa-next" class="pdfa-icon-btn" title="Next page"
aria-label="Next page">${it(at.chevronRight)}</button>
<span class="pdfa-sep"></span>
<button id="pdfa-zoom-out" class="pdfa-icon-btn" title="Zoom out"
aria-label="Zoom out">${it(at.remove)}</button>
<input id="pdfa-zoom-label" class="pdfa-label pdfa-zoom-field" type="text"
inputmode="numeric" autocomplete="off" spellcheck="false"
aria-label="Zoom level in percent"
title="Zoom level - type a percentage and press Enter" value="125%">
<button id="pdfa-zoom-in" class="pdfa-icon-btn" title="Zoom in"
aria-label="Zoom in">${it(at.add)}</button>
<span class="pdfa-sep"></span>
<span class="pdfa-break"></span>
<span id="pdfa-styles"></span>
<span id="pdfa-colors"></span>
<span class="pdfa-sep"></span>
<button id="pdfa-list-toggle" class="pdfa-icon-btn pdfa-notes-btn"
title="Show highlights and notes" aria-label="Show highlights and notes"
>${it(at.listBulleted)}<span class="pdfa-count" id="pdfa-count">0</span></button>
<span class="pdfa-spacer"></span>
<button id="pdfa-fit" class="pdfa-icon-btn" title="Fit to this screen"
aria-label="Fit to this screen" aria-pressed="false"
>${it(at.fitScreen)}</button>
<button id="pdfa-more" class="pdfa-icon-btn" title="More actions"
aria-label="More actions">${it(at.moreVert)}</button>
</div>
<span class="pdfa-name" hidden></span>
<div class="pdfa-status" id="pdfa-status">Loading...</div>
<div class="pdfa-body">
<div class="pdfa-scroll"><div id="pdfa-pages"></div></div>
<div class="pdfa-thumbs" id="pdfa-thumbs">
<div class="pdfa-thumbs-scroll" id="pdfa-thumbs-scroll"></div>
</div>
<div class="pdfa-panel" id="pdfa-panel">
<div class="pdfa-panel-scroll" id="pdfa-panel-scroll"></div>
</div>
<div class="pdfa-scrollnav">
<button id="pdfa-scroll-up" title="Scroll up" aria-label="Scroll up">${it(at.arrowUp)}</button>
<button id="pdfa-scroll-down" title="Scroll down" aria-label="Scroll down">${it(at.arrowDown)}</button>
</div>
</div>
<div class="pdfa-popover" id="pdfa-popover"></div>
</div>
<script>window.__PDFA_CONFIG = ${vo($)};
window.__PDFA_GEOM = (${Ee.toString()})();
window.__PDFA_ANNOTATIONS = (${Se.toString()})();
window.__PDFA_EXPORT = (${Ne.toString()})();<\/script>
<script>(${jn.toString()})();<\/script>`}var xo={noteOption:{"Annotate PDF":async function(n,c){return xn(n,c,n.context.pluginUUID)}},linkTarget:async function(n,...c){return bn(n,c[0])},renderEmbed:function(n,...c){let{attachmentUUID:i,page:d,highlightId:r,collapsed:p,attachmentName:l,aspectRatio:w}=zt(c[0]);return i?qn({attachmentUUID:i,page:d,highlightId:r,collapsed:p,attachmentName:l,aspectRatio:w,lightDarkMode:n.context.lightDarkMode,pluginUUID:n.context.pluginUUID,noteUUID:n.context.noteUUID,toolbarColorIds:Qt(n.settings?n.settings[Xt]:null)}):`<p style="font:13px sans-serif;padding:12px">
This viewer isn't linked to a PDF. Re-run <b>Annotate PDF</b> from the note menu.
</p>`},onEmbedCall:async function(n,...c){return Bn(n,c[0])}},bo=xo;return Gr(wo);})();
var plugin = __pluginModule.default;
return plugin;
})()