PDF Annotator Plugin





description

Highlight and annotate PDFs attached to a note

name

PDF Annotator

icon

picture_as_pdf

setting

Highlight colors

instructions

link

Highlight and annotate PDFs attached to your notes, in four colors, with notes on any highlight — and export it all back into Amplenote as linked, colored quotes.



linkOpen a PDF

Attach a PDF to a note, then type /pdf annotator and choose PDF Annotator: Annotate PDF plugin. Or run Annotate PDF from the note's menu. The viewer opens beneath it.



linkHighlight and annotate

Select text in the PDF, then pick a color — either from the four circles in the toolbar, or the popover that appears right at your selection. That's it; no second step. A prompt to add a note appears immediately after.


Click an existing highlight to recolor or remove it, or to add/edit/remove its note.


Underline and strikethrough are available too, next to the highlight shape — same colors, different mark.

The panel below the toolbar lists every highlight and note in the PDF; click one to jump straight to it.


linkGet your highlights out

Download (⋮ menu) saves the PDF with every highlight and note baked in as real, native PDF annotations — selectable and editable in Acrobat, Preview, or any other reader, not flattened images.


Copy puts a highlight on your clipboard as a colored Amplenote quote, ready to paste anywhere.

Send to note appends that same quote to the bottom of the current note.

Export all (⋮ menu) builds a new "<PDF name> - Highlights" note containing every highlight, optionally filtered to one color.


Each exported highlight is a colored link back to the PDF, the quoted text, and your note if you left one — click the small icon at the end of the link (not the text itself — that's how Amplenote links work) to jump back to the exact page and position.


What's the "PDF Annotator data" section?

Amplenote plugins have no database of their own, so every highlight and note you create is written back into the PDF's own note, under a "PDF Annotator data" heading the plugin adds automatically. It holds a block of JSON, not meant to be read — that's your highlights, keyed by which PDF they belong to so several PDFs on one note don't collide.



It's labeled "safe to ignore, don't edit" for a real reason: editing or deleting it resets or corrupts every highlight and note stored there the next time you save one. It always sits at the very bottom of the note — "Send to note," and every exported block are written just above it — so it stays out of the way of your own writing rather than splitting it up.



linkPick your own four colors

By default the toolbar shows coral, yellow, green and blue. To use different ones: in the viewer, ⋮ → Highlight colors…, click up to four from the full palette, Save. All eleven colors stay available for recoloring any highlight regardless of which four are in the toolbar. Takes effect the next time you open the viewer.



The Highlight colors picker: four slots above the full eleven-color palette



(The menu these last two live in — Collapse, Download, Export, Highlight colors, Remove viewer )


Remove viewer (⋮ menu) takes the viewer out of the note, and deletes the highlights

and notes held inside it for that PDF — not just the box showing them. Confirmed with a

prompt first, since there's no undo after.


It leaves everything you already put into the note itself alone: blocks from Copy,

Send to note and Export are ordinary note content and stay put, and so does the

PDF name - Highlights" note. Export first if you want to keep a record.

linkOn mobile

Selecting, highlighting, notes, and export all work the same as desktop. Two things don't, both because a plugin runs inside a sandboxed frame the phone app doesn't fully delegate to: downloading the annotated PDF (the viewer will tell you if it can't, rather than fail silently), and dragging to scroll — use the ▲/▼ buttons on the right edge instead. A deep link still opens the right note and highlight; you scroll down to it yourself.



Fit the viewer to your phone. An embed can't size itself — its box comes from a single number stored in the note, the same on every device that the note is opened on. On a narrow screen, an extra button appears in the toolbar next to ⋮: Fit to this screen.




Mobile toolbar in its default state, with the Fit to this screen (expand) icon next to ⋮



Tap it once, and the box resizes to a comfortable height for that phone — the button then becomes Restore height (a compress icon) so you can put it back to the plugin's default from the same place:




Mobile toolbar after fitting: the same button now shows Restore height, and the page renders noticeably taller



It's a one-time action, not a live/automatic fit — tap it again any time your screen changes (a different phone, a rotated tablet), and it stays exactly as you left it otherwise, so a phone and a desktop with the same note open don't keep re-adjusting each other's view. If a note was fitted to a phone and you later open it on a desktop, that toolbar button won't be there (it's phone-only) — instead the ⋮ menu on desktop grows a Restore height entry, so you can undo a phone-sized box from there too.


repo: https://github.com/tashreefshareef/amplenote-pdf-annotator
https://www.youtube.com/watch?v=GuH27C1LMQY







linkCode block

// Javascript updated 8/18/2026, 6:03:26 PM by Amplenote Plugin Builder from source code within "https://github.com/tashreefshareef/amplenote-pdf-annotator/dist/plugin.js"
(() => {
// Amplenote PDF Annotator - v1.0.0
// GENERATED FILE - do not edit. Edit src/ and run `npm run build`.
var __pluginModule=(()=>{var me=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Or=Object.getOwnPropertyNames;var _r=Object.prototype.hasOwnProperty;var Br=(n,d)=>{for(var i in d)me(n,i,{get:d[i],enumerable:!0})},Fr=(n,d,i,c)=>{if(d&&typeof d=="object"||typeof d=="function")for(let r of Or(d))!_r.call(n,r)&&r!==i&&me(n,r,{get:()=>d[r],enumerable:!(c=zr(d,r))||c.enumerable});return n};var $r=n=>Fr(me({},"__esModule",{value:!0}),n);var ho={};Br(ho,{default:()=>fo});function jr(n){return[1,3,5].map(d=>Math.round(parseInt(n.slice(d,d+2),16)/255*1e3)/1e3)}var Gt=[["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,d,i,c])=>({id:n,label:d,hex:i,cycleIndex:c,rgb:jr(i)})),Ht=["coral","yellow","green","blue"],Ke=4,Yt="Highlight colors",Xt="yellow",Et=[["highlight","Highlight","Highlight"],["underline","Underline","Underline"],["strike","Strikethrough","StrikeOut"]].map(([n,d,i])=>({id:n,label:d,pdfSubtype:i})),Mt=Et[0].id,nt="PDF Annotator data",Qe="Highlights",Ze="attachment://",tn=1,en=14,nn=.35,rn=1.2,St={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"},Vr="https://plugins.amplenote.com/cors-proxy";function on(n){let d=new URL(Vr);return d.searchParams.set("apiurl",n),d.toString()}var qr="application/pdf";function Gr(n){return Array.isArray(n)?n.filter(d=>d&&d.type===qr&&d.uuid):[]}async function an(n,d){let i=await n.getNoteAttachments({uuid:d}),c=Gr(i);if(c.length===0)return null;if(c.length===1)return c[0];let r=await n.prompt("Which PDF do you want to annotate?",{inputs:[{label:"PDF",type:"radio",options:c.map(l=>({label:l.name,value:l.uuid})),value:c[0].uuid}]});if(r==null)return null;let p=Array.isArray(r)?r[0]:r;return c.find(l=>l.uuid===p)||null}async function ln(n,d){if(!d)throw new Error("fetchableAttachmentURL: attachmentUUID required");let i=await n.getAttachmentURL(d);if(!i)throw new Error(`No URL returned for attachment ${d}`);return on(i)}function Pt(n){let d=typeof n=="string"?Number(n):n;return!Number.isFinite(d)||d<nn||d>rn?null:Math.round(d*100)/100}function cn(n,d){return n?en:Pt(d)||tn}function zt(n){let d={attachmentUUID:null,page:null,x:null,y:null,highlightId:null,noteUUID:null,collapsed:!1,attachmentName:"",aspectRatio:null};if(!n||typeof n!="string")return d;let i;try{i=new URLSearchParams(n.replace(/^\?/,""))}catch{return d}let c=p=>{let l=i.get(p);if(l===null||l.trim()==="")return null;let w=Number(l);return Number.isFinite(w)?w:null},r=c("page");return{attachmentUUID:i.get("att")||null,page:r!==null&&r>=1?Math.floor(r):null,x:c("x"),y:c("y"),highlightId:i.get("hl")||null,noteUUID:i.get("note")||null,collapsed:i.get("c")==="1",attachmentName:i.get("n")||"",aspectRatio:Pt(i.get("ar"))}}function dn({attachmentUUID:n,page:d,x:i,y:c,highlightId:r,collapsed:p,attachmentName:l,aspectRatio:w}={}){let I=new URLSearchParams;n&&I.set("att",n),p&&I.set("c","1");let z=Pt(w);return z&&I.set("ar",String(z)),l&&I.set("n",l),Number.isFinite(d)&&d>=1&&I.set("page",String(Math.floor(d))),Number.isFinite(i)&&I.set("x",String(i)),Number.isFinite(c)&&I.set("y",String(c)),r&&I.set("hl",r),I.toString()}function sn(n,d={},i=null){if(!n)throw new Error("buildEmbedMarkup: pluginUUID required");i===null&&(i=cn(d.collapsed,d.aspectRatio));let c=dn(d);return`<object data="${c?`plugin://${n}?${c}`:`plugin://${n}`}" data-aspect-ratio="${i}" />`}function pn(n,d,i){if(!n||!d||!i)return null;let c=n.split(`
`),r=c.findIndex(l=>l.includes(`${Ze}${d}`));if(r===-1)return null;let p=c.slice();return c[r+1]===""?p.splice(r+2,0,i.trim(),""):p.splice(r+1,0,"",i.trim(),""),p.join(`
`)}function un(n,d,i){let c=`plugin://${d}`;return n.findIndex(r=>r.includes("<object")&&r.includes(c)&&r.includes(`att=${i}`))}function fn(n,d,i=null){if(!n||!d)return!1;let c=`plugin://${d}`;return String(n).split(`
`).some(r=>r.includes("<object")&&r.includes(c)&&(!i||r.includes(`att=${i}`)))}function Wt(n,d,i){if(!n||!d||!i)return null;let c=n.split(`
`),r=un(c,d,i);if(r===-1)return null;let p=c.slice();return p.splice(r,1),p[r]===""&&p[r-1]===""&&p.splice(r,1),p.join(`
`)}function It(n,d,i,c={}){if(!n||!d||!i)return null;let r=n.split(`
`),p=un(r,d,i);if(p===-1)return null;let l=r[p],w=l.match(/data="(plugin:\/\/[^"]*)"/);if(!w)return null;let I=w[1],z=I.indexOf("?"),M=z===-1?"":I.slice(z+1),D={...zt(M),attachmentUUID:i,...c},x=dn(D),N=x?`plugin://${d}?${x}`:`plugin://${d}`,T=r.slice(),L=l.replace(w[0],`data="${N}"`),U=cn(D.collapsed,D.aspectRatio),u=L.match(/data-aspect-ratio="[^"]*"/);return L=u?L.replace(u[0],`data-aspect-ratio="${U}"`):L.replace(/\s*\/>\s*$/,` data-aspect-ratio="${U}" />`),T[p]=L,T.join(`
`)}function hn(n,d,i,c){return It(n,d,i,{collapsed:!!c})}async function gn(n,d,i){let c=await an(n,d);if(!c){let w=await n.getNoteAttachments({uuid:d});return(!(Array.isArray(w)&&w.length>0)||!w.some(z=>z&&z.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:d});if(fn(r,i,c.uuid))return await n.alert(`"${c.name}" is already open in this note - scroll to the viewer.`),c.uuid;let p=sn(i,{attachmentUUID:c.uuid,attachmentName:c.name}),l=pn(r,c.uuid,p);return l!==null?(await n.replaceNoteContent({uuid:d},l),c.uuid):(await n.insertNoteContent({uuid:d},`
${p}
`,{atEnd:!0}),c.uuid)}var Yr=n=>`https://www.amplenote.com/notes/${n}`;async function Xr(n,d,i,c){let r={uuid:d},p=Wt(i,n.context.pluginUUID,c);if(p!==null)try{await n.replaceNoteContent(r,p)}catch{}try{await n.replaceNoteContent(r,i)}catch{await n.replaceNoteContent(r,i)}}async function mn(n,d){let{noteUUID:i,attachmentUUID:c,page:r,highlightId:p}=zt(d);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}),I=It(w,n.context.pluginUUID,c,{page:r,highlightId:p,collapsed:!1});I!==null&&(l?await Xr(n,i,I,c):await n.replaceNoteContent({uuid:i},I))}catch{}await n.navigate(Yr(i))}function Ot(n){if(!n)return null;let d=String(n).trim().toLowerCase(),i=d.startsWith("#")?d:"#"+d;return Gt.find(c=>c.id===d||c.hex.toLowerCase()===i||c.label.toLowerCase()===d)||null}function vn(){return Ot(Xt)}function Jt(n){let d=[];for(let i of String(n??"").split(/[,;\s]+/)){let c=Ot(i);if(c&&d.indexOf(c.id)===-1&&d.push(c.id),d.length===Ke)break}return d.length?d:Ht.slice()}function xn(n){let d=n&&n.length?n:Ht;return d.indexOf(Xt)!==-1?Xt:d[0]}function Wr(n){if(!n)return Mt;let d=String(n).trim().toLowerCase(),i=Et.find(c=>c.id===d||c.label.toLowerCase()===d);return i?i.id:Mt}function Jr(){return"hl-"+Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,8)}function Kt({page:n,color:d,rects:i,quoteText:c,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 I of i)if(![I.x,I.y,I.width,I.height].every(Number.isFinite))throw new Error(`createHighlight: malformed rect ${JSON.stringify(I)}`);let w=Ot(d)||vn();return{id:p||Jr(),page:n,color:w.id,style:Wr(l),rects:i.map(I=>({x:I.x,y:I.y,width:I.width,height:I.height})),quoteText:String(c||""),note:r?String(r):null}}function bn(n,d){let i=d==null?null:String(d).trim();return{...n,note:i||null}}function wn(n,d){let i=Ot(d);if(!i)throw new Error(`withColor: unknown color "${d}"`);return{...n,color:i.id}}function yn(n,d){let i=Et.find(c=>c.id===d);if(!i)throw new Error(`withStyle: unknown mark style "${d}"`);return{...n,style:i.id}}function Cn(n,d){return(n||[]).filter(i=>i.id!==d)}function Qt(n,d,i){let c=!1,r=(n||[]).map(p=>p.id!==d?p:(c=!0,i(p)));return c?r:n}var Kr="json",Nt="__exportNotes",En="*Managed automatically by the PDF Annotator plugin - safe to ignore, don't edit.*";function Qr(n){let d=JSON.stringify(n,null,0).replace(/`/g,"\\u0060");return`${En}
\`\`\`${Kr}
${d}
\`\`\``}function Zt(n){if(!n)return null;let d=n.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/),i=!d&&n.match(/<!--\s*PDFA-DATA\s*\n?([\s\S]*?)-->/),c=(d?d[1]:i?i[1]:n).trim();if(!c)return null;try{return JSON.parse(c)}catch{return null}}function Zr(n){if(!Array.isArray(n))return[];let d=[];for(let i of n)try{d.push(Kt(i))}catch{}return d}async function te(n,d,i){let c=await n.getNoteContent({uuid:d}),r=ee(c,nt),p=Zt(r);return!p||typeof p!="object"?[]:Zr(p[i])}async function ve(n,d,i){let c={uuid:d},r=await n.getNoteContent(c);oo(r);let p=ee(r,nt),l=Zt(p)||{},w=i(l);if(w===null)return;let I=Qr(w);p===null&&await n.insertNoteContent(c,`
 
# ${nt}
 
`,{atEnd:!0});let z=ao(r,I);if(z!==null){await n.replaceNoteContent(c,z);return}await n.replaceNoteContent(c,I,{section:{heading:{text:nt,level:1}}})}async function Sn(n,d,i,c){await ve(n,d,r=>({...r,[i]:c}))}async function In(n,d,i){await ve(n,d,c=>{let r=c[Nt],p=r&&typeof r=="object"&&i in r;if(!(i in c)&&!p)return null;let l={...c};if(delete l[i],p){let w={...r};delete w[i],Object.keys(w).length?l[Nt]=w:delete l[Nt]}return l})}async function Nn(n,d,i){let c=await n.getNoteContent({uuid:d}),r=Zt(ee(c,nt));if(!r||typeof r!="object")return null;let p=r[Nt];if(!p||typeof p!="object")return null;let l=p[i];return typeof l=="string"&&l?l:null}async function Un(n,d,i,c){await ve(n,d,r=>{let p=r[Nt],l=p&&typeof p=="object"?p:{};return l[i]===c?null:{...r,[Nt]:{...l,[i]:c}}})}async function Tn(n,d,i,c){let r={uuid:d},p=await n.getNoteContent(r);if(ee(p,i)===null){let l=p&&p.trim()?`
 
`:"";await n.insertNoteContent(r,`${l}# ${i}
 
`,{atEnd:!0})}await n.replaceNoteContent(r,c,{section:{heading:{text:i,level:1}}})}function kn(n,d){let i=/^#\s+(.*)$/,c=[];for(let r=0;r<n.length;r++){let p=n[r].match(i);!p||p[1].trim()!==d||(c.length&&(c[c.length-1].end=r),c.push({start:r,end:n.length}))}for(let r of c)for(let p=r.start+1;p<r.end;p++)if(/^#\s+/.test(n[p])){r.end=p;break}return c}function xe(n,d){let i=kn(n,d);return i.length?i.find(r=>Zt(n.slice(r.start+1,r.end).join(`
`).trim()))||i[0]:null}function ee(n,d){if(!n)return null;let i=n.split(`
`),c=xe(i,d);return c?i.slice(c.start+1,c.end).join(`
`).trim():null}function to(n){if(!n)return"";let d=n,i=d.match(/```(?:json)?\s*\n?[\s\S]*?\n?```/);return i&&(d=d.replace(i[0],"")),d=d.replace(/<!--\s*PDFA-DATA[\s\S]*?-->/,""),d=d.replace(En,""),d.trim()}function eo(n){return String(n).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function no(n,d){return d?new RegExp("\\]\\(plugin://"+eo(d)+"[^)]*[?&]hl=").test(n):n.includes("](plugin://")}function ro(n){let d=n.split(`
`),i=d.findIndex(c=>c.trim()===`# ${nt}`);i===-1&&(i=d.length);for(let c=i-1;c>=0;c--){let r=d[c].trim();if(r!=="")return r==="---"}return!0}function An(n,d,i){let c=String(n||"");return no(c,i)||ro(c)?d:`---
 
${d}`}function Dn(n,d){let i=(n||"").split(`
`),c=xe(i,nt);if(!c)return null;let r=i.slice(0,c.start).join(`
`).replace(/\s+$/,""),p=i.slice(c.start).join(`
`);return`${r?r+`
 
`:""}${d}
 
${p}`}function oo(n){let d=kn((n||"").split(`
`),nt).length;if(!(d<2))throw new Error(`this note has ${d} "${nt}" headings, so highlights cannot be saved reliably. Delete the empty one - keep the heading whose code block holds the JSON - and try again.`)}function ao(n,d){let i=(n||"").split(`
`),c=xe(i,nt);if(!c)return null;let r=to(i.slice(c.start+1,c.end).join(`
`).trim());if(!r)return null;let p=i.slice(0,c.start).join(`
`).replace(/\s+$/,""),l=i.slice(c.end).join(`
`).replace(/^\s+/,"");return`${p?p+`
 
`:""}${r}
 
${i[c.start]}
 
${d}${l?`
 
`+l:""}`}function Rn(n){return/^\s*>/.test(n)}function Ln(n,d,i,c){if(!n||!d||!c)return null;for(let r=0;r<n.length;r++){let p=n[r];if(!p.includes(`](plugin://${d}`)||i&&!p.includes(`att=${i}`)||!new RegExp(`hl=${io(c)}(?![\\w-])`).test(p))continue;let l=r+1;for(l<n.length&&n[l].trim()===""&&l+1<n.length&&Rn(n[l+1])&&l++;l<n.length&&Rn(n[l]);)l++;return{start:r,end:l}}return null}function io(n){return String(n).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lo(n,d,i){if(!n||!d)return[];let c=[],r=String(n).split(`
`);for(let p of r){if(!p.includes(`](plugin://${d}`)||i&&!p.includes(`att=${i}`))continue;let l=p.match(/[?&]hl=([^&)\s]+)/);l&&c.indexOf(l[1])===-1&&c.push(l[1])}return c}function Hn(n,d,i,c){let r=String(n||"").split(`
`),p=Ln(r,d,i,c);if(!p)return null;let{start:l,end:w}=p;w<r.length&&r[w].trim()===""&&w++;let I=r.slice(0,l).concat(r.slice(w));return lo(I.join(`
`),d,i).length?I.join(`
`):co(I).join(`
`)}function co(n){let d=n.findIndex(i=>i.trim()===`# ${nt}`);d===-1&&(d=n.length);for(let i=d-1;i>=0;i--){let c=n[i].trim();if(c==="")continue;if(c!=="---")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 ne(n,d,i,c,r){let p=String(n||"").split(`
`),l=Ln(p,d,i,c);return l?p.slice(0,l.start).concat(String(r).split(`
`),p.slice(l.end)).join(`
`):null}function et(n,d){return d.noteUUID||n.context.noteUUID}async function Mn(n,d,i){try{let c=await n.getNoteAttachments({uuid:d}),r=Array.isArray(c)&&c.find(p=>p&&p.uuid===i);return r?r.name:""}catch{return""}}async function _t(n,d,i,c){let r=await te(n,d,i),p=c(r);return p!==r&&await Sn(n,d,i,p),{highlights:p}}async function be(n,d,i,c){if(i.pluginUUID)try{let r=await n.getNoteContent({uuid:d}),p=c(r);p!==null&&p!==r&&await n.replaceNoteContent({uuid:d},p)}catch{}}function Pn(n){if(n&&typeof n=="object")return n;if(typeof n!="string")return{};let d=n.trim();if(!d.startsWith("{"))return{action:d};try{return JSON.parse(d)}catch{return{action:d}}}async function zn(n,d){return JSON.stringify(await so(n,Pn(d)))}async function so(n,d){let i=Pn(d);switch(i.action){case"getPdfUrl":{let c=i.attachmentUUID;if(!c)return{error:"No attachment specified for this viewer."};try{return{url:await ln(n,c),name:await Mn(n,et(n,i),c)}}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 c=et(n,i);return{highlights:await te(n,c,i.attachmentUUID)}}catch(c){return{error:`Could not load highlights: ${c.message}`}}}case"addHighlight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let c=Kt(i.highlight||{});return await _t(n,et(n,i),i.attachmentUUID,r=>r.concat([c]))}catch(c){return{error:`Could not save the highlight: ${c.message}`}}}case"recolorHighlight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let c=et(n,i),r=await _t(n,c,i.attachmentUUID,p=>Qt(p,i.id,l=>wn(l,i.color)));return i.exportBlock&&await be(n,c,i,p=>ne(p,i.pluginUUID,i.attachmentUUID,i.id,i.exportBlock)),r}catch(c){return{error:`Could not change the highlight color: ${c.message}`}}}case"restyleHighlight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let c=et(n,i),r=await _t(n,c,i.attachmentUUID,p=>Qt(p,i.id,l=>yn(l,i.style)));return i.exportBlock&&await be(n,c,i,p=>ne(p,i.pluginUUID,i.attachmentUUID,i.id,i.exportBlock)),r}catch(c){return{error:`Could not change the mark: ${c.message}`}}}case"setHighlightNote":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{return await _t(n,et(n,i),i.attachmentUUID,c=>Qt(c,i.id,r=>bn(r,i.note)))}catch(c){return{error:`Could not save the note: ${c.message}`}}}case"removeHighlight":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};try{let c=et(n,i),r=await _t(n,c,i.attachmentUUID,p=>Cn(p,i.id));return await be(n,c,i,p=>Hn(p,i.pluginUUID,i.attachmentUUID,i.id)),r}catch(c){return{error:`Could not remove the highlight: ${c.message}`}}}case"sendToNote":{if(!i.content)return{error:"Nothing to send."};try{let c={uuid:et(n,i)},r=await n.getNoteContent(c);if(i.highlightId){let w=ne(r,i.pluginUUID,i.attachmentUUID,i.highlightId,i.content);if(w!==null)return await n.replaceNoteContent(c,w),{ok:!0,replaced:!0}}let p=An(r,i.content,i.pluginUUID),l=Dn(r,p);return l===null?await n.insertNoteContent(c,`
`+p+`
`,{atEnd:!0}):await n.replaceNoteContent(c,l),{ok:!0}}catch(c){return{error:`Could not add this to the note: ${c.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 c=et(n,i),r=await n.getNoteContent({uuid:c}),p=Wt(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:c},p),await In(n,c,i.attachmentUUID),{ok:!0})}catch(c){return{error:`Could not remove this viewer: ${c.message}`}}}case"getViewerSummary":{if(!i.attachmentUUID)return{error:"No attachment specified for this viewer."};let c=et(n,i),r=await Mn(n,c,i.attachmentUUID);try{let p=await te(n,c,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 c=et(n,i),r=await n.getNoteContent({uuid:c}),p=hn(r,i.pluginUUID,i.attachmentUUID,i.collapsed);return p===null?{ok:!1}:(await n.replaceNoteContent({uuid:c},p),{ok:!0})}catch(c){return{error:`Could not resize this viewer: ${c.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 c=et(n,i),r=await n.getNoteContent({uuid:c}),p=Pt(i.aspectRatio),l=It(r,i.pluginUUID,i.attachmentUUID,{aspectRatio:p});return l===null?{ok:!1}:(await n.replaceNoteContent({uuid:c},l),{ok:!0,aspectRatio:p})}catch(c){return{error:`Could not resize this viewer: ${c.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 c=et(n,i),r=await n.getNoteContent({uuid:c}),p=It(r,i.pluginUUID,i.attachmentUUID,{page:null,highlightId:null});return p===null?{ok:!1}:(await n.replaceNoteContent({uuid:c},p),{ok:!0})}catch(c){return{error:`Could not clear this viewer's deep link: ${c.message}`}}}case"exportAll":{if(!i.noteName)return{error:"Missing destination note name."};let c=et(n,i);try{let r=null;if(i.attachmentUUID){let p=await Nn(n,c,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 Tn(n,r,Qe,i.content||""),i.attachmentUUID)try{await Un(n,c,i.attachmentUUID,r)}catch{}return{ok:!0,noteUUID:r}}catch(r){return{error:`Could not export highlights: ${r.message}`}}}case"setToolbarColors":{let c=Jt(Array.isArray(i.colorIds)?i.colorIds.join(","):i.colorIds),r=c.join(", ");try{return typeof n.setSetting!="function"?{ids:c,saved:!1,error:"This Amplenote version can't save plugin settings."}:(await n.setSetting(Yt,r),{ids:c,saved:!0})}catch(p){return{ids:c,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 On=`*{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 it={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"},_n={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 lt(n){return'<svg class="pdfa-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="'+n+'"></path></svg>'}function we(){function n(u,h){return{x:u.left-h.left,y:u.top-h.top,width:u.width,height:u.height}}function d(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 c(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)},k=[],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++;k.push({start:P,end:E})}return k}function p(u){for(var h="",b=!1,g=null,m=0,S=null,C=!1,k=!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,_=Math.max(W/2,.5);if(g!==null&&Math.abs(P.line-g)>_){var rt=S===null||P.x===null||P.x===void 0?!0:S-P.x>Math.max(W*2,1);rt?C=!0:P.line>g&&P.lineSize&&m&&P.lineSize<m&&!w(u,E)?k=!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),G=0;G<B.length;G++){var J=h.length>0&&G===0&&C,ot=!J&&h.length>0&&G===0&&k,K=!J&&!ot&&h.length>0&&(G>0||b||B[G].start>P.from);h+=(J?`
`:ot?"^":K?" ":"")+P.text.slice(B[G].start,B[G].end),C=!1,k=!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],k=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(k===0&&E===0)return{x:u.x,y:u.y};(k<g||k===g&&E<m)&&(g=k,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 I(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];c(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 z(u,h,b){for(var g=[],m=0;m<u.length;m++){var S=n(u[m],h);if(c(S)){var C=b(S.x,S.y),k=b(S.x+S.width,S.y+S.height),E=i(d(C,k));c(E)&&g.push(E)}}return g}function M(u,h){var b=h(u.x,u.y),g=h(u.x+u.width,u.y+u.height);return d(b,g)}function F(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,k=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:k,y:P,width:E-k,height:W-P}}function D(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,at){return at.y-K.y||K.x-at.x}),m=[],S=0;S<g.length;S++){for(var C=!1,k=0;k<m.length;k++)if(D(m[k][0],g[S])){m[k].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,at){return K.x-at.x}),_=null,rt=0;rt<W.length;rt++){var B=W[rt];if(_===null){_={x:B.x,y:B.y,width:B.width,height:B.height};continue}var G=B.x-(_.x+_.width);if(G<=b*Math.max(_.height,B.height)){var J=Math.max(_.x+_.width,B.x+B.width),ot=Math.max(_.y+_.height,B.y+B.height);_.x=Math.min(_.x,B.x),_.y=Math.min(_.y,B.y),_.width=J-_.x,_.height=ot-_.y}else E.push(_),_={x:B.x,y:B.y,width:B.width,height:B.height}}_!==null&&E.push(_)}return E.map(function(K){return i(K)})}function N(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 k=S[C];if(!(!k||k.page!==h||!k.rects)){for(var E=0;E<k.rects.length;E++)if(N(k.rects[E],b,g,m===void 0?1:m))return k}}return null}function L(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,k=0;k<h.length;k++){var E=h[k];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:d,roundRect:i,isVisibleRect:c,textTokenRanges:r,joinSelectionSlices:p,unionClientRects:I,clientRectsToPdfRects:z,pdfRectToViewportRect:M,itemRelativeRect:F,mergeLineRects:x,rectContainsPoint:N,hitTestHighlights:T,normalizeQuoteText:L,expandRectToLineBox:U,snapPointToLineBox:l}}var Q=we(),Go=Q.clientRectToLocal,Yo=Q.rectFromCorners,Xo=Q.roundRect,Wo=Q.isVisibleRect,Jo=Q.textTokenRanges,Ko=Q.joinSelectionSlices,Qo=Q.unionClientRects,Zo=Q.clientRectsToPdfRects,ta=Q.pdfRectToViewportRect,ea=Q.expandRectToLineBox,na=Q.itemRelativeRect,ra=Q.mergeLineRects,oa=Q.rectContainsPoint,aa=Q.hitTestHighlights,ia=Q.normalizeQuoteText,la=Q.snapPointToLineBox;function ye(){var n=[.957,.871,.424],d={highlight:"Highlight",underline:"Underline",strike:"StrikeOut"},i=.77,c=.15,r=.12,p=.6,l=1;function w(x,N){if(N!=="underline"&&N!=="strike")return x;for(var T=[],L=0;L<x.length;L++){var U=x[L],u=Math.max(p,U.height*r),h=N==="underline"?U.y-Math.max(p,U.height*c)-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 I(x,N,T,L,U){var u=N.context.register(N.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(L[0],L[1],L[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=N.context.formXObject(h,{BBox:U,Resources:{ExtGState:{GS0:u}}});return N.context.register(m)}function z(x,N,T,L){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=N.maxX+U;C+u>T-U&&(C=T-U-u),C<U&&(C=U);var k=N.maxY;k>L-U&&(k=L-U);var E=k-S;return E<U&&(E=U,k=Math.min(E+S,L-U)),[C,E,C+u,k]}function M(x,N,T,L,U){for(var u=T.rects,h=d[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,k=0;k<u.length;k++){var E=u[k],P=E.x,W=E.x+E.width,_=E.y,rt=E.y+E.height;b.push(P,rt,W,rt,P,_,W,_),g=Math.min(g,P),m=Math.min(m,_),S=Math.max(S,W),C=Math.max(C,rt)}for(var B=w(u,h),G=g,J=m,ot=S,K=C,at=0;at<B.length;at++){var pt=B[at];G=Math.min(G,pt.x),J=Math.min(J,pt.y),ot=Math.max(ot,pt.x+pt.width),K=Math.max(K,pt.y+pt.height)}var ht=N.context.obj({Type:x.PDFName.of("Annot"),Subtype:x.PDFName.of(d[h]),Rect:N.context.obj([G,J,ot,K]),QuadPoints:N.context.obj(b),C:N.context.obj(L),F:x.PDFNumber.of(4),T:x.PDFString.of("PDF Annotator"),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=I(x,N,B,L,[G,J,ot,K]);ht.set(x.PDFName.of("AP"),N.context.obj({N:yt}));var Bt=N.context.register(ht),gt=[Bt];if(T.note){var Ft=N.context.register(N.context.obj({Type:x.PDFName.of("Annot"),Subtype:x.PDFName.of("Popup"),Rect:N.context.obj(z(T.note,{maxX:S,maxY:C},U&&U.width||612,U&&U.height||792)),Parent:Bt,Open:!1}));ht.set(x.PDFName.of("Popup"),Ft),gt.push(Ft)}return gt}function F(x,N,T){var L=N.node.get(x.PDFName.of("Annots"));if(L instanceof x.PDFArray)for(var U=0;U<T.length;U++)L.push(T[U]);else N.node.set(x.PDFName.of("Annots"),N.doc.context.obj(T))}async function D(x,N,T,L){for(var U=await x.PDFDocument.load(N),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=L&&L[g.color]||n,C=M(x,U,g,S,m.getSize());F(x,m,C)}}}return U.save()}return{writeHighlightsIntoPdf:D,buildHighlightAnnotation:M,appendAnnotationRefs:F,paintedRects:w}}var re=ye(),da=re.writeHighlightsIntoPdf,sa=re.buildHighlightAnnotation,pa=re.appendAnnotationRefs,ua=re.paintedRects;function Ce(){function n(M){return String(M??"").replace(/\]/g,"\\]").replace(/</g,"&lt;")}function d(M,F,D,x,N){var T=new URLSearchParams;F&&T.set("att",F),Number.isFinite(D)&&D>=1&&T.set("page",String(Math.floor(D))),x&&T.set("hl",x),N&&T.set("note",N);var L=T.toString();return"plugin://"+M+(L?"?"+L:"")}function i(M,F){return String(M??"").split(/\r?\n/).map(function(D){return(F+" "+D).replace(/[ \t]+$/,"")})}function c(M,F,D){if(!F)return M;var x=D!=null?'<!-- {"backgroundCycleColor":"'+D+'"} -->':"";return'<mark style="background-color:'+F+';">'+M+x+"</mark>"}function r(M,F,D,x,N,T,L){var U=d(F,D,x.page,x.id,L),u=c(n(M||"PDF"),N,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(M){return String(M??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function l(M){return"<p>"+p(M).replace(/\r?\n/g,"<br>")+"</p>"}function w(M,F,D,x,N,T,L){var U=d(F,D,x.page,x.id,L),u=p(M||"PDF"),h=T!=null?' data-background-color="'+p(T)+'"':"",b=N?"<mark"+h+' style="background-color: '+p(N)+';">'+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 I(M){return M.slice().sort(function(F,D){if(F.page!==D.page)return F.page-D.page;var x=F.rects&&F.rects[0]?F.rects[0].y:0,N=D.rects&&D.rects[0]?D.rects[0].y:0;return N-x})}function z(M,F,D,x,N,T,L){var U=T&&T.length?T:null,u=(x||[]).filter(function(g){return g&&(!U||U.indexOf(g.color)!==-1)}),h=I(u),b=h.map(function(g){var m=N&&N[g.color]||{};return r(M,F,D,g,m.hex,m.cycleIndex,L)});return b.join(`
 
`)}return{buildDeepLink:d,buildHighlightBlock:r,buildHighlightHtml:w,buildExportAllContent:z}}var oe=Ce(),ha=oe.buildDeepLink,ga=oe.buildHighlightBlock,ma=oe.buildHighlightHtml,va=oe.buildExportAllContent;function Bn(){var n=window.__PDFA_CONFIG||{},d=window.__PDFA_GEOM||{},i=window.__PDFA_ANNOTATIONS||{},c=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 I(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 z(){return n.colors||[]}function M(){for(var t=n.toolbarColorIds||[],e=z(),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 F(){for(var t={},e=0;e<l.highlights.length;e++)t[l.highlights[e].color]=!0;var a=z().filter(function(o){return t[o.id]});return a.length?a:M()}function D(t){for(var e=z(),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 N(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 L=.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*L-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 k(){for(var t=M(),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&&Te(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=z(),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,_(),E()},r.styles.appendChild(o)})(t[e]);_()}function _(){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 rt(){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 G(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 A=null;return l.doc.getPage(e).then(function(H){return A=H,H.render({canvasContext:y,viewport:a}).promise}).then(function(){return A.getTextContent()}).then(function(H){var O=[];return window.pdfjsLib.renderTextLayer({textContent:H,container:v,viewport:a,textDivs:O}).promise.then(function(){l.textSpans+=O.length;for(var R=0;R<O.length;R++)O[R].__pdfaItem=H.items[R];l.rendered[e]=!0,l.renderingPage[e]=!1,ht(e),ot()})}).catch(function(H){l.renderingPage[e]=!1,w("Failed to render page "+e+": "+(H.message||H),!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 A=v.getBoundingClientRect(),H=A.top-e.top,O=A.bottom-e.top;O<-a||H>t.clientHeight+a||s.push(G(v,y))}}return Promise.all(s)}function ot(){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,ke(!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,rt().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,Dt(),bt(),J()}).catch(function(o){l.rendering=!1,w("Failed to render: "+(o.message||o),!0)})}function at(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(),A=0;A<f.length;A++){y.selectNodeContents(f[A]);for(var H=y.getClientRects(),O=0;O<H.length;O++){var R=H[O];!R.width||!R.height||v.push({top:R.top-s.top,bottom:R.bottom-s.top,left:R.left-s.left,right:R.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 A=at(y),H=null,O=!1,R=0;R<l.highlights.length;R++){var $=l.highlights[R];if(!(!$||$.page!==f||!$.rects||!$.rects.length)){var X=document.createElement("div");X.className="pdfa-hl-group",X.dataset.id=$.id||"";var V=N($);V==="highlight"&&!O&&(H=pt(s,f),O=!0);for(var q=0;q<$.rects.length;q++){var tt=d.pdfRectToViewportRect($.rects[q],A),Y=V==="highlight"?d.expandRectToLineBox(tt,H):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=D($.color),X.appendChild(Z)}v.appendChild(X)}}}}}function yt(){ht(),gt(),r.count.textContent=String(l.highlights.length)}function Bt(){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(){Ut(!1)})),r.panelScroll.appendChild(t);var a=Bt();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=N(t),o=document.createElement("span");o.className="pdfa-chip"+(a==="highlight"?"":" pdfa-chip-band pdfa-chip-"+a),o.style.setProperty("--pdfa-chip-color",D(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(){Le(t)},e}function Ee(){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(){Rt(e)},r.thumbsScroll.appendChild(o)})(t)}function ae(){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))}}Se()}}function Se(){if(!(l.thumbRendering||!l.thumbQueue.length)){l.thumbRendering=!0;var t=l.thumbQueue.shift();Vn(t).catch(function(){l.thumbDrawn[t]=!1}).then(function(){l.thumbRendering=!1,Se()})}}function Vn(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}),A=document.createElement("canvas");return A.width=Math.max(1,Math.floor(y.width)),A.height=Math.max(1,Math.floor(y.height)),o.render({canvasContext:A.getContext("2d"),viewport:y}).promise.then(function(){a.appendChild(A)})}):Promise.resolve()}function Ie(){if(!r.thumbsScroll.childNodes.length&&r.thumbs.classList.contains("pdfa-open")&&l.doc&&l.pageCount&&(Ee(),ae()),!!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 ie(t){var e=t===void 0?!r.thumbs.classList.contains("pdfa-open"):t;e&&r.panel.classList.contains("pdfa-open")&&Ut(!1),r.thumbs.classList.toggle("pdfa-open",e),r.thumbsToggle.setAttribute("aria-pressed",String(e)),e&&(r.thumbsScroll.childNodes.length||Ee(),Ie(),qn(),ae()),bt()}function qn(){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 Ut(t){var e=t===void 0?!r.panel.classList.contains("pdfa-open"):t;e&&r.thumbs.classList.contains("pdfa-open")&&ie(!1),r.panel.classList.toggle("pdfa-open",e),r.listToggle.setAttribute("aria-pressed",String(e)),e&&gt(),bt()}function Tt(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 Gn(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||"",A=v===t.startContainer?t.startOffset:0,H=v===t.endContainer?t.endOffset:y.length,O=v.parentElement,R=O&&O.__pdfaItem;if(s.push({text:y,from:A,to:H,line:R?R.transform[5]:null,lineSize:R?R.height:null,x:R?R.transform[4]:null,xEnd:R?R.transform[4]+R.width:null}),!!R)for(var $={x1:R.transform[4],y1:R.transform[5],x2:R.transform[4]+R.width,y2:R.transform[5]+R.height},X=O.getBoundingClientRect(),V=d.textTokenRanges(y,A,H),q=0;q<V.length;q++){var tt=document.createRange();tt.setStart(v,V[q].start),tt.setEnd(v,V[q].end);var Y=d.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=d.itemRelativeRect($,X,Z);ft&&(a.push(ft),o=Z)}}}return{rects:a,text:d.joinSelectionSlices(s),lastCssRect:o}}function mt(t){l.pendingSelection=t,l.lastCapturedText=t&&t.rawText||""}function Ne(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=Tt(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=Tt(a.endContainer)!==o,y=Gn(a,o),A=d.mergeLineRects(y.rects);if(!A.length)return mt(null);var H=y.lastCssRect||s.getBoundingClientRect(),O=t&&t.clientX?t.clientX:H.left+H.width/2,R=t&&t.clientY?t.clientY:H.top+H.height,$={page:f,rects:A,quoteText:d.normalizeQuoteText(y.text),spilled:v,anchorX:O,anchorY:R,rawText:String(e)};mt($),er($)}}var Yn=300,vt=null;function Xn(){l.noteEditing||(vt&&clearTimeout(vt),vt=setTimeout(Ue,Yn))}function Ue(){if(vt=null,!l.noteEditing){var t=window.getSelection();!t||t.isCollapsed||t.rangeCount===0||Tt(t.getRangeAt(0).startContainer)&&String(t)!==l.lastCapturedText&&Ne(null)}}function kt(t,e){var a=l.highlights;return l.highlights=t,yt(),I(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 Te(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&&de(y,o,s,!0)}})}function Wn(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?jt(o):null})}function Jn(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?jt(o):null})}function Kn(t){j(!0),kt(l.highlights.filter(function(e){return e.id!==t}),{action:"removeHighlight",attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID,id:t})}function le(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 Qn=9;function Zn(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},ce()}function ce(){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-Qn),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 ke(t){l.popoverPlacement&&l.popoverPlacement.anchor||j(t)}function tr(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 er(t){var e=M(),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(),Te(t,f)},T(l.activeStyle)));xt(a,t.anchorX,t.anchorY)}function de(t,e,a,o){var s=[],f=document.createElement("div");f.className="pdfa-mark-row pdfa-mark-top";var v=x(),y=N(t);if(v.length>1){var A=document.createElement("span");A.className="pdfa-shape-row";for(var H=0;H<v.length;H++)(function(st){var dt=document.createElement("button");dt.className="pdfa-btn pdfa-shape-btn",dt.dataset.style=st.id,dt.title="Change to "+st.label.toLowerCase(),dt.setAttribute("aria-label",dt.title),dt.setAttribute("aria-pressed",String(st.id===y));var Je=g(st.id);Je?dt.appendChild(Je):dt.textContent=st.label,dt.onclick=function(Pr){if(Pr.stopPropagation(),st.id===y)return j(!0);Jn(t.id,st.id)},A.appendChild(dt)})(v[H]);f.appendChild(A);var O=document.createElement("span");O.className="pdfa-vrule",f.appendChild(O)}function R(st){Wn(t.id,st)}for(var $=M().slice(),X=!1,V=0;V<$.length;V++)$[V].id===t.color&&(X=!0);if(!X&&$.length)for(var q=z(),tt=0;tt<q.length;tt++)q[tt].id===t.color&&($[$.length-1]=q[tt]);var Y=document.createElement("span");Y.className="pdfa-mark-colors";for(var Z=0;Z<$.length;Z++)Y.appendChild(C($[Z],$[Z].id===t.color,R,"Change to"));f.appendChild(Y);for(var ft=[],he=z(),Vt=0;Vt<he.length;Vt++){for(var Ge=!1,ge=0;ge<$.length;ge++)$[ge].id===he[Vt].id&&(Ge=!0);Ge||ft.push(he[Vt])}if(ft.length){var Lt=document.createElement("div");Lt.className="pdfa-drawer",Lt.id="pdfa-color-drawer";for(var qt=0;qt<ft.length;qt++)Lt.appendChild(C(ft[qt],ft[qt].id===t.color,R,"Change to"));f.appendChild(nr(Lt)),s.push(f),s.push(Lt)}else s.push(f);var Ye=document.createElement("div");Ye.className="pdfa-hrule",s.push(Ye);var wt=document.createElement("div");wt.className="pdfa-mark-row";var Xe=!!t.note;wt.appendChild(m(Xe?"Edit note":"Add note",o&&!Xe?"pdfa-btn-primary":"",function(){lr(t,e,a)},"note"));var We=document.createElement("span");We.className="pdfa-spacer",wt.appendChild(We),wt.appendChild(S("Copy","",function(){wr(t)},"copy")),wt.appendChild(S("Send to note","",function(){yr(t)},"send")),wt.appendChild(S("Remove","pdfa-remove",function(){Kn(t.id)},"remove")),s.push(wt),xt(s,e,a,"mark")}function nr(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),ce()},e}function rr(t){for(var e=F(),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(A){var H=C(A,!0,function(O){a[O]=!a[O],H.setAttribute("aria-pressed",String(a[O]))},"Toggle");f.appendChild(H)})(e[v]);var y=document.createElement("div");y.className="pdfa-note-actions",y.appendChild(m("Create / update note","pdfa-btn-primary",function(){for(var A=[],H=0;H<e.length;H++)a[e[H].id]&&A.push(e[H].id);Cr(A.length===e.length?null:A)})),xt([s,f,y],0,0,"exporting",t)}function or(t){var e=M().map(function(O){return O.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 O=0;O<4;O++)(function(X){var V=e[X];if(!V){var q=document.createElement("span");q.className="pdfa-slot-empty",q.title="Empty slot - pick a color below",a.appendChild(q);return}var tt=C(ar(V),!0,function(){e.splice(X,1),s()},"Remove");tt.classList.add("pdfa-slot"),a.appendChild(tt)})(O);o.innerHTML="";for(var R=z(),$=0;$<R.length;$++)(function(X){var V=e.indexOf(X.id)!==-1,q=C(X,!1,function(){V?e.splice(e.indexOf(X.id),1):e.length<4&&e.push(X.id),s()},V?"Remove":"Add");V&&q.classList.add("pdfa-taken"),o.appendChild(q)})(R[$])}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 "+z().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 A=document.createElement("div");A.className="pdfa-note-actions",A.appendChild(m("Save","pdfa-btn-primary",function(){ir(e)})),A.appendChild(m("Cancel","",function(){j(!0)}));var H=document.createElement("span");H.className="pdfa-spacer",A.appendChild(H),A.appendChild(m("Reset","",function(){e=[],s()})),xt([f,a,v,o,y,A],0,0,"palette",t)}function ar(t){for(var e=z(),a=0;a<e.length;a++)if(e[a].id===t)return e[a];return e[0]}function ir(t){I({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="",k(),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 lr(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(){le(t.id,"")}));var f=document.createElement("span");f.className="pdfa-spacer",s.appendChild(f),s.appendChild(m("Cancel","",function(){Ae(t,e,a)})),s.appendChild(m("Save","pdfa-btn-primary",function(){le(t.id,o.value)})),o.onkeydown=function(v){v.key==="Enter"&&(v.ctrlKey||v.metaKey)?(v.preventDefault(),v.stopPropagation(),le(t.id,o.value)):v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),Ae(t,e,a))},xt([o,s],e,a,"editing"),o.focus(),o.setSelectionRange(o.value.length,o.value.length)}function Ae(t,e,a){l.noteEditing=null;var o=b(t.id)||t;de(o,e,a)}function cr(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),A=d.hitTestHighlights(l.highlights,s,y[0],y[1],1);A&&A.id?de(A,t.clientX,t.clientY):j()}}}function At(){return Math.round(l.scale*100)+"%"}function Dt(){document.activeElement!==r.pageInput&&(r.pageInput.value=l.current),r.pageTotal.textContent="/ "+l.pageCount,Ie(),document.activeElement!==r.zoomLabel&&(r.zoomLabel.value=At())}function ut(){return r.root.querySelector(".pdfa-scroll")}function De(){return r.panel&&r.panel.classList.contains("pdfa-open")?r.panelScroll:r.thumbs&&r.thumbs.classList.contains("pdfa-open")?r.thumbsScroll:ut()}function Re(t){var e=r.pages.querySelector('.pdfa-page[data-page="'+t+'"]');e&&G(e,t)}function Rt(t){var e=Math.min(Math.max(1,t),l.pageCount),a=r.pages.querySelector('.pdfa-page[data-page="'+e+'"]');Re(e);var o=ut();a&&o&&(o.scrollTop+=a.getBoundingClientRect().top-o.getBoundingClientRect().top),J(),l.current=e,Dt()}function Le(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=d.pdfRectToViewportRect(t.rects[0],at(a)),s=ut(),f=e.getBoundingClientRect().top+o.y;s.scrollTop+=f-s.getBoundingClientRect().top-s.clientHeight/3,Re(t.page),J(),l.current=t.page,Dt()}}function dr(){try{r.root.setAttribute("tabindex","-1"),r.root.focus(),r.root.scrollIntoView&&r.root.scrollIntoView({block:"nearest"})}catch{}}function sr(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 se(t){return Math.min(Math.max(.4,t),4)}function $t(t){return l.scale=se(t),K()}function He(){var t=String(r.zoomLabel.value).replace(/[\s%]/g,""),e=/^\d*\.?\d+$/.test(t)?parseFloat(t):NaN;if(e>0){var a=se(e/100);a!==l.scale&&$t(a)}r.zoomLabel.value=At()}function Me(){var t=String(r.pageInput.value).trim(),e=/^\d+$/.test(t)?parseInt(t,10):NaN;e>0&&Rt(e),r.pageInput.value=l.current}function pr(){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=se(o/s);f<l.scale&&(l.scale=f,Dt())}}}).catch(function(){}):Promise.resolve()}function Pe(t){var e=De();e&&(e.scrollTop+=t*Math.max(80,e.clientHeight*.85),bt(),J())}function ze(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();Pe(e*.25)},120)},320)}),["pointerup","pointercancel","pointerleave"].forEach(function(v){t.addEventListener(v,f)}),t.onclick=function(){if(s){s=!1;return}Pe(e)}}function bt(){var t=De();if(!(!t||!r.scrollUp)){var e=t.scrollHeight-t.clientHeight;r.scrollUp.disabled=t.scrollTop<=1,r.scrollDown.disabled=t.scrollTop>=e-1}}function ur(){bt(),J(),ke();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,Dt())}function fr(){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 hr(){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 gr(){for(var t={},e=z(),a=0;a<e.length;a++)e[a].rgb&&(t[e[a].id]=e[a].rgb);return t}function mr(){var t=(l.attachmentName||"annotated").replace(/\.pdf$/i,"");return t+"-annotated.pdf"}function pe(){for(var t={},e=z(),a=0;a<e.length;a++)t[e[a].id]={hex:e[a].hex,cycleIndex:e[a].cycleIndex};return t}function Oe(){var t=(l.attachmentName||"PDF").replace(/\.pdf$/i,"");return t+" - Highlights"}function jt(t){var e=pe()[t.color]||{};return c.buildHighlightBlock(l.attachmentName,n.pluginUUID,n.attachmentUUID,t,e.hex,e.cycleIndex,n.noteUUID)}function vr(t){if(!c.buildHighlightHtml)return null;var e=pe()[t.color]||{};return c.buildHighlightHtml(l.attachmentName,n.pluginUUID,n.attachmentUUID,t,e.hex,e.cycleIndex,n.noteUUID)}function xr(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 br(t,e){var a=function(){return!navigator.clipboard||!navigator.clipboard.writeText?o():navigator.clipboard.writeText(t).then(function(){return"plain"},o)},o=function(){return xr(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 wr(t){j(!0);var e,a;try{e=jt(t),a=vr(t)}catch(o){w("Could not build the copy: "+(o.message||o),!0);return}br(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 yr(t){j(!0),I({action:"sendToNote",content:jt(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 Cr(t){j(!0);var e=c.buildExportAllContent(l.attachmentName,n.pluginUUID,n.attachmentUUID,l.highlights,pe(),t,n.noteUUID);if(!e){w(t?"No highlights match those colors.":"No highlights to export yet.",!0);return}I({action:"exportAll",attachmentUUID:n.attachmentUUID,noteName:Oe(),content:e}).then(function(a){if(!a||a.error)throw new Error(a&&a.error||"Could not export highlights.");w('Exported to "'+Oe()+'".')}).catch(function(a){w(a.message||String(a),!0)})}var Er=420;function _e(){return window.innerWidth<=Er}function Be(){var t=document.createElement("div");return t.className="pdfa-menu-rule",t}function Sr(){var t=document.createElement("div");t.className="pdfa-menu-tools";var e=document.createElement("span");e.className="pdfa-label",e.textContent=At();function a(o){return function(s){s.stopPropagation(),$t(l.scale+o),e.textContent=At()}}return t.appendChild(Fe("minus","Zoom out",a(-.25))),t.appendChild(e),t.appendChild(Fe("add","Zoom in",a(.25))),t}function Fe(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 Ir(){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 Nr(){return _e()||!l.aspectRatio?null:m("Restore height","",function(){j(!0),$e(null)},"restoreHeight")}function $e(t){l.aspectRatio=t,ue(),I({action:"setViewerHeight",aspectRatio:t,attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).then(function(e){e&&e.ok&&(l.aspectRatio=e.aspectRatio||null),ue()}).catch(function(){})}function ue(){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 Ur(t){r.panel.classList.contains("pdfa-open")&&Ut(!1),r.thumbs.classList.contains("pdfa-open")&&ie(!1);var e=[];_e()&&(e.push(Sr(),Be()),e.push(m("Highlights ("+l.highlights.length+")","",function(){j(!0),Ut(!0)},"list"),Be()));var a=Nr();a&&e.push(a),e.push(m("Collapse","",function(){j(!0),Lr()},"collapse"),m("Download","",function(){j(!0),Ar()},"download"),m("Export...","",function(){rr(t)},"postAdd"),m("Highlight colors...","",function(){or(t)},"palette"),m("Remove viewer...","pdfa-remove",function(){Tr(t)},"remove")),xt(e,0,0,"menu",t)}function Tr(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",kr)),xt([e,a],0,0,"exporting",t)}function kr(){j(!0),w("Removing this viewer..."),I({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 Ar(){l.pdfBytes&&(w("Preparing the download..."),hr().then(function(t){return i.writeHighlightsIntoPdf(t,l.pdfBytes,l.highlights,gr())}).then(function(t){return Dr(t,mr())}).catch(function(t){w("Could not prepare the download: "+(t.message||t),!0)}))}function Dr(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(""):je(a,e)}):je(a,e)}function je(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 Rr(){return I({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 Lr(){var t=l.highlights.length;r.collapsedCount.textContent=t?t+(t===1?" highlight":" highlights"):"",r.root.classList.add("pdfa-collapsed-mode"),Ve(!0)}function Ve(t){I({action:"setCollapsed",collapsed:t,attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).catch(function(){})}function Hr(){I({action:"clearDeepLink",attachmentUUID:n.attachmentUUID,pluginUUID:n.pluginUUID}).catch(function(){})}function Mr(){r.root.classList.remove("pdfa-collapsed-mode"),l.doc||qe(),Ve(!1)}function qe(){w("Loading PDF..."),(n.highlightId||n.page)&&(dr(),Hr()),fr().then(function(t){return t.GlobalWorkerOptions.workerSrc=n.workerSrc,I({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,Rr()}).then(function(){return pr()}).then(function(){return K()}).then(function(){yt();var t=n.highlightId?b(n.highlightId):null;t?(Le(t),sr(t)):n.page&&Rt(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(!(!ct||!Ct)){var o=d.snapPointToLineBox(Ct,ct.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||Tt(f.startContainer)!==ct.layer)&&!(s.focusNode===f.startContainer&&s.focusOffset===f.startOffset)){fe=!0;try{s.extend(f.startContainer,f.startOffset)}catch{}fe=!1}}}}};document.getElementById("pdfa-prev").onclick=function(){Rt(l.current-1)},document.getElementById("pdfa-next").onclick=function(){Rt(l.current+1)},document.getElementById("pdfa-zoom-in").onclick=function(){$t(l.scale+.25)},document.getElementById("pdfa-zoom-out").onclick=function(){$t(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",He),r.zoomLabel.addEventListener("keydown",function(o){o.key==="Enter"?(o.preventDefault(),He(),r.zoomLabel.blur()):o.key==="Escape"&&(o.preventDefault(),r.zoomLabel.value=At(),r.zoomLabel.blur())}),r.pageInput.addEventListener("focus",function(){setTimeout(function(){document.activeElement===r.pageInput&&r.pageInput.select()},0)}),r.pageInput.addEventListener("blur",Me),r.pageInput.addEventListener("keydown",function(o){o.key==="Enter"?(o.preventDefault(),Me(),r.pageInput.blur()):o.key==="Escape"&&(o.preventDefault(),r.pageInput.value=l.current,r.pageInput.blur())}),ze(r.scrollUp,-1),ze(r.scrollDown,1),r.listToggle.onclick=function(){Ut()},r.thumbsToggle.onclick=function(){ie()},r.fit&&(r.fit.onclick=function(){$e(l.aspectRatio?null:Ir())}),r.more.onclick=function(){tr(r.more)||(Ur(Zn(r.more)),l.popoverOwner=r.more)},ut().addEventListener("scroll",ur),r.panelScroll.addEventListener("scroll",bt),r.thumbsScroll.addEventListener("scroll",function(){bt(),ae()}),r.pages.addEventListener("mouseup",Ne),r.pages.addEventListener("click",cr);var ct=null,Ct=null,fe=!1;r.pages.addEventListener("pointerdown",function(o){if(ct=null,!(o.pointerType!=="mouse"||o.button!==0)){var s=Tt(o.target);s&&(ct={layer:s,boxes:t(s)})}}),ut().addEventListener("scroll",function(){ct&&(ct.boxes=t(ct.layer))}),r.pages.addEventListener("pointermove",function(o){!ct||!(o.buttons&1)||(Ct={x:o.clientX,y:o.clientY},a())}),document.addEventListener("selectionchange",function(){fe||a()}),["pointerup","pointercancel"].forEach(function(o){r.pages.addEventListener(o,function(){ct=null,Ct=null})}),document.addEventListener("selectionchange",Xn),r.pages.addEventListener("touchend",function(){vt&&clearTimeout(vt),vt=null,Ue()}),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")&&ce()}),W(),k(),l.aspectRatio=n.aspectRatio||null,ue(),gt(),r.root.querySelector(".pdfa-collapsed").onclick=Mr,n.collapsed?I({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(){}):qe()}catch(t){w("Viewer failed to start: "+(t&&t.message?t.message:t),!0)}}function Fn(n){return String(n??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function po(n){return JSON.stringify(n).replace(/</g,"\\u003c")}var $n={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 jn({attachmentUUID:n,attachmentName:d="",page:i=null,highlightId:c=null,lightDarkMode:r="light",pluginUUID:p=null,noteUUID:l=null,collapsed:w=!1,aspectRatio:I=null,toolbarColorIds:z=Ht}={}){let M=$n[r]||$n.light,F={attachmentUUID:n,page:i,highlightId:c,pluginUUID:p,noteUUID:l,aspectRatio:I,pdfJsSrc:St.pdfJs,workerSrc:St.pdfJsWorker,pdfLibSrc:St.pdfLib,colors:Gt.map(D=>({id:D.id,label:D.label,hex:D.hex,rgb:D.rgb,cycleIndex:D.cycleIndex})),toolbarColorIds:z,defaultColorId:xn(z),markStyles:Et.map(D=>({id:D.id,label:D.label})),defaultMarkStyle:Mt,icons:_n,collapsed:w,attachmentName:d};return`<link rel="stylesheet" href="${St.pdfViewerCss}">
<link rel="stylesheet" href="${Fn(St.robotoCss)}">
<style>:root{${M}}${On}</style>
<div id="pdfa-root"${w?' class="pdfa-collapsed-mode"':""}>
<div class="pdfa-collapsed">
<span class="pdfa-brand" title="PDF Annotator plugin">PDF Annotator</span>
<span class="pdfa-collapsed-name">${Fn(d)}</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">${lt(it.sidebar)}</button>
<button id="pdfa-prev" class="pdfa-icon-btn" title="Previous page"
aria-label="Previous page">${lt(it.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">${lt(it.chevronRight)}</button>
<span class="pdfa-sep"></span>
<button id="pdfa-zoom-out" class="pdfa-icon-btn" title="Zoom out"
aria-label="Zoom out">${lt(it.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">${lt(it.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"
>${lt(it.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"
>${lt(it.fitScreen)}</button>
 
<button id="pdfa-more" class="pdfa-icon-btn" title="More actions"
aria-label="More actions">${lt(it.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">${lt(it.arrowUp)}</button>
<button id="pdfa-scroll-down" title="Scroll down" aria-label="Scroll down">${lt(it.arrowDown)}</button>
</div>
</div>
 
<div class="pdfa-popover" id="pdfa-popover"></div>
</div>
<script>window.__PDFA_CONFIG = ${po(F)};
window.__PDFA_GEOM = (${we.toString()})();
window.__PDFA_ANNOTATIONS = (${ye.toString()})();
window.__PDFA_EXPORT = (${Ce.toString()})();<\/script>
<script>(${Bn.toString()})();<\/script>`}var uo={noteOption:{"Annotate PDF":async function(n,d){return gn(n,d,n.context.pluginUUID)}},linkTarget:async function(n,...d){return mn(n,d[0])},renderEmbed:function(n,...d){let{attachmentUUID:i,page:c,highlightId:r,collapsed:p,attachmentName:l,aspectRatio:w}=zt(d[0]);return i?jn({attachmentUUID:i,page:c,highlightId:r,collapsed:p,attachmentName:l,aspectRatio:w,lightDarkMode:n.context.lightDarkMode,pluginUUID:n.context.pluginUUID,noteUUID:n.context.noteUUID,toolbarColorIds:Jt(n.settings?n.settings[Yt]: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,...d){return zn(n,d[0])}},fo=uo;return $r(ho);})();
 
var plugin = __pluginModule.default;
return plugin;
})()