pdf-factory 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parser.cjs +2 -2
- package/dist/parser.cjs.map +1 -1
- package/dist/parser.js +178 -99
- package/dist/parser.js.map +1 -1
- package/dist/pdf-factory.cjs +1 -1
- package/dist/pdf-factory.cjs.map +1 -1
- package/dist/rolldown-runtime-5iZMYShA.cjs +1 -0
- package/package.json +4 -4
- package/dist/rolldown-runtime-CYJQrBu7.cjs +0 -1
package/dist/parser.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CYJQrBu7.cjs");var t=e.t(((e,t)=>{t.exports={}})),n=e.n(t(),1),r=class e{constructor(e){this.nodeName=e,this.childNodes=[],this.attributes={},this.textContent=``}getAttribute(e){return this.attributes[e]||null}getElementsByTagName(t){let n=[];this.nodeName===t&&n.push(this);for(let r of this.childNodes)if(r instanceof e){(t===`*`||r.nodeName===t)&&n.push(r);let e=r.getElementsByTagName(t);n=n.concat(e)}return n}},i=class{constructor(){this.documentElement=null}},a=class{parseFromString(e){let t=new i;return e=e.replace(/<\?xml[^?]*\?>/,``).trim(),t.documentElement=this.parseElement(e),t}parseElement(e){let t=/<([^\s/>]+)([^>]*)>/,n=/([^\s=]+)=(?:"([^"]*)"|'([^']*)')/g,i=e.match(t);if(!i)return null;let a=i[1],o=i[2],s=new r(a),c;for(;(c=n.exec(o))!==null;){let e=c[1],t=c[2]||c[3];s.attributes[e]=t}let l=i[0].length,u=RegExp(`</${a}>`),d=e.slice(l).search(u);if(d===-1)return s;let f=e.slice(l,l+d).trim();for(;f.length>0;){if(f.startsWith(`<`)&&!f.startsWith(`</`)){let e=f.match(t);if(e){let t=e[1],n=RegExp(`</${t}>`),r=f.search(n);if(r!==-1){let e=t.length+3,n=f.slice(0,r+e),i=this.parseElement(n);i&&s.childNodes.push(i),f=f.slice(n.length).trim();continue}}}let e=f.indexOf(`<`);if(e===-1){s.textContent+=f.trim();break}if(e>0)s.textContent+=f.slice(0,e).trim(),f=f.slice(e).trim();else break}return s}},o={log:n.default.log.bind(n.default),info:n.default.info.bind(n.default),warn:n.default.warn.bind(n.default),error(e){throw Error(e)},verbosity(){},LogManager:{addLogger(){},notify(){}},ERRORS:0,WARNINGS:1,INFOS:5};function s(e){e&&(o.log=e.log,o.info=e.info,o.warn=e.warn,o.error=e.error,o.verbosity=e.verbosity,o.LogManager=e.LogManager,typeof e.verbosity==`function`&&e.verbosity())}function c(e,t){let n=e.get(`Parent`);n&&n.forEach((e,n)=>{e===`DV`||(e===`TU`?t.alternativeText=n:e===`TM`&&(t.alternativeID=n))}),e.get(`AP`).get(`N`).forEach((e,n)=>{e.toLowerCase()!==`off`&&(t.value=e,t.checked=t.fieldValue===t.value)}),t.value||=`off`}function l(e,t){let n=e.get(`MK`);n&&(t.value=n.get(`CA`)||``),t.FL=``;let r=e.get(`A`);if(r){let e=r.get(`S`);t.FL=r.get(e.name)}}function u(e,t){let n=e.get(`AP`).get(`N`),r=0;n.forEach((e,n)=>{r++,r===1&&(t.value=e)})}function d(e,t){t.value=e.get(`Opt`)||[]}function f(e,t){let n=e.get(`AA`);if(!n)return;let r=n.get(`F`);!r&&(r=n.get(`K`),!r)||r.forEach((e,n)=>{e===`JS`&&m(n,t)})}var p=[`zip`,`zip`,`phone`,`ssn`,``];function m(e,t){if(Object.prototype.hasOwnProperty.call(t,`TName`)||!e.split)return;let n=e.split(`(`);if(n.length!==2)return;let r=n[0],i=n[1].split(`)`)[0];switch(r){case`AFSpecial_Format`:t.TName=p[Number(i)];break;case`AFNumber_Format`:t.TName=`number`;break;case`AFDate_FormatEx`:t.TName=`date`,t.MV=i.replace(/^'+|^"+|'+$|"+$/g,``);break;case`AFSpecial_KeystrokeEx`:{let e=i.replace(/^'+|^"+|'+$|"+$/g,``);e&&e.length>0&&e.length<64&&(t.TName=`mask`,t.MV=e)}break;case`AFPercent_Format`:t.TName=`percent`}}function h(e,t){let n=e.get(`V`);if(!n)return;t.Sig={};let r=n.get(`Name`);r&&(t.Sig.Name=r);let i=n.get(`M`);i&&(t.Sig.M=i);let a=n.get(`Location`);a&&(t.Sig.Location=a);let o=n.get(`Reason`);o&&(t.Sig.Reason=o);let s=n.get(`ContactInfo`);s&&(t.Sig.ContactInfo=s)}var g=class{static processAnnotation(e,t){t.fieldType===`Btn`?t.fieldFlags&32768?c(e,t):t.fieldFlags&65536?l(e,t):u(e,t):t.fieldType===`Ch`?d(e,t):t.fieldType===`Tx`?f(e,t):t.fieldType===`Sig`?h(e,t):o.warn(`Unknown fieldType: `,t)}},_=class{#e=``;#t=null;set onload(e){this.#t=typeof e==`function`?e:null}get onload(){return this.#t}set src(e){this.#e=e,this.#t&&this.#t()}get src(){return this.#e}btoa(e){return new n.Buffer.from(e,`binary`).toString(`base64`)}},v=`#000000.#ffffff.#4c4c4c.#808080.#999999.#c0c0c0.#cccccc.#e5e5e5.#f2f2f2.#008000.#00ff00.#bfffa0.#ffd629.#ff99cc.#004080.#9fc0e1.#5580ff.#a9c9fa.#ff0080.#800080.#ffbfff.#e45b21.#ffbfaa.#008080.#ff0000.#fdc59f.#808000.#bfbf00.#824100.#007256.#008000.#000080.#008080.#800080.#ff0000.#0000ff.#008000`.split(`.`),y=[`quicktype,arial,helvetica,sans-serif`,`quicktype condensed,arial narrow,arial,helvetica,sans-serif`,`quicktypepi,quicktypeiipi`,`quicktype mono,courier new,courier,monospace`,`ocr-a,courier new,courier,monospace`,`ocr b mt,courier new,courier,monospace`],b=[[0,6,0,0],[0,8,0,0],[0,10,0,0],[0,12,0,0],[0,14,0,0],[0,18,0,0],[0,6,1,0],[0,8,1,0],[0,10,1,0],[0,12,1,0],[0,14,1,0],[0,18,1,0],[0,6,0,1],[0,8,0,1],[0,10,0,1],[0,12,0,1],[0,14,0,1],[0,18,0,1],[0,6,1,1],[0,8,1,1],[0,10,1,1],[0,12,1,1],[0,14,1,1],[0,18,1,1],[1,6,0,0],[1,8,0,0],[1,10,0,0],[1,12,0,0],[1,14,0,0],[1,18,0,0],[1,6,1,0],[1,8,1,0],[1,10,1,0],[1,12,1,0],[1,14,1,0],[1,18,1,0],[1,6,0,1],[1,8,0,1],[1,10,0,1],[1,12,0,1],[1,14,0,1],[1,18,0,1],[2,8,0,0],[2,10,0,0],[2,12,0,0],[2,14,0,0],[2,18,0,0],[3,8,0,0],[3,10,0,0],[3,12,0,0],[4,12,0,0],[0,9,0,0],[0,9,1,0],[0,9,0,1],[0,9,1,1],[1,9,0,0],[1,9,1,0],[1,9,1,1],[4,10,0,0],[5,10,0,0],[5,12,0,0]],x=96,S=4,C=4,w=x/S,T=x/C,E=x/72,D=class e{static toFixedFloat(e){return parseFloat(e.toFixed(3))}static colorCount(){return v.length}static toPixelX(e){return Math.round(e*w)}static toPixelY(e){return Math.round(e*T)}static pointToPixel(e){return e*E}static getColorByIndex(e){return v[e]}static toFormPoint(e,t){return[e/w,t/T]}static toFormX(t){return e.toFixedFloat(t/w)}static toFormY(t){return e.toFixedFloat(t/T)}static findColorIndex(e){return e.length===4&&(e+=`000`),v.indexOf(e)}static dateToIso8601(e){e.slice(0,2)===`D:`&&(e=e.slice(2));let t=`Z`,n=e.search(/[Z+-]/);return n>=0&&(t=e.slice(n),t!==`Z`&&(t=`${t.slice(0,3)}:${t.slice(4,6)}`),e=e.slice(0,n)),`${e.slice(0,4)}-${e.slice(4,6)||`01`}-${e.slice(6,8)||`01`}T${e.slice(8,10)||`00`}:${e.slice(10,12)||`00`}:${e.slice(12,14)||`00`}${t}`}},O=class{constructor(e,t,n,r,i,a,o){this.x1=e,this.y1=t,this.x2=n,this.y2=r,this.lineWidth=i||1,this.color=a,this.dashed=o}#e(e,t,n){e.x=D.toFormX(t),e.y=D.toFormY(n)}processLine(e){let t=Math.abs(this.x2-this.x1),n=Math.abs(this.y2-this.y1),r=this.lineWidth,i={x:0,y:0,w:D.toFixedFloat(this.lineWidth),l:0},a=D.findColorIndex(this.color),s=a>0&&a<D.colorCount()?{clr:a}:{oc:this.color};if(i={...i,...s},this.dashed&&(i={...i,dsh:1}),n<this.lineWidth&&t>r){if(this.lineWidth<4&&t/this.lineWidth<4){o.info(`Skipped: short thick HLine: lineWidth = ${this.lineWidth}, xDelta = ${t}`);return}i.l=D.toFormX(t),this.x1>this.x2?this.#e(i,this.x2,this.y2):this.#e(i,this.x1,this.y1),e.HLines.push(i)}else if(t<this.lineWidth&&n>r){if(this.lineWidth<4&&n/this.lineWidth<4){o.info(`Skipped: short thick VLine: lineWidth = ${this.lineWidth}, yDelta = ${n}`);return}i.l=D.toFormY(n),this.y1>this.y2?this.#e(i,this.x2,this.y2):this.#e(i,this.x1,this.y1),e.VLines.push(i)}}},k=class{constructor(e,t,n,r,i){this.x=e,this.y=t,this.width=n,this.height=r,this.color=i}processFill(e){let t=D.findColorIndex(this.color),n=t>0&&t<D.colorCount()?{clr:t}:{oc:this.color},r={x:D.toFormX(this.x),y:D.toFormY(this.y),w:D.toFormX(this.width),h:D.toFormY(this.height),...n};r.w<2&&r.h<2?o.info(`Skipped: tiny fill: ${r.w} x ${r.h}`):e.Fills.push(r)}},A=[`bd`,`bold`,`demi`,`black`,`medi`],j=[`arial`,`helvetica`,`sans-serif `,`courier `,`monospace `,`ocr `],M=.1,N=class e{#e(){let e=this.fontObj.name||this.fontObj.fallbackName;return e||=y[0],e=e.toLowerCase(),e}#t(){let e=this.typeName,t=!1,n=this.typeName.split(`+`);if(Array.isArray(n)&&n.length>1&&(e=n[1].split(`-`),Array.isArray(e)&&e.length>1)){let n=e[1].toLowerCase();t=A.indexOf(n)>=0,e=e[0]}return{subType:e,bold:t}}#n(){let e=this.typeName.indexOf(`symbol`)>0||y[2].indexOf(this.subType)>=0;return this.fontObj.isSymbolicFont?j.filter(e=>this.typeName.indexOf(e)>=0).length>0&&(this.fontObj.isSymbolicFont=!1,o.info(`Reset: isSymbolicFont (false) for ${this.fontObj.name}`)):e&&(this.fontObj.isSymbolicFont=!0,o.info(`Reset: isSymbolicFont (true) for ${this.fontObj.name}`)),e}#r(){let{spaceWidth:e}=this.fontObj;if(!e){var t=Array.isArray(this.fontObj.toFontChar)?this.fontObj.toFontChar.indexOf(32):-1;e=t>=0&&Array.isArray(this.fontObj.widths)?this.fontObj.widths[t]:250}return e=D.toFormX(e)/32,e}constructor(e){this.fontObj=e,this.typeName=this.#e();let{subType:t,bold:n}=this.#t();this.subType=t,this.bold=n,this.isSymbol=this.#n(),this.spaceWidth=this.#r(),this.fontSize=1,this.faceIdx=0,this.italic=!1,this.fontStyleId=-1}static compareBlockPos(e,t){if(e.y<t.y-M)return-1;if(Math.abs(e.y-t.y)<=M){if(e.x<t.x-M)return-1;if(Math.abs(e.x-t.x)<=M)return 0}return 1}static haveSameStyle(e,t){let n=e.R[0].S===t.R[0].S;if(n&&e.R[0].S<0){for(let r=0;r<e.R[0].TS.length;r++)if(e.R[0].TS[r]!==t.R[0].TS[r]){n=!1;break}}return n&&=e.R[0].RA===void 0&&t.R[0].RA===void 0,n}static getSpaceThreshHold(t){return e.getFontSize(t)/12*t.sw}static areAdjacentBlocks(t,n){let r=Math.abs(t.y-n.y)<=M,i=n.x-t.x-t.w<e.getSpaceThreshHold(t);return r&&i}static getFontSize(e){let t=e.R[0].S;return t<0?e.R[0].TS[1]:b[t][1]}static areDuplicateBlocks(t,n){return t.x===n.x&&t.y===n.y&&t.R[0].T===n.R[0].T&&e.haveSameStyle(t,n)}#i(){let{fontObj:e}=this;this.bold=e.bold,this.bold||=this.typeName.indexOf(`bold`)>=0||this.typeName.indexOf(`black`)>=0,this.italic=e.italic,this.italic||=this.typeName.indexOf(`italic`)>=0||this.typeName.indexOf(`oblique`)>=0,(!this.bold||!this.italic)&&this.typeName.indexOf(`boldobl`)>=0&&(this.bold=!0,this.italic=!0);let t=this.subType;e.isSerifFont?y[1].indexOf(t)>=0&&(this.faceIdx=1):y[2].indexOf(this.subType)>=0?this.faceIdx=2:e.isMonospace?(this.faceIdx=3,y[4].indexOf(t)>=0?this.faceIdx=4:y[5].indexOf(t)>=0&&(this.faceIdx=5)):e.isSymbolicFont&&(this.faceIdx=2),this.faceIdx===0&&this.typeName.indexOf(`narrow`)>0&&(this.faceIdx=1),o.info(`typeName = ${t} => faceIdx = ${this.faceIdx}`)}#a(e){this.#i(),this.fontSize=this.bold&&e>12?e+1:e;let t=[this.faceIdx,this.fontSize,+!!this.bold,+!!this.italic],n=-1;return b.forEach((e,r,i)=>{n===-1&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&(n=r)}),n}#o(e){let t=e;if(!e||e.length!==1)return t;if(!this.fontObj.isSymbolicFont||!this.isSymbol)return(t===`C`||t===`G`)&&(t=` ${t} `),t;switch(e.charCodeAt(0)){case 20:t=`✓`;break;case 70:t=this.fontObj.type===`CIDFontType0`?`⚠`:`}`;break;case 71:t=`▶`;break;case 97:t=`▶`;break;case 99:t=this.isSymbol?`•`:`▲`;break;case 100:t=`▼`;break;case 103:t=`➨`;break;case 106:t=``;break;case 114:t=`•`;break;case 115:t=`▲`;break;case 116:t=`•`;break;case 118:t=`•`;break;default:o.info(`${this.fontObj.type} - SymbolicFont - (${this.fontObj.name}) : ${e.charCodeAt(0)}::${e.charCodeAt(1)} => ${t}`)}return t}#s(e){if(!e||e.length!==1||this.fontObj.type!==`Type3`)return e;if(o.info(`Processing Type3 font: char code = ${e.charCodeAt(0)}, char = '${e}'`),this.fontObj.charProcMapping)o.info(`charProcMapping available with ${Object.keys(this.fontObj.charProcMapping).length} entries`);else if(o.info(`No charProcMapping available for this Type3 font`),e&&e.length===1){let t=e.charCodeAt(0);if(t>=65&&t<=90)return o.info(`Using direct uppercase letter: ${e}`),e;if(t>=97&&t<=122)return o.info(`Using direct lowercase letter: ${e}`),e;if(t>=48&&t<=57)return o.info(`Using direct digit: ${e}`),e}if(this.fontObj.charProcMapping){let t=e.charCodeAt(0),n=this.fontObj.charProcMapping[t];if(n){o.info(`Found glyph name in mapping: ${n}`);let e={bullet:`•`,checkbox:`☐`,checkmark:`✓`,check:`✓`,circle:`○`,square:`□`,triangle:`▲`,triangledown:`▼`,triangleleft:`◀`,triangleright:`▶`,star:`★`,diamond:`◆`,heart:`♥`,club:`♣`,spade:`♠`,filledcircle:`●`,filledsquare:`■`,filledtriangle:`▲`,filledtriangledown:`▼`,filledtriangleright:`▶`,filledtriangleleft:`◀`,arrowleft:`←`,arrowright:`→`,arrowup:`↑`,arrowdown:`↓`,cross:`✗`},t=typeof n==`string`?n.toLowerCase():``;if(t in e){let n=e[t];return o.info(`Mapped ${t} to Unicode ${n}`),n}if(typeof n==`string`&&n.length>1){let e=n.match(/[A-Za-z]/g);if(e&&e.length===1){let t=e[0].toUpperCase();return o.info(`Extracted letter ${t} from glyph name ${n}`),t}}for(let n in e)if(t.indexOf(n)>=0){let r=e[n];return o.info(`Partial match: ${t} contains ${n}, mapped to ${r}`),r}if(typeof n==`string`){let e=n.match(/[A-Za-z]/g);if(e&&e.length===1){let t=e[0].toUpperCase();return o.info(`Extracted letter ${t} from glyph name ${n}`),t}let t=n.match(/\d+/);if(t&&t.length===1){let e=parseInt(t[0],10);if(e>=1&&e<=26){let t=String.fromCharCode(64+e);return o.info(`Mapped number ${e} in glyph name ${n} to letter ${t}`),t}}}if(typeof n==`string`&&n.startsWith(`uni`)){let e=n.substring(3);if(/^[0-9A-F]{4,6}$/i.test(e))return o.info(`Mapped uni${e} to Unicode character`),String.fromCharCode(parseInt(e,16))}}}let t=e.charCodeAt(0);o.info(`No direct mapping for character code ${t}, checking general mappings`);let n=e;switch(t){case 18:n=`✓`;break;case 19:n=`☐`;break;case 20:n=`☑`;break;case 108:n=`•`;break;case 109:n=`●`;break;case 110:n=`○`;break;case 111:n=`■`;break;case 112:n=`□`;break;case 113:n=`▲`;break;case 114:n=`▼`;break;case 117:n=`←`;break;case 118:n=`→`;break;case 119:n=`↑`;break;case 120:n=`↓`;break;case 128:n=`∞`;break;case 129:n=`≠`;break;case 130:n=`≤`;break;case 131:n=`≥`}return n===e?o.info(`No mapping found for char code ${t}, returning original character`):o.info(`Mapped char code ${t} to Unicode ${n}`),n}#c(e){let t=0;if(e[0][0]===0&&e[1][1]===0)e[0][1]!==0&&e[1][0]!==0&&e[0][1]/e[1][0]+1<1e-4&&(t=90);else if(e[0][0]!==0&&e[1][1]!==0){let n=Math.atan(-e[0][1]/e[0][0]),r=Math.atan(e[1][0]/e[1][1]);Math.abs(n)>1e-4&&n-r<1e-4&&(t=n*180/Math.PI)}return t}processText(e,t,n,r,i,a,s){o.info(`Processing text: '${t}', font type: ${this.fontObj.type||`unknown`}, char code: ${t?t.charCodeAt(0):`none`}`);let c=t,l=this.fontObj.type===`Type3`?this.#s(t):this.#o(t);l||=(o.info(`Text processing returned null or empty, falling back to original text`),c),o.info(`Processed text: '${t}' -> '${l}'`),this.fontStyleId=this.#a(i);let u=[this.faceIdx,this.fontSize,+!!this.bold,+!!this.italic],d=D.findColorIndex(r),f=d>=0&&d<D.colorCount()?{clr:d}:{oc:r},p={T:this.flashEncode(l),S:this.fontStyleId,TS:u},m=this.#c(s);m!==0&&(o.info(`${t}: rotated ${m} degree.`),p=Object.assign({},p,{RA:m}));let h={x:D.toFormX(e.x)-.25,y:D.toFormY(e.y)-.75,w:D.toFixedFloat(n),...f,sw:this.spaceWidth,A:`left`,R:[p]};o.info(`Adding text to output: '${l}'`),a.Texts.push(h)}flashEncode(e){if(!e)return e;let t=e;return t=t.replace(/\u0096/g,`-`),t=t.replace(/\u0091/g,`'`),t=t.replace(/\u0092/g,`'`),t=t.replace(/\u0082/g,`'`),t=t.replace(/\u0093/g,`"`),t=t.replace(/\u0094/g,`"`),t=t.replace(/\u0084/g,`"`),t=t.replace(/\u008B/g,`«`),t=t.replace(/\u009B/g,`»`),t}clean(){this.fontObj=null,delete this.fontObj}},{round:P,sin:F,cos:I,abs:L,sqrt:ee}=Math,te=[];for(let e=0;e<16;e++)for(let t=0;t<16;t++)te[e*16+t]=e.toString(16)+t.toString(16);function ne(){return[[1,0,0],[0,1,0],[0,0,1]]}function re(e,t){let n=ne();for(let r=0;r<3;r++)for(let i=0;i<3;i++){let a=0;for(let n=0;n<3;n++)a+=e[r][n]*t[n][i];n[r][i]=a}return n}function ie(e,t){t.fillStyle=e.fillStyle,t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY,t.strokeStyle=e.strokeStyle,t.globalAlpha=e.globalAlpha,t.arcScaleX_=e.arcScaleX_,t.arcScaleY_=e.arcScaleY_,t.lineScale_=e.lineScale_,t.dashArray=e.dashArray}function ae(e){let t,n=1;if(e=String(e),e.substring(0,3)===`rgb`){let r=e.indexOf(`(`,3),i=e.indexOf(`)`,r+1),a=e.substring(r+1,i).split(`,`);t=`#`;for(let e=0;e<3;e++)t+=te[Number(a[e])];a.length===4&&e.substring(3,4)===`a`&&(n=a[3])}else t=e;return{color:t,alpha:n}}function oe(e,t,n,r){e.currentPath_.push({type:`bezierCurveTo`,cp1x:t.x,cp1y:t.y,cp2x:n.x,cp2y:n.y,x:r.x,y:r.y}),e.currentX_=r.x,e.currentY_=r.y}function se(e){for(let t=0;t<3;t++)for(let n=0;n<2;n++)if(!isFinite(e[t][n])||isNaN(e[t][n]))return!1;return!0}function ce(e,t,n){se(t)&&(e.m_=t,n&&(e.lineScale_=ee(L(t[0][0]*t[1][1]-t[0][1]*t[1][0]))))}var le=class{constructor(){}},ue=class{constructor(e){this.type_=e,this.x0_=0,this.y0_=0,this.r0_=0,this.x1_=0,this.y1_=0,this.r1_=0,this.colors_=[]}addColorStop(e,t){t=ae(t),this.colors_.push({offset:e,color:t.color,alpha:t.alpha})}},de=class{constructor(e,t,n){this.m_=ne(),this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.strokeStyle=`#000`,this.fillStyle=`#000`,this.lineWidth=1,this.lineJoin=`miter`,this.lineCap=`butt`,this.dashArray=[],this.miterLimit=1,this.globalAlpha=1,(!(`HLines`in e)||!Array.isArray(e.HLines))&&(e.HLines=[]),(!(`VLines`in e)||!Array.isArray(e.VLines))&&(e.VLines=[]),(!(`Fills`in e)||!Array.isArray(e.Fills))&&(e.Fills=[]),(!(`Texts`in e)||!Array.isArray(e.Texts))&&(e.Texts=[]),this.canvas=e,this.width=t,this.height=n,this.arcScaleX_=1,this.arcScaleY_=1,this.lineScale_=1,this.currentFont=null}#e(e,t,n,r){let i=Array.isArray(this.dashArray)&&this.dashArray.length>1;new O(e.x,e.y,t.x,t.y,n,r,i).processLine(this.canvas)}#t(e,t,n,r){let i=n.x-t.x,a=n.y-t.y;new k(e.x,e.y,i,a,r).processFill(this.canvas)}#n(e,t,n,r){let i=Math.abs(n-Math.abs(r))<1&&n<13;return i&&o.info(`Skipped: tiny rect: w=${n}, h=${r}`),i}getContext(e){return e===`2d`?this:null}setLineDash(e){this.dashArray=e}getLineDash(){return this.dashArray}fillText(e,t,n,r,i){if(!e||!e.length===1&&e.trim().length<1)return;let a=this.getCoords_(t,n),o=ae(this.fillStyle||this.strokeStyle),s=o?o.color:`#000000`;this.currentFont.processText(a,e,r,s,i,this.canvas,this.m_)}strokeText(e,t,n,r){this.fillText(e,t,n,r)}measureText(e){return o.warn(`to be implemented: contextPrototype.measureText - `,e),{width:(e.length||1)*(this.currentFont.spaceWidth||5)}}setFont(e){this.currentFont&&typeof this.currentFont.clean==`function`&&(this.currentFont.clean(),this.currentFont=null),this.currentFont=new N(e)}clearRect(){o.warn(`to be implemented: contextPrototype.clearRect`)}beginPath(){this.currentPath_=[]}moveTo(e,t){let n=this.getCoords_(e,t);this.currentPath_.push({type:`moveTo`,x:n.x,y:n.y}),this.currentX_=n.x,this.currentY_=n.y}lineTo(e,t){let n=this.getCoords_(e,t);this.currentPath_.push({type:`lineTo`,x:n.x,y:n.y}),this.currentX_=n.x,this.currentY_=n.y}bezierCurveTo(e,t,n,r,i,a){let o=this.getCoords_(i,a),s=this.getCoords_(e,t),c=this.getCoords_(n,r);oe(this,s,c,o)}quadraticCurveTo(e,t,n,r){let i=this.getCoords_(e,t),a=this.getCoords_(n,r),o={x:this.currentX_+2/3*(i.x-this.currentX_),y:this.currentY_+2/3*(i.y-this.currentY_)},s={x:o.x+(a.x-this.currentX_)/3,y:o.y+(a.y-this.currentY_)/3};oe(this,o,s,a)}arc(e,t,n,r,i,a){let o=a?`at`:`wa`,s=e+I(r)*n,c=t+F(r)*n,l=e+I(i)*n,u=t+F(i)*n;s===l&&!a&&(s+=.125);let d=this.getCoords_(e,t),f=this.getCoords_(s,c),p=this.getCoords_(l,u);this.currentPath_.push({type:o,x:d.x,y:d.y,radius:n,xStart:f.x,yStart:f.y,xEnd:p.x,yEnd:p.y})}rect(e,t,n,r){this.#n(e,t,n,r)||(this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath())}strokeRect(e,t,n,r){if(this.#n(e,t,n,r))return;let i=this.currentPath_;this.beginPath(),this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath(),this.stroke(),this.currentPath_=i}fillRect(e,t,n,r){if(this.#n(e,t,n,r))return;let i=this.currentPath_;this.beginPath(),this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath(),this.fill(),this.currentPath_=i}createLinearGradient(e,t,n,r){let i=new ue(`gradient`);return i.x0_=e,i.y0_=t,i.x1_=n,i.y1_=r,i}createRadialGradient(e,t,n,r,i,a){let o=new ue(`gradientradial`);return o.x0_=e,o.y0_=t,o.r0_=n,o.x1_=r,o.y1_=i,o.r1_=a,o}drawImage(e,t){e&&typeof e==`object`&&(e.Texts&&Array.isArray(e.Texts)&&e.Texts.length>0&&(this.canvas.Texts.push(...e.Texts),e.Texts=[]),e.HLines&&Array.isArray(e.HLines)&&e.HLines.length>0&&(this.canvas.HLines.push(...e.HLines),e.HLines=[]),e.VLines&&Array.isArray(e.VLines)&&e.VLines.length>0&&(this.canvas.VLines.push(...e.VLines),e.VLines=[]),e.Fills&&Array.isArray(e.Fills)&&e.Fills.length>0&&(this.canvas.Fills.push(...e.Fills),e.Fills=[]))}getImageData(e,t,n,r){return{width:n,height:r,data:new Uint8Array(n*r*4)}}stroke(e){if(this.currentPath_.length<2)return;let{color:t}=ae(e?this.fillStyle:this.strokeStyle),n=this.lineScale_*this.lineWidth,r={x:null,y:null},i={x:null,y:null};for(let a=0;a<this.currentPath_.length;a++){let o=this.currentPath_[a];switch(o.type){case`moveTo`:break;case`lineTo`:e||a>0&&this.#e(this.currentPath_[a-1],o,n,t);break;case`close`:e||a>0&&this.#e(this.currentPath_[a-1],this.currentPath_[0],n,t),o=null}e&&o&&((r.x===null||o.x<r.x)&&(r.x=o.x),(i.x===null||o.x>i.x)&&(i.x=o.x),(r.y===null||o.y<r.y)&&(r.y=o.y),(i.y===null||o.y>i.y)&&(i.y=o.y))}e&&this.#t(r,r,i,t)}fill(){this.stroke(!0)}closePath(){this.currentPath_.push({type:`close`})}getCoords_(e,t){let n=this.m_;return{x:e*n[0][0]+t*n[1][0]+n[2][0],y:e*n[0][1]+t*n[1][1]+n[2][1]}}save(){let e={};ie(this,e),this.aStack_.push(e),this.mStack_.push(this.m_),this.m_=re(ne(),this.m_)}restore(){ie(this.aStack_.pop(),this),this.m_=this.mStack_.pop()}translate(e,t){let n=[[1,0,0],[0,1,0],[e,t,1]];ce(this,re(n,this.m_),!1)}rotate(e){let t=I(e),n=F(e),r=[[t,n,0],[-n,t,0],[0,0,1]];ce(this,re(r,this.m_),!1)}scale(e,t){this.arcScaleX_*=e,this.arcScaleY_*=t;let n=[[e,0,0],[0,t,0],[0,0,1]];ce(this,re(n,this.m_),!0)}transform(e,t,n,r,i,a){let o=[[e,t,0],[n,r,0],[i,a,1]];ce(this,re(o,this.m_),!0)}setTransform(e,t,n,r,i,a){let o=[[e,t,0],[n,r,0],[i,a,1]];ce(this,o,!0)}clip(){}arcTo(){}createPattern(){return new le}};function fe(e,t){return new de({},e,t)}var R={disableWorker:!0},pe={console,PDFJS:R},me=typeof window>`u`,he=0,ge=1,_e=5,ve=ge,ye=[.001,0,0,.001,0,0],be={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};pe.PDFJS||={},pe.PDFJS.pdfBug=!1;var z=R.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87},xe=R.NO_OPS=[82,83,84,85,86,87],Se=R.NO_OPS_RANGE=[78,79,80,81],Ce=(function(){return!Number(process?.env?.PDF2JSON_DISABLE_LOGS??`0`)&&`console`in pe&&`log`in pe.console?pe.console.log.bind(pe.console):function(){}})();function B(e){ve>=_e&&(Ce(`Info: `+e),R.LogManager.notify(`info`,e))}function V(e){ve>=ge&&(Ce(`Warning: `+e),R.LogManager.notify(`warn`,e))}function H(e){if(arguments.length>1){var t=[`Error:`];t.push.apply(t,arguments),Ce.apply(null,t),e=[].join.call(arguments,` `)}throw R.LogManager.notify(`error`,e),Error(e)}function we(e){V(`TODO: `+e)}function Te(e,t){e||H(t)}function Ee(e,t){if(!t)return e;if(t.indexOf(`:`)>=0)return t;if(t.charAt(0)==`/`){var n=e.indexOf(`://`);return n=e.indexOf(`/`,n+3),e.substring(0,n)+t}var r=e.length,n=e.lastIndexOf(`#`);r=n>=0?n:r,n=e.lastIndexOf(`?`,r),r=n>=0?n:r;var i=e.lastIndexOf(`/`,r);return e.substring(0,i+1)+t}function De(e,t){if(!e)return!1;var n=e.indexOf(`:`);if(n<0)return t;switch(e.substring(0,n)){case`http`:case`https`:case`ftp`:case`mailto`:return!0;default:return!1}}R.isValidUrl=De;function Oe(e,t){e||H(t)}R.LogManager=(function(){var e=[];return{addLogger:function(t){e.push(t)},notify:function(t,n){for(var r=0,i=e.length;r<i;r++){var a=e[r];a[t]&&a[t](n)}}}})();function ke(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1}),n}var Ae=R.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},je=(function(){function e(e,t){this.name=`PasswordException`,this.message=e,this.code=t}return e.prototype=Error(),e.constructor=e,e})(),Me=(function(){function e(e,t){this.name=`UnknownErrorException`,this.message=e,this.details=t}return e.prototype=Error(),e.constructor=e,e})(),Ne=(function(){function e(e){this.name=`InvalidPDFException`,this.message=e}return e.prototype=Error(),e.constructor=e,e})(),Pe=(function(){function e(e){this.name=`MissingPDFException`,this.message=e}return e.prototype=Error(),e.constructor=e,e})(),Fe=(function(){function e(e){this.message=e}return e.prototype=Error(),e.prototype.name=`NotImplementedException`,e.constructor=e,e})(),Ie=(function(){function e(e,t){this.begin=e,this.end=t,this.message=`Missing data [`+e+`, `+t+`)`}return e.prototype=Error(),e.prototype.name=`MissingDataException`,e.constructor=e,e})(),Le=(function(){function e(e){this.message=e}return e.prototype=Error(),e.prototype.name=`XRefParseException`,e.constructor=e,e})();function Re(e){for(var t=``,n=e.length,r=0;r<n;++r)t+=String.fromCharCode(e[r]);return t}function ze(e){for(var t=e.length,n=new Uint8Array(t),r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}var Be=[1,0,0,1,0,0],U=R.Util=(function(){function e(){}return e.makeCssRgb=function(e){return`rgb(`+e[0]+`,`+e[1]+`,`+e[2]+`)`},e.makeCssCmyk=function(t){var n=q.singletons.cmyk.getRgb(t,0);return e.makeCssRgb(n)},e.transform=function(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]},e.applyTransform=function(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]},e.applyInverseTransform=function(e,t){var n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]},e.getAxialAlignedBoundingBox=function(t,n){var r=e.applyTransform(t,n),i=e.applyTransform(t.slice(2,4),n),a=e.applyTransform([t[0],t[3]],n),o=e.applyTransform([t[2],t[1]],n);return[Math.min(r[0],i[0],a[0],o[0]),Math.min(r[1],i[1],a[1],o[1]),Math.max(r[0],i[0],a[0],o[0]),Math.max(r[1],i[1],a[1],o[1])]},e.inverseTransform=function(e){var t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]},e.apply3dTransform=function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]},e.singularValueDecompose2dScale=function(e){var t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],o=(n+a)/2,s=Math.sqrt((n+a)*(n+a)-4*(n*a-i*r))/2,c=o+s||1,l=o-s||1;return[Math.sqrt(c),Math.sqrt(l)]},e.normalizeRect=function(e){var t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t},e.intersect=function(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]},e.sign=function(e){return e<0?-1:1},e.concatenateToArray=function(e,t){Array.prototype.push.apply(e,t)},e.prependToArray=function(e,t){Array.prototype.unshift.apply(e,t)},e.extendObj=function(e,t){for(var n in t)e[n]=t[n]},e.getInheritableProperty=function(e,t){for(;e&&!e.has(t);)e=e.get(`Parent`);return e?e.get(t):null},e.inherit=function(e,t,n){for(var r in e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n)e.prototype[r]=n[r]},e.loadScript=function(e,t){var n=document.createElement(`script`),r=!1;n.setAttribute(`src`,e),t&&(n.onload=function(){r||t(),r=!0}),document.getElementsByTagName(`head`)[0].appendChild(n)},e})();R.PageViewport=(function(){function e(e,t,n,r,i,a){this.viewBox=e,this.scale=t,this.rotation=n,this.offsetX=r,this.offsetY=i;var o=(e[2]+e[0])/2,s=(e[3]+e[1])/2,c,l,u,d;switch(n%=360,n=n<0?n+360:n,n){case 180:c=-1,l=0,u=0,d=1;break;case 90:c=0,l=1,u=1,d=0;break;case 270:c=0,l=-1,u=-1,d=0;break;default:c=1,l=0,u=0,d=-1}a&&(u=-u,d=-d);var f,p,m,h;c===0?(f=Math.abs(s-e[1])*t+r,p=Math.abs(o-e[0])*t+i,m=Math.abs(e[3]-e[1])*t,h=Math.abs(e[2]-e[0])*t):(f=Math.abs(o-e[0])*t+r,p=Math.abs(s-e[1])*t+i,m=Math.abs(e[2]-e[0])*t,h=Math.abs(e[3]-e[1])*t),this.transform=[c*t,l*t,u*t,d*t,f-c*t*o-u*t*s,p-l*t*o-d*t*s],this.width=m,this.height=h,this.fontScale=t}return e.prototype={clone:function(t){t||={};var n=`scale`in t?t.scale:this.scale,r=`rotation`in t?t.rotation:this.rotation;return new e(this.viewBox.slice(),n,r,this.offsetX,this.offsetY,t.dontFlip)},convertToViewportPoint:function(e,t){return U.applyTransform([e,t],this.transform)},convertToViewportRectangle:function(e){var t=U.applyTransform([e[0],e[1]],this.transform),n=U.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]},convertToPdfPoint:function(e,t){return U.applyInverseTransform([e,t],this.transform)}},e})();var Ve=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function He(e){var t,n=e.length,r=``;if(e[0]===`þ`&&e[1]===`ÿ`)for(t=2;t<n;t+=2)r+=String.fromCharCode(e.charCodeAt(t)<<8|e.charCodeAt(t+1));else for(t=0;t<n;++t){var i=Ve[e.charCodeAt(t)];r+=i?String.fromCharCode(i):e.charAt(t)}return r}function Ue(e){return decodeURIComponent(escape(e))}function We(e){for(var t in e)return!1;return!0}function Ge(e){return typeof e==`boolean`}function Ke(e){return typeof e==`number`&&(e|0)==e}function qe(e){return typeof e==`number`}function Je(e){return typeof e==`string`}function Ye(e){return e instanceof jt}function Xe(e,t){return e instanceof Mt&&(!t||e.cmd==t)}function W(e,t){if(!(e instanceof Nt))return!1;if(!t)return!0;var n=e.get(`Type`);return Ye(n)&&n.name==t}function G(e){return e instanceof Array}function Ze(e){return typeof e==`object`&&!!e&&e!==void 0&&`getBytes`in e}function Qe(e){return typeof e==`object`&&!!e&&e!==void 0&&`byteLength`in e}function $e(e){return e instanceof Pt}function et(e){var t;if(typeof e!=`object`)return!1;if(W(e))t=e;else if(Ze(e))t=e.dict;else return!1;return t.has(`FunctionType`)}var K=R.Promise=(function(){var e={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(e){e._status!=0&&(this.handlers=this.handlers.concat(e._handlers),e._handlers=[],!this.running&&(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(;this.handlers.length>0;){var e=this.handlers.shift(),t=e.thisPromise._status,n=e.thisPromise._value;try{t===1?typeof e.onResolve==`function`&&(n=e.onResolve(n)):typeof e.onReject==`function`&&(n=e.onReject(n),t=1,e.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(e.thisPromise))}catch(e){t=2,n=e}e.nextPromise._updateStatus(t,n)}this.running=!1},addUnhandledRejection:function(e){this.unhandledRejections.push({promise:e,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(e){e._unhandledRejection=!1;for(var t=0;t<this.unhandledRejections.length;t++)this.unhandledRejections[t].promise===e&&(this.unhandledRejections.splice(t),t--)},scheduleRejectionCheck:function(){this.pendingRejectionCheck||(this.pendingRejectionCheck=!0,setTimeout(function(){this.pendingRejectionCheck=!1;for(var e=Date.now(),t=0;t<this.unhandledRejections.length;t++)if(e-this.unhandledRejections[t].time>500){var n=this.unhandledRejections[t].promise._value,r=`Unhandled rejection: `+n;n.stack&&(r+=`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-5iZMYShA.cjs");var t=e.t(((e,t)=>{t.exports={}})),n=e.n(t(),1),r=class e{constructor(e){this.nodeName=e,this.childNodes=[],this.attributes={},this.textContent=``}getAttribute(e){return this.attributes[e]||null}getElementsByTagName(t){let n=[];this.nodeName===t&&n.push(this);for(let r of this.childNodes)if(r instanceof e){(t===`*`||r.nodeName===t)&&n.push(r);let e=r.getElementsByTagName(t);n=n.concat(e)}return n}},i=class{constructor(){this.documentElement=null}},a=class{parseFromString(e){let t=new i;return e=e.replace(/<\?xml[^?]*\?>/,``).trim(),t.documentElement=this.parseElement(e),t}parseElement(e){let t=/<([^\s/>]+)([^>]*)>/,n=/([^\s=]+)=(?:"([^"]*)"|'([^']*)')/g,i=e.match(t);if(!i)return null;let a=i[1],o=i[2],s=new r(a),c;for(;(c=n.exec(o))!==null;){let e=c[1],t=c[2]||c[3];s.attributes[e]=t}let l=i[0].length,u=RegExp(`</${a}>`),d=e.slice(l).search(u);if(d===-1)return s;let f=e.slice(l,l+d).trim();for(;f.length>0;){if(f.startsWith(`<`)&&!f.startsWith(`</`)){let e=f.match(t);if(e){let t=e[1],n=RegExp(`</${t}>`),r=f.search(n);if(r!==-1){let e=t.length+3,n=f.slice(0,r+e),i=this.parseElement(n);i&&s.childNodes.push(i),f=f.slice(n.length).trim();continue}}}let e=f.indexOf(`<`);if(e===-1){s.textContent+=f.trim();break}if(e>0)s.textContent+=f.slice(0,e).trim(),f=f.slice(e).trim();else break}return s}},o={log:n.default.log.bind(n.default),info:n.default.info.bind(n.default),warn:n.default.warn.bind(n.default),error(e){throw Error(e)},verbosity(){},LogManager:{addLogger(){},notify(){}},ERRORS:0,WARNINGS:1,INFOS:5};function s(e){e&&(o.log=e.log,o.info=e.info,o.warn=e.warn,o.error=e.error,o.verbosity=e.verbosity,o.LogManager=e.LogManager,typeof e.verbosity==`function`&&e.verbosity())}function c(e,t){let n=e.get(`Parent`);n&&n.forEach((e,n)=>{e===`DV`||(e===`TU`?t.alternativeText=n:e===`TM`&&(t.alternativeID=n))}),e.get(`AP`).get(`N`).forEach((e,n)=>{e.toLowerCase()!==`off`&&(t.value=e,t.checked=t.fieldValue===t.value)}),t.value||=`off`}function l(e,t){let n=e.get(`MK`);n&&(t.value=n.get(`CA`)||``),t.FL=``;let r=e.get(`A`);if(r){let e=r.get(`S`);t.FL=r.get(e.name)}}function u(e,t){let n=e.get(`AP`).get(`N`),r=0;n.forEach((e,n)=>{r++,r===1&&(t.value=e)})}function d(e,t){t.value=e.get(`Opt`)||[]}function f(e,t){let n=e.get(`AA`);if(!n)return;let r=n.get(`F`);!r&&(r=n.get(`K`),!r)||r.forEach((e,n)=>{e===`JS`&&m(n,t)})}var p=[`zip`,`zip`,`phone`,`ssn`,``];function m(e,t){if(Object.prototype.hasOwnProperty.call(t,`TName`)||!e.split)return;let n=e.split(`(`);if(n.length!==2)return;let r=n[0],i=n[1].split(`)`)[0];switch(r){case`AFSpecial_Format`:t.TName=p[Number(i)];break;case`AFNumber_Format`:t.TName=`number`;break;case`AFDate_FormatEx`:t.TName=`date`,t.MV=i.replace(/^'+|^"+|'+$|"+$/g,``);break;case`AFSpecial_KeystrokeEx`:{let e=i.replace(/^'+|^"+|'+$|"+$/g,``);e&&e.length>0&&e.length<64&&(t.TName=`mask`,t.MV=e)}break;case`AFPercent_Format`:t.TName=`percent`}}function h(e,t){let n=e.get(`V`);if(!n)return;t.Sig={};let r=n.get(`Name`);r&&(t.Sig.Name=r);let i=n.get(`M`);i&&(t.Sig.M=i);let a=n.get(`Location`);a&&(t.Sig.Location=a);let o=n.get(`Reason`);o&&(t.Sig.Reason=o);let s=n.get(`ContactInfo`);s&&(t.Sig.ContactInfo=s)}var g=class{static processAnnotation(e,t){t.fieldType===`Btn`?t.fieldFlags&32768?c(e,t):t.fieldFlags&65536?l(e,t):u(e,t):t.fieldType===`Ch`?d(e,t):t.fieldType===`Tx`?f(e,t):t.fieldType===`Sig`?h(e,t):o.warn(`Unknown fieldType: `,t)}},_=class{#e=``;#t=null;set onload(e){this.#t=typeof e==`function`?e:null}get onload(){return this.#t}set src(e){this.#e=e,this.#t&&this.#t()}get src(){return this.#e}btoa(e){return new n.Buffer.from(e,`binary`).toString(`base64`)}},v=`#000000.#ffffff.#4c4c4c.#808080.#999999.#c0c0c0.#cccccc.#e5e5e5.#f2f2f2.#008000.#00ff00.#bfffa0.#ffd629.#ff99cc.#004080.#9fc0e1.#5580ff.#a9c9fa.#ff0080.#800080.#ffbfff.#e45b21.#ffbfaa.#008080.#ff0000.#fdc59f.#808000.#bfbf00.#824100.#007256.#008000.#000080.#008080.#800080.#ff0000.#0000ff.#008000`.split(`.`),y=[`quicktype,arial,helvetica,sans-serif`,`quicktype condensed,arial narrow,arial,helvetica,sans-serif`,`quicktypepi,quicktypeiipi`,`quicktype mono,courier new,courier,monospace`,`ocr-a,courier new,courier,monospace`,`ocr b mt,courier new,courier,monospace`],b=[[0,6,0,0],[0,8,0,0],[0,10,0,0],[0,12,0,0],[0,14,0,0],[0,18,0,0],[0,6,1,0],[0,8,1,0],[0,10,1,0],[0,12,1,0],[0,14,1,0],[0,18,1,0],[0,6,0,1],[0,8,0,1],[0,10,0,1],[0,12,0,1],[0,14,0,1],[0,18,0,1],[0,6,1,1],[0,8,1,1],[0,10,1,1],[0,12,1,1],[0,14,1,1],[0,18,1,1],[1,6,0,0],[1,8,0,0],[1,10,0,0],[1,12,0,0],[1,14,0,0],[1,18,0,0],[1,6,1,0],[1,8,1,0],[1,10,1,0],[1,12,1,0],[1,14,1,0],[1,18,1,0],[1,6,0,1],[1,8,0,1],[1,10,0,1],[1,12,0,1],[1,14,0,1],[1,18,0,1],[2,8,0,0],[2,10,0,0],[2,12,0,0],[2,14,0,0],[2,18,0,0],[3,8,0,0],[3,10,0,0],[3,12,0,0],[4,12,0,0],[0,9,0,0],[0,9,1,0],[0,9,0,1],[0,9,1,1],[1,9,0,0],[1,9,1,0],[1,9,1,1],[4,10,0,0],[5,10,0,0],[5,12,0,0]],x=96,S=4,C=4,w=x/S,T=x/C,E=x/72,D=class e{static toFixedFloat(e){return parseFloat(e.toFixed(3))}static colorCount(){return v.length}static toPixelX(e){return Math.round(e*w)}static toPixelY(e){return Math.round(e*T)}static pointToPixel(e){return e*E}static getColorByIndex(e){return v[e]}static toFormPoint(e,t){return[e/w,t/T]}static toFormX(t){return e.toFixedFloat(t/w)}static toFormY(t){return e.toFixedFloat(t/T)}static findColorIndex(e){return e.length===4&&(e+=`000`),v.indexOf(e)}static dateToIso8601(e){e.slice(0,2)===`D:`&&(e=e.slice(2));let t=`Z`,n=e.search(/[Z+-]/);return n>=0&&(t=e.slice(n),t!==`Z`&&(t=`${t.slice(0,3)}:${t.slice(4,6)}`),e=e.slice(0,n)),`${e.slice(0,4)}-${e.slice(4,6)||`01`}-${e.slice(6,8)||`01`}T${e.slice(8,10)||`00`}:${e.slice(10,12)||`00`}:${e.slice(12,14)||`00`}${t}`}},O=class{constructor(e,t,n,r,i,a,o){this.x1=e,this.y1=t,this.x2=n,this.y2=r,this.lineWidth=i||1,this.color=a,this.dashed=o}#e(e,t,n){e.x=D.toFormX(t),e.y=D.toFormY(n)}processLine(e){let t=Math.abs(this.x2-this.x1),n=Math.abs(this.y2-this.y1),r=this.lineWidth,i={x:0,y:0,w:D.toFixedFloat(this.lineWidth),l:0},a=D.findColorIndex(this.color),s=a>0&&a<D.colorCount()?{clr:a}:{oc:this.color};if(i={...i,...s},this.dashed&&(i={...i,dsh:1}),n<this.lineWidth&&t>r){if(this.lineWidth<4&&t/this.lineWidth<4){o.info(`Skipped: short thick HLine: lineWidth = ${this.lineWidth}, xDelta = ${t}`);return}i.l=D.toFormX(t),this.x1>this.x2?this.#e(i,this.x2,this.y2):this.#e(i,this.x1,this.y1),e.HLines.push(i)}else if(t<this.lineWidth&&n>r){if(this.lineWidth<4&&n/this.lineWidth<4){o.info(`Skipped: short thick VLine: lineWidth = ${this.lineWidth}, yDelta = ${n}`);return}i.l=D.toFormY(n),this.y1>this.y2?this.#e(i,this.x2,this.y2):this.#e(i,this.x1,this.y1),e.VLines.push(i)}}},k=class{constructor(e,t,n,r,i){this.x=e,this.y=t,this.width=n,this.height=r,this.color=i}processFill(e){let t=D.findColorIndex(this.color),n=t>0&&t<D.colorCount()?{clr:t}:{oc:this.color},r={x:D.toFormX(this.x),y:D.toFormY(this.y),w:D.toFormX(this.width),h:D.toFormY(this.height),...n};r.w<2&&r.h<2?o.info(`Skipped: tiny fill: ${r.w} x ${r.h}`):e.Fills.push(r)}},A=[`bd`,`bold`,`demi`,`black`,`medi`],j=[`arial`,`helvetica`,`sans-serif `,`courier `,`monospace `,`ocr `],M=.1,N=class e{#e(){let e=this.fontObj.name||this.fontObj.fallbackName;return e||=y[0],e=e.toLowerCase(),e}#t(){let e=this.typeName,t=!1,n=this.typeName.split(`+`);if(Array.isArray(n)&&n.length>1&&(e=n[1].split(`-`),Array.isArray(e)&&e.length>1)){let n=e[1].toLowerCase();t=A.indexOf(n)>=0,e=e[0]}return{subType:e,bold:t}}#n(){let e=this.typeName.indexOf(`symbol`)>0||y[2].indexOf(this.subType)>=0;return this.fontObj.isSymbolicFont?j.filter(e=>this.typeName.indexOf(e)>=0).length>0&&(this.fontObj.isSymbolicFont=!1,o.info(`Reset: isSymbolicFont (false) for ${this.fontObj.name}`)):e&&(this.fontObj.isSymbolicFont=!0,o.info(`Reset: isSymbolicFont (true) for ${this.fontObj.name}`)),e}#r(){let{spaceWidth:e}=this.fontObj;if(!e){var t=Array.isArray(this.fontObj.toFontChar)?this.fontObj.toFontChar.indexOf(32):-1;e=t>=0&&Array.isArray(this.fontObj.widths)?this.fontObj.widths[t]:250}return e=D.toFormX(e)/32,e}constructor(e){this.fontObj=e,this.typeName=this.#e();let{subType:t,bold:n}=this.#t();this.subType=t,this.bold=n,this.isSymbol=this.#n(),this.spaceWidth=this.#r(),this.fontSize=1,this.faceIdx=0,this.italic=!1,this.fontStyleId=-1}static compareBlockPos(e,t){if(e.y<t.y-M)return-1;if(Math.abs(e.y-t.y)<=M){if(e.x<t.x-M)return-1;if(Math.abs(e.x-t.x)<=M)return 0}return 1}static haveSameStyle(e,t){let n=e.R[0].S===t.R[0].S;if(n&&e.R[0].S<0){for(let r=0;r<e.R[0].TS.length;r++)if(e.R[0].TS[r]!==t.R[0].TS[r]){n=!1;break}}return n&&=e.R[0].RA===void 0&&t.R[0].RA===void 0,n}static getSpaceThreshHold(t){return e.getFontSize(t)/12*t.sw}static areAdjacentBlocks(t,n){let r=Math.abs(t.y-n.y)<=M,i=n.x-t.x-t.w<e.getSpaceThreshHold(t);return r&&i}static getFontSize(e){let t=e.R[0].S;return t<0?e.R[0].TS[1]:b[t][1]}static areDuplicateBlocks(t,n){return t.x===n.x&&t.y===n.y&&t.R[0].T===n.R[0].T&&e.haveSameStyle(t,n)}#i(){let{fontObj:e}=this;this.bold=e.bold,this.bold||=this.typeName.indexOf(`bold`)>=0||this.typeName.indexOf(`black`)>=0,this.italic=e.italic,this.italic||=this.typeName.indexOf(`italic`)>=0||this.typeName.indexOf(`oblique`)>=0,(!this.bold||!this.italic)&&this.typeName.indexOf(`boldobl`)>=0&&(this.bold=!0,this.italic=!0);let t=this.subType;e.isSerifFont?y[1].indexOf(t)>=0&&(this.faceIdx=1):y[2].indexOf(this.subType)>=0?this.faceIdx=2:e.isMonospace?(this.faceIdx=3,y[4].indexOf(t)>=0?this.faceIdx=4:y[5].indexOf(t)>=0&&(this.faceIdx=5)):e.isSymbolicFont&&(this.faceIdx=2),this.faceIdx===0&&this.typeName.indexOf(`narrow`)>0&&(this.faceIdx=1),o.info(`typeName = ${t} => faceIdx = ${this.faceIdx}`)}#a(e){this.#i(),this.fontSize=this.bold&&e>12?e+1:e;let t=[this.faceIdx,this.fontSize,+!!this.bold,+!!this.italic],n=-1;return b.forEach((e,r,i)=>{n===-1&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&(n=r)}),n}#o(e){let t=e;if(!e||e.length!==1)return t;if(!this.fontObj.isSymbolicFont||!this.isSymbol)return(t===`C`||t===`G`)&&(t=` ${t} `),t;switch(e.charCodeAt(0)){case 20:t=`✓`;break;case 70:t=this.fontObj.type===`CIDFontType0`?`⚠`:`}`;break;case 71:t=`▶`;break;case 97:t=`▶`;break;case 99:t=this.isSymbol?`•`:`▲`;break;case 100:t=`▼`;break;case 103:t=`➨`;break;case 106:t=``;break;case 114:t=`•`;break;case 115:t=`▲`;break;case 116:t=`•`;break;case 118:t=`•`;break;default:o.info(`${this.fontObj.type} - SymbolicFont - (${this.fontObj.name}) : ${e.charCodeAt(0)}::${e.charCodeAt(1)} => ${t}`)}return t}#s(e){if(!e||e.length!==1||this.fontObj.type!==`Type3`)return e;if(o.info(`Processing Type3 font: char code = ${e.charCodeAt(0)}, char = '${e}'`),this.fontObj.charProcMapping)o.info(`charProcMapping available with ${Object.keys(this.fontObj.charProcMapping).length} entries`);else if(o.info(`No charProcMapping available for this Type3 font`),e&&e.length===1){let t=e.charCodeAt(0);if(t>=65&&t<=90)return o.info(`Using direct uppercase letter: ${e}`),e;if(t>=97&&t<=122)return o.info(`Using direct lowercase letter: ${e}`),e;if(t>=48&&t<=57)return o.info(`Using direct digit: ${e}`),e}if(this.fontObj.charProcMapping){let t=e.charCodeAt(0),n=this.fontObj.charProcMapping[t];if(n){o.info(`Found glyph name in mapping: ${n}`);let e={bullet:`•`,checkbox:`☐`,checkmark:`✓`,check:`✓`,circle:`○`,square:`□`,triangle:`▲`,triangledown:`▼`,triangleleft:`◀`,triangleright:`▶`,star:`★`,diamond:`◆`,heart:`♥`,club:`♣`,spade:`♠`,filledcircle:`●`,filledsquare:`■`,filledtriangle:`▲`,filledtriangledown:`▼`,filledtriangleright:`▶`,filledtriangleleft:`◀`,arrowleft:`←`,arrowright:`→`,arrowup:`↑`,arrowdown:`↓`,cross:`✗`},t=typeof n==`string`?n.toLowerCase():``;if(t in e){let n=e[t];return o.info(`Mapped ${t} to Unicode ${n}`),n}if(typeof n==`string`&&n.length>1){let e=n.match(/[A-Za-z]/g);if(e&&e.length===1){let t=e[0].toUpperCase();return o.info(`Extracted letter ${t} from glyph name ${n}`),t}}for(let n in e)if(t.indexOf(n)>=0){let r=e[n];return o.info(`Partial match: ${t} contains ${n}, mapped to ${r}`),r}if(typeof n==`string`){let e=n.match(/[A-Za-z]/g);if(e&&e.length===1){let t=e[0].toUpperCase();return o.info(`Extracted letter ${t} from glyph name ${n}`),t}let t=n.match(/\d+/);if(t&&t.length===1){let e=parseInt(t[0],10);if(e>=1&&e<=26){let t=String.fromCharCode(64+e);return o.info(`Mapped number ${e} in glyph name ${n} to letter ${t}`),t}}}if(typeof n==`string`&&n.startsWith(`uni`)){let e=n.substring(3);if(/^[0-9A-F]{4,6}$/i.test(e))return o.info(`Mapped uni${e} to Unicode character`),String.fromCharCode(parseInt(e,16))}}}let t=e.charCodeAt(0);o.info(`No direct mapping for character code ${t}, checking general mappings`);let n=e;switch(t){case 18:n=`✓`;break;case 19:n=`☐`;break;case 20:n=`☑`;break;case 108:n=`•`;break;case 109:n=`●`;break;case 110:n=`○`;break;case 111:n=`■`;break;case 112:n=`□`;break;case 113:n=`▲`;break;case 114:n=`▼`;break;case 117:n=`←`;break;case 118:n=`→`;break;case 119:n=`↑`;break;case 120:n=`↓`;break;case 128:n=`∞`;break;case 129:n=`≠`;break;case 130:n=`≤`;break;case 131:n=`≥`}return n===e?o.info(`No mapping found for char code ${t}, returning original character`):o.info(`Mapped char code ${t} to Unicode ${n}`),n}#c(e){let t=0;if(e[0][0]===0&&e[1][1]===0)e[0][1]!==0&&e[1][0]!==0&&e[0][1]/e[1][0]+1<1e-4&&(t=90);else if(e[0][0]!==0&&e[1][1]!==0){let n=Math.atan(-e[0][1]/e[0][0]),r=Math.atan(e[1][0]/e[1][1]);Math.abs(n)>1e-4&&n-r<1e-4&&(t=n*180/Math.PI)}return t}processText(e,t,n,r,i,a,s){o.info(`Processing text: '${t}', font type: ${this.fontObj.type||`unknown`}, char code: ${t?t.charCodeAt(0):`none`}`);let c=t,l=this.fontObj.type===`Type3`?this.#s(t):this.#o(t);l||=(o.info(`Text processing returned null or empty, falling back to original text`),c),o.info(`Processed text: '${t}' -> '${l}'`),this.fontStyleId=this.#a(i);let u=[this.faceIdx,this.fontSize,+!!this.bold,+!!this.italic],d=D.findColorIndex(r),f=d>=0&&d<D.colorCount()?{clr:d}:{oc:r},p={T:this.flashEncode(l),S:this.fontStyleId,TS:u},m=this.#c(s);m!==0&&(o.info(`${t}: rotated ${m} degree.`),p=Object.assign({},p,{RA:m}));let h={x:D.toFormX(e.x)-.25,y:D.toFormY(e.y)-.75,w:D.toFixedFloat(n),...f,sw:this.spaceWidth,A:`left`,R:[p]};o.info(`Adding text to output: '${l}'`),a.Texts.push(h)}flashEncode(e){if(!e)return e;let t=e;return t=t.replace(/\u0096/g,`-`),t=t.replace(/\u0091/g,`'`),t=t.replace(/\u0092/g,`'`),t=t.replace(/\u0082/g,`'`),t=t.replace(/\u0093/g,`"`),t=t.replace(/\u0094/g,`"`),t=t.replace(/\u0084/g,`"`),t=t.replace(/\u008B/g,`«`),t=t.replace(/\u009B/g,`»`),t}clean(){this.fontObj=null,delete this.fontObj}},{round:P,sin:F,cos:I,abs:L,sqrt:ee}=Math,te=[];for(let e=0;e<16;e++)for(let t=0;t<16;t++)te[e*16+t]=e.toString(16)+t.toString(16);function ne(){return[[1,0,0],[0,1,0],[0,0,1]]}function re(e,t){let n=ne();for(let r=0;r<3;r++)for(let i=0;i<3;i++){let a=0;for(let n=0;n<3;n++)a+=e[r][n]*t[n][i];n[r][i]=a}return n}function ie(e,t){t.fillStyle=e.fillStyle,t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY,t.strokeStyle=e.strokeStyle,t.globalAlpha=e.globalAlpha,t.arcScaleX_=e.arcScaleX_,t.arcScaleY_=e.arcScaleY_,t.lineScale_=e.lineScale_,t.dashArray=e.dashArray}function ae(e){let t,n=1;if(e=String(e),e.substring(0,3)===`rgb`){let r=e.indexOf(`(`,3),i=e.indexOf(`)`,r+1),a=e.substring(r+1,i).split(`,`);t=`#`;for(let e=0;e<3;e++)t+=te[Number(a[e])];a.length===4&&e.substring(3,4)===`a`&&(n=a[3])}else t=e;return{color:t,alpha:n}}function oe(e,t,n,r){e.currentPath_.push({type:`bezierCurveTo`,cp1x:t.x,cp1y:t.y,cp2x:n.x,cp2y:n.y,x:r.x,y:r.y}),e.currentX_=r.x,e.currentY_=r.y}function se(e){for(let t=0;t<3;t++)for(let n=0;n<2;n++)if(!isFinite(e[t][n])||isNaN(e[t][n]))return!1;return!0}function ce(e,t,n){se(t)&&(e.m_=t,n&&(e.lineScale_=ee(L(t[0][0]*t[1][1]-t[0][1]*t[1][0]))))}var le=class{constructor(){}},ue=class{constructor(e){this.type_=e,this.x0_=0,this.y0_=0,this.r0_=0,this.x1_=0,this.y1_=0,this.r1_=0,this.colors_=[]}addColorStop(e,t){t=ae(t),this.colors_.push({offset:e,color:t.color,alpha:t.alpha})}},de=class{constructor(e,t,n){this.m_=ne(),this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.strokeStyle=`#000`,this.fillStyle=`#000`,this.lineWidth=1,this.lineJoin=`miter`,this.lineCap=`butt`,this.dashArray=[],this.miterLimit=1,this.globalAlpha=1,(!(`HLines`in e)||!Array.isArray(e.HLines))&&(e.HLines=[]),(!(`VLines`in e)||!Array.isArray(e.VLines))&&(e.VLines=[]),(!(`Fills`in e)||!Array.isArray(e.Fills))&&(e.Fills=[]),(!(`Texts`in e)||!Array.isArray(e.Texts))&&(e.Texts=[]),this.canvas=e,this.width=t,this.height=n,this.arcScaleX_=1,this.arcScaleY_=1,this.lineScale_=1,this.currentFont=null}#e(e,t,n,r){let i=Array.isArray(this.dashArray)&&this.dashArray.length>1;new O(e.x,e.y,t.x,t.y,n,r,i).processLine(this.canvas)}#t(e,t,n,r){let i=n.x-t.x,a=n.y-t.y;new k(e.x,e.y,i,a,r).processFill(this.canvas)}#n(e,t,n,r){let i=Math.abs(n-Math.abs(r))<1&&n<13;return i&&o.info(`Skipped: tiny rect: w=${n}, h=${r}`),i}getContext(e){return e===`2d`?this:null}setLineDash(e){this.dashArray=e}getLineDash(){return this.dashArray}fillText(e,t,n,r,i){if(!e||!e.length===1&&e.trim().length<1)return;let a=this.getCoords_(t,n),o=ae(this.fillStyle||this.strokeStyle),s=o?o.color:`#000000`;this.currentFont.processText(a,e,r,s,i,this.canvas,this.m_)}strokeText(e,t,n,r){this.fillText(e,t,n,r)}measureText(e){return o.warn(`to be implemented: contextPrototype.measureText - `,e),{width:(e.length||1)*(this.currentFont.spaceWidth||5)}}setFont(e){this.currentFont&&typeof this.currentFont.clean==`function`&&(this.currentFont.clean(),this.currentFont=null),this.currentFont=new N(e)}clearRect(){o.warn(`to be implemented: contextPrototype.clearRect`)}beginPath(){this.currentPath_=[]}moveTo(e,t){let n=this.getCoords_(e,t);this.currentPath_.push({type:`moveTo`,x:n.x,y:n.y}),this.currentX_=n.x,this.currentY_=n.y}lineTo(e,t){let n=this.getCoords_(e,t);this.currentPath_.push({type:`lineTo`,x:n.x,y:n.y}),this.currentX_=n.x,this.currentY_=n.y}bezierCurveTo(e,t,n,r,i,a){let o=this.getCoords_(i,a),s=this.getCoords_(e,t),c=this.getCoords_(n,r);oe(this,s,c,o)}quadraticCurveTo(e,t,n,r){let i=this.getCoords_(e,t),a=this.getCoords_(n,r),o={x:this.currentX_+2/3*(i.x-this.currentX_),y:this.currentY_+2/3*(i.y-this.currentY_)},s={x:o.x+(a.x-this.currentX_)/3,y:o.y+(a.y-this.currentY_)/3};oe(this,o,s,a)}arc(e,t,n,r,i,a){let o=a?`at`:`wa`,s=e+I(r)*n,c=t+F(r)*n,l=e+I(i)*n,u=t+F(i)*n;s===l&&!a&&(s+=.125);let d=this.getCoords_(e,t),f=this.getCoords_(s,c),p=this.getCoords_(l,u);this.currentPath_.push({type:o,x:d.x,y:d.y,radius:n,xStart:f.x,yStart:f.y,xEnd:p.x,yEnd:p.y})}rect(e,t,n,r){this.#n(e,t,n,r)||(this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath())}strokeRect(e,t,n,r){if(this.#n(e,t,n,r))return;let i=this.currentPath_;this.beginPath(),this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath(),this.stroke(),this.currentPath_=i}fillRect(e,t,n,r){if(this.#n(e,t,n,r))return;let i=this.currentPath_;this.beginPath(),this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath(),this.fill(),this.currentPath_=i}createLinearGradient(e,t,n,r){let i=new ue(`gradient`);return i.x0_=e,i.y0_=t,i.x1_=n,i.y1_=r,i}createRadialGradient(e,t,n,r,i,a){let o=new ue(`gradientradial`);return o.x0_=e,o.y0_=t,o.r0_=n,o.x1_=r,o.y1_=i,o.r1_=a,o}drawImage(e,t){e&&typeof e==`object`&&(e.Texts&&Array.isArray(e.Texts)&&e.Texts.length>0&&(this.canvas.Texts.push(...e.Texts),e.Texts=[]),e.HLines&&Array.isArray(e.HLines)&&e.HLines.length>0&&(this.canvas.HLines.push(...e.HLines),e.HLines=[]),e.VLines&&Array.isArray(e.VLines)&&e.VLines.length>0&&(this.canvas.VLines.push(...e.VLines),e.VLines=[]),e.Fills&&Array.isArray(e.Fills)&&e.Fills.length>0&&(this.canvas.Fills.push(...e.Fills),e.Fills=[]))}getImageData(e,t,n,r){return{width:n,height:r,data:new Uint8Array(n*r*4)}}stroke(e){if(this.currentPath_.length<2)return;let{color:t}=ae(e?this.fillStyle:this.strokeStyle),n=this.lineScale_*this.lineWidth,r={x:null,y:null},i={x:null,y:null};for(let a=0;a<this.currentPath_.length;a++){let o=this.currentPath_[a];switch(o.type){case`moveTo`:break;case`lineTo`:e||a>0&&this.#e(this.currentPath_[a-1],o,n,t);break;case`close`:e||a>0&&this.#e(this.currentPath_[a-1],this.currentPath_[0],n,t),o=null}e&&o&&((r.x===null||o.x<r.x)&&(r.x=o.x),(i.x===null||o.x>i.x)&&(i.x=o.x),(r.y===null||o.y<r.y)&&(r.y=o.y),(i.y===null||o.y>i.y)&&(i.y=o.y))}e&&this.#t(r,r,i,t)}fill(){this.stroke(!0)}closePath(){this.currentPath_.push({type:`close`})}getCoords_(e,t){let n=this.m_;return{x:e*n[0][0]+t*n[1][0]+n[2][0],y:e*n[0][1]+t*n[1][1]+n[2][1]}}save(){let e={};ie(this,e),this.aStack_.push(e),this.mStack_.push(this.m_),this.m_=re(ne(),this.m_)}restore(){ie(this.aStack_.pop(),this),this.m_=this.mStack_.pop()}translate(e,t){let n=[[1,0,0],[0,1,0],[e,t,1]];ce(this,re(n,this.m_),!1)}rotate(e){let t=I(e),n=F(e),r=[[t,n,0],[-n,t,0],[0,0,1]];ce(this,re(r,this.m_),!1)}scale(e,t){this.arcScaleX_*=e,this.arcScaleY_*=t;let n=[[e,0,0],[0,t,0],[0,0,1]];ce(this,re(n,this.m_),!0)}transform(e,t,n,r,i,a){let o=[[e,t,0],[n,r,0],[i,a,1]];ce(this,re(o,this.m_),!0)}setTransform(e,t,n,r,i,a){let o=[[e,t,0],[n,r,0],[i,a,1]];ce(this,o,!0)}clip(){}arcTo(){}createPattern(){return new le}};function fe(e,t){return new de({},e,t)}var R={disableWorker:!0},pe={console,PDFJS:R},me=typeof window>`u`,he=0,ge=1,_e=5,ve=ge,ye=[.001,0,0,.001,0,0],be={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};pe.PDFJS||={},pe.PDFJS.pdfBug=!1;var z=R.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87},xe=R.NO_OPS=[82,83,84,85,86,87],Se=R.NO_OPS_RANGE=[78,79,80,81],Ce=(function(){return!Number(process?.env?.PDF2JSON_DISABLE_LOGS??`0`)&&`console`in pe&&`log`in pe.console?pe.console.log.bind(pe.console):function(){}})();function B(e){ve>=_e&&(Ce(`Info: `+e),R.LogManager.notify(`info`,e))}function V(e){ve>=ge&&(Ce(`Warning: `+e),R.LogManager.notify(`warn`,e))}function H(e){if(arguments.length>1){var t=[`Error:`];t.push.apply(t,arguments),Ce.apply(null,t),e=[].join.call(arguments,` `)}throw R.LogManager.notify(`error`,e),Error(e)}function we(e){V(`TODO: `+e)}function Te(e,t){e||H(t)}function Ee(e,t){if(!t)return e;if(t.indexOf(`:`)>=0)return t;if(t.charAt(0)==`/`){var n=e.indexOf(`://`);return n=e.indexOf(`/`,n+3),e.substring(0,n)+t}var r=e.length,n=e.lastIndexOf(`#`);r=n>=0?n:r,n=e.lastIndexOf(`?`,r),r=n>=0?n:r;var i=e.lastIndexOf(`/`,r);return e.substring(0,i+1)+t}function De(e,t){if(!e)return!1;var n=e.indexOf(`:`);if(n<0)return t;switch(e.substring(0,n)){case`http`:case`https`:case`ftp`:case`mailto`:return!0;default:return!1}}R.isValidUrl=De;function Oe(e,t){e||H(t)}R.LogManager=(function(){var e=[];return{addLogger:function(t){e.push(t)},notify:function(t,n){for(var r=0,i=e.length;r<i;r++){var a=e[r];a[t]&&a[t](n)}}}})();function ke(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1}),n}var Ae=R.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},je=(function(){function e(e,t){this.name=`PasswordException`,this.message=e,this.code=t}return e.prototype=Error(),e.constructor=e,e})(),Me=(function(){function e(e,t){this.name=`UnknownErrorException`,this.message=e,this.details=t}return e.prototype=Error(),e.constructor=e,e})(),Ne=(function(){function e(e){this.name=`InvalidPDFException`,this.message=e}return e.prototype=Error(),e.constructor=e,e})(),Pe=(function(){function e(e){this.name=`MissingPDFException`,this.message=e}return e.prototype=Error(),e.constructor=e,e})(),Fe=(function(){function e(e){this.message=e}return e.prototype=Error(),e.prototype.name=`NotImplementedException`,e.constructor=e,e})(),Ie=(function(){function e(e,t){this.begin=e,this.end=t,this.message=`Missing data [`+e+`, `+t+`)`}return e.prototype=Error(),e.prototype.name=`MissingDataException`,e.constructor=e,e})(),Le=(function(){function e(e){this.message=e}return e.prototype=Error(),e.prototype.name=`XRefParseException`,e.constructor=e,e})();function Re(e){for(var t=``,n=e.length,r=0;r<n;++r)t+=String.fromCharCode(e[r]);return t}function ze(e){for(var t=e.length,n=new Uint8Array(t),r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}var Be=[1,0,0,1,0,0],U=R.Util=(function(){function e(){}return e.makeCssRgb=function(e){return`rgb(`+e[0]+`,`+e[1]+`,`+e[2]+`)`},e.makeCssCmyk=function(t){var n=q.singletons.cmyk.getRgb(t,0);return e.makeCssRgb(n)},e.transform=function(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]},e.applyTransform=function(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]},e.applyInverseTransform=function(e,t){var n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]},e.getAxialAlignedBoundingBox=function(t,n){var r=e.applyTransform(t,n),i=e.applyTransform(t.slice(2,4),n),a=e.applyTransform([t[0],t[3]],n),o=e.applyTransform([t[2],t[1]],n);return[Math.min(r[0],i[0],a[0],o[0]),Math.min(r[1],i[1],a[1],o[1]),Math.max(r[0],i[0],a[0],o[0]),Math.max(r[1],i[1],a[1],o[1])]},e.inverseTransform=function(e){var t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]},e.apply3dTransform=function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]},e.singularValueDecompose2dScale=function(e){var t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],o=(n+a)/2,s=Math.sqrt((n+a)*(n+a)-4*(n*a-i*r))/2,c=o+s||1,l=o-s||1;return[Math.sqrt(c),Math.sqrt(l)]},e.normalizeRect=function(e){var t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t},e.intersect=function(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]},e.sign=function(e){return e<0?-1:1},e.concatenateToArray=function(e,t){Array.prototype.push.apply(e,t)},e.prependToArray=function(e,t){Array.prototype.unshift.apply(e,t)},e.extendObj=function(e,t){for(var n in t)e[n]=t[n]},e.getInheritableProperty=function(e,t){for(;e&&!e.has(t);)e=e.get(`Parent`);return e?e.get(t):null},e.inherit=function(e,t,n){for(var r in e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n)e.prototype[r]=n[r]},e.loadScript=function(e,t){var n=document.createElement(`script`),r=!1;n.setAttribute(`src`,e),t&&(n.onload=function(){r||t(),r=!0}),document.getElementsByTagName(`head`)[0].appendChild(n)},e})();R.PageViewport=(function(){function e(e,t,n,r,i,a){this.viewBox=e,this.scale=t,this.rotation=n,this.offsetX=r,this.offsetY=i;var o=(e[2]+e[0])/2,s=(e[3]+e[1])/2,c,l,u,d;switch(n%=360,n=n<0?n+360:n,n){case 180:c=-1,l=0,u=0,d=1;break;case 90:c=0,l=1,u=1,d=0;break;case 270:c=0,l=-1,u=-1,d=0;break;default:c=1,l=0,u=0,d=-1}a&&(u=-u,d=-d);var f,p,m,h;c===0?(f=Math.abs(s-e[1])*t+r,p=Math.abs(o-e[0])*t+i,m=Math.abs(e[3]-e[1])*t,h=Math.abs(e[2]-e[0])*t):(f=Math.abs(o-e[0])*t+r,p=Math.abs(s-e[1])*t+i,m=Math.abs(e[2]-e[0])*t,h=Math.abs(e[3]-e[1])*t),this.transform=[c*t,l*t,u*t,d*t,f-c*t*o-u*t*s,p-l*t*o-d*t*s],this.width=m,this.height=h,this.fontScale=t}return e.prototype={clone:function(t){t||={};var n=`scale`in t?t.scale:this.scale,r=`rotation`in t?t.rotation:this.rotation;return new e(this.viewBox.slice(),n,r,this.offsetX,this.offsetY,t.dontFlip)},convertToViewportPoint:function(e,t){return U.applyTransform([e,t],this.transform)},convertToViewportRectangle:function(e){var t=U.applyTransform([e[0],e[1]],this.transform),n=U.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]},convertToPdfPoint:function(e,t){return U.applyInverseTransform([e,t],this.transform)}},e})();var Ve=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function He(e){var t,n=e.length,r=``;if(e[0]===`þ`&&e[1]===`ÿ`)for(t=2;t<n;t+=2)r+=String.fromCharCode(e.charCodeAt(t)<<8|e.charCodeAt(t+1));else for(t=0;t<n;++t){var i=Ve[e.charCodeAt(t)];r+=i?String.fromCharCode(i):e.charAt(t)}return r}function Ue(e){return decodeURIComponent(escape(e))}function We(e){for(var t in e)return!1;return!0}function Ge(e){return typeof e==`boolean`}function Ke(e){return typeof e==`number`&&(e|0)==e}function qe(e){return typeof e==`number`}function Je(e){return typeof e==`string`}function Ye(e){return e instanceof jt}function Xe(e,t){return e instanceof Mt&&(!t||e.cmd==t)}function W(e,t){if(!(e instanceof Nt))return!1;if(!t)return!0;var n=e.get(`Type`);return Ye(n)&&n.name==t}function G(e){return e instanceof Array}function Ze(e){return typeof e==`object`&&!!e&&e!==void 0&&`getBytes`in e}function Qe(e){return typeof e==`object`&&!!e&&e!==void 0&&`byteLength`in e}function $e(e){return e instanceof Pt}function et(e){var t;if(typeof e!=`object`)return!1;if(W(e))t=e;else if(Ze(e))t=e.dict;else return!1;return t.has(`FunctionType`)}var K=R.Promise=(function(){var e={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(e){e._status!=0&&(this.handlers=this.handlers.concat(e._handlers),e._handlers=[],!this.running&&(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(;this.handlers.length>0;){var e=this.handlers.shift(),t=e.thisPromise._status,n=e.thisPromise._value;try{t===1?typeof e.onResolve==`function`&&(n=e.onResolve(n)):typeof e.onReject==`function`&&(n=e.onReject(n),t=1,e.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(e.thisPromise))}catch(e){t=2,n=e}e.nextPromise._updateStatus(t,n)}this.running=!1},addUnhandledRejection:function(e){this.unhandledRejections.push({promise:e,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(e){e._unhandledRejection=!1;for(var t=0;t<this.unhandledRejections.length;t++)this.unhandledRejections[t].promise===e&&(this.unhandledRejections.splice(t),t--)},scheduleRejectionCheck:function(){this.pendingRejectionCheck||(this.pendingRejectionCheck=!0,setTimeout(function(){this.pendingRejectionCheck=!1;for(var e=Date.now(),t=0;t<this.unhandledRejections.length;t++)if(e-this.unhandledRejections[t].time>500){var n=this.unhandledRejections[t].promise._value,r=`Unhandled rejection: `+n;n.stack&&(r+=`
|
|
2
2
|
`+n.stack),V(r),this.unhandledRejections.splice(t),t--}this.unhandledRejections.length&&this.scheduleRejectionCheck()}.bind(this),500))}};function t(){this._status=0,this._handlers=[]}return t.all=function(e){var n=new t,r=e.length,i=[];if(r===0)return n.resolve(i),n;function a(e){n._status!==2&&(i=[],n.reject(e))}for(var o=0,s=e.length;o<s;++o){var c=e[o],l=(function(e){return function(t){n._status!==2&&(i[e]=t,r--,r===0&&n.resolve(i))}})(o);t.isPromise(c)?c.then(l,a):l(c)}return n},t.isPromise=function(e){return e&&typeof e.then==`function`},t.prototype={_status:null,_value:null,_handlers:null,_unhandledRejection:null,_updateStatus:function(n,r){this._status!==1&&this._status!==2&&(n==1&&t.isPromise(r)?r.then(this._updateStatus.bind(this,1),this._updateStatus.bind(this,2)):(this._status=n,this._value=r,n===2&&this._handlers.length===0&&(this._unhandledRejection=!0,e.addUnhandledRejection(this)),e.scheduleHandlers(this)))},get isResolved(){return this._status===1},get isRejected(){return this._status===2},resolve:function(e){this._updateStatus(1,e)},reject:function(e){this._updateStatus(2,e)},then:function(n,r){var i=new t;return this._handlers.push({thisPromise:this,onResolve:n,onReject:r,nextPromise:i}),e.scheduleHandlers(this),i}},t})(),tt=(function(){function e(e,t,n){for(;e.length<n;)e+=t;return e}function t(){this.started={},this.times=[],this.enabled=!0}return t.prototype={time:function(e){this.enabled&&(e in this.started&&V(`Timer is already running for `+e),this.started[e]=Date.now())},timeEnd:function(e){this.enabled&&(e in this.started||V(`Timer has not been started for `+e),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e])},toString:function(){for(var t=this.times,n=``,r=0,i=0,a=t.length;i<a;++i){var o=t[i].name;o.length>r&&(r=o.length)}for(var i=0,a=t.length;i<a;++i){var s=t[i],c=s.end-s.start;n+=e(s.name,` `,r)+` `+c+`ms
|
|
3
3
|
`}return n}},t})();R.createBlob=function(e,t){return new n.Blob([e],{type:t})},R.createObjectURL=(function(){if(typeof URL<`u`&&URL.createObjectURL)return function(e,t){var n=R.createBlob(e,t);return URL.createObjectURL(n)};var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`;return function(t,n){for(var r=`data:`+n+`;base64,`,i=0,a=t.length;i<a;i+=3){var o=t[i]&255,s=t[i+1]&255,c=t[i+2]&255,l=o>>2,u=(o&3)<<4|s>>4,d=i+1<a?(s&15)<<2|c>>6:64,f=i+2<a?c&63:64;r+=e[l]+e[u]+e[d]+e[f]}return r}})();function nt(e,t){this.name=e,this.comObj=t,this.callbackIndex=1,this.postMessageTransfers=!0;var n=this.callbacks={},r=this.actionHandler={};r.console_log=[function(e){Ce.apply(null,e)}],r.console_error=`console`in pe?[function(e){pe.console.error.apply(null,e)}]:[function(e){Ce.apply(null,e)}],r._warn=[function(e){V(e)}],typeof t==`object`&&(t.onmessage=function(e){var i=e.data;if(i.isReply){var a=i.callbackId;if(i.callbackId in n){var o=n[a];delete n[a],o(i.data)}else H(`Cannot resolve callback `+a)}else if(i.action in r){var s=r[i.action];if(i.callbackId){var c=new K;c.then(function(e){t.postMessage({isReply:!0,callbackId:i.callbackId,data:e})}),s[0].call(s[1],i.data,c)}else s[0].call(s[1],i.data)}else H(`Unkown action from worker: `+i.action)})}nt.prototype={on:function(e,t,n){var r=this.actionHandler;r[e]&&H(`There is already an actionName called "`+e+`"`),r[e]=[t,n]},send:function(e,t,n,r){var i={action:e,data:t};if(n){var a=this.callbackIndex++;this.callbacks[a]=n,i.callbackId=a}r&&this.postMessageTransfers?this.comObj.postMessage(i,r):this.comObj.postMessage(i)}};function rt(e,t,n){var r=new _;r.onload=function(){n.resolve(e,r)},r.src=`data:image/jpeg;base64,`+r.btoa(t)}R.log=Ce,R.info=B,R.warn=V,R.error=H,R.verbosity=function(e){ve=isNaN(e)?ge:e<=he?he:e>=_e?_e:e},R.verbosity();var q=(function(){function e(){H(`should not call ColorSpace constructor`)}return e.prototype={getRgb:function(e,t){H(`Should not call ColorSpace.getRgb`)},getRgbItem:function(e,t,n,r){H(`Should not call ColorSpace.getRgbItem`)},getRgbBuffer:function(e,t,n,r,i,a){H(`Should not call ColorSpace.getRgbBuffer`)},getOutputLength:function(e){H(`Should not call ColorSpace.getOutputLength`)},isPassthrough:function(e){return!1},createRgbBuffer:function(e,t,n,r){if(this.isPassthrough(r))return e.subarray(t);var i=new Uint8Array(n*3),a=1<<r;if(this.numComps===1&&n>a&&this.name!==`DeviceGray`&&this.name!==`DeviceRGB`){for(var o=r<=8?new Uint8Array(a):new Uint16Array(a),s=0;s<a;s++)o[s]=s;var c=new Uint8Array(a*3);this.getRgbBuffer(o,0,a,c,0,r);for(var l=0,s=0;s<n;++s){var u=e[t++]*3;i[l++]=c[u],i[l++]=c[u+1],i[l++]=c[u+2]}return i}return this.getRgbBuffer(e,t,n,i,0,r),i},usesZeroToOneRange:!0},e.parse=function(t,n,r){var i=e.parseToIR(t,n,r);return i instanceof it?i:e.fromIR(i)},e.fromIR=function(t){var n=G(t)?t[0]:t;switch(n){case`DeviceGrayCS`:return this.singletons.gray;case`DeviceRgbCS`:return this.singletons.rgb;case`DeviceCmykCS`:return this.singletons.cmyk;case`CalGrayCS`:var r=t[1].WhitePoint,i=t[1].BlackPoint,a=t[1].Gamma;return new ut(r,i,a);case`PatternCS`:var o=t[1];return o&&=e.fromIR(o),new at(o);case`IndexedCS`:var s=t[1],c=t[2],l=t[3];return new ot(e.fromIR(s),c,l);case`AlternateCS`:var u=t[1],d=t[2],f=t[3];return new it(u,e.fromIR(d),gt.fromIR(f));case`LabCS`:var r=t[1].WhitePoint,i=t[1].BlackPoint,p=t[1].Range;return new dt(r,i,p);default:H(`Unkown name `+n)}return null},e.parseToIR=function(t,n,r){if(Ye(t)){var i=r.get(`ColorSpace`);if(W(i)){var a=i.get(t.name);a&&(t=a)}}t=n.fetchIfRef(t);var o;if(Ye(t))switch(o=t.name,this.mode=o,o){case`DeviceGray`:case`G`:return`DeviceGrayCS`;case`DeviceRGB`:case`RGB`:return`DeviceRgbCS`;case`DeviceCMYK`:case`CMYK`:return`DeviceCmykCS`;case`Pattern`:return[`PatternCS`,null];default:H(`unrecognized colorspace `+o)}else if(G(t))switch(o=t[0].name,this.mode=o,o){case`DeviceGray`:case`G`:return`DeviceGrayCS`;case`DeviceRGB`:case`RGB`:return`DeviceRgbCS`;case`DeviceCMYK`:case`CMYK`:return`DeviceCmykCS`;case`CalGray`:var s=n.fetchIfRef(t[1]);return W(s)&&(s=s.getAll()),[`CalGrayCS`,s];case`CalRGB`:return`DeviceRgbCS`;case`ICCBased`:var c=n.fetchIfRef(t[1]).dict.get(`N`);if(c==1)return`DeviceGrayCS`;if(c==3)return`DeviceRgbCS`;if(c==4)return`DeviceCmykCS`;break;case`Pattern`:var l=t[1];return l&&=e.parseToIR(l,n,r),[`PatternCS`,l];case`Indexed`:case`I`:var u=e.parseToIR(t[1],n,r),d=t[2]+1,f=n.fetchIfRef(t[3]);return Ze(f)&&(f=f.getBytes()),[`IndexedCS`,u,d,f];case`Separation`:case`DeviceN`:var p=t[1],c=1;Ye(p)?c=1:G(p)&&(c=p.length);var m=e.parseToIR(t[2],n,r),h=gt.getIR(n,n.fetchIfRef(t[3]));return[`AlternateCS`,c,m,h];case`Lab`:var s=n.fetchIfRef(t[1]);return W(s)&&(s=s.getAll()),[`LabCS`,s];default:H(`unimplemented color space object "`+o+`"`)}else H(`unrecognized color space object: "`+t+`"`);return null},e.isDefaultDecode=function(e,t){if(!e)return!0;if(t*2!==e.length)return V(`The decode map is not the correct length`),!0;for(var n=0,r=e.length;n<r;n+=2)if(e[n]!==0||e[n+1]!=1)return!1;return!0},e.singletons={get gray(){return ke(this,`gray`,new st)},get rgb(){return ke(this,`rgb`,new ct)},get cmyk(){return ke(this,`cmyk`,new lt)}},e})(),it=(function(){function e(e,t,n){this.name=`Alternate`,this.numComps=e,this.defaultColor=new Float32Array(e);for(var r=0;r<e;++r)this.defaultColor[r]=1;this.base=t,this.tintFn=n}return e.prototype={getRgb:function(e,t){var n=new Uint8Array(3);return this.getRgbItem(e,t,n,0),n},getRgbItem:function(e,t,n,r){this.base.numComps;var i=`subarray`in e?e.subarray(t,t+this.numComps):Array.prototype.slice.call(e,t,t+this.numComps),a=this.tintFn(i);this.base.getRgbItem(a,0,n,r)},getRgbBuffer:function(e,t,n,r,i,a){for(var o=this.tintFn,s=this.base,c=1/((1<<a)-1),l=s.numComps,u=s.usesZeroToOneRange,d=s.isPassthrough(8)||!u,f=d?i:0,p=d?r:new Uint8Array(l*n),m=this.numComps,h=new Float32Array(m),g=0;g<n;g++){for(var _=0;_<m;_++)h[_]=e[t++]*c;var v=o(h);if(u)for(var _=0;_<l;_++)p[f++]=v[_]*255;else s.getRgbItem(v,0,p,f),f+=l}d||s.getRgbBuffer(p,0,n,r,i,8)},getOutputLength:function(e){return this.base.getOutputLength(e*this.base.numComps/this.numComps)},isPassthrough:q.prototype.isPassthrough,createRgbBuffer:q.prototype.createRgbBuffer,isDefaultDecode:function(e){return q.isDefaultDecode(e,this.numComps)},usesZeroToOneRange:!0},e})(),at=(function(){function e(e){this.name=`Pattern`,this.base=e}return e.prototype={},e})(),ot=(function(){function e(e,t,n){this.name=`Indexed`,this.numComps=1,this.defaultColor=new Uint8Array([0]),this.base=e,this.highVal=t;var r=e.numComps*t,i;if(Ze(n)){i=new Uint8Array(r);var a=n.getBytes(r);i.set(a)}else if(Je(n)){i=new Uint8Array(r);for(var o=0;o<r;++o)i[o]=n.charCodeAt(o)}else n instanceof Uint8Array||n instanceof Array?i=n:H(`Unrecognized lookup table: `+n);this.lookup=i}return e.prototype={getRgb:function(e,t){var n=this.base.numComps,r=e[t]*n;return this.base.getRgb(this.lookup,r)},getRgbItem:function(e,t,n,r){var i=this.base.numComps,a=e[t]*i;this.base.getRgbItem(this.lookup,a,n,r)},getRgbBuffer:function(e,t,n,r,i){for(var a=this.base,o=a.numComps,s=a.getOutputLength(o),c=this.lookup,l=0;l<n;++l){var u=e[t++]*o;a.getRgbBuffer(c,u,1,r,i,8),i+=s}},getOutputLength:function(e){return this.base.getOutputLength(e*this.base.numComps)},isPassthrough:q.prototype.isPassthrough,createRgbBuffer:q.prototype.createRgbBuffer,isDefaultDecode:function(e){return!0},usesZeroToOneRange:!0},e})(),st=(function(){function e(){this.name=`DeviceGray`,this.numComps=1,this.defaultColor=new Float32Array([0])}return e.prototype={getRgb:function(e,t){var n=new Uint8Array(3);return this.getRgbItem(e,t,n,0),n},getRgbItem:function(e,t,n,r){var i=e[t]*255|0;i=i<0?0:i>255?255:i,n[r]=n[r+1]=n[r+2]=i},getRgbBuffer:function(e,t,n,r,i,a){for(var o=255/((1<<a)-1),s=t,c=i,l=0;l<n;++l){var u=o*e[s++]|0;r[c++]=u,r[c++]=u,r[c++]=u}},getOutputLength:function(e){return e*3},isPassthrough:q.prototype.isPassthrough,createRgbBuffer:q.prototype.createRgbBuffer,isDefaultDecode:function(e){return q.isDefaultDecode(e,this.numComps)},usesZeroToOneRange:!0},e})(),ct=(function(){function e(){this.name=`DeviceRGB`,this.numComps=3,this.defaultColor=new Float32Array([0,0,0])}return e.prototype={getRgb:function(e,t){var n=new Uint8Array(3);return this.getRgbItem(e,t,n,0),n},getRgbItem:function(e,t,n,r){var i=e[t]*255|0,a=e[t+1]*255|0,o=e[t+2]*255|0;n[r]=i<0?0:i>255?255:i,n[r+1]=a<0?0:a>255?255:a,n[r+2]=o<0?0:o>255?255:o},getRgbBuffer:function(e,t,n,r,i,a){var o=n*3;if(a==8)r.set(e.subarray(t,t+o),i);else for(var s=255/((1<<a)-1),c=t,l=i,u=0;u<o;++u)r[l++]=s*e[c++]|0},getOutputLength:function(e){return e},isPassthrough:function(e){return e==8},createRgbBuffer:q.prototype.createRgbBuffer,isDefaultDecode:function(e){return q.isDefaultDecode(e,this.numComps)},usesZeroToOneRange:!0},e})(),lt=(function(){function e(e,t,n,r,i){var a=e[t+0]*n,o=e[t+1]*n,s=e[t+2]*n,c=e[t+3]*n,l=a*(-4.387332384609988*a+54.48615194189176*o+18.82290502165302*s+212.25662451639585*c+-285.2331026137004)+o*(1.7149763477362134*o-5.6096736904047315*s+-17.873870861415444*c-5.497006427196366)+s*(-2.5217340131683033*s-21.248923337353073*c+17.5119270841813)+c*(-21.86122147463605*c-189.48180835922747)+255,u=a*(8.841041422036149*a+60.118027045597366*o+6.871425592049007*s+31.159100130055922*c+-79.2970844816548)+o*(-15.310361306967817*o+17.575251261109482*s+131.35250912493976*c-190.9453302588951)+s*(4.444339102852739*s+9.8632861493405*c-24.86741582555878)+c*(-20.737325471181034*c-187.80453709719578)+255,d=a*(.8842522430003296*a+8.078677503112928*o+30.89978309703729*s-.23883238689178934*c+-14.183576799673286)+o*(10.49593273432072*o+63.02378494754052*s+50.606957656360734*c-112.23884253719248)+s*(.03296041114873217*s+115.60384449646641*c+-193.58209356861505)+c*(-22.33816807309886*c-180.12613974708367)+255;r[i]=l>255?255:l<0?0:l,r[i+1]=u>255?255:u<0?0:u,r[i+2]=d>255?255:d<0?0:d}function t(){this.name=`DeviceCMYK`,this.numComps=4,this.defaultColor=new Float32Array([0,0,0,1])}return t.prototype={getRgb:function(t,n){var r=new Uint8Array(3);return e(t,n,1,r,0),r},getRgbItem:function(t,n,r,i){e(t,n,1,r,i)},getRgbBuffer:function(t,n,r,i,a,o){for(var s=1/((1<<o)-1),c=0;c<r;c++)e(t,n,s,i,a),n+=4,a+=3},getOutputLength:function(e){return(e>>2)*3},isPassthrough:q.prototype.isPassthrough,createRgbBuffer:q.prototype.createRgbBuffer,isDefaultDecode:function(e){return q.isDefaultDecode(e,this.numComps)},usesZeroToOneRange:!0},t})(),ut=(function(){function e(e,t,n){this.name=`CalGray`,this.numComps=3,this.defaultColor=new Float32Array([0,0,0]),e||H(`WhitePoint missing - required for color space CalGray`),t||=[0,0,0],n||=1,this.XW=e[0],this.YW=e[1],this.ZW=e[2],this.XB=t[0],this.YB=t[1],this.ZB=t[2],this.G=n,(this.XW<0||this.ZW<0||this.YW!==1)&&H(`Invalid WhitePoint components for `+this.name+`, no fallback available`),(this.XB<0||this.YB<0||this.ZB<0)&&(B(`Invalid BlackPoint for `+this.name+`, falling back to default`),this.XB=this.YB=this.ZB=0),(this.XB!==0||this.YB!==0||this.ZB!==0)&&we(this.name+`, BlackPoint: XB: `+this.XB+`, YB: `+this.YB+`, ZB: `+this.ZB+`, only default values are supported.`),this.G<1&&(B(`Invalid Gamma: `+this.G+` for `+this.name+`, falling back to default`),this.G=1)}return e.prototype={getRgb:function(e,t){var n=new Uint8Array(3);return this.getRgbItem(e,t,n,0),n},getRgbItem:function(e,t,n,r){var i=e[t]**+this.G;this.XW*i;var a=this.YW*i;this.ZW*i;var o=Math.max(116*a**(1/3)-16,0);n[r]=o*255/100,n[r+1]=o*255/100,n[r+2]=o*255/100},getRgbBuffer:function(e,t,n,r,i,a){for(var o=255/((1<<a)-1),s=t,c=i,l=0;l<n;++l){var u=o*e[s++]|0;r[c++]=u,r[c++]=u,r[c++]=u}},getOutputLength:function(e){return e*3},isPassthrough:q.prototype.isPassthrough,createRgbBuffer:q.prototype.createRgbBuffer,isDefaultDecode:function(e){return q.isDefaultDecode(e,this.numComps)},usesZeroToOneRange:!0},e})(),dt=(function(){function e(e,t,n){this.name=`Lab`,this.numComps=3,this.defaultColor=new Float32Array([0,0,0]),e||H(`WhitePoint missing - required for color space Lab`),t||=[0,0,0],n||=[-100,100,-100,100],this.XW=e[0],this.YW=e[1],this.ZW=e[2],this.amin=n[0],this.amax=n[1],this.bmin=n[2],this.bmax=n[3],this.XB=t[0],this.YB=t[1],this.ZB=t[2],(this.XW<0||this.ZW<0||this.YW!==1)&&H(`Invalid WhitePoint components, no fallback available`),(this.XB<0||this.YB<0||this.ZB<0)&&(B(`Invalid BlackPoint, falling back to default`),this.XB=this.YB=this.ZB=0),(this.amin>this.amax||this.bmin>this.bmax)&&(B(`Invalid Range, falling back to defaults`),this.amin=-100,this.amax=100,this.bmin=-100,this.bmax=100)}function t(e){return e>=6/29?e*e*e:108/841*(e-4/29)}function n(e,t,n,r){return n+e*(r-n)/t}function r(e,r,i,a,o,s){var c=r[i],l=r[i+1],u=r[i+2];a!==!1&&(c=n(c,a,0,100),l=n(l,a,e.amin,e.amax),u=n(u,a,e.bmin,e.bmax)),l=l>e.amax?e.amax:l<e.amin?e.amin:l,u=u>e.bmax?e.bmax:u<e.bmin?e.bmin:u;var d=(c+16)/116,f=d+l/500,p=d-u/200,m=e.XW*t(f),h=e.YW*t(d),g=e.ZW*t(p),_,v,y;e.ZW<1?(_=m*3.1339+h*-1.617+g*-.4906,v=m*-.9785+h*1.916+g*.0333,y=m*.072+h*-.229+g*1.4057):(_=m*3.2406+h*-1.5372+g*-.4986,v=m*-.9689+h*1.8758+g*.0415,y=m*.0557+h*-.204+g*1.057),o[s]=Math.sqrt(_<0?0:_>1?1:_)*255,o[s+1]=Math.sqrt(v<0?0:v>1?1:v)*255,o[s+2]=Math.sqrt(y<0?0:y>1?1:y)*255}return e.prototype={getRgb:function(e,t){var n=new Uint8Array(3);return r(this,e,t,!1,n,0),n},getRgbItem:function(e,t,n,i){r(this,e,t,!1,n,i)},getRgbBuffer:function(e,t,n,i,a,o){for(var s=(1<<o)-1,c=0;c<n;c++)r(this,e,t,s,i,a),t+=3,a+=3},getOutputLength:function(e){return e},createRgbBuffer:q.prototype.createRgbBuffer,isPassthrough:q.prototype.isPassthrough,isDefaultDecode:function(e){return!0},usesZeroToOneRange:!1},e})(),ft={AXIAL:2,RADIAL:3},pt=(function(){function e(){H(`should not call Pattern constructor`)}return e.prototype={getPattern:function(e){H(`Should not call Pattern.getStyle: `+e)}},e.shadingFromIR=function(e){return mt[e[0]].fromIR(e)},e.parseShading=function(e,t,n,r){var i=Ze(e)?e.dict:e,a=i.get(`ShadingType`);switch(a){case ft.AXIAL:case ft.RADIAL:return new mt.RadialAxial(i,t,n,r);default:return we(`Unsupported shading type: `+a),new mt.Dummy}},e})(),mt={};mt.SMALL_NUMBER=.01,mt.RadialAxial=(function(){function e(e,t,n,r,i){this.matrix=t,this.coordsArr=e.get(`Coords`),this.shadingType=e.get(`ShadingType`),this.type=`Pattern`,this.ctx=i;var a=e.get(`ColorSpace`,`CS`);a=q.parse(a,n,r),this.cs=a;var o=0,s=1;if(e.has(`Domain`)){var c=e.get(`Domain`);o=c[0],s=c[1]}var l=!1,u=!1;if(e.has(`Extend`)){var d=e.get(`Extend`);l=d[0],u=d[1]}if(this.shadingType===ft.RADIAL&&(!l||!u)){var f=this.coordsArr[0],p=this.coordsArr[1],m=this.coordsArr[2],h=this.coordsArr[3],g=this.coordsArr[4],_=this.coordsArr[5],v=Math.sqrt((f-h)*(f-h)+(p-g)*(p-g));m<=_+v&&_<=m+v&&V(`Unsupported radial gradient.`)}this.extendStart=l,this.extendEnd=u;var y=e.get(`Function`),b;if(G(y)){for(var x=[],S=0,C=y.length;S<C;S++){var w=n.fetchIfRef(y[S]);et(w)||H(`Invalid function`),x.push(gt.parse(n,w))}b=function(e){for(var t=[],n=0,r=x.length;n<r;n++)t.push(x[n](e)[0]);return t}}else et(y)||H(`Invalid function`),b=gt.parse(n,y);var T=s-o,E=T/10,D=this.colorStops=[];if(o>=s||E<=0)B(`Bad shading domain.`);else{for(var O=o;O<=s;O+=E){var k=a.getRgb(b([O]),0),A=U.makeCssRgb(k);D.push([(O-o)/T,A])}var j=`transparent`;if(e.has(`Background`)){var k=a.getRgb(e.get(`Background`),0);j=U.makeCssRgb(k)}l||(D.unshift([0,j]),D[1][0]+=mt.SMALL_NUMBER),u||(D[D.length-1][0]-=mt.SMALL_NUMBER,D.push([1,j])),this.colorStops=D}}return e.fromIR=function(e){var t=e[1],n=e[2],r=e[3],i=e[4],a=e[5],o=e[6];return{type:`Pattern`,getPattern:function(e){var s;t==ft.AXIAL?s=e.createLinearGradient(r[0],r[1],i[0],i[1]):t==ft.RADIAL&&(s=e.createRadialGradient(r[0],r[1],a,i[0],i[1],o));for(var c=0,l=n.length;c<l;++c){var u=n[c];s.addColorStop(u[0],u[1])}return s}}},e.prototype={getIR:function(){var e=this.coordsArr,t=this.shadingType;if(t==ft.AXIAL)var n=[e[0],e[1]],r=[e[2],e[3]],i=null,a=null;else if(t==ft.RADIAL)var n=[e[0],e[1]],r=[e[3],e[4]],i=e[2],a=e[5];else H(`getPattern type unknown: `+t);var o=this.matrix;return o&&(n=U.applyTransform(n,o),r=U.applyTransform(r,o)),[`RadialAxial`,t,this.colorStops,n,r,i,a]}},e})(),mt.Dummy=(function(){function e(){this.type=`Pattern`}return e.fromIR=function(){return{type:`Pattern`,getPattern:function(){return`hotpink`}}},e.prototype={getIR:function(){return[`Dummy`]}},e})();var ht=(function(){var e={COLORED:1,UNCOLORED:2},t=3e3;function n(e,t,n,r,i,a){this.name=e[1][0].name,this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.objs=r,this.commonObjs=i,this.baseTransform=a,this.type=`Pattern`,this.ctx=n}return n.getIR=function(e,t,n){return[`TilingPattern`,n,e,t.get(`Matrix`),t.get(`BBox`),t.get(`XStep`),t.get(`YStep`),t.get(`PaintType`),t.get(`TilingType`)]},n.prototype={createPatternCanvas:function(e){var n=this.operatorList,r=this.bbox,i=this.xstep,a=this.ystep,o=this.paintType,s=this.tilingType,c=this.color,l=this.objs,u=this.commonObjs;this.ctx,we(`TilingType: `+s);var d=r[0],f=r[1],p=r[2],m=r[3],h=[d,f],g=[d+i,f+a],_=g[0]-h[0],v=g[1]-h[1],y=U.singularValueDecompose2dScale(this.matrix),b=U.singularValueDecompose2dScale(this.baseTransform),x=[y[0]*b[0],y[1]*b[1]];_=Math.min(Math.ceil(Math.abs(_*x[0])),t),v=Math.min(Math.ceil(Math.abs(v*x[1])),t);var S=Hr.getCanvas(`pattern`,_,v,!0),C=S.context,w=new Gr(C,u,l);w.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(C,o,c),this.setScale(_,v,i,a),this.transformToScale(w);var T=[1,0,0,1,-h[0],-h[1]];return w.transform.apply(w,T),this.clipBbox(w,r,d,f,p,m),w.executeOperatorList(n),S.canvas},setScale:function(e,t,n,r){this.scale=[e/n,t/r]},transformToScale:function(e){var t=this.scale,n=[t[0],0,0,t[1],0,0];e.transform.apply(e,n)},scaleToContext:function(){var e=this.scale;this.ctx.scale(1/e[0],1/e[1])},clipBbox:function(e,t,n,r,i,a){if(t&&G(t)&&t.length==4){var o=i-n,s=a-r;e.rectangle(n,r,o,s),e.clip(),e.endPath()}},setFillAndStrokeStyleToContext:function(t,n,r){switch(n){case e.COLORED:var i=this.ctx;t.fillStyle=i.fillStyle,t.strokeStyle=i.strokeStyle;break;case e.UNCOLORED:var a=q.singletons.rgb.getRgb(r,0),o=U.makeCssRgb(a);t.fillStyle=o,t.strokeStyle=o;break;default:H(`Unsupported paint type: `+n)}},getPattern:function(e,t){var n=this.createPatternCanvas(t),e=this.ctx;return e.setTransform.apply(e,this.baseTransform),e.transform.apply(e,this.matrix),this.scaleToContext(),e.createPattern(n,`repeat`)}},n})(),gt=(function(){return{getSampleArray:function(e,t,n,r){for(var i=1,a=0,o=e.length;a<o;a++)i*=e[a];i*=t;for(var s=[],c=0,l=0,u=1/(2**n-1),d=r.getBytes((i*n+7)/8),f=0,a=0;a<i;a++){for(;c<n;)l<<=8,l|=d[f++],c+=8;c-=n,s.push((l>>c)*u),l&=(1<<c)-1}return s},getIR:function(e,t){var n=t.dict;n||=t;var r=[this.constructSampled,null,this.constructInterpolated,this.constructStiched,this.constructPostScript][n.get(`FunctionType`)];return r||H(`Unknown type of function`),r.call(this,t,n,e)},fromIR:function(e){switch(e[0]){case 0:return this.constructSampledFromIR(e);case 2:return this.constructInterpolatedFromIR(e);case 3:return this.constructStichedFromIR(e);default:return this.constructPostScriptFromIR(e)}},parse:function(e,t){var n=this.getIR(e,t);return this.fromIR(n)},constructSampled:function(e,t){function n(e){var t=e.length;e.length/2;for(var n=[],r=0,i=0;i<t;i+=2)n[r]=[e[i],e[i+1]],++r;return n}var r=t.get(`Domain`),i=t.get(`Range`);(!r||!i)&&H(`No domain or range`);var a=r.length/2,o=i.length/2;r=n(r),i=n(i);var s=t.get(`Size`),c=t.get(`BitsPerSample`),l=t.get(`Order`)||1;l!==1&&we(`No support for cubic spline interpolation: `+l);var u=t.get(`Encode`);if(!u){u=[];for(var d=0;d<a;++d)u.push(0),u.push(s[d]-1)}u=n(u);var f=t.get(`Decode`);f=f?n(f):i;var p=this.getSampleArray(s,o,c,e);return[0,a,r,u,f,p,s,o,2**c-1,i]},constructSampledFromIR:function(e){function t(e,t,n,r,i){return r+(e-t)*((i-r)/(n-t))}return function(n){var r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7];e[8];var u=e[9];r!=n.length&&H(`Incorrect number of arguments: `+r+` != `+n.length);for(var d=n,f=1<<r,p=new Float64Array(f),m=new Uint32Array(f),h=0;h<f;h++)p[h]=1;for(var g=l,_=1,v=0;v<r;++v){var y=i[v][0],b=i[v][1],x=t(Math.min(Math.max(d[v],y),b),y,b,a[v][0],a[v][1]),S=c[v];x=Math.min(Math.max(x,0),S-1);for(var C=x<S-1?Math.floor(x):x-1,w=C+1-x,T=x-C,E=C*g,D=E+g,h=0;h<f;h++)h&_?(p[h]*=T,m[h]+=D):(p[h]*=w,m[h]+=E);g*=S,_<<=1}for(var O=new Float64Array(l),h=0;h<l;++h){for(var k=0,v=0;v<f;v++)k+=s[m[v]+h]*p[v];k=t(k,0,1,o[h][0],o[h][1]),O[h]=Math.min(Math.max(k,u[h][0]),u[h][1])}return O}},constructInterpolated:function(e,t){var n=t.get(`C0`)||[0],r=t.get(`C1`)||[1],i=t.get(`N`);(!G(n)||!G(r))&&H(`Illegal dictionary for interpolated function`);for(var a=n.length,o=[],s=0;s<a;++s)o.push(r[s]-n[s]);return[2,n,o,i]},constructInterpolatedFromIR:function(e){var t=e[1],n=e[2],r=e[3],i=n.length;return function(e){for(var a=r==1?e[0]:e[0]**+r,o=[],s=0;s<i;++s)o.push(t[s]+a*n[s]);return o}},constructStiched:function(e,t,n){var r=t.get(`Domain`);r||H(`No domain`),r.length/2!=1&&H(`Bad domain for stiched function`);for(var i=t.get(`Functions`),a=[],o=0,s=i.length;o<s;++o)a.push(gt.getIR(n,n.fetchIfRef(i[o])));return[3,r,t.get(`Bounds`),t.get(`Encode`),a]},constructStichedFromIR:function(e){for(var t=e[1],n=e[2],r=e[3],i=e[4],a=[],o=0,s=i.length;o<s;o++)a.push(gt.fromIR(i[o]));return function(e){for(var i=function(e,t,n){return e>n?e=n:e<t&&(e=t),e}(e[0],t[0],t[1]),o=0,s=n.length;o<s&&!(i<n[o]);++o);var c=t[0];o>0&&(c=n[o-1]);var l=t[1];o<n.length&&(l=n[o]);var u=r[2*o],d=r[2*o+1],f=u+(i-c)*(d-u)/(l-c);return a[o]([f])}},constructPostScript:function(e,t,n){var r=t.get(`Domain`),i=t.get(`Range`);return r||H(`No domain.`),i||H(`No range.`),[4,r,i,new bt(new Ct(e)).parse()]},constructPostScriptFromIR:function(e){var t=e[1],n=e[2],r=e[3],i=n.length/2,a=new yt(r),o=new _t;return function(e){for(var r=[],s=0,c=t.length/2;s<c;++s)r.push(e[s]);var l=r.join(`_`);if(o.has(l))return o.get(l);var u=a.execute(r),d=[];for(s=i-1;s>=0;--s){var f=u.pop(),p=2*s;f<n[p]?f=n[p]:f>n[p+1]&&(f=n[p+1]),d[s]=f}return o.set(l,d),d}}}})(),_t=(function(){function e(){this.cache={},this.total=0}return e.prototype={has:function(e){return e in this.cache},get:function(e){return this.cache[e]},set:function(e,t){this.total<1024&&(this.cache[e]=t,this.total++)}},e})(),vt=(function(){function e(e){this.stack=e||[]}return e.prototype={push:function(e){this.stack.length>=100&&H(`PostScript function stack overflow.`),this.stack.push(e)},pop:function(){return this.stack.length<=0&&H(`PostScript function stack underflow.`),this.stack.pop()},copy:function(e){this.stack.length+e>=100&&H(`PostScript function stack overflow.`);for(var t=this.stack,n=t.length-e,r=e-1;r>=0;r--,n++)t.push(t[n])},index:function(e){this.push(this.stack[this.stack.length-e-1])},roll:function(e,t){for(var n=this.stack,r=n.length-e,i=n.length-1,a=r+(t-Math.floor(t/e)*e),o=r,s=i,c;o<s;o++,s--)c=n[o],n[o]=n[s],n[s]=c;for(o=r,s=a-1;o<s;o++,s--)c=n[o],n[o]=n[s],n[s]=c;for(o=a,s=i;o<s;o++,s--)c=n[o],n[o]=n[s],n[s]=c}},e})(),yt=(function(){function e(e,t){this.operators=e,this.operands=t}return e.prototype={execute:function(e){for(var t=new vt(e),n=0,r=this.operators,i=r.length,a,o,s;n<i;)if(a=r[n++],typeof a==`number`)t.push(a);else switch(a){case`jz`:s=t.pop(),o=t.pop(),o||(n=s);break;case`j`:o=t.pop(),n=o;break;case`abs`:o=t.pop(),t.push(Math.abs(o));break;case`add`:s=t.pop(),o=t.pop(),t.push(o+s);break;case`and`:s=t.pop(),o=t.pop(),Ge(o)&&Ge(s)?t.push(o&&s):t.push(o&s);break;case`atan`:o=t.pop(),t.push(Math.atan(o));break;case`bitshift`:s=t.pop(),o=t.pop(),o>0?t.push(o<<s):t.push(o>>s);break;case`ceiling`:o=t.pop(),t.push(Math.ceil(o));break;case`copy`:o=t.pop(),t.copy(o);break;case`cos`:o=t.pop(),t.push(Math.cos(o));break;case`cvi`:o=t.pop()|0,t.push(o);break;case`cvr`:break;case`div`:s=t.pop(),o=t.pop(),t.push(o/s);break;case`dup`:t.copy(1);break;case`eq`:s=t.pop(),o=t.pop(),t.push(o==s);break;case`exch`:t.roll(2,1);break;case`exp`:s=t.pop(),o=t.pop(),t.push(o**+s);break;case`false`:t.push(!1);break;case`floor`:o=t.pop(),t.push(Math.floor(o));break;case`ge`:s=t.pop(),o=t.pop(),t.push(o>=s);break;case`gt`:s=t.pop(),o=t.pop(),t.push(o>s);break;case`idiv`:s=t.pop(),o=t.pop(),t.push(o/s|0);break;case`index`:o=t.pop(),t.index(o);break;case`le`:s=t.pop(),o=t.pop(),t.push(o<=s);break;case`ln`:o=t.pop(),t.push(Math.log(o));break;case`log`:o=t.pop(),t.push(Math.log(o)/Math.LN10);break;case`lt`:s=t.pop(),o=t.pop(),t.push(o<s);break;case`mod`:s=t.pop(),o=t.pop(),t.push(o%s);break;case`mul`:s=t.pop(),o=t.pop(),t.push(o*s);break;case`ne`:s=t.pop(),o=t.pop(),t.push(o!=s);break;case`neg`:o=t.pop(),t.push(-s);break;case`not`:o=t.pop(),Ge(o)&&Ge(s)?t.push(o&&s):t.push(o&s);break;case`or`:s=t.pop(),o=t.pop(),Ge(o)&&Ge(s)?t.push(o||s):t.push(o|s);break;case`pop`:t.pop();break;case`roll`:s=t.pop(),o=t.pop(),t.roll(o,s);break;case`round`:o=t.pop(),t.push(Math.round(o));break;case`sin`:o=t.pop(),t.push(Math.sin(o));break;case`sqrt`:o=t.pop(),t.push(Math.sqrt(o));break;case`sub`:s=t.pop(),o=t.pop(),t.push(o-s);break;case`true`:t.push(!0);break;case`truncate`:o=t.pop(),o=o<0?Math.ceil(o):Math.floor(o),t.push(o);break;case`xor`:s=t.pop(),o=t.pop(),Ge(o)&&Ge(s)?t.push(o!=s):t.push(o^s);break;default:H(`Unknown operator `+a)}return t.stack}},e})(),bt=(function(){function e(e){this.lexer=e,this.operators=[],this.token=null,this.prev=null}return e.prototype={nextToken:function(){this.prev=this.token,this.token=this.lexer.getToken()},accept:function(e){return this.token.type==e&&(this.nextToken(),!0)},expect:function(e){if(this.accept(e))return!0;H(`Unexpected symbol: found `+this.token.type+` expected `+e+`.`)},parse:function(){return this.nextToken(),this.expect(xt.LBRACE),this.parseBlock(),this.expect(xt.RBRACE),this.operators},parseBlock:function(){for(;;)if(this.accept(xt.NUMBER))this.operators.push(this.prev.value);else if(this.accept(xt.OPERATOR))this.operators.push(this.prev.value);else if(this.accept(xt.LBRACE))this.parseCondition();else return},parseCondition:function(){var e=this.operators.length;if(this.operators.push(null,null),this.parseBlock(),this.expect(xt.RBRACE),this.accept(xt.IF))this.operators[e]=this.operators.length,this.operators[e+1]=`jz`;else if(this.accept(xt.LBRACE)){var t=this.operators.length;this.operators.push(null,null);var n=this.operators.length;this.parseBlock(),this.expect(xt.RBRACE),this.expect(xt.IFELSE),this.operators[t]=this.operators.length,this.operators[t+1]=`j`,this.operators[e]=n,this.operators[e+1]=`jz`}else H(`PS Function: error parsing conditional.`)}},e})(),xt={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5},St=(function(){function e(e,t){this.type=e,this.value=t}var t={};return e.getOperator=function(n){return t[n]||(t[n]=new e(xt.OPERATOR,n))},e.LBRACE=new e(xt.LBRACE,`{`),e.RBRACE=new e(xt.RBRACE,`}`),e.IF=new e(xt.IF,`IF`),e.IFELSE=new e(xt.IFELSE,`IFELSE`),e})(),Ct=(function(){function e(e){this.stream=e,this.nextChar()}return e.prototype={nextChar:function(){return this.currentChar=this.stream.getByte()},getToken:function(){for(var e=!1,t=this.currentChar;;){if(t<0)return nr;if(e)(t===10||t===13)&&(e=!1);else if(t==37)e=!0;else if(!ar.isSpace(t))break;t=this.nextChar()}switch(t|0){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new St(xt.NUMBER,this.getNumber());case 123:return this.nextChar(),St.LBRACE;case 125:return this.nextChar(),St.RBRACE}for(var n=String.fromCharCode(t);(t=this.nextChar())>=0&&(t>=65&&t<=90||t>=97&&t<=122);)n+=String.fromCharCode(t);switch(n.toLowerCase()){case`if`:return St.IF;case`ifelse`:return St.IFELSE;default:return St.getOperator(n)}},getNumber:function(){for(var e=this.currentChar,t=String.fromCharCode(e);(e=this.nextChar())>=0&&(e>=48&&e<=57||e===45||e===46);)t+=String.fromCharCode(e);var n=parseFloat(t);return isNaN(n)&&H(`Invalid floating point number: `+n),n}},e})(),wt=(function(){function e(e,t,n){var r=U.getAxialAlignedBoundingBox(t,n),i=r[0],a=r[1],o=r[2],s=r[3];if(i===o||a===s)return[1,0,0,1,e[0],e[1]];var c=(e[2]-e[0])/(o-i),l=(e[3]-e[1])/(s-a);return[c,0,0,l,e[0]-i*c,e[1]-a*l]}function t(e){var t=e.get(`AP`);if(W(t)){var n,r=t.get(`N`);if(W(r)){var i=e.get(`AS`);i&&r.has(i.name)&&(n=r.get(i.name))}else n=r;return n}}function n(e){if(e.data)this.data=e.data;else{var n=e.dict,r=this.data={};r.subtype=n.get(`Subtype`).name,r.annotationFlags=n.get(`F`),this.getAndSetRectangle(n),r.rect=this.rectangle;var i=n.get(`C`);if(r.color=G(i)&&i.length===3?i:[0,0,0],n.has(`BS`)){var a=n.get(`BS`);r.borderWidth=a.has(`W`)?a.get(`W`):1}else r.borderWidth=(n.get(`Border`)||[0,0,1])[2]||0;this.appearance=t(n),r.hasAppearance=!!this.appearance}}return n.prototype={setRectangle:function(e){this.rectangle=G(e)&&e.length===4?U.normalizeRect(e):[0,0,0,0]},getAndSetRectangle:function(e){var t=e.get(`Rect`),n=e.xref;if(G(t)&&t.length===4){for(var r=0;r<4;r++)t[r]=typeof t[r]==`object`?n.fetchIfRef(t[r]):t[r];this.setRectangle(t)}else this.rectangle=[0,0,0,0]},getData:function(){return this.data},hasHtml:function(){return!1},getHtmlElement:function(e){throw new Fe(`getHtmlElement() should be implemented in subclass`)},getEmptyContainer:function(e,t){Te(!me,`getEmptyContainer() should be called from main thread`),t||=this.data.rect;var n=document.createElement(e);return n.style.width=Math.ceil(t[2]-t[0])+`px`,n.style.height=Math.ceil(t[3]-t[1])+`px`,n},isViewable:function(){var e=this.data;return!(!e||e.annotationFlags&&e.annotationFlags&34||!e.rect)},loadResources:function(e){var t=new K;return this.appearance.dict.getAsync(`Resources`).then(function(n){n?new Bt(n.map,e,n.xref).load().then(function(){t.resolve(n)}):t.resolve()}.bind(this)),t},getOperatorList:function(t){var n=new K;if(!this.appearance)return n.resolve(new Zt),n;var r=this.data,i=this.appearance.dict,a=this.loadResources([`ExtGState`,`ColorSpace`,`Pattern`,`Shading`,`XObject`,`Font`]),o=i.get(`BBox`)||[0,0,1,1],s=i.get(`Matrix`)||[1,0,0,1,0,0],c=e(r.rect,o,s);return r.border,a.then(function(e){var i=new Zt;i.addOp(z.beginAnnotation,[r.rect,c,s]),t.getOperatorList(this.appearance,e,i),i.addOp(z.endAnnotation,[]),n.resolve(i)}.bind(this)),n}},n.getConstructor=function(e,t){if(e)return e===`Link`?Ot:e===`Text`?Dt:e===`Widget`?t?t===`Tx`?Et:Tt:void 0:n},n.fromData=function(e){var t=e.subtype,r=e.fieldType,i=n.getConstructor(t,r);if(i)return new i({data:e})},n.fromRef=function(e,t){var r=e.fetchIfRef(t);if(W(r)){var i=r.get(`Subtype`);if(i=Ye(i)?i.name:``,i){var a=U.getInheritableProperty(r,`FT`);a=Ye(a)?a.name:``;var o=n.getConstructor(i,a);if(o){var s=new o({dict:r,ref:t});if(s.isViewable())return s;we(`unimplemented/notViewable annotation type: `+i)}}}},n.appendToOperatorList=function(e,t,n,r){function i(e){a.reject(e)}for(var a=new K,o=[],s=0,c=e.length;s<c;++s)o.push(e[s].getOperatorList(r));return K.all(o).then(function(e){t.addOp(z.beginAnnotations,[]);for(var n=0,r=e.length;n<r;++n){var i=e[n];t.addOpList(i)}t.addOp(z.endAnnotations,[]),a.resolve()},i),a},n})();R.Annotation=wt;var Tt=(function(){function e(e){if(wt.call(this,e),!e.data){var t=e.dict,n=this.data,r=U.getInheritableProperty(t,`V`)||``;n.fieldValue=He((r.name?r.name:r)||``),n.alternativeText=He(t.get(`TU`)||``),n.alternativeID=He(t.get(`TM`)||``),n.defaultAppearance=U.getInheritableProperty(t,`DA`)||``;var i=U.getInheritableProperty(t,`FT`);n.fieldType=Ye(i)?i.name:``,n.fieldFlags=U.getInheritableProperty(t,`Ff`)||0,this.fieldResources=U.getInheritableProperty(t,`DR`)||new Nt;var a=He(U.getInheritableProperty(t,`T`)||``);a=a.replace(/[.\s\W]+/g,`_`),n.fullName=a.replace(/^[\s_,:.;\/\\]+/,``),g.processAnnotation(t,n)}}var t=wt.prototype;return U.inherit(e,wt,{isViewable:function(){return t.isViewable.call(this)}}),e})(),Et=(function(){function e(e){Tt.call(this,e),!e.data&&(this.data.textAlignment=U.getInheritableProperty(e.dict,`Q`))}function t(e,t,n){var r=e.style;if(r.fontSize=t.fontSize+`px`,r.direction=t.fontDirection<0?`rtl`:`ltr`,n){r.fontWeight=n.black?n.bold?`bolder`:`bold`:n.bold?`bold`:`normal`,r.fontStyle=n.italic?`italic`:`normal`;var i=n.loadedName;r.fontFamily=(i?`"`+i+`", `:``)+(n.fallbackName||`Helvetica, sans-serif`)}}return Tt.prototype,U.inherit(e,Tt,{hasHtml:function(){return!this.data.hasAppearance&&!!this.data.fieldValue},getHtmlElement:function(e){Te(!me,`getHtmlElement() shall be called from main thread`);var n=this.data,r=this.getEmptyContainer(`div`);r.style.display=`table`;var i=document.createElement(`div`);i.textContent=n.fieldValue;var a=n.textAlignment;return i.style.textAlign=[`left`,`center`,`right`][a],i.style.verticalAlign=`middle`,i.style.display=`table-cell`,t(i,n,n.fontRefName?e.getData(n.fontRefName):null),r.appendChild(i),r},getOperatorList:function(e){if(this.appearance)return wt.prototype.getOperatorList.call(this,e);var t=new K,n=new Zt,r=this.data,i=r.defaultAppearance;if(!i)return t.resolve(n),t;var a=new sr(ze(i));e.getOperatorList(a,this.fieldResources,n);var o=n.fnArray,s=n.argsArray,c=[];r.rgb=[0,0,0];for(var l=0,u=c.length;l<u;++l){var d=o[l],f=s[l];if(d===z.setFont){r.fontRefName=f[0];var p=f[1];p<0?(r.fontDirection=-1,r.fontSize=-p):(r.fontDirection=1,r.fontSize=p)}else if(d===z.setFillRGBColor)r.rgb=f;else if(d===z.setFillGray){var m=f[0]*255;r.rgb=[m,m,m]}}return t.resolve(n),t}}),e})(),Dt=(function(){function e(e){if(wt.call(this,e),!e.data){var t=e.dict,n=this.data,r=t.get(`Contents`),i=t.get(`T`);n.content=He(r||``),n.title=He(i||``),n.name=t.has(`Name`)?t.get(`Name`).name:`Note`}}return U.inherit(e,wt,{getOperatorList:function(e){var t=new K;return t.resolve(new Zt),t},hasHtml:function(){return!0},getHtmlElement:function(e){Te(!me,`getHtmlElement() shall be called from main thread`);var t=this.data,n=t.rect;n[3]-n[1]<10&&(n[3]=n[1]+10),n[2]-n[0]<10&&(n[2]=n[0]+(n[3]-n[1]));var r=this.getEmptyContainer(`section`,n);r.className=`annotText`;var i=document.createElement(`img`);i.style.height=r.style.height;var a=t.name;i.src=R.imageResourcesPath+`annotation-`+a.toLowerCase()+`.svg`,i.alt=`[{{type}} Annotation]`,i.dataset.l10nId=`text_annotation_type`,i.dataset.l10nArgs=JSON.stringify({type:a});var o=document.createElement(`div`);o.setAttribute(`hidden`,!0);var s=document.createElement(`h1`),c=document.createElement(`p`);if(o.style.left=Math.floor(n[2]-n[0])+`px`,o.style.top=`0px`,s.textContent=t.title,!t.content&&!t.title)o.setAttribute(`hidden`,!0);else{for(var l=document.createElement(`span`),u=t.content.split(/(?:\r\n?|\n)/),d=0,f=u.length;d<f;++d){var p=u[d];l.appendChild(document.createTextNode(p)),d<f-1&&l.appendChild(document.createElement(`br`))}c.appendChild(l);var m=function(){r.style.zIndex+=1,o.removeAttribute(`hidden`)},h=function(e){(e.toElement||e.relatedTarget)&&(--r.style.zIndex,o.setAttribute(`hidden`,!0))};o.addEventListener(`mouseover`,m,!1),o.addEventListener(`mouseout`,h,!1),i.addEventListener(`mouseover`,m,!1),i.addEventListener(`mouseout`,h,!1)}return o.appendChild(s),o.appendChild(c),r.appendChild(i),r.appendChild(o),r}}),e})(),Ot=(function(){function e(e){if(wt.call(this,e),!e.data){var n=e.dict,r=this.data,i=n.get(`A`);if(i){var a=i.get(`S`).name;if(a===`URI`){var o=t(i.get(`URI`));De(o,!1)||(o=``),r.url=o}else if(a===`GoTo`)r.dest=i.get(`D`);else if(a===`GoToR`){var s=i.get(`F`);W(s)&&(o=s.get(`F`)||``),De(o,!1)||(o=``),r.url=o,r.dest=i.get(`D`)}else a===`Named`?r.action=i.get(`N`).name:we(`unrecognized link type: `+a)}else if(n.has(`Dest`)){var c=n.get(`Dest`);r.dest=Ye(c)?c.name:c}}}function t(e){return e&&e.indexOf(`www.`)===0?`http://`+e:e}return U.inherit(e,wt,{hasOperatorList:function(){return!1},hasHtml:function(){return!0},getHtmlElement:function(e){var t=this.data.rect,n=document.createElement(`a`),r=this.data.borderWidth;n.style.borderWidth=r+`px`;for(var i=this.data.color,a=[],o=0;o<3;++o)a[o]=Math.round(i[o]*255);n.style.borderColor=U.makeCssRgb(a),n.style.borderStyle=`solid`;var s=t[2]-t[0]-2*r,c=t[3]-t[1]-2*r;return n.style.width=s+`px`,n.style.height=c+`px`,n.href=this.data.url||``,n}}),e})(),kt=(function(){function e(e,t,n,r,i,a){this.pdfManager=e,this.pageIndex=n,this.pageDict=r,this.xref=t,this.ref=i,this.fontCache=a,this.idCounters={obj:0},this.resourcesPromise=null}return e.prototype={getPageProp:function(e){return this.pageDict.get(e)},inheritPageProp:function(e){for(var t=this.pageDict,n=t.get(e);n===void 0&&(t=t.get(`Parent`),t);)n=t.get(e);return n},get content(){return this.getPageProp(`Contents`)},get resources(){return ke(this,`resources`,this.inheritPageProp(`Resources`))},get mediaBox(){var e=this.inheritPageProp(`MediaBox`);return(!G(e)||e.length!==4)&&(e=[0,0,612,792]),ke(this,`mediaBox`,e)},get view(){var e=this.mediaBox,t=this.inheritPageProp(`CropBox`);return!G(t)||t.length!==4||(t=U.intersect(t,e),!t)?ke(this,`view`,e):ke(this,`view`,t)},get annotationRefs(){return ke(this,`annotationRefs`,this.inheritPageProp(`Annots`))},get rotate(){var e=this.inheritPageProp(`Rotate`)||0;return e%90==0?e>=360?e%=360:e<0&&(e=(e%360+360)%360):e=0,ke(this,`rotate`,e)},getContentStream:function(){var e=this.content,t;if(G(e)){var n=this.xref,r,i=e.length,a=[];for(r=0;r<i;++r)a.push(n.fetchIfRef(e[r]));t=new lr(a)}else t=Ze(e)?e:new xr;return t},loadResources:function(e){this.resourcesPromise||=this.pdfManager.ensure(this,`resources`);var t=new K;return this.resources?this.resourcesPromise.then(function(){new Bt(this.resources.map,e,this.xref).load().then(function(){t.resolve()})}.bind(this)):t.resolve(),t},getOperatorList:function(e){var t=new K;function n(e){t.reject(e)}var r=new K,i=this.pdfManager,a=i.ensure(this,`getContentStream`,[]),o=this.loadResources([`ExtGState`,`ColorSpace`,`Pattern`,`Shading`,`XObject`,`Font`]),s=new Xt(i,this.xref,e,this.pageIndex,`p`+this.pageIndex+`_`,this.idCounters,this.fontCache);K.all([a,o]).then(function(t){var i=t[0];try{var a=new Zt(e,this.pageIndex);s.getOperatorList(i,this.resources,a),r.resolve(a),e.send(`StartRenderPage`,{transparency:s.hasBlendModes(this.resources),pageIndex:this.pageIndex})}catch(e){n(e)}}.bind(this),n);var c=i.ensure(this,`annotations`);return K.all([r,c]).then(function(e){var r=e[0],a=e[1];if(a.length===0)return r.flush(!0),t.resolve(r),t;wt.appendToOperatorList(a,r,i,s).then(function(){r.flush(!0),t.resolve(r)},n)},n),t},extractTextContent:function(){var e={on:function(){},send:function(){}},t=this,n=new K,r=this.pdfManager,i=r.ensure(this,`getContentStream`,[]),a=this.loadResources([`ExtGState`,`XObject`,`Font`]);return K.all([i,a]).then(function(i){var a=i[0],o=new Xt(r,t.xref,e,t.pageIndex,`p`+t.pageIndex+`_`,t.idCounters,t.fontCache).getTextContent(a,t.resources);n.resolve(o)}),n},getAnnotationsData:function(){for(var e=this.annotations,t=[],n=0,r=e.length;n<r;++n)t.push(e[n].getData());return t},get annotations(){for(var e=[],t=this.annotationRefs||[],n=0,r=t.length;n<r;++n){var i=t[n],a=wt.fromRef(this.xref,i);a&&e.push(a)}return ke(this,`annotations`,e)}},e})(),At=(function(){function e(e,n,r){Ze(n)?t.call(this,e,n,r):Qe(n)?t.call(this,e,new sr(n),r):H(`PDFDocument: Unknown argument type`)}function t(e,t,n){Oe(t.length>0,`stream must have data`),this.pdfManager=e,this.stream=t;var r=new Rt(this.stream,n,e);this.xref=r}function n(e,t,n,r){var i=e.pos,a=e.end,o=``;i+n>a&&(n=a-i);for(var s=0;s<n;++s)o+=String.fromCharCode(e.getByte());e.pos=i;var c=r?o.lastIndexOf(t):o.indexOf(t);return c!=-1&&(e.pos+=c,!0)}var r={get entries(){return ke(this,`entries`,{Title:Je,Author:Je,Subject:Je,Keywords:Je,Creator:Je,Producer:Je,CreationDate:Je,ModDate:Je,Trapped:Ye})}};return e.prototype={parse:function(e){try{if(this.setup(e),this.acroForm=this.catalog.catDict.get(`AcroForm`),this.acroForm){this.xfa=this.acroForm.get(`XFA`);var t=this.acroForm.get(`Fields`);(!t||!G(t)||t.length===0)&&!this.xfa&&(this.acroForm=null)}}catch(e){H(e),this.acroForm=null}},get linearization(){var e=this.stream.length,t=!1;if(e)try{t=new or(this.stream),t.length!=e&&(t=!1)}catch(e){if(e instanceof Ie)throw e;B(`The linearization data is not available or unreadable PDF data is found`),t=!1}return ke(this,`linearization`,t)},get startXRef(){var e=this.stream,t=0;if(this.linearization)e.reset(),n(e,`endobj`,1024)&&(t=e.pos+6);else{for(var r=1024,i=!1,a=e.end;!i&&a>0;)a-=r-9,a<0&&(a=0),e.pos=a,i=n(e,`startxref`,r,!0);if(i){e.skip(9);var o;do o=e.getByte();while(ar.isSpace(o));for(var s=``;o>=32&&o<=57;)s+=String.fromCharCode(o),o=e.getByte();t=parseInt(s,10),isNaN(t)&&(t=0)}}return ke(this,`startXRef`,t)},get mainXRefEntriesOffset(){var e=0,t=this.linearization;return t&&(e=t.mainXRefEntriesOffset),ke(this,`mainXRefEntriesOffset`,e)},checkHeader:function(){var e=this.stream;if(e.reset(),n(e,`%PDF-`,1024)){e.moveStart();for(var t=12,r=``,i;(i=e.getByte())>32&&!(r.length>=t);)r+=String.fromCharCode(i);this.pdfFormatVersion=r.substring(5)}},parseStartXRef:function(){var e=this.startXRef;this.xref.setStartXRef(e)},setup:function(e){this.xref.parse(e),this.catalog=new Lt(this.pdfManager,this.xref)},get numPages(){var e=this.linearization,t=e?e.numPages:this.catalog.numPages;return ke(this,`numPages`,t)},get documentInfo(){var e={PDFFormatVersion:this.pdfFormatVersion,IsAcroFormPresent:!!this.acroForm,IsXFAPresent:!!this.xfa},t;try{t=this.xref.trailer.get(`Info`)}catch{B(`The document information dictionary is invalid.`)}if(t){var n=r.entries;for(var i in n)if(t.has(i)){var a=t.get(i);n[i](a)?e[i]=typeof a==`string`?He(a):a:B(`Bad value in document info for "`+i+`"`)}}return ke(this,`documentInfo`,e)},get fingerprint(){var e=this.xref,t,n=``;t=e.trailer.has(`ID`)?ze(e.trailer.get(`ID`)[0]):Gt(this.stream.bytes.subarray(0,100),0,100);for(var r=0,i=t.length;r<i;r++)n+=t[r].toString(16);return ke(this,`fingerprint`,n)},getPage:function(e){return this.catalog.getPage(e)},cleanup:function(){return this.catalog.cleanup()}},e})(),jt=(function(){function e(e){this.name=e}return e.prototype={},e})(),Mt=(function(){function e(e){this.cmd=e}e.prototype={};var t={};return e.get=function(n){return t[n]||(t[n]=new e(n))},e})(),Nt=(function(){var e=function(){return e};function t(t){this.map=Object.create(null),this.xref=t,this.__nonSerializable__=e}return t.prototype={assignXref:function(e){this.xref=e},get:function(e,t,n){var r,i=this.xref;return(r=this.map[e])!==void 0||e in this.map||t===void 0||(r=this.map[t])!==void 0||t in this.map||n===void 0||(r=this.map[n]||null),i?i.fetchIfRef(r):r},getAsync:function(e,t,n){var r,i,a=this.xref;return typeof(r=this.map[e])!==void 0||e in this.map||typeof(r=this.map[t])!==void 0||t in this.map||(r=this.map[n]||null),a?a.fetchIfRefAsync(r):(i=new K,i.resolve(r),i)},getRaw:function(e){return this.map[e]},getAll:function(){var e={};for(var n in this.map){var r=this.get(n);e[n]=r instanceof t?r.getAll():r}return e},set:function(e,t){this.map[e]=t},has:function(e){return e in this.map},forEach:function(e){for(var t in this.map)e(t,this.get(t))}},t})(),Pt=(function(){function e(e,t){this.num=e,this.gen=t}return e.prototype={},e})(),Ft=(function(){function e(){this.dict={}}return e.prototype={has:function(e){return`R`+e.num+`.`+e.gen in this.dict},put:function(e){this.dict[`R`+e.num+`.`+e.gen]=!0},remove:function(e){delete this.dict[`R`+e.num+`.`+e.gen]}},e})(),It=(function(){function e(){this.dict=Object.create(null)}return e.prototype={get:function(e){return this.dict[`R`+e.num+`.`+e.gen]},has:function(e){return e?`R`+e.num+`.`+e.gen in this.dict:!1},put:function(e,t){this.dict[`R`+e.num+`.`+e.gen]=t},forEach:function(e,t){for(var n in this.dict)e.call(t,this.dict[n])},clear:function(){this.dict=Object.create(null)}},e})(),Lt=(function(){function e(e,t){this.pdfManager=e,this.xref=t,this.catDict=t.getCatalogObj(),this.fontCache=new It,Oe(W(this.catDict),`catalog object is not a dictionary`),this.pagePromises=[]}return e.prototype={get metadata(){var e=this.catDict.getRaw(`Metadata`);if(!$e(e))return ke(this,`metadata`,null);var t=this.xref.encrypt?this.xref.encrypt.encryptMetadata:!1,n=this.xref.fetch(e,!t),r;if(n&&W(n.dict)){var i=n.dict.get(`Type`),a=n.dict.get(`Subtype`);if(Ye(i)&&Ye(a)&&i.name===`Metadata`&&a.name===`XML`)try{r=Ue(Re(n.getBytes()))}catch{B(`Skipping invalid metadata.`)}}return ke(this,`metadata`,r)},get toplevelPagesDict(){var e=this.catDict.get(`Pages`);return Oe(W(e),`invalid top-level pages dictionary`),ke(this,`toplevelPagesDict`,e)},get documentOutline(){var e=null;try{e=this.readDocumentOutline()}catch(e){if(e instanceof Ie)throw e;V(`Unable to read document outline`)}return ke(this,`documentOutline`,e)},readDocumentOutline:function(){var e=this.xref,t=this.catDict.get(`Outlines`),n={items:[]};if(W(t)){t=t.getRaw(`First`);var r=new Ft;if($e(t)){var i=[{obj:t,parent:n}];for(r.put(t);i.length>0;){var a=i.shift(),o=e.fetchIfRef(a.obj);if(o!==null){o.has(`Title`)||H(`Invalid outline item`);var s=o.get(`A`);s?s=s.get(`D`):o.has(`Dest`)&&(s=o.getRaw(`Dest`),Ye(s)&&(s=s.name));var c=o.get(`Title`),l={dest:s,title:He(c),color:o.get(`C`)||[0,0,0],count:o.get(`Count`),bold:!!(o.get(`F`)&2),italic:!!(o.get(`F`)&1),items:[]};a.parent.items.push(l),t=o.getRaw(`First`),$e(t)&&!r.has(t)&&(i.push({obj:t,parent:l}),r.put(t)),t=o.getRaw(`Next`),$e(t)&&!r.has(t)&&(i.push({obj:t,parent:a.parent}),r.put(t))}}}}return n.items.length>0?n.items:null},get numPages(){var e=this.toplevelPagesDict.get(`Count`);return Oe(Ke(e),`page count in top level pages object is not an integer`),ke(this,`num`,e)},get destinations(){function e(e){return W(e)?e.get(`D`):e}var t=this.xref,n={},r,i,a=this.catDict.get(`Names`);if(a?r=a.getRaw(`Dests`):this.catDict.has(`Dests`)&&(i=this.catDict.get(`Dests`)),i&&(a=i,a.forEach(function(t,r){r&&(n[t]=e(r))})),r){var o=new zt(r,t).getAll();for(var s in o)o.hasOwnProperty(s)&&(n[s]=e(o[s]))}return ke(this,`destinations`,n)},get javaScript(){var e=this.xref,t=this.catDict.get(`Names`),n=[];if(t&&t.has(`JavaScript`)){var r=new zt(t.getRaw(`JavaScript`),e).getAll();for(var i in r)if(r.hasOwnProperty(i)){var a=r[i];if(W(a)){var o=a.get(`S`);if(Ye(o)&&o.name===`JavaScript`){var s=a.get(`JS`);(Je(s)||Ze(s))&&(Ze(s)&&(s=Re(s.getBytes())),n.push(He(s)))}}}}return ke(this,`javaScript`,n)},cleanup:function(){this.fontCache.forEach(function(e){delete e.sent,delete e.translated}),this.fontCache.clear()},getPage:function(e){return e in this.pagePromises||(this.pagePromises[e]=this.getPageDict(e).then(function(t){var n=t[0],r=t[1];return new kt(this.pdfManager,this.xref,e,n,r,this.fontCache)}.bind(this))),this.pagePromises[e]},getPageDict:function(e){var t=new K,n=[this.catDict.getRaw(`Pages`)],r=0,i=this.xref;function a(){for(;n.length;){var o=n.pop();if($e(o)){i.fetchAsync(o).then(function(i){W(i,`Page`)||W(i)&&!i.has(`Kids`)?e===r?t.resolve([i,o]):(r++,a()):(n.push(i),a())}.bind(this),t.reject.bind(t));return}Te(W(o),`page dictionary kid reference points to wrong type of object`);var s=o.get(`Count`);if(r+s<=e)r+=s;else{var c=o.get(`Kids`);if(Te(G(c),`page dictionary kids object is not an array`),s===c.length)n=[c[e-r]],r=e;else for(var l=c.length-1;l>=0;l--)n.push(c[l])}}t.reject(`Page index `+e+` not found.`)}return a(),t},getPageIndex:function(e){var t=this.xref;function n(e){var n=0,r;return t.fetchAsync(e).then(function(e){return e?(r=e.getRaw(`Parent`),e.getAsync(`Parent`)):null}).then(function(e){return e?e.getAsync(`Kids`):null}).then(function(i){if(!i)return null;for(var a=[],o=!1,s=0;s<i.length;s++){var c=i[s];if(Te($e(c),`kids must be an ref`),c.num==e.num){o=!0;break}a.push(t.fetchAsync(c).then(function(e){if(e.has(`Count`)){var t=e.get(`Count`);n+=t}else n++}))}return o||H(`kid ref not found in parents kids`),K.all(a).then(function(){return[n,r]})})}var r=0;function i(e){return n(e).then(function(e){if(!e)return r;var t=e[0],n=e[1];return r+=t,i(n)})}return i(e)}},e})(),Rt=(function(){function e(e,t){this.stream=e,this.entries=[],this.xrefstms={},this.cache=[],this.password=t}return e.prototype={setStartXRef:function(e){this.startXRefQueue=[e]},parse:function(e){var t;e?(V(`Indexing all PDF objects`),t=this.indexObjects()):t=this.readXRef(),t.assignXref(this),this.trailer=t;var n=t.get(`Encrypt`);if(n){var r=t.get(`ID`),i=r&&r.length?r[0]:``;this.encrypt=new Yt(n,i,this.password)}(this.root=t.get(`Root`))||H(`Invalid root reference`)},processXRefTable:function(e){`tableState`in this||(this.tableState={entryNum:0,streamPos:e.lexer.stream.pos,parserBuf1:e.buf1,parserBuf2:e.buf2}),Xe(this.readXRefTable(e),`trailer`)||H(`Invalid XRef table: could not find trailer dictionary`);var t=e.getObj();return W(t)||H(`Invalid XRef table: could not parse trailer dictionary`),delete this.tableState,t},readXRefTable:function(e){var t=e.lexer.stream,n=this.tableState;t.pos=n.streamPos,e.buf1=n.parserBuf1,e.buf2=n.parserBuf2;for(var r;;){if(!(`firstEntryNum`in n)||!(`entryCount`in n)){if(Xe(r=e.getObj(),`trailer`))break;n.firstEntryNum=r,n.entryCount=e.getObj()}var i=n.firstEntryNum,a=n.entryCount;(!Ke(i)||!Ke(a))&&H(`Invalid XRef table: wrong types in subsection header`);for(var o=n.entryNum;o<a;o++){n.streamPos=t.pos,n.entryNum=o,n.parserBuf1=e.buf1,n.parserBuf2=e.buf2;var s={};s.offset=e.getObj(),s.gen=e.getObj();var c=e.getObj();Xe(c,`f`)?s.free=!0:Xe(c,`n`)&&(s.uncompressed=!0),(!Ke(s.offset)||!Ke(s.gen)||!(s.free||s.uncompressed))&&(console.log(s.offset,s.gen,s.free,s.uncompressed),H(`Invalid entry in XRef subsection: `+i+`, `+a)),this.entries[o+i]||(this.entries[o+i]=s)}n.entryNum=0,n.streamPos=t.pos,n.parserBuf1=e.buf1,n.parserBuf2=e.buf2,delete n.firstEntryNum,delete n.entryCount}return i===1&&this.entries[1]&&this.entries[1].free&&this.entries.shift(),this.entries[0]&&!this.entries[0].free&&H(`Invalid XRef table: unexpected first object`),r},processXRefStream:function(e){if(!(`streamState`in this)){var t=e.dict,n=t.get(`W`),r=t.get(`Index`);r||=[0,t.get(`Size`)],this.streamState={entryRanges:r,byteWidths:n,entryNum:0,streamPos:e.pos}}return this.readXRefStream(e),delete this.streamState,e.dict},readXRefStream:function(e){var t,n,r=this.streamState;e.pos=r.streamPos;for(var i=r.byteWidths,a=i[0],o=i[1],s=i[2],c=r.entryRanges;c.length>0;){var l=c[0],u=c[1];for((!Ke(l)||!Ke(u))&&H(`Invalid XRef range fields: `+l+`, `+u),(!Ke(a)||!Ke(o)||!Ke(s))&&H(`Invalid XRef entry fields length: `+l+`, `+u),t=r.entryNum;t<u;++t){r.entryNum=t,r.streamPos=e.pos;var d=0,f=0,p=0;for(n=0;n<a;++n)d=d<<8|e.getByte();for(a===0&&(d=1),n=0;n<o;++n)f=f<<8|e.getByte();for(n=0;n<s;++n)p=p<<8|e.getByte();var m={};switch(m.offset=f,m.gen=p,d){case 0:m.free=!0;break;case 1:m.uncompressed=!0;break;case 2:break;default:H(`Invalid XRef entry type: `+d)}this.entries[l+t]||(this.entries[l+t]=m)}r.entryNum=0,r.streamPos=e.pos,c.splice(0,2)}},indexObjects:function(){function e(e,t){for(var n=``,r=e[t];r!==13&&r!==10&&!(++t>=e.length);)n+=String.fromCharCode(r),r=e[t];return n}function t(e,t,n){for(var r=n.length,i=e.length,a=0;t<i;){for(var o=0;o<r&&e[t+o]==n[o];)++o;if(o>=r)break;t++,a++}return a}var n=new Uint8Array([116,114,97,105,108,101,114]),r=new Uint8Array([115,116,97,114,116,120,114,101,102]),i=new Uint8Array([101,110,100,111,98,106]),a=new Uint8Array([47,88,82,101,102]),o=this.stream;o.pos=0;for(var s=o.getBytes(),c=o.start,l=s.length,u=[],d=[];c<l;){var f=s[c];if(f===32||f===9||f===13||f===10)++c;else if(f===37)do{if(++c,c>=l)break;f=s[c]}while(f!==13&&f!==10);else{var p=e(s,c),m;if(p===`xref`)c+=t(s,c,n),u.push(c),c+=t(s,c,r);else if(m=/^(\d+)\s+(\d+)\s+obj\b/.exec(p)){this.entries[m[1]]={offset:c,gen:m[2]|0,uncompressed:!0};var h=t(s,c,i)+7,g=s.subarray(c,c+h),_=t(g,0,a);_<h&&g[_+5]<64&&(d.push(c),this.xrefstms[c]=1),c+=h}else c+=p.length+1}}for(var v=0,y=d.length;v<y;++v)this.startXRefQueue.push(d[v]),this.readXRef(!0);for(var b,v=0,y=u.length;v<y;++v){o.pos=u[v];var x=new ir(new ar(o),!0,null);if(Xe(x.getObj(),`trailer`)&&W(b=x.getObj())&&b.has(`ID`))return b}if(b)return b;throw new Ne(`Invalid PDF structure`)},readXRef:function(e){var t=this.stream;try{for(;this.startXRefQueue.length;){t.pos=this.startXRefQueue[0];var n=new ir(new ar(t),!0,null),r=n.getObj(),i;if(Xe(r,`xref`)){if(i=this.processXRefTable(n),this.topDict||=i,r=i.get(`XRefStm`),Ke(r)){var a=r;a in this.xrefstms||(this.xrefstms[a]=1,this.startXRefQueue.push(a))}}else Ke(r)?((!Ke(n.getObj())||!Xe(n.getObj(),`obj`)||!Ze(r=n.getObj()))&&H(`Invalid XRef stream`),i=this.processXRefStream(r),this.topDict||=i,i||H(`Failed to read XRef stream`)):H(`Invalid XRef stream header`);r=i.get(`Prev`),Ke(r)?this.startXRefQueue.push(r):$e(r)&&this.startXRefQueue.push(r.num),this.startXRefQueue.shift()}return this.topDict}catch(e){if(e instanceof Ie)throw e;Ce(`(while reading XRef): `+e),H(e)}if(!e)throw new Le},getEntry:function(e){var t=this.entries[e];return t===null||t.free||!t.offset?null:t},fetchIfRef:function(e){return $e(e)?this.fetch(e):e},fetch:function(e,t){Oe($e(e),`ref object is not a reference`);var n=e.num,r;if(n in this.cache)return r=this.cache[n],r instanceof sr?r.makeSubStream(r.start,r.length,r.dict):r;if(r=this.getEntry(n),r===null)return this.cache[n]=r;var i=e.gen,a,o;if(r.uncompressed){r.gen!=i&&H(`inconsistent generation in XRef`),a=this.stream.makeSubStream(r.offset),o=new ir(new ar(a),!0,this);var s=o.getObj(),c=o.getObj(),l=o.getObj();if((!Ke(s)||s!=n||!Ke(c)||c!=i||!Xe(l))&&H(`bad XRef entry`),!Xe(l,`obj`)){if(l.cmd.indexOf(`obj`)===0&&(n=parseInt(l.cmd.substring(3),10),!isNaN(n)))return n;H(`bad XRef entry`)}if(this.encrypt&&!t)try{r=o.getObj(this.encrypt.createCipherTransform(n,i))}catch{return this.fetch(e,!0)}else r=o.getObj();return Ze(r)||(this.cache[n]=r),r}var u=r.offset;a=this.fetch(new Pt(u,0)),Ze(a)||H(`bad ObjStm stream`);var d=a.dict.get(`First`),f=a.dict.get(`N`);(!Ke(d)||!Ke(f))&&H(`invalid first and n parameters for ObjStm stream`),o=new ir(new ar(a),!1,this),o.allowStreams=!0;var p,m=[],h=[];for(p=0;p<f;++p){n=o.getObj(),Ke(n)||H(`invalid object number in the ObjStm stream: `+n),h.push(n);var g=o.getObj();Ke(g)||H(`invalid object offset in the ObjStm stream: `+g)}for(p=0;p<f;++p){m.push(o.getObj()),n=h[p];var _=this.entries[n];_&&_.offset===u&&_.gen===p&&(this.cache[n]=m[p])}return r=m[r.gen],r===void 0&&H(`bad XRef entry for compressed object`),r},fetchIfRefAsync:function(e){if(!$e(e)){var t=new K;return t.resolve(e),t}return this.fetchAsync(e)},fetchAsync:function(e,t){var n=new K,r=function(n){try{n.resolve(this.fetch(e,t))}catch(e){if(e instanceof Ie){this.stream.manager.requestRange(e.begin,e.end,r);return}n.reject(e)}}.bind(this,n);return r(),n},getCatalogObj:function(){return this.root}},e})(),zt=(function(){function e(e,t){this.root=e,this.xref=t}return e.prototype={getAll:function(){var e={};if(!this.root)return e;var t=this.xref,n=new Ft;n.put(this.root);for(var r=[this.root];r.length>0;){var i,a,o=t.fetchIfRef(r.shift());if(W(o)){if(o.has(`Kids`)){var s=o.get(`Kids`);for(i=0,a=s.length;i<a;i++){var c=s[i];n.has(c)&&H(`invalid destinations`),r.push(c),n.put(c)}}else{var l=o.get(`Names`);if(l)for(i=0,a=l.length;i<a;i+=2)e[l[i]]=t.fetchIfRef(l[i+1])}}}return e}},e})(),Bt=(function(){function e(e){return $e(e)||W(e)||G(e)||Ze(e)}function t(t,n){if(W(t)||Ze(t)){var r=W(t)?t.map:t.dict.map;for(var i in r){var a=r[i];e(a)&&n.push(a)}}else if(G(t))for(var o=0,s=t.length;o<s;o++){var a=t[o];e(a)&&n.push(a)}}function n(e,t,n){this.obj=e,this.keys=t,this.xref=n,this.refSet=null}return n.prototype={load:function(){var e=this.keys;if(this.promise=new K,!(this.xref.stream instanceof kr)||this.xref.stream.getMissingChunks().length===0)return this.promise.resolve(),this.promise;this.refSet=new Ft;for(var t=[],n=0;n<e.length;n++)t.push(this.obj[e[n]]);return this.walk(t),this.promise},walk:function(e){for(var n=[],r=[];e.length;){var i=e.pop();if($e(i)){if(this.refSet.has(i))continue;try{var a=i;this.refSet.put(a),i=this.xref.fetch(i)}catch(e){if(!(e instanceof Ie))throw e;n.push(i),r.push({begin:e.begin,end:e.end})}}if(i&&i.getBaseStreams){for(var o=i.getBaseStreams(),s=!1,c=0;c<o.length;c++){var l=o[c];l.getMissingChunks&&l.getMissingChunks().length&&(s=!0,r.push({begin:l.start,end:l.end}))}s&&n.push(i)}t(i,e)}r.length?this.xref.stream.manager.requestRanges(r,function(){e=n;for(var t=0;t<n.length;t++){var r=n[t];$e(r)&&this.refSet.remove(r)}this.walk(e)}.bind(this)):(this.refSet=null,this.promise.resolve())}},n})(),Vt=`.notdef,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quoteright,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,quoteleft,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,exclamdown,cent,sterling,fraction,yen,florin,section,currency,quotesingle,quotedblleft,guillemotleft,guilsinglleft,guilsinglright,fi,fl,endash,dagger,daggerdbl,periodcentered,paragraph,bullet,quotesinglbase,quotedblbase,quotedblright,guillemotright,ellipsis,perthousand,questiondown,grave,acute,circumflex,tilde,macron,breve,dotaccent,dieresis,ring,cedilla,hungarumlaut,ogonek,caron,emdash,AE,ordfeminine,Lslash,Oslash,OE,ordmasculine,ae,dotlessi,lslash,oslash,oe,germandbls,onesuperior,logicalnot,mu,trademark,Eth,onehalf,plusminus,Thorn,onequarter,divide,brokenbar,degree,thorn,threequarters,twosuperior,registered,minus,eth,multiply,threesuperior,copyright,Aacute,Acircumflex,Adieresis,Agrave,Aring,Atilde,Ccedilla,Eacute,Ecircumflex,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Ntilde,Oacute,Ocircumflex,Odieresis,Ograve,Otilde,Scaron,Uacute,Ucircumflex,Udieresis,Ugrave,Yacute,Ydieresis,Zcaron,aacute,acircumflex,adieresis,agrave,aring,atilde,ccedilla,eacute,ecircumflex,edieresis,egrave,iacute,icircumflex,idieresis,igrave,ntilde,oacute,ocircumflex,odieresis,ograve,otilde,scaron,uacute,ucircumflex,udieresis,ugrave,yacute,ydieresis,zcaron`.split(`,`),Ht=`.notdef,space,exclamsmall,Hungarumlautsmall,dollaroldstyle,dollarsuperior,ampersandsmall,Acutesmall,parenleftsuperior,parenrightsuperior,twodotenleader,onedotenleader,comma,hyphen,period,fraction,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,colon,semicolon,commasuperior,threequartersemdash,periodsuperior,questionsmall,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,fi,fl,ffi,ffl,parenleftinferior,parenrightinferior,Circumflexsmall,hyphensuperior,Gravesmall,Asmall,Bsmall,Csmall,Dsmall,Esmall,Fsmall,Gsmall,Hsmall,Ismall,Jsmall,Ksmall,Lsmall,Msmall,Nsmall,Osmall,Psmall,Qsmall,Rsmall,Ssmall,Tsmall,Usmall,Vsmall,Wsmall,Xsmall,Ysmall,Zsmall,colonmonetary,onefitted,rupiah,Tildesmall,exclamdownsmall,centoldstyle,Lslashsmall,Scaronsmall,Zcaronsmall,Dieresissmall,Brevesmall,Caronsmall,Dotaccentsmall,Macronsmall,figuredash,hypheninferior,Ogoneksmall,Ringsmall,Cedillasmall,onequarter,onehalf,threequarters,questiondownsmall,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,onesuperior,twosuperior,threesuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior,Agravesmall,Aacutesmall,Acircumflexsmall,Atildesmall,Adieresissmall,Aringsmall,AEsmall,Ccedillasmall,Egravesmall,Eacutesmall,Ecircumflexsmall,Edieresissmall,Igravesmall,Iacutesmall,Icircumflexsmall,Idieresissmall,Ethsmall,Ntildesmall,Ogravesmall,Oacutesmall,Ocircumflexsmall,Otildesmall,Odieresissmall,OEsmall,Oslashsmall,Ugravesmall,Uacutesmall,Ucircumflexsmall,Udieresissmall,Yacutesmall,Thornsmall,Ydieresissmall`.split(`,`),Ut=`.notdef,space,dollaroldstyle,dollarsuperior,parenleftsuperior,parenrightsuperior,twodotenleader,onedotenleader,comma,hyphen,period,fraction,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,colon,semicolon,commasuperior,threequartersemdash,periodsuperior,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,fi,fl,ffi,ffl,parenleftinferior,parenrightinferior,hyphensuperior,colonmonetary,onefitted,rupiah,centoldstyle,figuredash,hypheninferior,onequarter,onehalf,threequarters,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,onesuperior,twosuperior,threesuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior`.split(`,`),Wt=(function(){function e(e){this.a=0,this.b=0;var t=new Uint8Array(256),n,r=0,i,a=e.length;for(n=0;n<256;++n)t[n]=n;for(n=0;n<256;++n)i=t[n],r=r+i+e[n%a]&255,t[n]=t[r],t[r]=i;this.s=t}return e.prototype={encryptBlock:function(e){var t,n=e.length,r,i,a=this.a,o=this.b,s=this.s,c=new Uint8Array(n);for(t=0;t<n;++t)a=a+1&255,r=s[a],o=o+r&255,i=s[o],s[a]=i,s[o]=r,c[t]=e[t]^s[r+i&255];return this.a=a,this.b=o,c}},e.prototype.decryptBlock=e.prototype.encryptBlock,e})(),Gt=(function(){var e=new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]),t=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551]);function n(n,r,i){for(var a=1732584193,o=-271733879,s=-1732584194,c=271733878,l=i+72&-64,u=new Uint8Array(l),d=0,f,p;d<i;++d)u[d]=n[r++];for(u[d++]=128,p=l-8;d<p;)u[d++]=0;u[d++]=i<<3&255,u[d++]=i>>5&255,u[d++]=i>>13&255,u[d++]=i>>21&255,u[d++]=i>>>29&255,u[d++]=0,u[d++]=0,u[d++]=0;var m=new Int32Array(16);for(d=0;d<l;){for(f=0;f<16;++f,d+=4)m[f]=u[d]|u[d+1]<<8|u[d+2]<<16|u[d+3]<<24;var h=a,g=o,_=s,v=c,y,b;for(f=0;f<64;++f){f<16?(y=g&_|~g&v,b=f):f<32?(y=v&g|~v&_,b=5*f+1&15):f<48?(y=g^_^v,b=3*f+5&15):(y=_^(g|~v),b=7*f&15);var x=v,S=h+y+t[f]+m[b]|0,C=e[f];v=_,_=g,g=g+(S<<C|S>>>32-C)|0,h=x}a=a+h|0,o=o+g|0,s=s+_|0,c=c+v|0}return new Uint8Array([a&255,a>>8&255,a>>16&255,a>>>24&255,o&255,o>>8&255,o>>16&255,o>>>24&255,s&255,s>>8&255,s>>16&255,s>>>24&255,c&255,c>>8&255,c>>16&255,c>>>24&255])}return n})(),Kt=(function(){function e(){}return e.prototype={decryptBlock:function(e){return e}},e})(),qt=(function(){var e=new Uint8Array([141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141]),t=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]),n=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),r=new Uint32Array([0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795]);function i(n){var r=176,i=new Uint8Array(r);i.set(n);for(var a=16,o=1;a<r;++o){var s=i[a-3],c=i[a-2],l=i[a-1],u=i[a-4];s=t[s],c=t[c],l=t[l],u=t[u],s^=e[o];for(var d=0;d<4;++d)i[a]=s^=i[a-16],a++,i[a]=c^=i[a-16],a++,i[a]=l^=i[a-16],a++,i[a]=u^=i[a-16],a++}return i}function a(e,t){var i=new Uint8Array(16);i.set(e);for(var a,o=0,s=160,c,l,u;o<16;++o,++s)i[o]^=t[s];for(a=9;a>=1;--a){for(c=i[13],i[13]=i[9],i[9]=i[5],i[5]=i[1],i[1]=c,c=i[14],l=i[10],i[14]=i[6],i[10]=i[2],i[6]=c,i[2]=l,c=i[15],l=i[11],u=i[7],i[15]=i[3],i[11]=c,i[7]=l,i[3]=u,o=0;o<16;++o)i[o]=n[i[o]];for(o=0,s=a*16;o<16;++o,++s)i[o]^=t[s];for(o=0;o<16;o+=4){var d=r[i[o]],f=r[i[o+1]],p=r[i[o+2]],m=r[i[o+3]];c=d^f>>>8^f<<24^p>>>16^p<<16^m>>>24^m<<8,i[o]=c>>>24&255,i[o+1]=c>>16&255,i[o+2]=c>>8&255,i[o+3]=c&255}}for(c=i[13],i[13]=i[9],i[9]=i[5],i[5]=i[1],i[1]=c,c=i[14],l=i[10],i[14]=i[6],i[10]=i[2],i[6]=c,i[2]=l,c=i[15],l=i[11],u=i[7],i[15]=i[3],i[11]=c,i[7]=l,i[3]=u,o=0;o<16;++o)i[o]=n[i[o]],i[o]^=t[o];return i}function o(e){this.key=i(e),this.buffer=new Uint8Array(16),this.bufferPosition=0}function s(e,t){var n,r,i,o=e.length,s=this.buffer,c=this.bufferPosition,l=[],u=this.iv;for(n=0;n<o;++n)if(s[c]=e[n],++c,!(c<16)){var d=a(s,this.key);for(r=0;r<16;++r)d[r]^=u[r];u=s,l.push(d),s=new Uint8Array(16),c=0}if(this.buffer=s,this.bufferLength=c,this.iv=u,l.length===0)return new Uint8Array([]);var f=16*l.length;if(t){var p=l[l.length-1];f-=p[15],l[l.length-1]=p.subarray(0,16-p[15])}var m=new Uint8Array(f);for(n=0,r=0,i=l.length;n<i;++n,r+=16)m.set(l[n],r);return m}return o.prototype={decryptBlock:function(e,t){var n,r=e.length,i=this.buffer,a=this.bufferPosition;for(n=0;a<16&&n<r;++n,++a)i[a]=e[n];return a<16?(this.bufferLength=a,new Uint8Array([])):(this.iv=i,this.buffer=new Uint8Array(16),this.bufferLength=0,this.decryptBlock=s,this.decryptBlock(e.subarray(16),t))}},o})(),Jt=(function(){function e(e,t){this.stringCipherConstructor=e,this.streamCipherConstructor=t}return e.prototype={createStream:function(e){var t=new this.streamCipherConstructor;return new hr(e,function(e,n){return t.decryptBlock(e,n)})},decryptString:function(e){var t=new this.stringCipherConstructor,n=ze(e);return n=t.decryptBlock(n,!0),Re(n)}},e})(),Yt=(function(){var e=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);function t(t,n,r,i,a,o,s,c){var l=40+r.length+t.length,u=new Uint8Array(l),d=0,f,p;if(n)for(p=Math.min(32,n.length);d<p;++d)u[d]=n[d];for(f=0;d<32;)u[d++]=e[f++];for(f=0,p=r.length;f<p;++f)u[d++]=r[f];for(u[d++]=a&255,u[d++]=a>>8&255,u[d++]=a>>16&255,u[d++]=a>>>24&255,f=0,p=t.length;f<p;++f)u[d++]=t[f];o>=4&&!c&&(u[d++]=255,u[d++]=255,u[d++]=255,u[d++]=255);var m=Gt(u,0,d),h=s>>3;if(o>=3)for(f=0;f<50;++f)m=Gt(m,0,h);var g=m.subarray(0,h),_,v;if(o>=3){for(d=0;d<32;++d)u[d]=e[d];for(f=0,p=t.length;f<p;++f)u[d++]=t[f];_=new Wt(g);var v=_.encryptBlock(Gt(u,0,d));p=g.length;var y=new Uint8Array(p),b;for(f=1;f<=19;++f){for(b=0;b<p;++b)y[b]=g[b]^f;_=new Wt(y),v=_.encryptBlock(v)}for(f=0,p=v.length;f<p;++f)if(i[f]!=v[f])return null}else for(_=new Wt(g),v=_.encryptBlock(e),f=0,p=v.length;f<p;++f)if(i[f]!=v[f])return null;return g}function n(t,n,r,i){for(var a=new Uint8Array(32),o=0,s,c=Math.min(32,t.length);o<c;++o)a[o]=t[o];for(s=0;o<32;)a[o++]=e[s++];var l=Gt(a,0,o),u=i>>3;if(r>=3)for(s=0;s<50;++s)l=Gt(l,0,l.length);var d,f;if(r>=3){f=n;var p=new Uint8Array(u),m;for(s=19;s>=0;s--){for(m=0;m<u;++m)p[m]=l[m]^s;d=new Wt(p),f=d.encryptBlock(f)}}else d=new Wt(l.subarray(0,u)),f=d.encryptBlock(n);return f}var r=new jt(`Identity`);function i(e,i,a){var o=e.get(`Filter`);(!Ye(o)||o.name!=`Standard`)&&H(`Error: unknown encryption method`),this.dict=e;var s=e.get(`V`);(!Ke(s)||s!=1&&s!=2&&s!=4)&&H(`Error: unsupported encryption algorithm`),this.algorithm=s;var c=e.get(`Length`)||40;(!Ke(c)||c<40||c%8!=0)&&H(`Error: invalid key length`);var l=ze(e.get(`O`)).subarray(0,32),u=ze(e.get(`U`)).subarray(0,32),d=e.get(`P`),f=e.get(`R`),p=s==4&&e.get(`EncryptMetadata`)!==!1;this.encryptMetadata=p;var m=ze(i),h;a&&(h=ze(a));var g=t(m,h,l,u,d,f,c,p);if(!g&&!a)throw new je(`No password given`,Ae.NEED_PASSWORD);if(!g&&a&&(g=t(m,n(h,l,f,c),l,u,d,f,c,p)),!g)throw new je(`Incorrect Password`,Ae.INCORRECT_PASSWORD);this.encryptionKey=g,s==4&&(this.cf=e.get(`CF`),this.stmf=e.get(`StmF`)||r,this.strf=e.get(`StrF`)||r,this.eff=e.get(`EFF`)||this.strf)}function a(e,t,n,r){for(var i=new Uint8Array(n.length+9),a=0,o=n.length;a<o;++a)i[a]=n[a];return i[a++]=e&255,i[a++]=e>>8&255,i[a++]=e>>16&255,i[a++]=t&255,i[a++]=t>>8&255,r&&(i[a++]=115,i[a++]=65,i[a++]=108,i[a++]=84),Gt(i,0,a).subarray(0,Math.min(n.length+5,16))}function o(e,t,n,r,i){var o=e.get(t.name),s;if(o!=null&&(s=o.get(`CFM`)),!s||s.name==`None`)return function(){return new Kt};if(s.name==`V2`)return function(){return new Wt(a(n,r,i,!1))};if(s.name==`AESV2`)return function(){return new qt(a(n,r,i,!0))};H(`Unknown crypto method`)}return i.prototype={createCipherTransform:function(e,t){if(this.algorithm==4)return new Jt(o(this.cf,this.stmf,e,t,this.encryptionKey),o(this.cf,this.strf,e,t,this.encryptionKey));var n=a(e,t,this.encryptionKey,!1),r=function(){return new Wt(n)};return new Jt(r,r)}},i})(),Xt=(function(){function e(e,t,n,r,i,a,o){this.state=new $t,this.stateStack=[],this.pdfManager=e,this.xref=t,this.handler=n,this.pageIndex=r,this.uniquePrefix=i,this.idCounters=a,this.fontCache=o}var t={w:{id:z.setLineWidth,numArgs:1,variableArgs:!1},J:{id:z.setLineCap,numArgs:1,variableArgs:!1},j:{id:z.setLineJoin,numArgs:1,variableArgs:!1},M:{id:z.setMiterLimit,numArgs:1,variableArgs:!1},d:{id:z.setDash,numArgs:2,variableArgs:!1},ri:{id:z.setRenderingIntent,numArgs:1,variableArgs:!1},i:{id:z.setFlatness,numArgs:1,variableArgs:!1},gs:{id:z.setGState,numArgs:1,variableArgs:!1},q:{id:z.save,numArgs:0,variableArgs:!1},Q:{id:z.restore,numArgs:0,variableArgs:!1},cm:{id:z.transform,numArgs:6,variableArgs:!1},m:{id:z.moveTo,numArgs:2,variableArgs:!1},l:{id:z.lineTo,numArgs:2,variableArgs:!1},c:{id:z.curveTo,numArgs:6,variableArgs:!1},v:{id:z.curveTo2,numArgs:4,variableArgs:!1},y:{id:z.curveTo3,numArgs:4,variableArgs:!1},h:{id:z.closePath,numArgs:0,variableArgs:!1},re:{id:z.rectangle,numArgs:4,variableArgs:!1},S:{id:z.stroke,numArgs:0,variableArgs:!1},s:{id:z.closeStroke,numArgs:0,variableArgs:!1},f:{id:z.fill,numArgs:0,variableArgs:!1},F:{id:z.fill,numArgs:0,variableArgs:!1},"f*":{id:z.eoFill,numArgs:0,variableArgs:!1},B:{id:z.fillStroke,numArgs:0,variableArgs:!1},"B*":{id:z.eoFillStroke,numArgs:0,variableArgs:!1},b:{id:z.closeFillStroke,numArgs:0,variableArgs:!1},"b*":{id:z.closeEOFillStroke,numArgs:0,variableArgs:!1},n:{id:z.endPath,numArgs:0,variableArgs:!1},W:{id:z.clip,numArgs:0,variableArgs:!1},"W*":{id:z.eoClip,numArgs:0,variableArgs:!1},BT:{id:z.beginText,numArgs:0,variableArgs:!1},ET:{id:z.endText,numArgs:0,variableArgs:!1},Tc:{id:z.setCharSpacing,numArgs:1,variableArgs:!1},Tw:{id:z.setWordSpacing,numArgs:1,variableArgs:!1},Tz:{id:z.setHScale,numArgs:1,variableArgs:!1},TL:{id:z.setLeading,numArgs:1,variableArgs:!1},Tf:{id:z.setFont,numArgs:2,variableArgs:!1},Tr:{id:z.setTextRenderingMode,numArgs:1,variableArgs:!1},Ts:{id:z.setTextRise,numArgs:1,variableArgs:!1},Td:{id:z.moveText,numArgs:2,variableArgs:!1},TD:{id:z.setLeadingMoveText,numArgs:2,variableArgs:!1},Tm:{id:z.setTextMatrix,numArgs:6,variableArgs:!1},"T*":{id:z.nextLine,numArgs:0,variableArgs:!1},Tj:{id:z.showText,numArgs:1,variableArgs:!1},TJ:{id:z.showSpacedText,numArgs:1,variableArgs:!1},"'":{id:z.nextLineShowText,numArgs:1,variableArgs:!1},'"':{id:z.nextLineSetSpacingShowText,numArgs:3,variableArgs:!1},d0:{id:z.setCharWidth,numArgs:2,variableArgs:!1},d1:{id:z.setCharWidthAndBounds,numArgs:6,variableArgs:!1},CS:{id:z.setStrokeColorSpace,numArgs:1,variableArgs:!1},cs:{id:z.setFillColorSpace,numArgs:1,variableArgs:!1},SC:{id:z.setStrokeColor,numArgs:4,variableArgs:!0},SCN:{id:z.setStrokeColorN,numArgs:33,variableArgs:!0},sc:{id:z.setFillColor,numArgs:4,variableArgs:!0},scn:{id:z.setFillColorN,numArgs:33,variableArgs:!0},G:{id:z.setStrokeGray,numArgs:1,variableArgs:!1},g:{id:z.setFillGray,numArgs:1,variableArgs:!1},RG:{id:z.setStrokeRGBColor,numArgs:3,variableArgs:!1},rg:{id:z.setFillRGBColor,numArgs:3,variableArgs:!1},K:{id:z.setStrokeCMYKColor,numArgs:4,variableArgs:!1},k:{id:z.setFillCMYKColor,numArgs:4,variableArgs:!1},sh:{id:z.shadingFill,numArgs:1,variableArgs:!1},BI:{id:z.beginInlineImage,numArgs:0,variableArgs:!1},ID:{id:z.beginImageData,numArgs:0,variableArgs:!1},EI:{id:z.endInlineImage,numArgs:1,variableArgs:!1},Do:{id:z.paintXObject,numArgs:1,variableArgs:!1},MP:{id:z.markPoint,numArgs:1,variableArgs:!1},DP:{id:z.markPointProps,numArgs:2,variableArgs:!1},BMC:{id:z.beginMarkedContent,numArgs:1,variableArgs:!1},BDC:{id:z.beginMarkedContentProps,numArgs:2,variableArgs:!1},EMC:{id:z.endMarkedContent,numArgs:0,variableArgs:!1},BX:{id:z.beginCompat,numArgs:0,variableArgs:!1},EX:{id:z.endCompat,numArgs:0,variableArgs:!1},BM:null,BD:null,true:null,fa:null,fal:null,fals:null,false:null,nu:null,nul:null,null:null},n=1,r=2;return e.prototype={hasBlendModes:function(e){if(!W(e))return!1;for(var t=[e];t.length;){var n=t.shift(),r=n.get(`ExtGState`);if(W(r))for(var i in r=r.getAll(),r){var a=r[i].BM;if(Ye(a)&&a.name!==`Normal`)return!0}var o=n.get(`XObject`);if(W(o))for(var i in o=o.getAll(),o){var s=o[i];if(Ze(s)){var c=s.dict.get(`Resources`);W(c)&&c!==n&&t.indexOf(c)<0&&t.push(c)}}}return!1},buildFormXObject:function(e,t,n,r){var i=t.dict.get(`Matrix`),a=t.dict.get(`BBox`),o=t.dict.get(`Group`);if(o){var s={matrix:i,bbox:a,smask:!!n,isolated:!1,knockout:!1},c=o.get(`S`);Ye(c)&&c.name===`Transparency`&&(s.isolated=o.get(`I`)||!1,s.knockout=o.get(`K`)||!1),r.addOp(z.beginGroup,[s])}r.addOp(z.paintFormXObjectBegin,[i,a]),this.getOperatorList(t,t.dict.get(`Resources`)||e,r),r.addOp(z.paintFormXObjectEnd,[]),o&&r.addOp(z.endGroup,[s])},buildPaintImageXObject:function(e,t,n,r){var i=this,a=t.dict,o=a.get(`Width`,`W`),s=a.get(`Height`,`H`);if(R.maxImageSize!==-1&&o*s>R.maxImageSize)V(`Image exceeded maximum allowed size and was removed.`);else if(a.get(`ImageMask`,`IM`)){var c=a.get(`Width`,`W`),l=a.get(`Height`,`H`),u=c+7>>3,d=t.getBytes(u*l),f=a.get(`Decode`,`D`),p=!!f&&f[0]>0;r.addOp(z.paintImageMaskXObject,[er.createMask(d,c,l,p)])}else{var m=a.get(`SMask`,`SM`)||!1,h=a.get(`Mask`)||!1;if(n&&!m&&!h&&!(t instanceof fr)&&o+s<200){var g=new er(this.xref,e,t,n,null,null).getImageData();r.addOp(z.paintInlineImageXObject,[g])}else{var _=`img_`+(this.uniquePrefix||``)+ ++this.idCounters.obj;r.addDependency(_);var v=[_,o,s];!m&&!h&&t instanceof fr&&t.isNativelySupported(this.xref,e)?(r.addOp(z.paintJpegXObject,v),this.handler.send(`obj`,[_,this.pageIndex,`JpegStream`,t.getIR()])):(er.buildImage(function(e){var t=e.getImageData();i.handler.send(`obj`,[_,i.pageIndex,`Image`,t],null,[t.data.buffer])},i.handler,i.xref,e,t,n),r.addOp(z.paintImageXObject,v))}}},handleTilingType:function(e,t,n,r,i,a){var o=this.getOperatorList(r,i.get(`Resources`)||n);a.addDependencies(o.dependencies),a.addOp(e,ht.getIR({fnArray:o.fnArray,argsArray:o.argsArray},i,t))},handleSetFont:function(e,t,n,r){var i;t&&(t=t.slice(),i=t[0].name);var a=this,o=this.loadFont(i,n,this.xref,e,r);this.state.font=o;var s=o.loadedName;if(!o.sent){var c=o.translated.exportData();a.handler.send(`commonobj`,[s,`Font`,c]),o.sent=!0}return s},handleText:function(e){var t=this.state.font.translated,n=t.charsToGlyphs(e),r=!!(this.state.textRenderingMode&be.ADD_TO_PATH_FLAG);if(t.data&&(r||R.disableFontFace)){for(var i=0;i<n.length;i++)if(n[i]!==null){var a=n[i].fontChar;if(!t.renderer.hasBuiltPath(a)){var o=t.renderer.getPathJs(a);this.handler.send(`commonobj`,[t.loadedName+`_path_`+a,`FontPath`,o])}}}return n},setGState:function(e,t,n){var r=this;function i(t,i,a){switch(i){case`Type`:break;case`LW`:case`LC`:case`LJ`:case`ML`:case`D`:case`RI`:case`FL`:case`CA`:case`ca`:t.push([i,a]);break;case`Font`:var o=r.handleSetFont(e,null,a[0],n);n.addDependency(o),t.push([i,[o,a[1]]]);break;case`BM`:t.push([i,a]);break;case`SMask`:(!Ye(a)||a.name!=`None`)&&we(`graphic state operator `+i);break;case`OP`:case`op`:case`OPM`:case`BG`:case`BG2`:case`UCR`:case`UCR2`:case`TR`:case`TR2`:case`HT`:case`SM`:case`SA`:case`AIS`:case`TK`:B(`graphic state operator `+i);break;default:B(`Unknown graphic state operator `+i)}}var a=[],o=t.map;for(var s in o){var c=o[s];i(a,s,c)}n.addOp(z.setGState,[a])},loadFont:function(e,t,n,r,i){function a(){return{translated:new Mn(`Font `+e+` is not available`),loadedName:`g_font_error`}}var o;if(t)Te($e(t)),o=t;else{var s=r.get(`Font`);if(s)o=s.getRaw(e);else return a()}if(this.fontCache.has(o))return this.fontCache.get(o);if(t=n.fetchIfRef(o),!W(t))return a();if(this.fontCache.put(o,t),t.loadedName=`g_font_`+o.num+`_`+o.gen,!t.translated){var c;try{c=this.translateFont(t,n)}catch(e){c=new Mn(e instanceof Error?e.message:e)}t.translated=c}if(t.translated.loadCharProcs){var l=t.get(`CharProcs`).getAll(),u=t.get(`Resources`)||r,d=Object.keys(l),f={};B(`Processing Type3 font: ${e}, found ${d.length} CharProcs`);var p={},m=t.get(`Encoding`);if(m){B(`Type3 font has encoding: ${m.name||`custom`}`);var h=m.get(`Differences`),g=m.get(`BaseEncoding`);if(h){B(`Processing Differences array of length ${h.length}`);for(var _=0,v=0;v<h.length;v++){var y=h[v];if(typeof y==`number`)_=y,B(`Setting current code to ${_}`);else{var b=typeof y,x;b===`object`&&y.name?x=y.name:b===`object`?(x=JSON.stringify(y),B(`Warning: Non-name object in Differences array: ${x}`)):x=y.toString(),p[_]=x,_++}}}if(g&&g.name){B(`Using BaseEncoding: ${g.name}`);var S=on[g.name];if(S)for(var C=0;C<256;C++)!p[C]&&S[C]&&(p[C]=S[C])}}t.translated.charProcMapping=p;for(var v=0,w=d.length;v<w;++v){var T=d[v],E=l[T],D=this.getOperatorList(E,u);f[T]=D.getIR(),i&&i.addDependencies(D.dependencies)}t.translated.charProcOperatorList=f,t.translated.charProcMapping=p,t.loaded=!0}else t.loaded=!0;return t},getOperatorList:function(e,i,a){var o=this,s=this.xref;this.handler,a||=new Zt,i||=new Nt;var c=i.get(`XObject`)||new Nt,l=i.get(`Pattern`)||new Nt,u=new ir(new ar(e,t),!1,s);new K;for(var d=[];;){var f=u.getObj();if(rr(f))break;if(Xe(f)){var p=f.cmd,m=t[p];if(!m){V(`Unknown command "`+p+`"`);continue}var h=m.id;if(m.variableArgs)d.length>m.numArgs&&B(`Command `+h+`: expected [0,`+m.numArgs+`] args, but received `+d.length+` args`);else if(d.length<m.numArgs){B(`Command `+h+`: because expected `+m.numArgs+` args, but received `+d.length+` args; skipping`),d=[];continue}else d.length>m.numArgs&&B(`Command `+h+`: expected `+m.numArgs+` args, but received `+d.length+` args`);switch(h){case z.setStrokeColorN:case z.setFillColorN:if(d[d.length-1].code)break;var g=d[d.length-1],_;if(Ye(g)&&(_=l.get(g.name))){var v=Ze(_)?_.dict:_,y=v.get(`PatternType`);if(y==n){o.handleTilingType(h,d,i,_,v,a),d=[];continue}if(y==r){var b=v.get(`Shading`),x=v.get(`Matrix`),_=pt.parseShading(b,x,s,i);d=_.getIR()}else H(`Unkown PatternType `+y)}break;case z.paintXObject:if(d[0].code)break;var S=d[0].name,C=c.get(S);if(C){Oe(Ze(C),`XObject should be a stream`);var w=C.dict.get(`Subtype`);if(Oe(Ye(w),`XObject should have a Name subtype`),w.name==`Form`){o.buildFormXObject(i,C,null,a),d=[];continue}if(w.name==`Image`){o.buildPaintImageXObject(i,C,!1,a),d=[];continue}H(`Unhandled XObject subtype `+w.name)}break;case z.setFont:var T=o.handleSetFont(i,d,null,a);a.addDependency(T),d[0]=T;break;case z.endInlineImage:o.buildPaintImageXObject(i,d[0],!0,a),d=[];continue;case z.save:var E=this.state;this.stateStack.push(this.state),this.state=E.clone();break;case z.restore:var D=this.stateStack.pop();D&&(this.state=D);break;case z.showText:d[0]=this.handleText(d[0]);break;case z.showSpacedText:for(var O=d[0],k=O.length,A=0;A<k;++A)Je(O[A])&&(O[A]=this.handleText(O[A]));break;case z.nextLineShowText:d[0]=this.handleText(d[0]);break;case z.nextLineSetSpacingShowText:d[2]=this.handleText(d[2]);break;case z.setTextRenderingMode:this.state.textRenderingMode=d[0];break;case z.setFillColorSpace:case z.setStrokeColorSpace:d=[q.parseToIR(d[0],s,i)];break;case z.shadingFill:var j=i.get(`Shading`);j||H(`No shading resource found`);var b=j.get(d[0].name);b||H(`No shading object found`),d=[pt.parseShading(b,null,s,i).getIR()],h=z.shadingFill;break;case z.setGState:var M=d[0],N=i.get(`ExtGState`);if(!W(N)||!N.has(M.name))break;var P=N.get(M.name);o.setGState(i,P,a),d=[];continue}a.addOp(h,d),d=[],u.saveState()}else f!=null&&(d.push(f instanceof Nt?f.getAll():f),Oe(d.length<=33,`Too many arguments`))}return a},getTextContent:function(e,t,n){var r,i=.35,a=1.5,o;n?(r=n.bidiTexts,o=n.textState):(o=new Qt,r=[],n={textState:o,bidiTexts:r});var s=this,c=this.xref;function l(e,n){return s.loadFont(e,n,c,t,null)}t=c.fetchIfRef(t)||new Nt;for(var u=null,d=new ir(new ar(e),!1),f=[],p,m=``,h=null,g=0,_=0;!rr(p=d.getObj());)if(Xe(p)){switch(p.cmd){case`Tf`:h=l(f[0].name).translated,o.fontSize=f[1];break;case`Ts`:o.textRise=f[0];break;case`Tz`:o.textHScale=f[0]/100;break;case`TL`:o.leading=f[0];break;case`Td`:o.translateTextMatrix(f[0],f[1]);break;case`TD`:o.leading=-f[1],o.translateTextMatrix(f[0],f[1]);break;case`T*`:o.translateTextMatrix(0,-o.leading);break;case`Tm`:o.setTextMatrix(f[0],f[1],f[2],f[3],f[4],f[5]);break;case`Tc`:g=f[0];break;case`Tw`:_=f[0];break;case`q`:o.push();break;case`Q`:o.pop();break;case`BT`:o.initialiseTextObj();break;case`cm`:o.transformCTM(f[0],f[1],f[2],f[3],f[4],f[5]);break;case`TJ`:for(var v=f[0],y=0,b=v.length;y<b;y++)if(typeof v[y]==`string`)m+=kn(v[y],h);else if(v[y]<0&&h.spaceWidth>0){var x=-v[y]/h.spaceWidth;if(x>a)for(x=Math.round(x);x--;)m+=` `;else x>i&&(m+=` `)}break;case`Tj`:m+=kn(f[0],h);break;case`'`:m+=kn(f[0],h);break;case`"`:m+=kn(f[2],h);break;case`Do`:if(m=``,f[0].code)break;u||=t.get(`XObject`)||new Nt;var S=f[0].name,C=u.get(S);if(!C)break;Oe(Ze(C),`XObject should be a stream`);var w=C.dict.get(`Subtype`);if(Oe(Ye(w),`XObject should have a Name subtype`),w.name!==`Form`)break;n=this.getTextContent(C,C.dict.get(`Resources`)||t,n);break;case`gs`:var T=f[0],E=t.get(`ExtGState`);if(!W(E)||!E.has(T.name))break;for(var D=E.get(T.name),O=0;O<D.length;O++)D[O]===`Font`&&(h=l(f[0].name).translated)}if(m!==``){var k=R.bidi(m,-1,h.vertical),A=o.calcRenderParams();k.x=A.renderMatrix[4]-o.fontSize*A.vScale*Math.sin(A.angle),k.y=A.renderMatrix[5]+o.fontSize*A.vScale*Math.cos(A.angle),k.dir==`ttb`&&(k.x+=A.vScale/2,k.y-=A.vScale),k.fontName=h.loadedName||h.name,k.fontSize=o.fontSize;var j=h.fontMatrix||ye,M=o.fontDirection||1;k.spaceWidth=h.spaceWidth*o.fontSize*j[0],k.charSpace=g,k.wordSpace=_,k.textHScale=o.textHScale;for(var N=0,P=h.charsToGlyphs(m),O=0,F=P.length;O<F;O++){var I=P[O],L=(I&&I.width||h.defaultWidth||0)*o.fontSize*j[0]+g*M;N+=L}k.width=N,r.push(k),m=``}f=[]}else p!=null&&(Oe(f.length<=33,`Too many arguments`),f.push(p));return n},extractDataStructures:function(e,t,n,r){var i=e.get(`ToUnicode`)||t.get(`ToUnicode`);if(i&&(r.toUnicode=this.readToUnicode(i,n,r)),r.composite){var a=e.get(`CIDSystemInfo`);W(a)&&(r.cidSystemInfo={registry:a.get(`Registry`),ordering:a.get(`Ordering`),supplement:a.get(`Supplement`)});var o=e.get(`CIDToGIDMap`);Ze(o)&&(r.cidToGidMap=this.readCidToGidMap(o))}var s=!0,c=!1,l=r.flags,u=[],d=r.type===`TrueType`?on.WinAnsiEncoding:on.StandardEncoding;if(l&an.Symbolic&&(d=r.file?on.MacRomanEncoding:on.SymbolSetEncoding),e.has(`Encoding`)){var f=e.get(`Encoding`);if(W(f)){var p=f.get(`BaseEncoding`);if(p&&(s=!1,c=!0,d=on[p.name]),f.has(`Differences`)){c=!0;for(var m=f.get(`Differences`),h=0,g=0,_=m.length;g<_;g++){var v=m[g];qe(v)?h=v:u[h++]=v.name}}}else Ye(f)?(s=!1,c=!0,d=on[f.name]):H(`Encoding is not a Name nor a Dict`)}r.differences=u,r.baseEncoding=d,r.hasEncoding=c,r.overridableEncoding=s},readToUnicode:function(e,t,n){var r=e,i=[];if(Ye(r))r.name.substring(0,9)!=`Identity-`&&H(`ToUnicode file cmap translation not implemented`);else if(Ze(r)){var a=Lr.create(r).map;for(var o in a){for(var s=a[o],c=[],l=0;l<s.length;l+=2){var u=s.charCodeAt(l)<<8|s.charCodeAt(l+1);if((u&63488)!=55296)c.push(u);else{l+=2;var d=s.charCodeAt(l)<<8|s.charCodeAt(l+1);c.push(((u&1023)<<10)+(d&1023)+65536)}}a[o]=String.fromCharCode.apply(String,c)}return a}return i},readCidToGidMap:function(e){for(var t=e.getBytes(),n=[],r=0,i=t.length;r<i;r++){var a=t[r++]<<8|t[r];if(a!==0){var o=r>>1;n[o]=a}}return n},extractWidths:function(e,t,n,r){var i=[],a=0,o=[],s;if(r.composite){a=e.get(`DW`)||1e3;var c=e.get(`W`);if(c)for(var l=0,u=c.length;l<u;l++){var d=c[l++],f=t.fetchIfRef(c[l]);if(G(f))for(var p=0,m=f.length;p<m;p++)i[d++]=f[p];else for(var h=c[++l],p=d;p<=f;p++)i[p]=h}if(r.vertical){var g=e.get(`DW2`)||[880,-1e3];if(s=[g[1],a*.5,g[0]],g=e.get(`W2`),g)for(var l=0,u=g.length;l<u;l++){var d=g[l++],f=t.fetchIfRef(g[l]);if(G(f))for(var p=0,m=f.length;p<m;p++)o[d++]=[f[p++],f[p++],f[p]];else for(var _=[g[++l],g[++l],g[++l]],p=d;p<=f;p++)o[p]=_}}}else{var v=r.firstChar,c=e.get(`Widths`);if(c){for(var p=v,l=0,u=c.length;l<u;l++)i[p++]=c[l];a=parseFloat(n.get(`MissingWidth`))||0}else{var y=e.get(`BaseFont`);if(Ye(y)){var b=this.getBaseFontMetrics(y.name);i=b.widths,a=b.defaultWidth}}}var x=!0,S=a;for(var C in i){var w=i[C];if(w){if(!S)S=w;else if(S!=w){x=!1;break}}}x&&(r.flags|=an.FixedPitch),r.defaultWidth=a,r.widths=i,r.defaultVMetrics=s,r.vmetrics=o},isSerifFont:function(e){var t=e.split(`-`)[0];return t in ln||t.search(/serif/gi)!==-1},getBaseFontMetrics:function(e){var t=0,n=[],r=!1,i=sn[e]||e;i in tr||(i=this.isSerifFont(e)?`Times-Roman`:`Helvetica`);var a=tr[i];return qe(a)?(t=a,r=!0):n=a,{defaultWidth:t,monospace:r,widths:n}},translateFont:function(e,t){var n=e,r=e.get(`Subtype`);Oe(Ye(r),`invalid font Subtype`);var i=!1;if(r.name==`Type0`){var a=e.get(`DescendantFonts`);a||H(`Descendant fonts are not specified`),e=G(a)?t.fetchIfRef(a[0]):a,r=e.get(`Subtype`),Oe(Ye(r),`invalid font Subtype`),i=!0}var o=i?65535:255,s=e.get(`FontDescriptor`);if(!s){if(r.name==`Type3`)s=new Nt,s.set(`FontName`,new jt(r.name));else{var c=e.get(`BaseFont`);Ye(c)||H(`Base font is not specified`),c=c.name.replace(/[,_]/g,`-`);var l=this.getBaseFontMetrics(c),u=c.split(`-`)[0],d=(this.isSerifFont(u)?an.Serif:0)|(l.monospace?an.FixedPitch:0)|(un[u]?an.Symbolic:an.Nonsymbolic),f={type:r.name,widths:l.widths,defaultWidth:l.defaultWidth,flags:d,firstChar:0,lastChar:o};return this.extractDataStructures(e,e,t,f),new jn(c,null,f)}}var p=e.get(`FirstChar`)||0,m=e.get(`LastChar`)||o,h=s.get(`FontName`),g=e.get(`BaseFont`);if(Je(h)&&(h=new jt(h)),Je(g)&&(g=new jt(g)),r.name!==`Type3`){var _=h&&h.name,v=g&&g.name;_!==v&&B(`The FontDescriptor's FontName is "`+_+`" but should be the same as the Font's BaseFont "`+v+`"`)}h||=g,Oe(Ye(h),`invalid font name`);var y=s.get(`FontFile`,`FontFile2`,`FontFile3`);if(y&&y.dict){var b=y.dict.get(`Subtype`);b&&=b.name;var x=y.dict.get(`Length1`),S=y.dict.get(`Length2`)}var f={type:r.name,subtype:b,file:y,length1:x,length2:S,loadedName:n.loadedName,composite:i,wideChars:i,fixedPitch:!1,fontMatrix:e.get(`FontMatrix`)||ye,firstChar:p||0,lastChar:m||o,bbox:s.get(`FontBBox`),ascent:s.get(`Ascent`),descent:s.get(`Descent`),xHeight:s.get(`XHeight`),capHeight:s.get(`CapHeight`),flags:s.get(`Flags`),italicAngle:s.get(`ItalicAngle`),coded:!1};if(i){var C=n.get(`Encoding`);Ye(C)&&(f.cidEncoding=C.name,f.vertical=/-V$/.test(C.name)),f.cmap=Lr.create(C)}return this.extractWidths(e,t,s,f),this.extractDataStructures(e,n,t,f),r.name===`Type3`&&(f.coded=!0),new jn(h.name,y,f)}},e.optimizeQueue=function(e){function t(e,t,n,r){if(G(e))e.splice(t,n,r);else{e[t]=r;var i=e.subarray(t+n);e.set(i,t+1)}}for(var n=e.fnArray,r=e.argsArray,i=10,a=200,o=1e3,s=1,c=0,l=r.length;c<l;c++)if(n[c]===z.paintInlineImageXObject&&n[c-2]===z.save&&n[c-1]===z.transform&&n[c+1]===z.restore){var u=c-2;for(c+=2;c<l&&n[c-4]===n[c];c++);var d=Math.min(c-u>>2,a);if(d<i)continue;for(var f=0,p=[],m=0,h=s,g=s,_=0;_<d;_++){var v=r[u+(_<<2)+1],y=r[u+(_<<2)+2][0];h+y.width>o&&(f=Math.max(f,h),g+=m+2*s,h=0,m=0),p.push({transform:v,x:h,y:g,w:y.width,h:y.height}),h+=y.width+2*s,m=Math.max(m,y.height)}for(var b=Math.max(f,h)+s,x=g+m+s,S=new Uint8Array(b*x*4),C=b<<2,_=0;_<d;_++){var w=r[u+(_<<2)+2][0].data,T=p[_].w<<2,E=0,D=p[_].x+p[_].y*b<<2;S.set(w.subarray(0,T),D-C);for(var O=0,k=p[_].h;O<k;O++)S.set(w.subarray(E,E+T),D),E+=T,D+=C;for(S.set(w.subarray(E-T,E),D);D>=0;)w[D-4]=w[D],w[D-3]=w[D+1],w[D-2]=w[D+2],w[D-1]=w[D+3],w[D+T]=w[D+T-4],w[D+T+1]=w[D+T-3],w[D+T+2]=w[D+T-2],w[D+T+3]=w[D+T-1],D-=C}t(n,u,d*4,z.paintInlineImageXObjectGroup),r.splice(u,d*4,[{width:b,height:x,data:S},p]),c=u,l=r.length}for(var A=10,j=100,c=0,l=r.length;c<l;c++)if(n[c]===z.paintImageMaskXObject&&n[c-2]===z.save&&n[c-1]===z.transform&&n[c+1]===z.restore){var u=c-2;for(c+=2;c<l&&n[c-4]===n[c];c++);var d=Math.min(c-u>>2,j);if(d<A)continue;for(var M=[],_=0;_<d;_++){var v=r[u+(_<<2)+1],N=r[u+(_<<2)+2][0];M.push({data:N.data,width:N.width,height:N.height,transform:v})}t(n,u,d*4,z.paintImageMaskXObjectGroup),r.splice(u,d*4,[M]),c=u,l=r.length}},e})(),Zt=(function(){function e(e){for(var t=[],n=e.fnArray,r=e.argsArray,i=0,a=e.length;i<a;i++)switch(n[i]){case z.paintInlineImageXObject:case z.paintInlineImageXObjectGroup:case z.paintImageMaskXObject:var o=r[i][0];t.push(o.data.buffer)}return t}function t(e,t){this.messageHandler=e,this.fnArray=e?new Uint8Array(100):[],this.argsArray=[],this.dependencies={},this.pageIndex=t,this.fnIndex=0}return t.prototype={get length(){return this.argsArray.length},addOp:function(e,t){this.messageHandler?(this.fnArray[this.fnIndex++]=e,this.argsArray.push(t),this.fnIndex>=100&&this.flush()):(this.fnArray.push(e),this.argsArray.push(t))},addDependency:function(e){e in this.dependencies||(this.dependencies[e]=!0,this.addOp(z.dependency,[e]))},addDependencies:function(e){for(var t in e)this.addDependency(t)},addOpList:function(e){U.extendObj(this.dependencies,e.dependencies);for(var t=0,n=e.length;t<n;t++)this.addOp(e.fnArray[t],e.argsArray[t])},getIR:function(){return{fnArray:this.fnArray,argsArray:this.argsArray,length:this.length}},flush:function(t){Xt.optimizeQueue(this);var n=e(this);this.messageHandler.send(`RenderPageChunk`,{operatorList:{fnArray:this.fnArray,argsArray:this.argsArray,lastChunk:t,length:this.length},pageIndex:this.pageIndex},null,n),this.dependencies=[],this.fnIndex=0,this.argsArray=[]}},t})(),Qt=(function(){function e(){this.fontSize=0,this.ctm=[1,0,0,1,0,0],this.textMatrix=[1,0,0,1,0,0],this.stateStack=[],this.leading=0,this.textHScale=1,this.textRise=0}return e.prototype={push:function(){this.stateStack.push(this.ctm.slice())},pop:function(){var e=this.stateStack.pop();e&&(this.ctm=e)},initialiseTextObj:function(){var e=this.textMatrix;e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0},setTextMatrix:function(e,t,n,r,i,a){var o=this.textMatrix;o[0]=e,o[1]=t,o[2]=n,o[3]=r,o[4]=i,o[5]=a},transformCTM:function(e,t,n,r,i,a){var o=this.ctm,s=o[0],c=o[1],l=o[2],u=o[3],d=o[4],f=o[5];o[0]=s*e+l*t,o[1]=c*e+u*t,o[2]=s*n+l*r,o[3]=c*n+u*r,o[4]=s*i+l*a+d,o[5]=c*i+u*a+f},translateTextMatrix:function(e,t){var n=this.textMatrix;n[4]=n[0]*e+n[2]*t+n[4],n[5]=n[1]*e+n[3]*t+n[5]},calcRenderParams:function(){var e=this.textMatrix,t=this.ctm,n=this.fontSize,r=n*this.textHScale,i=this.textRise,a=Math.sqrt(e[2]*e[2]+e[3]*e[3]),o=Math.atan2(e[1],e[0]),s=e[0]*t[0]+e[1]*t[2],c=e[0]*t[1]+e[1]*t[3],l=e[2]*t[0]+e[3]*t[2],u=e[2]*t[1]+e[3]*t[3],d=e[4]*t[0]+e[5]*t[2]+t[4],f=e[4]*t[1]+e[5]*t[3]+t[5];return{renderMatrix:[r*s,r*c,n*l,n*u,i*l+d,i*u+f],vScale:a,angle:o}}},e})(),$t=(function(){function e(){this.font=null,this.textRenderingMode=be.FILL}return e.prototype={clone:function(){return Object.create(this)}},e})(),en=57344,tn=6400,nn=61440,rn=1e3,an={FixedPitch:1,Serif:2,Symbolic:4,Script:8,Nonsymbolic:32,Italic:64,AllCap:65536,SmallCap:131072,ForceBold:262144},on={ExpertEncoding:`................................space.exclamsmall.Hungarumlautsmall..dollaroldstyle.dollarsuperior.ampersandsmall.Acutesmall.parenleftsuperior.parenrightsuperior.twodotenleader.onedotenleader.comma.hyphen.period.fraction.zerooldstyle.oneoldstyle.twooldstyle.threeoldstyle.fouroldstyle.fiveoldstyle.sixoldstyle.sevenoldstyle.eightoldstyle.nineoldstyle.colon.semicolon.commasuperior.threequartersemdash.periodsuperior.questionsmall..asuperior.bsuperior.centsuperior.dsuperior.esuperior...isuperior...lsuperior.msuperior.nsuperior.osuperior...rsuperior.ssuperior.tsuperior..ff.fi.fl.ffi.ffl.parenleftinferior..parenrightinferior.Circumflexsmall.hyphensuperior.Gravesmall.Asmall.Bsmall.Csmall.Dsmall.Esmall.Fsmall.Gsmall.Hsmall.Ismall.Jsmall.Ksmall.Lsmall.Msmall.Nsmall.Osmall.Psmall.Qsmall.Rsmall.Ssmall.Tsmall.Usmall.Vsmall.Wsmall.Xsmall.Ysmall.Zsmall.colonmonetary.onefitted.rupiah.Tildesmall...................................exclamdownsmall.centoldstyle.Lslashsmall...Scaronsmall.Zcaronsmall.Dieresissmall.Brevesmall.Caronsmall..Dotaccentsmall...Macronsmall...figuredash.hypheninferior...Ogoneksmall.Ringsmall.Cedillasmall....onequarter.onehalf.threequarters.questiondownsmall.oneeighth.threeeighths.fiveeighths.seveneighths.onethird.twothirds...zerosuperior.onesuperior.twosuperior.threesuperior.foursuperior.fivesuperior.sixsuperior.sevensuperior.eightsuperior.ninesuperior.zeroinferior.oneinferior.twoinferior.threeinferior.fourinferior.fiveinferior.sixinferior.seveninferior.eightinferior.nineinferior.centinferior.dollarinferior.periodinferior.commainferior.Agravesmall.Aacutesmall.Acircumflexsmall.Atildesmall.Adieresissmall.Aringsmall.AEsmall.Ccedillasmall.Egravesmall.Eacutesmall.Ecircumflexsmall.Edieresissmall.Igravesmall.Iacutesmall.Icircumflexsmall.Idieresissmall.Ethsmall.Ntildesmall.Ogravesmall.Oacutesmall.Ocircumflexsmall.Otildesmall.Odieresissmall.OEsmall.Oslashsmall.Ugravesmall.Uacutesmall.Ucircumflexsmall.Udieresissmall.Yacutesmall.Thornsmall.Ydieresissmall`.split(`.`),MacExpertEncoding:`................................space.exclamsmall.Hungarumlautsmall.centoldstyle.dollaroldstyle.dollarsuperior.ampersandsmall.Acutesmall.parenleftsuperior.parenrightsuperior.twodotenleader.onedotenleader.comma.hyphen.period.fraction.zerooldstyle.oneoldstyle.twooldstyle.threeoldstyle.fouroldstyle.fiveoldstyle.sixoldstyle.sevenoldstyle.eightoldstyle.nineoldstyle.colon.semicolon..threequartersemdash..questionsmall.....Ethsmall...onequarter.onehalf.threequarters.oneeighth.threeeighths.fiveeighths.seveneighths.onethird.twothirds.......ff.fi.fl.ffi.ffl.parenleftinferior..parenrightinferior.Circumflexsmall.hypheninferior.Gravesmall.Asmall.Bsmall.Csmall.Dsmall.Esmall.Fsmall.Gsmall.Hsmall.Ismall.Jsmall.Ksmall.Lsmall.Msmall.Nsmall.Osmall.Psmall.Qsmall.Rsmall.Ssmall.Tsmall.Usmall.Vsmall.Wsmall.Xsmall.Ysmall.Zsmall.colonmonetary.onefitted.rupiah.Tildesmall...asuperior.centsuperior.....Aacutesmall.Agravesmall.Acircumflexsmall.Adieresissmall.Atildesmall.Aringsmall.Ccedillasmall.Eacutesmall.Egravesmall.Ecircumflexsmall.Edieresissmall.Iacutesmall.Igravesmall.Icircumflexsmall.Idieresissmall.Ntildesmall.Oacutesmall.Ogravesmall.Ocircumflexsmall.Odieresissmall.Otildesmall.Uacutesmall.Ugravesmall.Ucircumflexsmall.Udieresissmall..eightsuperior.fourinferior.threeinferior.sixinferior.eightinferior.seveninferior.Scaronsmall..centinferior.twoinferior..Dieresissmall..Caronsmall.osuperior.fiveinferior..commainferior.periodinferior.Yacutesmall..dollarinferior..Thornsmall..nineinferior.zeroinferior.Zcaronsmall.AEsmall.Oslashsmall.questiondownsmall.oneinferior.Lslashsmall.......Cedillasmall......OEsmall.figuredash.hyphensuperior.....exclamdownsmall..Ydieresissmall..onesuperior.twosuperior.threesuperior.foursuperior.fivesuperior.sixsuperior.sevensuperior.ninesuperior.zerosuperior..esuperior.rsuperior.tsuperior...isuperior.ssuperior.dsuperior......lsuperior.Ogoneksmall.Brevesmall.Macronsmall.bsuperior.nsuperior.msuperior.commasuperior.periodsuperior.Dotaccentsmall.Ringsmall`.split(`.`),MacRomanEncoding:`................................space.exclam.quotedbl.numbersign.dollar.percent.ampersand.quotesingle.parenleft.parenright.asterisk.plus.comma.hyphen.period.slash.zero.one.two.three.four.five.six.seven.eight.nine.colon.semicolon.less.equal.greater.question.at.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.bracketleft.backslash.bracketright.asciicircum.underscore.grave.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.braceleft.bar.braceright.asciitilde..Adieresis.Aring.Ccedilla.Eacute.Ntilde.Odieresis.Udieresis.aacute.agrave.acircumflex.adieresis.atilde.aring.ccedilla.eacute.egrave.ecircumflex.edieresis.iacute.igrave.icircumflex.idieresis.ntilde.oacute.ograve.ocircumflex.odieresis.otilde.uacute.ugrave.ucircumflex.udieresis.dagger.degree.cent.sterling.section.bullet.paragraph.germandbls.registered.copyright.trademark.acute.dieresis.notequal.AE.Oslash.infinity.plusminus.lessequal.greaterequal.yen.mu.partialdiff.summation.product.pi.integral.ordfeminine.ordmasculine.Omega.ae.oslash.questiondown.exclamdown.logicalnot.radical.florin.approxequal.Delta.guillemotleft.guillemotright.ellipsis..Agrave.Atilde.Otilde.OE.oe.endash.emdash.quotedblleft.quotedblright.quoteleft.quoteright.divide.lozenge.ydieresis.Ydieresis.fraction.currency.guilsinglleft.guilsinglright.fi.fl.daggerdbl.periodcentered.quotesinglbase.quotedblbase.perthousand.Acircumflex.Ecircumflex.Aacute.Edieresis.Egrave.Iacute.Icircumflex.Idieresis.Igrave.Oacute.Ocircumflex.apple.Ograve.Uacute.Ucircumflex.Ugrave.dotlessi.circumflex.tilde.macron.breve.dotaccent.ring.cedilla.hungarumlaut.ogonek.caron`.split(`.`),StandardEncoding:`................................space.exclam.quotedbl.numbersign.dollar.percent.ampersand.quoteright.parenleft.parenright.asterisk.plus.comma.hyphen.period.slash.zero.one.two.three.four.five.six.seven.eight.nine.colon.semicolon.less.equal.greater.question.at.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.bracketleft.backslash.bracketright.asciicircum.underscore.quoteleft.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.braceleft.bar.braceright.asciitilde...................................exclamdown.cent.sterling.fraction.yen.florin.section.currency.quotesingle.quotedblleft.guillemotleft.guilsinglleft.guilsinglright.fi.fl..endash.dagger.daggerdbl.periodcentered..paragraph.bullet.quotesinglbase.quotedblbase.quotedblright.guillemotright.ellipsis.perthousand..questiondown..grave.acute.circumflex.tilde.macron.breve.dotaccent.dieresis..ring.cedilla..hungarumlaut.ogonek.caron.emdash.................AE..ordfeminine.....Lslash.Oslash.OE.ordmasculine......ae....dotlessi...lslash.oslash.oe.germandbls`.split(`.`),WinAnsiEncoding:`................................space.exclam.quotedbl.numbersign.dollar.percent.ampersand.quotesingle.parenleft.parenright.asterisk.plus.comma.hyphen.period.slash.zero.one.two.three.four.five.six.seven.eight.nine.colon.semicolon.less.equal.greater.question.at.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.bracketleft.backslash.bracketright.asciicircum.underscore.grave.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.braceleft.bar.braceright.asciitilde.bullet.Euro.bullet.quotesinglbase.florin.quotedblbase.ellipsis.dagger.daggerdbl.circumflex.perthousand.Scaron.guilsinglleft.OE.bullet.Zcaron.bullet.bullet.quoteleft.quoteright.quotedblleft.quotedblright.bullet.endash.emdash.tilde.trademark.scaron.guilsinglright.oe.bullet.zcaron.Ydieresis..exclamdown.cent.sterling.currency.yen.brokenbar.section.dieresis.copyright.ordfeminine.guillemotleft.logicalnot.hyphen.registered.macron.degree.plusminus.twosuperior.threesuperior.acute.mu.paragraph.periodcentered.cedilla.onesuperior.ordmasculine.guillemotright.onequarter.onehalf.threequarters.questiondown.Agrave.Aacute.Acircumflex.Atilde.Adieresis.Aring.AE.Ccedilla.Egrave.Eacute.Ecircumflex.Edieresis.Igrave.Iacute.Icircumflex.Idieresis.Eth.Ntilde.Ograve.Oacute.Ocircumflex.Otilde.Odieresis.multiply.Oslash.Ugrave.Uacute.Ucircumflex.Udieresis.Yacute.Thorn.germandbls.agrave.aacute.acircumflex.atilde.adieresis.aring.ae.ccedilla.egrave.eacute.ecircumflex.edieresis.igrave.iacute.icircumflex.idieresis.eth.ntilde.ograve.oacute.ocircumflex.otilde.odieresis.divide.oslash.ugrave.uacute.ucircumflex.udieresis.yacute.thorn.ydieresis`.split(`.`),SymbolSetEncoding:`................................space.exclam.universal.numbersign.existential.percent.ampersand.suchthat.parenleft.parenright.asteriskmath.plus.comma.minus.period.slash.zero.one.two.three.four.five.six.seven.eight.nine.colon.semicolon.less.equal.greater.question.congruent.Alpha.Beta.Chi.Delta.Epsilon.Phi.Gamma.Eta.Iota.theta1.Kappa.Lambda.Mu.Nu.Omicron.Pi.Theta.Rho.Sigma.Tau.Upsilon.sigma1.Omega.Xi.Psi.Zeta.bracketleft.therefore.bracketright.perpendicular.underscore.radicalex.alpha.beta.chi.delta.epsilon.phi.gamma.eta.iota.phi1.kappa.lambda.mu.nu.omicron.pi.theta.rho.sigma.tau.upsilon.omega1.omega.xi.psi.zeta.braceleft.bar.braceright.similar..................................Euro.Upsilon1.minute.lessequal.fraction.infinity.florin.club.diamond.heart.spade.arrowboth.arrowleft.arrowup.arrowright.arrowdown.degree.plusminus.second.greaterequal.multiply.proportional.partialdiff.bullet.divide.notequal.equivalence.approxequal.ellipsis.arrowvertex.arrowhorizex.carriagereturn.aleph.Ifraktur.Rfraktur.weierstrass.circlemultiply.circleplus.emptyset.intersection.union.propersuperset.reflexsuperset.notsubset.propersubset.reflexsubset.element.notelement.angle.gradient.registerserif.copyrightserif.trademarkserif.product.radical.dotmath.logicalnot.logicaland.logicalor.arrowdblboth.arrowdblleft.arrowdblup.arrowdblright.arrowdbldown.lozenge.angleleft.registersans.copyrightsans.trademarksans.summation.parenlefttp.parenleftex.parenleftbt.bracketlefttp.bracketleftex.bracketleftbt.bracelefttp.braceleftmid.braceleftbt.braceex..angleright.integral.integraltp.integralex.integralbt.parenrighttp.parenrightex.parenrightbt.bracketrighttp.bracketrightex.bracketrightbt.bracerighttp.bracerightmid.bracerightbt`.split(`.`),zapfDingbatsEncoding:`................................space.a1.a2.a202.a3.a4.a5.a119.a118.a117.a11.a12.a13.a14.a15.a16.a105.a17.a18.a19.a20.a21.a22.a23.a24.a25.a26.a27.a28.a6.a7.a8.a9.a10.a29.a30.a31.a32.a33.a34.a35.a36.a37.a38.a39.a40.a41.a42.a43.a44.a45.a46.a47.a48.a49.a50.a51.a52.a53.a54.a55.a56.a57.a58.a59.a60.a61.a62.a63.a64.a65.a66.a67.a68.a69.a70.a71.a72.a73.a74.a203.a75.a204.a76.a77.a78.a79.a81.a82.a83.a84.a97.a98.a99.a100...................................a101.a102.a103.a104.a106.a107.a108.a112.a111.a110.a109.a120.a121.a122.a123.a124.a125.a126.a127.a128.a129.a130.a131.a132.a133.a134.a135.a136.a137.a138.a139.a140.a141.a142.a143.a144.a145.a146.a147.a148.a149.a150.a151.a152.a153.a154.a155.a156.a157.a158.a159.a160.a161.a163.a164.a196.a165.a192.a166.a167.a168.a169.a170.a171.a172.a173.a162.a174.a175.a176.a177.a178.a179.a193.a180.a199.a181.a200.a182..a201.a183.a184.a197.a185.a194.a198.a186.a195.a187.a188.a189.a190.a191`.split(`.`)},sn={ArialNarrow:`Helvetica`,"ArialNarrow-Bold":`Helvetica-Bold`,"ArialNarrow-BoldItalic":`Helvetica-BoldOblique`,"ArialNarrow-Italic":`Helvetica-Oblique`,ArialBlack:`Helvetica`,"ArialBlack-Bold":`Helvetica-Bold`,"ArialBlack-BoldItalic":`Helvetica-BoldOblique`,"ArialBlack-Italic":`Helvetica-Oblique`,Arial:`Helvetica`,"Arial-Bold":`Helvetica-Bold`,"Arial-BoldItalic":`Helvetica-BoldOblique`,"Arial-Italic":`Helvetica-Oblique`,"Arial-BoldItalicMT":`Helvetica-BoldOblique`,"Arial-BoldMT":`Helvetica-Bold`,"Arial-ItalicMT":`Helvetica-Oblique`,ArialMT:`Helvetica`,"Courier-Bold":`Courier-Bold`,"Courier-BoldItalic":`Courier-BoldOblique`,"Courier-Italic":`Courier-Oblique`,CourierNew:`Courier`,"CourierNew-Bold":`Courier-Bold`,"CourierNew-BoldItalic":`Courier-BoldOblique`,"CourierNew-Italic":`Courier-Oblique`,"CourierNewPS-BoldItalicMT":`Courier-BoldOblique`,"CourierNewPS-BoldMT":`Courier-Bold`,"CourierNewPS-ItalicMT":`Courier-Oblique`,CourierNewPSMT:`Courier`,"Helvetica-Bold":`Helvetica-Bold`,"Helvetica-BoldItalic":`Helvetica-BoldOblique`,"Helvetica-Italic":`Helvetica-Oblique`,"Symbol-Bold":`Symbol`,"Symbol-BoldItalic":`Symbol`,"Symbol-Italic":`Symbol`,TimesNewRoman:`Times-Roman`,"TimesNewRoman-Bold":`Times-Bold`,"TimesNewRoman-BoldItalic":`Times-BoldItalic`,"TimesNewRoman-Italic":`Times-Italic`,TimesNewRomanPS:`Times-Roman`,"TimesNewRomanPS-Bold":`Times-Bold`,"TimesNewRomanPS-BoldItalic":`Times-BoldItalic`,"TimesNewRomanPS-BoldItalicMT":`Times-BoldItalic`,"TimesNewRomanPS-BoldMT":`Times-Bold`,"TimesNewRomanPS-Italic":`Times-Italic`,"TimesNewRomanPS-ItalicMT":`Times-Italic`,TimesNewRomanPSMT:`Times-Roman`,"TimesNewRomanPSMT-Bold":`Times-Bold`,"TimesNewRomanPSMT-BoldItalic":`Times-BoldItalic`,"TimesNewRomanPSMT-Italic":`Times-Italic`},cn={ComicSansMS:`Comic Sans MS`,"ComicSansMS-Bold":`Comic Sans MS-Bold`,"ComicSansMS-BoldItalic":`Comic Sans MS-BoldItalic`,"ComicSansMS-Italic":`Comic Sans MS-Italic`,LucidaConsole:`Courier`,"LucidaConsole-Bold":`Courier-Bold`,"LucidaConsole-BoldItalic":`Courier-BoldOblique`,"LucidaConsole-Italic":`Courier-Oblique`,"MS-Gothic":`MS Gothic`,"MS-Gothic-Bold":`MS Gothic-Bold`,"MS-Gothic-BoldItalic":`MS Gothic-BoldItalic`,"MS-Gothic-Italic":`MS Gothic-Italic`,"MS-Mincho":`MS Mincho`,"MS-Mincho-Bold":`MS Mincho-Bold`,"MS-Mincho-BoldItalic":`MS Mincho-BoldItalic`,"MS-Mincho-Italic":`MS Mincho-Italic`,"MS-PGothic":`MS PGothic`,"MS-PGothic-Bold":`MS PGothic-Bold`,"MS-PGothic-BoldItalic":`MS PGothic-BoldItalic`,"MS-PGothic-Italic":`MS PGothic-Italic`,"MS-PMincho":`MS PMincho`,"MS-PMincho-Bold":`MS PMincho-Bold`,"MS-PMincho-BoldItalic":`MS PMincho-BoldItalic`,"MS-PMincho-Italic":`MS PMincho-Italic`},ln={"Adobe Jenson":!0,"Adobe Text":!0,Albertus:!0,Aldus:!0,Alexandria:!0,Algerian:!0,"American Typewriter":!0,Antiqua:!0,Apex:!0,Arno:!0,Aster:!0,Aurora:!0,Baskerville:!0,Bell:!0,Bembo:!0,"Bembo Schoolbook":!0,Benguiat:!0,"Berkeley Old Style":!0,"Bernhard Modern":!0,"Berthold City":!0,Bodoni:!0,"Bauer Bodoni":!0,"Book Antiqua":!0,Bookman:!0,"Bordeaux Roman":!0,"Californian FB":!0,Calisto:!0,Calvert:!0,Capitals:!0,Cambria:!0,Cartier:!0,Caslon:!0,Catull:!0,Centaur:!0,"Century Old Style":!0,"Century Schoolbook":!0,Chaparral:!0,"Charis SIL":!0,Cheltenham:!0,"Cholla Slab":!0,Clarendon:!0,Clearface:!0,Cochin:!0,Colonna:!0,"Computer Modern":!0,"Concrete Roman":!0,Constantia:!0,"Cooper Black":!0,Corona:!0,Ecotype:!0,Egyptienne:!0,Elephant:!0,Excelsior:!0,Fairfield:!0,"FF Scala":!0,Folkard:!0,Footlight:!0,FreeSerif:!0,"Friz Quadrata":!0,Garamond:!0,Gentium:!0,Georgia:!0,Gloucester:!0,"Goudy Old Style":!0,"Goudy Schoolbook":!0,"Goudy Pro Font":!0,Granjon:!0,"Guardian Egyptian":!0,Heather:!0,Hercules:!0,"High Tower Text":!0,Hiroshige:!0,"Hoefler Text":!0,"Humana Serif":!0,Imprint:!0,"Ionic No. 5":!0,Janson:!0,Joanna:!0,Korinna:!0,Lexicon:!0,"Liberation Serif":!0,"Linux Libertine":!0,Literaturnaya:!0,Lucida:!0,"Lucida Bright":!0,Melior:!0,Memphis:!0,Miller:!0,Minion:!0,Modern:!0,"Mona Lisa":!0,"Mrs Eaves":!0,"MS Serif":!0,"Museo Slab":!0,"New York":!0,"Nimbus Roman":!0,"NPS Rawlinson Roadway":!0,Palatino:!0,Perpetua:!0,Plantin:!0,"Plantin Schoolbook":!0,Playbill:!0,"Poor Richard":!0,"Rawlinson Roadway":!0,Renault:!0,Requiem:!0,Rockwell:!0,Roman:!0,"Rotis Serif":!0,Sabon:!0,Scala:!0,Seagull:!0,Sistina:!0,Souvenir:!0,STIX:!0,"Stone Informal":!0,"Stone Serif":!0,Sylfaen:!0,Times:!0,Trajan:!0,Trinité:!0,"Trump Mediaeval":!0,Utopia:!0,"Vale Type":!0,"Bitstream Vera":!0,"Vera Serif":!0,Versailles:!0,Wanted:!0,Weiss:!0,"Wide Latin":!0,Windsor:!0,XITS:!0},un={Dingbats:!0,Symbol:!0,ZapfDingbats:!0},dn={H:mn,V:mn,"EUC-H":hn,"EUC-V":hn,"83pv-RKSJ-H":_n,"90pv-RKSJ-H":vn,"90ms-RKSJ-H":gn,"90ms-RKSJ-V":gn,"90msp-RKSJ-H":gn,"90msp-RKSJ-V":gn,"GBK-EUC-H":yn,"GBKp-EUC-H":yn,"B5pc-H":bn,"ETenms-B5-H":bn,"ETenms-B5-V":bn},fn={H:!0,V:!0,"EUC-H":!0,"EUC-V":!0,"90ms-RKSJ-H":!0,"90ms-RKSJ-V":!0,"UniJIS-UCS2-HW-H":!0,"UniJIS-UCS2-HW-V":!0},pn;typeof TextDecoder<`u`?pn=function(e,t,n){return new TextDecoder(t,{fatal:!!n}).decode(e)}:typeof FileReaderSync<`u`?pn=function(e,t){return new FileReaderSync().readAsText(new n.Blob([e]),t)}:dn={};function mn(e){for(var t=ze(e),n=t.length,r=0;r<n;++r)t[r]|=128;return pn(t,`euc-jp`)}function hn(e){return pn(ze(e),`euc-jp`)}function gn(e){return pn(ze(e),`shift_jis`)}function _n(e){var t=ze(e);try{return pn(t,`shift_jis`,!0)}catch{return we(`Unsupported 83pv character found`),pn(t,`shift_jis`)}}function vn(e){var t=ze(e);try{return pn(t,`shift_jis`,!0)}catch{return we(`Unsupported 90pv character found`),pn(t,`shift_jis`)}}function yn(e){return pn(ze(e),`gbk`)}function bn(e){return pn(ze(e),`big5`)}function xn(e){switch(e){case 63721:case 63193:return 169;default:return e}}var Sn=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}],Cn=`.notdef,.null,nonmarkingreturn,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quotesingle,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,grave,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,Adieresis,Aring,Ccedilla,Eacute,Ntilde,Odieresis,Udieresis,aacute,agrave,acircumflex,adieresis,atilde,aring,ccedilla,eacute,egrave,ecircumflex,edieresis,iacute,igrave,icircumflex,idieresis,ntilde,oacute,ograve,ocircumflex,odieresis,otilde,uacute,ugrave,ucircumflex,udieresis,dagger,degree,cent,sterling,section,bullet,paragraph,germandbls,registered,copyright,trademark,acute,dieresis,notequal,AE,Oslash,infinity,plusminus,lessequal,greaterequal,yen,mu,partialdiff,summation,product,pi,integral,ordfeminine,ordmasculine,Omega,ae,oslash,questiondown,exclamdown,logicalnot,radical,florin,approxequal,Delta,guillemotleft,guillemotright,ellipsis,nonbreakingspace,Agrave,Atilde,Otilde,OE,oe,endash,emdash,quotedblleft,quotedblright,quoteleft,quoteright,divide,lozenge,ydieresis,Ydieresis,fraction,currency,guilsinglleft,guilsinglright,fi,fl,daggerdbl,periodcentered,quotesinglbase,quotedblbase,perthousand,Acircumflex,Ecircumflex,Aacute,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Oacute,Ocircumflex,apple,Ograve,Uacute,Ucircumflex,Ugrave,dotlessi,circumflex,tilde,macron,breve,dotaccent,ring,cedilla,hungarumlaut,ogonek,caron,Lslash,lslash,Scaron,scaron,Zcaron,zcaron,brokenbar,Eth,eth,Yacute,yacute,Thorn,thorn,minus,multiply,onesuperior,twosuperior,threesuperior,onehalf,onequarter,threequarters,franc,Gbreve,gbreve,Idotaccent,Scedilla,scedilla,Cacute,cacute,Ccaron,ccaron,dcroat`.split(`,`);function wn(e){for(var t=0,n=Sn.length;t<n;t++){var r=Sn[t];if(e>=r.begin&&e<r.end)return t}return-1}function Tn(e){var t=Sn[13];return e>=t.begin&&e<t.end||(t=Sn[11],e>=t.begin&&e<t.end)}function En(e){return e<=31||e>=127&&e<tn||e>=en&&e<en+tn}var Dn={"¨":` ̈`,"¯":` ̄`,"´":` ́`,µ:`μ`,"¸":` ̧`,IJ:`IJ`,ij:`ij`,Ŀ:`L·`,ŀ:`l·`,ʼn:`ʼn`,ſ:`s`,DŽ:`DŽ`,Dž:`Dž`,dž:`dž`,LJ:`LJ`,Lj:`Lj`,lj:`lj`,NJ:`NJ`,Nj:`Nj`,nj:`nj`,DZ:`DZ`,Dz:`Dz`,dz:`dz`,"˘":` ̆`,"˙":` ̇`,"˚":` ̊`,"˛":` ̨`,"˜":` ̃`,"˝":` ̋`,ͺ:` ͅ`,"΄":` ́`,ϐ:`β`,ϑ:`θ`,ϒ:`Υ`,ϕ:`φ`,ϖ:`π`,ϰ:`κ`,ϱ:`ρ`,ϲ:`ς`,ϴ:`Θ`,ϵ:`ε`,Ϲ:`Σ`,և:`եւ`,ٵ:`اٴ`,ٶ:`وٴ`,ٷ:`ۇٴ`,ٸ:`يٴ`,ำ:`ํา`,ຳ:`ໍາ`,ໜ:`ຫນ`,ໝ:`ຫມ`,"ཷ":`ྲཱྀ`,"ཹ":`ླཱྀ`,ẚ:`aʾ`,"᾽":` ̓`,"᾿":` ̓`,"῀":` ͂`,"῾":` ̔`," ":` `," ":` `," ":` `," ":` `," ":` `," ":` `," ":` `," ":` `,"‗":` ̳`,"․":`.`,"‥":`..`,"…":`...`,"″":`′′`,"‴":`′′′`,"‶":`‵‵`,"‷":`‵‵‵`,"‼":`!!`,"‾":` ̅`,"⁇":`??`,"⁈":`?!`,"⁉":`!?`,"⁗":`′′′′`," ":` `,"₨":`Rs`,"℀":`a/c`,"℁":`a/s`,"℃":`°C`,"℅":`c/o`,"℆":`c/u`,ℇ:`Ɛ`,"℉":`°F`,"№":`No`,"℡":`TEL`,ℵ:`א`,ℶ:`ב`,ℷ:`ג`,ℸ:`ד`,"℻":`FAX`,Ⅰ:`I`,Ⅱ:`II`,Ⅲ:`III`,Ⅳ:`IV`,Ⅴ:`V`,Ⅵ:`VI`,Ⅶ:`VII`,Ⅷ:`VIII`,Ⅸ:`IX`,Ⅹ:`X`,Ⅺ:`XI`,Ⅻ:`XII`,Ⅼ:`L`,Ⅽ:`C`,Ⅾ:`D`,Ⅿ:`M`,ⅰ:`i`,ⅱ:`ii`,ⅲ:`iii`,ⅳ:`iv`,ⅴ:`v`,ⅵ:`vi`,ⅶ:`vii`,ⅷ:`viii`,ⅸ:`ix`,ⅹ:`x`,ⅺ:`xi`,ⅻ:`xii`,ⅼ:`l`,ⅽ:`c`,ⅾ:`d`,ⅿ:`m`,"∬":`∫∫`,"∭":`∫∫∫`,"∯":`∮∮`,"∰":`∮∮∮`,"⑴":`(1)`,"⑵":`(2)`,"⑶":`(3)`,"⑷":`(4)`,"⑸":`(5)`,"⑹":`(6)`,"⑺":`(7)`,"⑻":`(8)`,"⑼":`(9)`,"⑽":`(10)`,"⑾":`(11)`,"⑿":`(12)`,"⒀":`(13)`,"⒁":`(14)`,"⒂":`(15)`,"⒃":`(16)`,"⒄":`(17)`,"⒅":`(18)`,"⒆":`(19)`,"⒇":`(20)`,"⒈":`1.`,"⒉":`2.`,"⒊":`3.`,"⒋":`4.`,"⒌":`5.`,"⒍":`6.`,"⒎":`7.`,"⒏":`8.`,"⒐":`9.`,"⒑":`10.`,"⒒":`11.`,"⒓":`12.`,"⒔":`13.`,"⒕":`14.`,"⒖":`15.`,"⒗":`16.`,"⒘":`17.`,"⒙":`18.`,"⒚":`19.`,"⒛":`20.`,"⒜":`(a)`,"⒝":`(b)`,"⒞":`(c)`,"⒟":`(d)`,"⒠":`(e)`,"⒡":`(f)`,"⒢":`(g)`,"⒣":`(h)`,"⒤":`(i)`,"⒥":`(j)`,"⒦":`(k)`,"⒧":`(l)`,"⒨":`(m)`,"⒩":`(n)`,"⒪":`(o)`,"⒫":`(p)`,"⒬":`(q)`,"⒭":`(r)`,"⒮":`(s)`,"⒯":`(t)`,"⒰":`(u)`,"⒱":`(v)`,"⒲":`(w)`,"⒳":`(x)`,"⒴":`(y)`,"⒵":`(z)`,"⨌":`∫∫∫∫`,"⩴":`::=`,"⩵":`==`,"⩶":`===`,"⺟":`母`,"⻳":`龟`,"⼀":`一`,"⼁":`丨`,"⼂":`丶`,"⼃":`丿`,"⼄":`乙`,"⼅":`亅`,"⼆":`二`,"⼇":`亠`,"⼈":`人`,"⼉":`儿`,"⼊":`入`,"⼋":`八`,"⼌":`冂`,"⼍":`冖`,"⼎":`冫`,"⼏":`几`,"⼐":`凵`,"⼑":`刀`,"⼒":`力`,"⼓":`勹`,"⼔":`匕`,"⼕":`匚`,"⼖":`匸`,"⼗":`十`,"⼘":`卜`,"⼙":`卩`,"⼚":`厂`,"⼛":`厶`,"⼜":`又`,"⼝":`口`,"⼞":`囗`,"⼟":`土`,"⼠":`士`,"⼡":`夂`,"⼢":`夊`,"⼣":`夕`,"⼤":`大`,"⼥":`女`,"⼦":`子`,"⼧":`宀`,"⼨":`寸`,"⼩":`小`,"⼪":`尢`,"⼫":`尸`,"⼬":`屮`,"⼭":`山`,"⼮":`巛`,"⼯":`工`,"⼰":`己`,"⼱":`巾`,"⼲":`干`,"⼳":`幺`,"⼴":`广`,"⼵":`廴`,"⼶":`廾`,"⼷":`弋`,"⼸":`弓`,"⼹":`彐`,"⼺":`彡`,"⼻":`彳`,"⼼":`心`,"⼽":`戈`,"⼾":`戶`,"⼿":`手`,"⽀":`支`,"⽁":`攴`,"⽂":`文`,"⽃":`斗`,"⽄":`斤`,"⽅":`方`,"⽆":`无`,"⽇":`日`,"⽈":`曰`,"⽉":`月`,"⽊":`木`,"⽋":`欠`,"⽌":`止`,"⽍":`歹`,"⽎":`殳`,"⽏":`毋`,"⽐":`比`,"⽑":`毛`,"⽒":`氏`,"⽓":`气`,"⽔":`水`,"⽕":`火`,"⽖":`爪`,"⽗":`父`,"⽘":`爻`,"⽙":`爿`,"⽚":`片`,"⽛":`牙`,"⽜":`牛`,"⽝":`犬`,"⽞":`玄`,"⽟":`玉`,"⽠":`瓜`,"⽡":`瓦`,"⽢":`甘`,"⽣":`生`,"⽤":`用`,"⽥":`田`,"⽦":`疋`,"⽧":`疒`,"⽨":`癶`,"⽩":`白`,"⽪":`皮`,"⽫":`皿`,"⽬":`目`,"⽭":`矛`,"⽮":`矢`,"⽯":`石`,"⽰":`示`,"⽱":`禸`,"⽲":`禾`,"⽳":`穴`,"⽴":`立`,"⽵":`竹`,"⽶":`米`,"⽷":`糸`,"⽸":`缶`,"⽹":`网`,"⽺":`羊`,"⽻":`羽`,"⽼":`老`,"⽽":`而`,"⽾":`耒`,"⽿":`耳`,"⾀":`聿`,"⾁":`肉`,"⾂":`臣`,"⾃":`自`,"⾄":`至`,"⾅":`臼`,"⾆":`舌`,"⾇":`舛`,"⾈":`舟`,"⾉":`艮`,"⾊":`色`,"⾋":`艸`,"⾌":`虍`,"⾍":`虫`,"⾎":`血`,"⾏":`行`,"⾐":`衣`,"⾑":`襾`,"⾒":`見`,"⾓":`角`,"⾔":`言`,"⾕":`谷`,"⾖":`豆`,"⾗":`豕`,"⾘":`豸`,"⾙":`貝`,"⾚":`赤`,"⾛":`走`,"⾜":`足`,"⾝":`身`,"⾞":`車`,"⾟":`辛`,"⾠":`辰`,"⾡":`辵`,"⾢":`邑`,"⾣":`酉`,"⾤":`釆`,"⾥":`里`,"⾦":`金`,"⾧":`長`,"⾨":`門`,"⾩":`阜`,"⾪":`隶`,"⾫":`隹`,"⾬":`雨`,"⾭":`靑`,"⾮":`非`,"⾯":`面`,"⾰":`革`,"⾱":`韋`,"⾲":`韭`,"⾳":`音`,"⾴":`頁`,"⾵":`風`,"⾶":`飛`,"⾷":`食`,"⾸":`首`,"⾹":`香`,"⾺":`馬`,"⾻":`骨`,"⾼":`高`,"⾽":`髟`,"⾾":`鬥`,"⾿":`鬯`,"⿀":`鬲`,"⿁":`鬼`,"⿂":`魚`,"⿃":`鳥`,"⿄":`鹵`,"⿅":`鹿`,"⿆":`麥`,"⿇":`麻`,"⿈":`黃`,"⿉":`黍`,"⿊":`黑`,"⿋":`黹`,"⿌":`黽`,"⿍":`鼎`,"⿎":`鼓`,"⿏":`鼠`,"⿐":`鼻`,"⿑":`齊`,"⿒":`齒`,"⿓":`龍`,"⿔":`龜`,"⿕":`龠`,"〶":`〒`,〸:`十`,〹:`卄`,〺:`卅`,゛:` ゙`,゜:` ゚`,ㄱ:`ᄀ`,ㄲ:`ᄁ`,ㄳ:`ᆪ`,ㄴ:`ᄂ`,ㄵ:`ᆬ`,ㄶ:`ᆭ`,ㄷ:`ᄃ`,ㄸ:`ᄄ`,ㄹ:`ᄅ`,ㄺ:`ᆰ`,ㄻ:`ᆱ`,ㄼ:`ᆲ`,ㄽ:`ᆳ`,ㄾ:`ᆴ`,ㄿ:`ᆵ`,ㅀ:`ᄚ`,ㅁ:`ᄆ`,ㅂ:`ᄇ`,ㅃ:`ᄈ`,ㅄ:`ᄡ`,ㅅ:`ᄉ`,ㅆ:`ᄊ`,ㅇ:`ᄋ`,ㅈ:`ᄌ`,ㅉ:`ᄍ`,ㅊ:`ᄎ`,ㅋ:`ᄏ`,ㅌ:`ᄐ`,ㅍ:`ᄑ`,ㅎ:`ᄒ`,ㅏ:`ᅡ`,ㅐ:`ᅢ`,ㅑ:`ᅣ`,ㅒ:`ᅤ`,ㅓ:`ᅥ`,ㅔ:`ᅦ`,ㅕ:`ᅧ`,ㅖ:`ᅨ`,ㅗ:`ᅩ`,ㅘ:`ᅪ`,ㅙ:`ᅫ`,ㅚ:`ᅬ`,ㅛ:`ᅭ`,ㅜ:`ᅮ`,ㅝ:`ᅯ`,ㅞ:`ᅰ`,ㅟ:`ᅱ`,ㅠ:`ᅲ`,ㅡ:`ᅳ`,ㅢ:`ᅴ`,ㅣ:`ᅵ`,ㅤ:`ᅠ`,ㅥ:`ᄔ`,ㅦ:`ᄕ`,ㅧ:`ᇇ`,ㅨ:`ᇈ`,ㅩ:`ᇌ`,ㅪ:`ᇎ`,ㅫ:`ᇓ`,ㅬ:`ᇗ`,ㅭ:`ᇙ`,ㅮ:`ᄜ`,ㅯ:`ᇝ`,ㅰ:`ᇟ`,ㅱ:`ᄝ`,ㅲ:`ᄞ`,ㅳ:`ᄠ`,ㅴ:`ᄢ`,ㅵ:`ᄣ`,ㅶ:`ᄧ`,ㅷ:`ᄩ`,ㅸ:`ᄫ`,ㅹ:`ᄬ`,ㅺ:`ᄭ`,ㅻ:`ᄮ`,ㅼ:`ᄯ`,ㅽ:`ᄲ`,ㅾ:`ᄶ`,ㅿ:`ᅀ`,ㆀ:`ᅇ`,ㆁ:`ᅌ`,ㆂ:`ᇱ`,ㆃ:`ᇲ`,ㆄ:`ᅗ`,ㆅ:`ᅘ`,ㆆ:`ᅙ`,ㆇ:`ᆄ`,ㆈ:`ᆅ`,ㆉ:`ᆈ`,ㆊ:`ᆑ`,ㆋ:`ᆒ`,ㆌ:`ᆔ`,ㆍ:`ᆞ`,ㆎ:`ᆡ`,"㈀":`(ᄀ)`,"㈁":`(ᄂ)`,"㈂":`(ᄃ)`,"㈃":`(ᄅ)`,"㈄":`(ᄆ)`,"㈅":`(ᄇ)`,"㈆":`(ᄉ)`,"㈇":`(ᄋ)`,"㈈":`(ᄌ)`,"㈉":`(ᄎ)`,"㈊":`(ᄏ)`,"㈋":`(ᄐ)`,"㈌":`(ᄑ)`,"㈍":`(ᄒ)`,"㈎":`(가)`,"㈏":`(나)`,"㈐":`(다)`,"㈑":`(라)`,"㈒":`(마)`,"㈓":`(바)`,"㈔":`(사)`,"㈕":`(아)`,"㈖":`(자)`,"㈗":`(차)`,"㈘":`(카)`,"㈙":`(타)`,"㈚":`(파)`,"㈛":`(하)`,"㈜":`(주)`,"㈝":`(오전)`,"㈞":`(오후)`,"㈠":`(一)`,"㈡":`(二)`,"㈢":`(三)`,"㈣":`(四)`,"㈤":`(五)`,"㈥":`(六)`,"㈦":`(七)`,"㈧":`(八)`,"㈨":`(九)`,"㈩":`(十)`,"㈪":`(月)`,"㈫":`(火)`,"㈬":`(水)`,"㈭":`(木)`,"㈮":`(金)`,"㈯":`(土)`,"㈰":`(日)`,"㈱":`(株)`,"㈲":`(有)`,"㈳":`(社)`,"㈴":`(名)`,"㈵":`(特)`,"㈶":`(財)`,"㈷":`(祝)`,"㈸":`(労)`,"㈹":`(代)`,"㈺":`(呼)`,"㈻":`(学)`,"㈼":`(監)`,"㈽":`(企)`,"㈾":`(資)`,"㈿":`(協)`,"㉀":`(祭)`,"㉁":`(休)`,"㉂":`(自)`,"㉃":`(至)`,"㋀":`1月`,"㋁":`2月`,"㋂":`3月`,"㋃":`4月`,"㋄":`5月`,"㋅":`6月`,"㋆":`7月`,"㋇":`8月`,"㋈":`9月`,"㋉":`10月`,"㋊":`11月`,"㋋":`12月`,"㍘":`0点`,"㍙":`1点`,"㍚":`2点`,"㍛":`3点`,"㍜":`4点`,"㍝":`5点`,"㍞":`6点`,"㍟":`7点`,"㍠":`8点`,"㍡":`9点`,"㍢":`10点`,"㍣":`11点`,"㍤":`12点`,"㍥":`13点`,"㍦":`14点`,"㍧":`15点`,"㍨":`16点`,"㍩":`17点`,"㍪":`18点`,"㍫":`19点`,"㍬":`20点`,"㍭":`21点`,"㍮":`22点`,"㍯":`23点`,"㍰":`24点`,"㏠":`1日`,"㏡":`2日`,"㏢":`3日`,"㏣":`4日`,"㏤":`5日`,"㏥":`6日`,"㏦":`7日`,"㏧":`8日`,"㏨":`9日`,"㏩":`10日`,"㏪":`11日`,"㏫":`12日`,"㏬":`13日`,"㏭":`14日`,"㏮":`15日`,"㏯":`16日`,"㏰":`17日`,"㏱":`18日`,"㏲":`19日`,"㏳":`20日`,"㏴":`21日`,"㏵":`22日`,"㏶":`23日`,"㏷":`24日`,"㏸":`25日`,"㏹":`26日`,"㏺":`27日`,"㏻":`28日`,"㏼":`29日`,"㏽":`30日`,"㏾":`31日`,ff:`ff`,fi:`fi`,fl:`fl`,ffi:`ffi`,ffl:`ffl`,ſt:`ſt`,st:`st`,ﬓ:`մն`,ﬔ:`մե`,ﬕ:`մի`,ﬖ:`վն`,ﬗ:`մխ`,ﭏ:`אל`,ﭐ:`ٱ`,ﭑ:`ٱ`,ﭒ:`ٻ`,ﭓ:`ٻ`,ﭔ:`ٻ`,ﭕ:`ٻ`,ﭖ:`پ`,ﭗ:`پ`,ﭘ:`پ`,ﭙ:`پ`,ﭚ:`ڀ`,ﭛ:`ڀ`,ﭜ:`ڀ`,ﭝ:`ڀ`,ﭞ:`ٺ`,ﭟ:`ٺ`,ﭠ:`ٺ`,ﭡ:`ٺ`,ﭢ:`ٿ`,ﭣ:`ٿ`,ﭤ:`ٿ`,ﭥ:`ٿ`,ﭦ:`ٹ`,ﭧ:`ٹ`,ﭨ:`ٹ`,ﭩ:`ٹ`,ﭪ:`ڤ`,ﭫ:`ڤ`,ﭬ:`ڤ`,ﭭ:`ڤ`,ﭮ:`ڦ`,ﭯ:`ڦ`,ﭰ:`ڦ`,ﭱ:`ڦ`,ﭲ:`ڄ`,ﭳ:`ڄ`,ﭴ:`ڄ`,ﭵ:`ڄ`,ﭶ:`ڃ`,ﭷ:`ڃ`,ﭸ:`ڃ`,ﭹ:`ڃ`,ﭺ:`چ`,ﭻ:`چ`,ﭼ:`چ`,ﭽ:`چ`,ﭾ:`ڇ`,ﭿ:`ڇ`,ﮀ:`ڇ`,ﮁ:`ڇ`,ﮂ:`ڍ`,ﮃ:`ڍ`,ﮄ:`ڌ`,ﮅ:`ڌ`,ﮆ:`ڎ`,ﮇ:`ڎ`,ﮈ:`ڈ`,ﮉ:`ڈ`,ﮊ:`ژ`,ﮋ:`ژ`,ﮌ:`ڑ`,ﮍ:`ڑ`,ﮎ:`ک`,ﮏ:`ک`,ﮐ:`ک`,ﮑ:`ک`,ﮒ:`گ`,ﮓ:`گ`,ﮔ:`گ`,ﮕ:`گ`,ﮖ:`ڳ`,ﮗ:`ڳ`,ﮘ:`ڳ`,ﮙ:`ڳ`,ﮚ:`ڱ`,ﮛ:`ڱ`,ﮜ:`ڱ`,ﮝ:`ڱ`,ﮞ:`ں`,ﮟ:`ں`,ﮠ:`ڻ`,ﮡ:`ڻ`,ﮢ:`ڻ`,ﮣ:`ڻ`,ﮤ:`ۀ`,ﮥ:`ۀ`,ﮦ:`ہ`,ﮧ:`ہ`,ﮨ:`ہ`,ﮩ:`ہ`,ﮪ:`ھ`,ﮫ:`ھ`,ﮬ:`ھ`,ﮭ:`ھ`,ﮮ:`ے`,ﮯ:`ے`,ﮰ:`ۓ`,ﮱ:`ۓ`,ﯓ:`ڭ`,ﯔ:`ڭ`,ﯕ:`ڭ`,ﯖ:`ڭ`,ﯗ:`ۇ`,ﯘ:`ۇ`,ﯙ:`ۆ`,ﯚ:`ۆ`,ﯛ:`ۈ`,ﯜ:`ۈ`,ﯝ:`ٷ`,ﯞ:`ۋ`,ﯟ:`ۋ`,ﯠ:`ۅ`,ﯡ:`ۅ`,ﯢ:`ۉ`,ﯣ:`ۉ`,ﯤ:`ې`,ﯥ:`ې`,ﯦ:`ې`,ﯧ:`ې`,ﯨ:`ى`,ﯩ:`ى`,ﯪ:`ئا`,ﯫ:`ئا`,ﯬ:`ئە`,ﯭ:`ئە`,ﯮ:`ئو`,ﯯ:`ئو`,ﯰ:`ئۇ`,ﯱ:`ئۇ`,ﯲ:`ئۆ`,ﯳ:`ئۆ`,ﯴ:`ئۈ`,ﯵ:`ئۈ`,ﯶ:`ئې`,ﯷ:`ئې`,ﯸ:`ئې`,ﯹ:`ئى`,ﯺ:`ئى`,ﯻ:`ئى`,ﯼ:`ی`,ﯽ:`ی`,ﯾ:`ی`,ﯿ:`ی`,ﰀ:`ئج`,ﰁ:`ئح`,ﰂ:`ئم`,ﰃ:`ئى`,ﰄ:`ئي`,ﰅ:`بج`,ﰆ:`بح`,ﰇ:`بخ`,ﰈ:`بم`,ﰉ:`بى`,ﰊ:`بي`,ﰋ:`تج`,ﰌ:`تح`,ﰍ:`تخ`,ﰎ:`تم`,ﰏ:`تى`,ﰐ:`تي`,ﰑ:`ثج`,ﰒ:`ثم`,ﰓ:`ثى`,ﰔ:`ثي`,ﰕ:`جح`,ﰖ:`جم`,ﰗ:`حج`,ﰘ:`حم`,ﰙ:`خج`,ﰚ:`خح`,ﰛ:`خم`,ﰜ:`سج`,ﰝ:`سح`,ﰞ:`سخ`,ﰟ:`سم`,ﰠ:`صح`,ﰡ:`صم`,ﰢ:`ضج`,ﰣ:`ضح`,ﰤ:`ضخ`,ﰥ:`ضم`,ﰦ:`طح`,ﰧ:`طم`,ﰨ:`ظم`,ﰩ:`عج`,ﰪ:`عم`,ﰫ:`غج`,ﰬ:`غم`,ﰭ:`فج`,ﰮ:`فح`,ﰯ:`فخ`,ﰰ:`فم`,ﰱ:`فى`,ﰲ:`في`,ﰳ:`قح`,ﰴ:`قم`,ﰵ:`قى`,ﰶ:`قي`,ﰷ:`كا`,ﰸ:`كج`,ﰹ:`كح`,ﰺ:`كخ`,ﰻ:`كل`,ﰼ:`كم`,ﰽ:`كى`,ﰾ:`كي`,ﰿ:`لج`,ﱀ:`لح`,ﱁ:`لخ`,ﱂ:`لم`,ﱃ:`لى`,ﱄ:`لي`,ﱅ:`مج`,ﱆ:`مح`,ﱇ:`مخ`,ﱈ:`مم`,ﱉ:`مى`,ﱊ:`مي`,ﱋ:`نج`,ﱌ:`نح`,ﱍ:`نخ`,ﱎ:`نم`,ﱏ:`نى`,ﱐ:`ني`,ﱑ:`هج`,ﱒ:`هم`,ﱓ:`هى`,ﱔ:`هي`,ﱕ:`يج`,ﱖ:`يح`,ﱗ:`يخ`,ﱘ:`يم`,ﱙ:`يى`,ﱚ:`يي`,ﱛ:`ذٰ`,ﱜ:`رٰ`,ﱝ:`ىٰ`,ﱞ:` ٌّ`,ﱟ:` ٍّ`,ﱠ:` َّ`,ﱡ:` ُّ`,ﱢ:` ِّ`,ﱣ:` ّٰ`,ﱤ:`ئر`,ﱥ:`ئز`,ﱦ:`ئم`,ﱧ:`ئن`,ﱨ:`ئى`,ﱩ:`ئي`,ﱪ:`بر`,ﱫ:`بز`,ﱬ:`بم`,ﱭ:`بن`,ﱮ:`بى`,ﱯ:`بي`,ﱰ:`تر`,ﱱ:`تز`,ﱲ:`تم`,ﱳ:`تن`,ﱴ:`تى`,ﱵ:`تي`,ﱶ:`ثر`,ﱷ:`ثز`,ﱸ:`ثم`,ﱹ:`ثن`,ﱺ:`ثى`,ﱻ:`ثي`,ﱼ:`فى`,ﱽ:`في`,ﱾ:`قى`,ﱿ:`قي`,ﲀ:`كا`,ﲁ:`كل`,ﲂ:`كم`,ﲃ:`كى`,ﲄ:`كي`,ﲅ:`لم`,ﲆ:`لى`,ﲇ:`لي`,ﲈ:`ما`,ﲉ:`مم`,ﲊ:`نر`,ﲋ:`نز`,ﲌ:`نم`,ﲍ:`نن`,ﲎ:`نى`,ﲏ:`ني`,ﲐ:`ىٰ`,ﲑ:`ير`,ﲒ:`يز`,ﲓ:`يم`,ﲔ:`ين`,ﲕ:`يى`,ﲖ:`يي`,ﲗ:`ئج`,ﲘ:`ئح`,ﲙ:`ئخ`,ﲚ:`ئم`,ﲛ:`ئه`,ﲜ:`بج`,ﲝ:`بح`,ﲞ:`بخ`,ﲟ:`بم`,ﲠ:`به`,ﲡ:`تج`,ﲢ:`تح`,ﲣ:`تخ`,ﲤ:`تم`,ﲥ:`ته`,ﲦ:`ثم`,ﲧ:`جح`,ﲨ:`جم`,ﲩ:`حج`,ﲪ:`حم`,ﲫ:`خج`,ﲬ:`خم`,ﲭ:`سج`,ﲮ:`سح`,ﲯ:`سخ`,ﲰ:`سم`,ﲱ:`صح`,ﲲ:`صخ`,ﲳ:`صم`,ﲴ:`ضج`,ﲵ:`ضح`,ﲶ:`ضخ`,ﲷ:`ضم`,ﲸ:`طح`,ﲹ:`ظم`,ﲺ:`عج`,ﲻ:`عم`,ﲼ:`غج`,ﲽ:`غم`,ﲾ:`فج`,ﲿ:`فح`,ﳀ:`فخ`,ﳁ:`فم`,ﳂ:`قح`,ﳃ:`قم`,ﳄ:`كج`,ﳅ:`كح`,ﳆ:`كخ`,ﳇ:`كل`,ﳈ:`كم`,ﳉ:`لج`,ﳊ:`لح`,ﳋ:`لخ`,ﳌ:`لم`,ﳍ:`له`,ﳎ:`مج`,ﳏ:`مح`,ﳐ:`مخ`,ﳑ:`مم`,ﳒ:`نج`,ﳓ:`نح`,ﳔ:`نخ`,ﳕ:`نم`,ﳖ:`نه`,ﳗ:`هج`,ﳘ:`هم`,ﳙ:`هٰ`,ﳚ:`يج`,ﳛ:`يح`,ﳜ:`يخ`,ﳝ:`يم`,ﳞ:`يه`,ﳟ:`ئم`,ﳠ:`ئه`,ﳡ:`بم`,ﳢ:`به`,ﳣ:`تم`,ﳤ:`ته`,ﳥ:`ثم`,ﳦ:`ثه`,ﳧ:`سم`,ﳨ:`سه`,ﳩ:`شم`,ﳪ:`شه`,ﳫ:`كل`,ﳬ:`كم`,ﳭ:`لم`,ﳮ:`نم`,ﳯ:`نه`,ﳰ:`يم`,ﳱ:`يه`,ﳲ:`ـَّ`,ﳳ:`ـُّ`,ﳴ:`ـِّ`,ﳵ:`طى`,ﳶ:`طي`,ﳷ:`عى`,ﳸ:`عي`,ﳹ:`غى`,ﳺ:`غي`,ﳻ:`سى`,ﳼ:`سي`,ﳽ:`شى`,ﳾ:`شي`,ﳿ:`حى`,ﴀ:`حي`,ﴁ:`جى`,ﴂ:`جي`,ﴃ:`خى`,ﴄ:`خي`,ﴅ:`صى`,ﴆ:`صي`,ﴇ:`ضى`,ﴈ:`ضي`,ﴉ:`شج`,ﴊ:`شح`,ﴋ:`شخ`,ﴌ:`شم`,ﴍ:`شر`,ﴎ:`سر`,ﴏ:`صر`,ﴐ:`ضر`,ﴑ:`طى`,ﴒ:`طي`,ﴓ:`عى`,ﴔ:`عي`,ﴕ:`غى`,ﴖ:`غي`,ﴗ:`سى`,ﴘ:`سي`,ﴙ:`شى`,ﴚ:`شي`,ﴛ:`حى`,ﴜ:`حي`,ﴝ:`جى`,ﴞ:`جي`,ﴟ:`خى`,ﴠ:`خي`,ﴡ:`صى`,ﴢ:`صي`,ﴣ:`ضى`,ﴤ:`ضي`,ﴥ:`شج`,ﴦ:`شح`,ﴧ:`شخ`,ﴨ:`شم`,ﴩ:`شر`,ﴪ:`سر`,ﴫ:`صر`,ﴬ:`ضر`,ﴭ:`شج`,ﴮ:`شح`,ﴯ:`شخ`,ﴰ:`شم`,ﴱ:`سه`,ﴲ:`شه`,ﴳ:`طم`,ﴴ:`سج`,ﴵ:`سح`,ﴶ:`سخ`,ﴷ:`شج`,ﴸ:`شح`,ﴹ:`شخ`,ﴺ:`طم`,ﴻ:`ظم`,ﴼ:`اً`,ﴽ:`اً`,ﵐ:`تجم`,ﵑ:`تحج`,ﵒ:`تحج`,ﵓ:`تحم`,ﵔ:`تخم`,ﵕ:`تمج`,ﵖ:`تمح`,ﵗ:`تمخ`,ﵘ:`جمح`,ﵙ:`جمح`,ﵚ:`حمي`,ﵛ:`حمى`,ﵜ:`سحج`,ﵝ:`سجح`,ﵞ:`سجى`,ﵟ:`سمح`,ﵠ:`سمح`,ﵡ:`سمج`,ﵢ:`سمم`,ﵣ:`سمم`,ﵤ:`صحح`,ﵥ:`صحح`,ﵦ:`صمم`,ﵧ:`شحم`,ﵨ:`شحم`,ﵩ:`شجي`,ﵪ:`شمخ`,ﵫ:`شمخ`,ﵬ:`شمم`,ﵭ:`شمم`,ﵮ:`ضحى`,ﵯ:`ضخم`,ﵰ:`ضخم`,ﵱ:`طمح`,ﵲ:`طمح`,ﵳ:`طمم`,ﵴ:`طمي`,ﵵ:`عجم`,ﵶ:`عمم`,ﵷ:`عمم`,ﵸ:`عمى`,ﵹ:`غمم`,ﵺ:`غمي`,ﵻ:`غمى`,ﵼ:`فخم`,ﵽ:`فخم`,ﵾ:`قمح`,ﵿ:`قمم`,ﶀ:`لحم`,ﶁ:`لحي`,ﶂ:`لحى`,ﶃ:`لجج`,ﶄ:`لجج`,ﶅ:`لخم`,ﶆ:`لخم`,ﶇ:`لمح`,ﶈ:`لمح`,ﶉ:`محج`,ﶊ:`محم`,ﶋ:`محي`,ﶌ:`مجح`,ﶍ:`مجم`,ﶎ:`مخج`,ﶏ:`مخم`,ﶒ:`مجخ`,ﶓ:`همج`,ﶔ:`همم`,ﶕ:`نحم`,ﶖ:`نحى`,ﶗ:`نجم`,ﶘ:`نجم`,ﶙ:`نجى`,ﶚ:`نمي`,ﶛ:`نمى`,ﶜ:`يمم`,ﶝ:`يمم`,ﶞ:`بخي`,ﶟ:`تجي`,ﶠ:`تجى`,ﶡ:`تخي`,ﶢ:`تخى`,ﶣ:`تمي`,ﶤ:`تمى`,ﶥ:`جمي`,ﶦ:`جحى`,ﶧ:`جمى`,ﶨ:`سخى`,ﶩ:`صحي`,ﶪ:`شحي`,ﶫ:`ضحي`,ﶬ:`لجي`,ﶭ:`لمي`,ﶮ:`يحي`,ﶯ:`يجي`,ﶰ:`يمي`,ﶱ:`ممي`,ﶲ:`قمي`,ﶳ:`نحي`,ﶴ:`قمح`,ﶵ:`لحم`,ﶶ:`عمي`,ﶷ:`كمي`,ﶸ:`نجح`,ﶹ:`مخي`,ﶺ:`لجم`,ﶻ:`كمم`,ﶼ:`لجم`,ﶽ:`نجح`,ﶾ:`جحي`,ﶿ:`حجي`,ﷀ:`مجي`,ﷁ:`فمي`,ﷂ:`بحي`,ﷃ:`كمم`,ﷄ:`عجم`,ﷅ:`صمم`,ﷆ:`سخي`,ﷇ:`نجي`,"﹉":`‾`,"﹊":`‾`,"﹋":`‾`,"﹌":`‾`,"﹍":`_`,"﹎":`_`,"﹏":`_`,ﺀ:`ء`,ﺁ:`آ`,ﺂ:`آ`,ﺃ:`أ`,ﺄ:`أ`,ﺅ:`ؤ`,ﺆ:`ؤ`,ﺇ:`إ`,ﺈ:`إ`,ﺉ:`ئ`,ﺊ:`ئ`,ﺋ:`ئ`,ﺌ:`ئ`,ﺍ:`ا`,ﺎ:`ا`,ﺏ:`ب`,ﺐ:`ب`,ﺑ:`ب`,ﺒ:`ب`,ﺓ:`ة`,ﺔ:`ة`,ﺕ:`ت`,ﺖ:`ت`,ﺗ:`ت`,ﺘ:`ت`,ﺙ:`ث`,ﺚ:`ث`,ﺛ:`ث`,ﺜ:`ث`,ﺝ:`ج`,ﺞ:`ج`,ﺟ:`ج`,ﺠ:`ج`,ﺡ:`ح`,ﺢ:`ح`,ﺣ:`ح`,ﺤ:`ح`,ﺥ:`خ`,ﺦ:`خ`,ﺧ:`خ`,ﺨ:`خ`,ﺩ:`د`,ﺪ:`د`,ﺫ:`ذ`,ﺬ:`ذ`,ﺭ:`ر`,ﺮ:`ر`,ﺯ:`ز`,ﺰ:`ز`,ﺱ:`س`,ﺲ:`س`,ﺳ:`س`,ﺴ:`س`,ﺵ:`ش`,ﺶ:`ش`,ﺷ:`ش`,ﺸ:`ش`,ﺹ:`ص`,ﺺ:`ص`,ﺻ:`ص`,ﺼ:`ص`,ﺽ:`ض`,ﺾ:`ض`,ﺿ:`ض`,ﻀ:`ض`,ﻁ:`ط`,ﻂ:`ط`,ﻃ:`ط`,ﻄ:`ط`,ﻅ:`ظ`,ﻆ:`ظ`,ﻇ:`ظ`,ﻈ:`ظ`,ﻉ:`ع`,ﻊ:`ع`,ﻋ:`ع`,ﻌ:`ع`,ﻍ:`غ`,ﻎ:`غ`,ﻏ:`غ`,ﻐ:`غ`,ﻑ:`ف`,ﻒ:`ف`,ﻓ:`ف`,ﻔ:`ف`,ﻕ:`ق`,ﻖ:`ق`,ﻗ:`ق`,ﻘ:`ق`,ﻙ:`ك`,ﻚ:`ك`,ﻛ:`ك`,ﻜ:`ك`,ﻝ:`ل`,ﻞ:`ل`,ﻟ:`ل`,ﻠ:`ل`,ﻡ:`م`,ﻢ:`م`,ﻣ:`م`,ﻤ:`م`,ﻥ:`ن`,ﻦ:`ن`,ﻧ:`ن`,ﻨ:`ن`,ﻩ:`ه`,ﻪ:`ه`,ﻫ:`ه`,ﻬ:`ه`,ﻭ:`و`,ﻮ:`و`,ﻯ:`ى`,ﻰ:`ى`,ﻱ:`ي`,ﻲ:`ي`,ﻳ:`ي`,ﻴ:`ي`,ﻵ:`لآ`,ﻶ:`لآ`,ﻷ:`لأ`,ﻸ:`لأ`,ﻹ:`لإ`,ﻺ:`لإ`,ﻻ:`لا`,ﻼ:`لا`};function On(e){var t=e.length;if(t<=1||!Tn(e.charCodeAt(0)))return e;for(var n=``,r=t-1;r>=0;r--)n+=e[r];return n}function kn(e,t){for(var n=t.charsToGlyphs(e),r=``,i=0,a=n.length;i<a;i++){var o=n[i];if(o){var s=o.unicode;s in Dn&&(s=Dn[s]),r+=On(s)}}return r}function An(e){if(e.fontMatrix[0]!==ye[0]){var t=.001/e.fontMatrix[0],n=e.widths;for(var r in n)n[r]*=t;e.defaultWidth*=t}}var jn=(function(){function e(e,t,n){this.name=e,this.loadedName=n.loadedName,this.coded=n.coded,this.loadCharProcs=n.coded,this.sizes=[];var r=e.split(`+`);r=r.length>1?r[1]:r[0],r=r.split(/[-,_]/g)[0],this.isSerifFont=!!(n.flags&an.Serif),this.isSymbolicFont=!!(n.flags&an.Symbolic),this.isMonospace=!!(n.flags&an.FixedPitch);var i=n.type;if(this.type=i,this.fallbackName=this.isMonospace?`monospace`:this.isSerifFont?`serif`:`sans-serif`,this.differences=n.differences,this.widths=n.widths,this.defaultWidth=n.defaultWidth,this.composite=n.composite,this.wideChars=n.wideChars,this.hasEncoding=n.hasEncoding,this.cmap=n.cmap,this.fontMatrix=n.fontMatrix,n.type==`Type3`){if(this.encoding=n.baseEncoding,this.disableFontFace=!0,this.loadedName=this.loadedName||`Type3Font`,n.toUnicode)this.toUnicode=n.toUnicode;else{let e={},t=n.baseEncoding||[];for(let n=0;n<t.length;n++){let r=t[n];r&&$n[r]&&(e[n]=String.fromCharCode($n[r]))}if(n.differences&&n.differences.length){for(let t=0;t<256;t++)if(n.differences[t]){let r=n.differences[t];typeof r==`string`&&$n[r]&&(e[t]=String.fromCharCode($n[r]))}}this.toUnicode=e}}else if(this.loadCidToUnicode(n),this.cidEncoding=n.cidEncoding,this.vertical=n.vertical,this.vertical&&(this.vmetrics=n.vmetrics,this.defaultVMetrics=n.defaultVMetrics),n.toUnicode&&n.toUnicode.length>0?this.toUnicode=n.toUnicode:this.rebuildToUnicode(n),this.toFontChar=this.buildToFontChar(this.toUnicode),!t){var a=e.replace(/[,_]/g,`-`);a=sn[a]||cn[a]||a,this.bold=a.search(/bold/gi)!=-1,this.italic=a.search(/oblique/gi)!=-1||a.search(/italic/gi)!=-1,this.black=e.search(/Black/g)!=-1,this.encoding=n.baseEncoding,this.noUnicodeAdaptation=!0,this.loadedName=a.split(`-`)[0],this.loading=!1}else{var o=n.subtype;o==`Type1C`&&i!=`Type1`&&i!=`MMType1`&&(i=`Type1`),o==`CIDFontType0C`&&i!=`CIDFontType0`&&(i=`CIDFontType0`),o===`OpenType`&&(i=`OpenType`);var s;switch(i){case`Type1`:case`CIDFontType0`:this.mimetype=`font/opentype`;var c=o==`Type1C`||o==`CIDFontType0C`?new Ln(t,n):new In(e,t,n);An(n),s=this.convert(e,c,n);break;case`OpenType`:case`TrueType`:case`CIDFontType2`:this.mimetype=`font/opentype`,s=this.checkAndRepair(e,t,n);break;default:H(`Font `+i+` is not supported`)}this.data=s,this.fontMatrix=n.fontMatrix,this.widths=n.widths,this.defaultWidth=n.defaultWidth,this.encoding=n.baseEncoding,this.seacMap=n.seacMap,this.loading=!0}}function t(e){for(var t=[],n=0,r=e.length;n<r;++n)t[n]=e.charCodeAt(n);return t}function n(e){for(var t=``,n=0,r=e.length;n<r;++n)t+=String.fromCharCode(e[n]);return t}function r(e){return(e[0]<<8)+(e[1]&255)}function i(e){return(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+(e[3]&255)}function a(e){for(var t=0,n=e;n>=2;)n/=2,t++;n=2;for(var r=1;r<t;r++)n*=2;return n}function o(e){return String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)}function s(e){return e=e>32767?32767:e<-32768?-32768:e,String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)}function c(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)}function l(e,t,n){e==`true`&&(e=c(65536));var r=e;r+=o(n);var i=a(n),s=i*16;r+=o(s),r+=o(Math.log(i)/Math.log(2)),r+=o(n*16-s),t.file+=r,t.virtualOffset+=r.length}function u(e,t,n){for(var r=e.virtualOffset,a=n.length;n.length&3;)n.push(0);for(;e.virtualOffset&3;)e.virtualOffset++;for(var o=0,s=n.length,l=0;l<s;l+=4)o=o+i([n[l],n[l+1],n[l+2],n[l+3]])|0;var u=t+c(o)+c(r)+c(a);e.file+=u,e.virtualOffset+=n.length}function d(e,t){for(var n=[],r=e.length,i=0;i<r;++i)n.push({unicode:e[i].unicode,code:i});n.sort(function(e,t){return e.unicode-t.unicode});for(var a=[],i=0;i<r;){var o=n[i].unicode,s=[t?t[n[i].code]:n[i].code+1];++i;for(var c=o;i<r&&c+1==n[i].unicode&&(s.push(t?t[n[i].code]:n[i].code+1),++c,++i,c!==65535););a.push([o,c,s])}return a}function f(e,n){for(var r=d(e,n),i=r[r.length-1][1]>65535?2:1,s=`\0\0`+o(i)+`\0\0`+c(4+i*8),l=r.length-1;l>=0&&!(r[l][0]<=65535);--l);var u=l+1;r[l][0]<65535&&r[l][1]===65535&&(r[l][1]=65534);for(var f=+(r[l][1]<65535),p=u+f,m=p*2,h=a(p)*2,g=Math.log(p)/Math.log(2),_=2*p-h,v=``,y=``,b=``,x=``,S=``,C=0,l=0,w=u;l<w;l++){var T=r[l],E=T[0],D=T[1];v+=o(E),y+=o(D);for(var O=T[2],k=!0,A=1,j=O.length;A<j;++A)if(O[A]!==O[A-1]+1){k=!1;break}if(k){var M=O[0];b+=o(M-E&65535),x+=o(0)}else{var N=(p-l)*2+C*2;C+=D-E+1,b+=o(0),x+=o(N);for(var A=0,j=O.length;A<j;++A)S+=o(O[A])}}f>0&&(y+=`ÿÿ`,v+=`ÿÿ`,b+=`\0`,x+=`\0\0`);var P=`\0\0`+o(m)+o(h)+o(g)+o(_)+y+`\0\0`+v+b+x+S,F=``,I=``;if(i>1){s+=`\0\0
|
|
4
4
|
`+c(4+i*8+4+P.length),F=``;for(var l=0,w=r.length;l<w;l++){for(var T=r[l],E=T[0],O=T[2],L=O[0],A=1,j=O.length;A<j;++A)if(O[A]!==O[A-1]+1){var D=T[0]+A-1;F+=c(E)+c(D)+c(L),E=D+1,L=O[A]}F+=c(E)+c(T[1])+c(L)}I=`\0\f\0\0`+c(F.length+16)+`\0\0\0\0`+c(F.length/12)}return t(s+`\0`+o(P.length+4)+P+I+F)}function p(e){var t=new sr(e.data),n=r(t.getBytes(2));t.getBytes(60);var i=r(t.getBytes(2));return n<4&&i&768||r(t.getBytes(2))>r(t.getBytes(2))||(t.getBytes(6),r(t.getBytes(2))===0)?!1:(e.data[8]=e.data[9]=0,!0)}function m(e,t,n){n||={unitsPerEm:0,yMax:0,yMin:0,ascent:0,descent:0};var r=0,i=0,a=0,s=0,l=null,u=0;if(t)for(var d=0;d<t.length;++d){var f=t[d].unicode;(l>f||!l)&&(l=f),u<f&&(u=f);var p=wn(f);p<32?r|=1<<p:p<64?i|=1<<p-32:p<96?a|=1<<p-64:p<123?s|=1<<p-96:H(`Unicode ranges Bits > 123 are reserved for internal usage`)}else l=0,u=255;var m=e.bbox||[0,0,0,0],h=n.unitsPerEm||1/(e.fontMatrix||ye)[0],g=e.ascentScaled?1:h/rn,_=n.ascent||Math.round(g*(e.ascent||m[3])),v=n.descent||Math.round(g*(e.descent||m[1]));v>0&&e.descent>0&&m[1]<0&&(v=-v);var y=n.yMax||_,b=-n.yMin||-v;return`\0$ô\0\0\0»\0\0\0»\0\0ß\x001\0\0\0\0`+String.fromCharCode(e.fixedPitch?9:0)+`\0\0\0\0\0\0`+c(r)+c(i)+c(a)+c(s)+`*21*`+o(+!!e.italicAngle)+o(l||e.firstChar)+o(u||e.lastChar)+o(_)+o(v)+`\0d`+o(y)+o(b)+`\0\0\0\0\0\0\0\0`+o(e.xHeight)+o(e.capHeight)+o(0)+o(l||e.firstChar)+`\0`}function h(e){return`\0\0\0`+c(Math.floor(e.italicAngle*2**16))+`\0\0\0\0`+c(e.fixedPitch)+`\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`}function g(e,t){t||=[[],[]];for(var n=[t[0][0]||`Original licence`,t[0][1]||e,t[0][2]||`Unknown`,t[0][3]||`uniqueID`,t[0][4]||e,t[0][5]||`Version 0.11`,t[0][6]||``,t[0][7]||`Unknown`,t[0][8]||`Unknown`,t[0][9]||`Unknown`],r=[],i=0,a=n.length;i<a;i++){for(var s=t[1][i]||n[i],c=``,l=0,u=s.length;l<u;l++)c+=o(s.charCodeAt(l));r.push(c)}for(var d=[n,r],f=[`\0`,`\0`],p=[`\0\0`,`\0`],m=[`\0\0`,` `],h=n.length*f.length,g=`\0\0`+o(h)+o(h*12+6),_=0,i=0,a=f.length;i<a;i++)for(var v=d[i],l=0,u=v.length;l<u;l++){var s=v[l],y=f[i]+p[i]+m[i]+o(l)+o(s.length)+o(_);g+=y,_+=s.length}return g+=n.join(``)+r.join(``),g}function _(e,t,n,r){var i;if(t)(n===3&&r===0||n===1&&r===0)&&(i=nn|e&255);else if(n===3&&r===1)i=e;else if(n===1&&r===0){var a=on.MacRomanEncoding[e];a&&(i=$n[a])}return i}return e.prototype={name:null,font:null,mimetype:null,encoding:null,get renderer(){var e=Qn.create(this);return ke(this,`renderer`,e)},exportData:function(){var e={};for(var t in this)this.hasOwnProperty(t)&&(e[t]=this[t]);return e},checkAndRepair:function(e,a,o){function s(e){var t=e.getBytes(4);t=String.fromCharCode(t[0])+String.fromCharCode(t[1])+String.fromCharCode(t[2])+String.fromCharCode(t[3]);var n=i(e.getBytes(4)),r=i(e.getBytes(4)),a=i(e.getBytes(4)),o=e.pos;e.pos=e.start?e.start:0,e.skip(r);var s=e.getBytes(a);return e.pos=o,t==`head`&&(s[8]=s[9]=s[10]=s[11]=0,s[17]|=32),{tag:t,checksum:n,length:a,offset:r,data:s}}function c(e){return{version:n(e.getBytes(4)),numTables:r(e.getBytes(2)),searchRange:r(e.getBytes(2)),entrySelector:r(e.getBytes(2)),rangeShift:r(e.getBytes(2))}}function d(e,t,n){var r=n.glyphNames;if(!r)n.glyphNameMap={};else{for(var i=e.length,a={},o=[],s=0;s<i;++s){var c=r[t[s]];if(c){a[c]=e[s].unicode;var l=e[s].code;o[l]=c}}n.glyphNameMap=a,n.overridableEncoding&&(n.baseEncoding=o)}}function v(e,t,n,a){var o=(t.start?t.start:0)+e.offset;t.pos=o,r(t.getBytes(2));for(var s=r(t.getBytes(2)),c,l,u=0;u<s;u++){var d=r(t.getBytes(2)),f=r(t.getBytes(2)),p=i(t.getBytes(4)),m=!1,h=!1;if(a&&d===3&&f===0?(m=!0,h=!0,l=!0):n&&d===3&&f===1?(m=!0,h=!0,l=!0,a=!1):d===1&&f===0&&!l?(m=!0,l=!0):c||(m=!0),m&&(c={platformId:d,encodingId:f,offset:p,isSymbolicFont:a}),h)break}if(!c)H(`Could not find a cmap table`);else{l||(V(`Did not find a cmap of suitable format. Interpreting (`+c.platformId+`, `+c.encodingId+`) as (3, 1) table`),c.platformId=3,c.encodingId=1),t.pos=o+c.offset;var g=r(t.getBytes(2));r(t.getBytes(2)),r(t.getBytes(2));var _=!1,v=[];if(g===0){for(var y=0;y<256;y++){var b=t.getByte();b&&v.push({charcode:y,glyphId:b})}_=!0}else if(g===4){var x=r(t.getBytes(2))>>1;t.getBytes(6);var S,C=[];for(S=0;S<x;S++)C.push({end:r(t.getBytes(2))});for(t.getBytes(2),S=0;S<x;S++)C[S].start=r(t.getBytes(2));for(S=0;S<x;S++)C[S].delta=r(t.getBytes(2));var w=0;for(S=0;S<x;S++){var T=C[S],E=r(t.getBytes(2));if(!E)T.offsetIndex=-1;else{var D=(E>>1)-(x-S);T.offsetIndex=D,w=Math.max(w,D+T.end-T.start+1)}}for(var O=[],y=0;y<w;y++)O.push(r(t.getBytes(2)));for(S=0;S<x;S++)for(var T=C[S],o=T.start,k=T.end,A=T.delta,D=T.offsetIndex,y=o;y<=k;y++)if(y!=65535){var j=D<0?y:O[D+y-o];j=j+A&65535,j!==0&&v.push({charcode:y,glyphId:j})}}else if(g==6)for(var M=r(t.getBytes(2)),N=r(t.getBytes(2)),y=0;y<N;y++){var j=r(t.getBytes(2)),P=M+y;v.push({charcode:P,glyphId:j})}else H(`cmap table has unsupported format: `+g);v.sort(function(e,t){return e.charcode-t.charcode});for(var u=1;u<v.length;u++)v[u-1].charcode===v[u].charcode&&(v.splice(u,1),u--);return{platformId:c.platformId,encodingId:c.encodingId,isSymbolicFont:c.isSymbolicFont,mappings:v,hasShortCmap:_}}}function y(e,n,i,a){if(!n)i&&(i.data=null);else{e.pos=(e.start?e.start:0)+n.offset,e.pos+=n.length-2;var o=r(e.getBytes(2));o>a&&(B(`The numOfMetrics (`+o+`) should not be greater than the numGlyphs (`+a+`)`),o=a,n.data[34]=(o&65280)>>8,n.data[35]=o&255);var s=a-o-(i.length-o*4>>1);if(s>0){e.pos=(e.start?e.start:0)+i.offset;for(var c=``,l=0,u=i.length;l<u;l++)c+=String.fromCharCode(e.getByte());for(var l=0;l<s;l++)c+=`\0\0`;i.data=t(c)}}}function b(e,t,n,r,i,a){if(n-t<=12)return 0;var o=e.subarray(t,n),s=o[0]<<8|o[1];if(s&32768)return r.set(o,i),o.length;for(var c=10,l=0,u=0;u<s;u++)l=(o[c]<<8|o[c+1])+1,c+=2;var d=c,f=o[c]<<8|o[c+1];c+=2+f;for(var p=c,m=0,u=0;u<l;u++){var h=o[c++];h&192&&(o[c-1]=h&63);var g=(h&2?1:h&16?0:2)+(h&4?1:h&32?0:2);if(m+=g,h&8){var _=o[c++];u+=_,m+=_*g}}if(m===0)return 0;var v=c+m;return v>o.length?0:!a&&f>0?(r.set(o.subarray(0,d),i),r.set([0,0],i+d),r.set(o.subarray(p,v),i+d+2),v-=f,o.length-v>3&&(v=v+3&-4),v):o.length-v>3?(v=v+3&-4,r.set(o.subarray(0,v),i),v):(r.set(o,i),o.length)}function x(e,t,n){var a=e.data,o=i([a[0],a[1],a[2],a[3]]);o>>16!=1&&(B(`Attempting to fix invalid version in head table: `+o),a[0]=0,a[1]=1,a[2]=0,a[3]=0);var s=r([a[50],a[51]]);if(s<0||s>1){B(`Attempting to fix invalid indexToLocFormat in head table: `+s);var c=t+1;n===c<<1?(a[50]=0,a[51]=0):n===c<<2?(a[50]=0,a[51]=1):V(`Could not fix indexToLocFormat: `+s)}}function S(e,t,n,r,i,a){var o,s,c;r?(o=4,s=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]},c=function(e,t,n){e[t]=n>>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255}):(o=2,s=function(e,t){return e[t]<<9|e[t+1]<<1},c=function(e,t,n){e[t]=n>>9&255,e[t+1]=n>>1&255});var l=e.data,u=o*(1+n);l.length!==u&&(l=new Uint8Array(u),l.set(e.data.subarray(0,u)),e.data=l);var d=t.data,f=d.length,p=new Uint8Array(f),m=s(l,0),h=0;c(l,0,h);for(var g=0,_=o;g<n;g++,_+=o){var v=s(l,_);if(v>f)c(l,_,h),m=v;else{var y=b(d,m,v,p,h,i);h+=y,c(l,_,h),m=v}}if(h===0){for(var x=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]),g=0,_=o;g<n;g++,_+=o)c(l,_,x.length);t.data=x}else if(a){var S=s(l,o);p.length>S+h?t.data=p.subarray(0,S+h):(t.data=new Uint8Array(S+h),t.data.set(p.subarray(0,h))),t.data.set(p.subarray(0,S),h),c(e.data,l.length-o,h+S)}else t.data=p.subarray(0,h)}function C(e,t,n){var o=(a.start?a.start:0)+e.offset;a.pos=o;var s=o+e.length,c=i(a.getBytes(4));a.getBytes(28);var l,u=!0;switch(c){case 65536:l=Cn;break;case 131072:var d=r(a.getBytes(2));if(d!=n){u=!1;break}for(var f=[],p=0;p<d;++p){var m=r(a.getBytes(2));if(m>=32768){u=!1;break}f.push(m)}if(!u)break;for(var h=[];a.pos<s;){for(var g=a.getByte(),_=``,p=0;p<g;++p)_+=String.fromCharCode(a.getByte());h.push(_)}l=[];for(var p=0;p<d;++p){var v=f[p];v<258?l.push(Cn[v]):l.push(h[v-258])}break;case 196608:break;default:V(`Unknown/unsupported post table version `+c),u=!1}return t.glyphNames=l,u}function w(e){var t=(a.start?a.start:0)+e.offset;a.pos=t;var n=[[],[]],i=e.length,o=t+i;if(r(a.getBytes(2))!==0||i<6)return n;for(var s=r(a.getBytes(2)),c=r(a.getBytes(2)),l=[],u=12,d=0;d<s&&a.pos+u<=o;d++){var f={platform:r(a.getBytes(2)),encoding:r(a.getBytes(2)),language:r(a.getBytes(2)),name:r(a.getBytes(2)),length:r(a.getBytes(2)),offset:r(a.getBytes(2))};(f.platform==1&&f.encoding===0&&f.language===0||f.platform==3&&f.encoding==1&&f.language==1033)&&l.push(f)}for(var d=0,p=l.length;d<p;d++){var m=l[d],h=t+c+m.offset;if(!(h+m.length>o)){a.pos=h;var g=m.name;if(m.encoding,m.encoding){for(var _=``,v=0,y=m.length;v<y;v+=2)_+=String.fromCharCode(r(a.getBytes(2)));n[1][g]=_}else n[0][g]=Re(a.getBytes(m.length))}}return n}var T=[0,0,0,0,0,0,0,0,-2,-2,-2,-2,0,0,-2,-5,-1,-1,-1,-1,-1,-1,-1,-1,0,0,-1,0,-1,-1,-1,-1,1,-1,-999,0,1,0,-1,-2,0,-1,-2,-1,-1,0,-1,-1,0,0,-999,-999,-1,-1,-1,-1,-2,-999,-2,-2,-999,0,-2,-2,0,0,-2,0,-2,0,0,0,-2,-1,-1,1,1,0,0,-1,-1,-1,-1,-1,-1,-1,0,0,-1,0,-1,-1,0,-999,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,-2,-999,-999,-999,-999,-999,-1,-1,-2,-2,0,0,0,0,-1,-1,-999,-2,-2,0,0,-1,-2,-2,0,0,0,-1,-1,-1,-2];function E(e,t){for(var n=e.data,r=0,i,a=0,o=0,s=[],c=[],l=[],u=t.tooComplexToFollowFunctions,d=!1,f=0,p=0,m=n.length;r<m;){var h=n[r++];if(h===64){if(i=n[r++],d||p)r+=i;else for(var g=0;g<i;g++)s.push(n[r++])}else if(h===65){if(i=n[r++],d||p)r+=i*2;else for(var g=0;g<i;g++){var _=n[r++];s.push(_<<8|n[r++])}}else if((h&248)==176){if(i=h-176+1,d||p)r+=i;else for(var g=0;g<i;g++)s.push(n[r++])}else if((h&248)==184){if(i=h-184+1,d||p)r+=i*2;else for(var g=0;g<i;g++){var _=n[r++];s.push(_<<8|n[r++])}}else if(h===43&&!u){if(!d&&!p){var v=s[s.length-1];if(t.functionsUsed[v]=!0,v in t.functionsStackDeltas)s.length+=t.functionsStackDeltas[v];else if(v in t.functionsDefined&&l.indexOf(v)<0){c.push({data:n,i:r,stackTop:s.length-1}),l.push(v);var y=t.functionsDefined[v];if(!y){V(`TT: CALL non-existent function`),t.hintsValid=!1;return}n=y.data,r=y.i}}}else if(h===44&&!u){(d||p)&&(V(`TT: nested FDEFs not allowed`),u=!0),d=!0,o=r;var v=s.pop();t.functionsDefined[v]={data:n,i:r}}else if(h===45){if(d)d=!1,a=r;else{var y=c.pop();if(!y){V(`TT: ENDF bad stack`),t.hintsValid=!1;return}var v=l.pop();n=y.data,r=y.i,t.functionsStackDeltas[v]=s.length-y.stackTop}}else if(h===137)(d||p)&&(V(`TT: nested IDEFs not allowed`),u=!0),d=!0,o=r;else if(h===88)++f;else if(h===27)p=f;else if(h===89)p===f&&(p=0),--f;else if(h===28){var b=s[s.length-1];b>0&&(r+=b-1)}if(!d&&!p){var x=h<=142?T[h]:h>=192&&h<=223?-1:h>=224?-2:0;for(h>=113&&h<=117&&(i=s.pop(),i===i&&(x=-i*2));x<0&&s.length>0;)s.pop(),x++;for(;x>0;)s.push(NaN),x--}}t.tooComplexToFollowFunctions=u;var S=[n];r>n.length&&S.push(new Uint8Array(r-n.length)),o>a&&(V(`TT: complementing a missing function tail`),S.push(new Uint8Array([34,45]))),O(e,S)}function D(e,t){if(!e.tooComplexToFollowFunctions)for(var n=0,r=e.functionsUsed.length;n<r;n++){if(n>t){V(`TT: invalid function id: `+n),e.hintsValid=!1;return}if(e.functionsUsed[n]&&!e.functionsDefined[n]){V(`TT: undefined function: `+n),e.hintsValid=!1;return}}}function O(e,t){if(t.length>1){for(var n=0,r=0,i=t.length;r<i;r++)n+=t[r].length;n=n+3&-4;for(var a=new Uint8Array(n),o=0,r=0,i=t.length;r<i;r++)a.set(t[r],o),o+=t[r].length;e.data=a,e.length=n}}function k(e,t,n){var r={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};if(e&&E(e,r),t&&E(t,r),e&&D(r,re),n&&n.length&1){var i=new Uint8Array(n.length+1);i.set(n.data),n.data=i}return r.hintsValid}a=new sr(new Uint8Array(a.getBytes()));for(var A=[`OS/2`,`cmap`,`head`,`hhea`,`hmtx`,`maxp`,`name`,`post`,`loca`,`glyf`,`fpgm`,`prep`,`cvt `,`CFF `],j=c(a),M=j.numTables,N={"OS/2":null,cmap:null,head:null,hhea:null,hmtx:null,maxp:null,name:null,post:null},P=0;P<M;P++){var F=s(a);A.indexOf(F.tag)<0||F.length!==0&&(N[F.tag]=F)}var I=!N[`CFF `];if(I)(!N.glyf||!N.loca)&&H(`Required "glyf" or "loca" tables are not found`);else{if(!N.head||!N.hhea||!N.maxp||!N.post){var L=new sr(N[`CFF `].data),ee=new Ln(L,o);return this.convert(e,ee,o)}delete N.glyf,delete N.loca,delete N.fpgm,delete N.prep,delete N[`cvt `]}N.maxp||H(`Required "maxp" table is not found`),a.pos=(a.start||0)+N.maxp.offset;var te=i(a.getBytes(4)),ne=r(a.getBytes(2)),re=0;te>=65536&&N.maxp.length>=22&&(a.pos+=8,r(a.getBytes(2))>2&&(N.maxp.data[14]=0,N.maxp.data[15]=2),a.pos+=4,re=r(a.getBytes(2)));var ie=!1;o.type==`CIDFontType2`&&o.toUnicode&&o.toUnicode[0]>`\0`&&(ie=!0,ne++,N.maxp.data[4]=ne>>8,N.maxp.data[5]=ne&255);var ae=k(N.fpgm,N.prep,N[`cvt `],re);ae||(delete N.fpgm,delete N.prep,delete N[`cvt `]);var oe=Object.keys(N);oe.sort(),M=oe.length;var se={file:``,virtualOffset:M*16};if(l(j.version,se,M),y(a,N.hhea,N.hmtx,ne),N.head||H(`Required "head" table is not found`),x(N.head,ne,I?N.loca.length:0),I){var ce=r([N.head.data[50],N.head.data[51]]);S(N.loca,N.glyf,ne,ce,ae,ie)}N.hhea||H(`Required "hhea" table is not found`),N.hhea.data[10]===0&&N.hhea.data[11]===0&&(N.hhea.data[10]=255,N.hhea.data[11]=255),N.post&&(C(N.post,o,ne)||(N.post=null));var le,ue;if(o.type==`CIDFontType2`){N.cmap||={tag:`cmap`,data:null};var de=o.cidToGidMap||[],fe=[0];if(de.length>0){for(var R=de.length-1;R>=0;R--){var pe=de[R];pe&&(fe[pe]=R)}for(var me=de.length,P=1;P<ne;P++)fe[P]||(fe[P]=me++)}else{for(var P=1;P<ne;P++)fe[P]=P;ie&&(fe[ne-1]=0)}le=[],ue=[];for(var he=[],ge=[],_e=this.cidToFontChar||this.toFontChar,P=1;P<ne;P++){var ve=fe[P],ye=_e[ve];!ye||typeof ye!=`number`||En(ye)||ye in he?ge.push(P):(he[ye]=!0,le.push({unicode:ye,code:ve}),ue.push(P))}if(!this.cidToFontChar)for(var be=en,R=0,z=ge.length;R<z;R++){for(var P=ge[R],ve=fe[P];be in he;)be++;if(be>=en+tn)break;var ye=be++;this.toFontChar[ve]=ye,he[ye]=!0,le.push({unicode:ye,code:ve}),ue.push(P)}}else{this.useToFontChar=!0;var xe=v(N.cmap,a,this.hasEncoding,this.isSymbolicFont);this.isSymbolicFont=xe.isSymbolicFont;for(var Se=xe.platformId,Ce=xe.encodingId,we=xe.mappings,Te=we.length,le=[],ue=[],P=0;P<Te;++P){var Ee=we[P],De=Ee.charcode,ye=_(De,this.isSymbolicFont,Se,Ce);ye&&(le.push({code:De,unicode:ye}),ue.push(Ee.glyphId))}var Oe=xe.hasShortCmap,_e=this.toFontChar;if(Oe&&ue.length==ne)for(var P=0,ke=ue.length;P<ke;P++)ue[P]=P;var Ae=[];if(this.isSymbolicFont)for(var P=0,ke=le.length;P<ke;P++){var je=le[P];Ae[je.code&255]=je.unicode}else{var Me=o.baseEncoding,Ne=o.differences;xe.glyphCodeMapping;for(var De=0;De<Me.length;++De)if(Me.hasOwnProperty(De)){var Pe=Me[De];De in Ne&&(Pe=Ne[De]),Pe||=on.StandardEncoding[De],Pe||=`.notdef`;var ye=$n[Pe];Ae[De]=ye}}this.toFontChar=_e=Ae,d(le,ue,o),this.glyphNameMap=o.glyphNameMap}le.length===0&&(le.push({unicode:61440,code:61440,glyph:`.notdef`}),ue.push(0)),N.cmap.data=f(le,ue);for(var Fe=[],P=0,ke=le.length;P<ke;P++)Fe[le[P].unicode]=!0;if(this.unicodeIsEnabled=Fe,!N[`OS/2`]||!p(N[`OS/2`])){var Ie={unitsPerEm:r([N.head.data[18],N.head.data[19]]),yMax:r([N.head.data[42],N.head.data[43]]),yMin:r([N.head.data[38],N.head.data[39]])-65536,ascent:r([N.hhea.data[4],N.hhea.data[5]]),descent:r([N.hhea.data[6],N.hhea.data[7]])-65536};N[`OS/2`]={tag:`OS/2`,data:t(m(o,le,Ie))}}if(N.post||={tag:`post`,data:t(h(o))},!I)try{var L=new sr(N[`CFF `].data),ee=new Rn(L,o).parse(),Le=new Zn(ee);N[`CFF `].data=Le.compile()}catch{V(`Failed to compile font `+o.loadedName)}if(!N.name)N.name={tag:`name`,data:t(g(this.name))};else{var ze=w(N.name);N.name.data=t(g(e,ze))}for(var P=0;P<M;P++){for(var F=N[oe[P]],Be=[],U=F.data,R=0,z=U.length;R<z;R++)Be.push(U[R]);u(se,F.tag,Be)}for(var P=0;P<M;P++){var F=N[oe[P]],U=F.data;for(se.file+=n(U);se.file.length&3;)se.file+=`\0`}return t(se.file)},convert:function(e,r,i){function a(e){for(var t=0,n=e.length-1;t<n;t++)if(e[t]!=e[t+1])return!1;return!0}var c={file:``,virtualOffset:144};l(`OTTO`,c,9);var d=r.charstrings;i.fixedPitch=a(d);for(var p={},_=0;_<d.length;++_){var v=d[_];p[v.glyph]=v.unicode}if(this.glyphNameMap=p,r.seacs,0)var y,b,_,v,x,S,C,w;if(i.overridableEncoding&&(i.subtype==`Type1C`||i.subtype==`CIDFontType0C`)){for(var T=[],_=0;_<d.length;++_){var v=d[_];T[v.code]=v.glyph}i.baseEncoding=T}if(i.subtype==`CIDFontType0C`){for(var E=[],_=0;_<d.length;++_){var v=d[_];E[v.code]=v.unicode}this.toFontChar=E}var D=1/(i.fontMatrix||ye)[0],O={"CFF ":r.data,"OS/2":t(m(i,d)),cmap:f(d.slice(),`glyphIds`in r?r.glyphIds:null),head:(function(){return t(`\0\0\0\0\0\0\0\0\0\0_<õ\0\0`+s(D)+`\0\0\0\0\v~'\0\0\0\0\v~'\0\0`+s(i.descent)+`ÿ`+s(i.ascent)+o(i.italicAngle?2:0)+`\0\0\0\0\0\0\0`)})(),hhea:(function(){return t(`\0\0\0`+s(i.ascent)+s(i.descent)+`\0\0ÿÿ\0\0\0\0\0\0`+s(i.capHeight)+s(Math.tan(i.italicAngle)*i.xHeight)+`\0\0\0\0\0\0\0\0\0\0\0\0`+o(d.length+1))})(),hmtx:(function(){for(var e=`\0\0\0\0`,n=0,r=d.length;n<r;n++){var i=d[n],a=`width`in i?i.width:0;e+=o(a)+o(0)}return t(e)})(),maxp:(function(){return t(`\0\0P\0`+o(d.length+1))})(),name:t(g(e)),post:t(h(i))};for(var k in O)u(c,k,O[k]);for(var k in O){var A=O[k];c.file+=n(A)}return t(c.file)},buildToFontChar:function(e){for(var t=[],n=en,r=0,i=e.length;r<i;r++){var a=e[r],o=typeof a==`object`?n++:a;a!==void 0&&(Je(o)&&o.length===1&&(o=o.charCodeAt(0)),t[r]=o)}return t},rebuildToUnicode:function(e){var t=e.firstChar,n=e.lastChar,r=[],i=this.toUnicode||this.cidToUnicode;if(i)for(var a=i.length===0,o=t,s=n;o<=s;o++)r[o]=a?String.fromCharCode(o):i[o];else for(var o=t,s=n;o<=s;o++){var c=e.differences[o];c||=e.baseEncoding[o],c&&c in $n&&(r[o]=String.fromCharCode($n[c]))}this.toUnicode=r},loadCidToUnicode:function(e){if(e.cidSystemInfo){var t=[],n=[];this.cidToUnicode=t,this.unicodeToCID=n;var r=e.cidEncoding;if(e.toUnicode)r&&r.indexOf(`Identity-`)!==0&&we(`Need to create a reverse mapping from 'ToUnicode' CMap`);else{var i=e.cidSystemInfo,a;if(i&&(a=Rr[i.registry+`-`+i.ordering]),a){for(var o=fn[r],s=1,c=0,l,u,d=a.length;c<d;++c){var f=a[c];if(G(f)){var p=f.length;for(l=0;l<p;l++)t[s]=u=f[l],(!n[u]||o)&&(n[u]=s);s++}else if(typeof f==`object`){var m=f.f;if(m)for(u=f.c,l=0;l<m;++l)t[s]=u,(!n[u]||o)&&(n[u]=s),s++,u++;else s+=f.s}else f&&(t[s]=f,(!n[f]||o)&&(n[f]=s)),s++}r&&(r.indexOf(`Identity-`)===0?this.unicodeToCID=[]:(this.cidToUnicode=[],e.type==`CIDFontType2`&&(this.cidToFontChar=t)))}}}},get spaceWidth(){if(`_shadowWidth`in this)return this._shadowWidth;for(var e=[`space`,`minus`,`one`,`i`],t,n=0,r=e.length;n<r;n++){var i=e[n];if(i in this.widths){t=this.widths[i];break}var a=$n[i],o=0;if(this.composite&&(o=this.unicodeToCID[a]),!o&&`toUnicode`in this&&(o=this.toUnicode.indexOf(a)),o<=0&&(o=a),t=this.widths[o],t)break}return t||=this.defaultWidth,this._shadowWidth=t,t},charToGlyph:function(e){var t,n,r,i,n=this.widths[e],a=this.vmetrics&&this.vmetrics[e];switch(this.type){case`CIDFontType0`:var o=this.unicodeToCID[e]||e;if(this.unicodeToCID.length>0&&(n=this.widths[o],a=this.vmetrics&&this.vmetrics[o]),this.noUnicodeAdaptation){t=this.toFontChar[e]||e;break}t=this.toFontChar[o]||o;break;case`CIDFontType2`:if(this.unicodeToCID.length>0){var o=this.unicodeToCID[e]||e;n=this.widths[o],a=this.vmetrics&&this.vmetrics[o],t=e;break}t=this.toFontChar[e]||e;break;case`MMType1`:case`Type1`:var s=this.differences[e]||this.encoding[e];if(qe(n)||(n=this.widths[s]),this.noUnicodeAdaptation){t=xn($n[s]||e);break}t=this.glyphNameMap[s]||$n[s]||e;break;case`Type3`:var s=this.differences[e]||this.encoding[e];if(r=this.charProcOperatorList[s],s){if(t=$n[s]||e,t===e&&typeof s==`string`){if(s.startsWith(`uni`)){let e=s.substring(3);/^[0-9A-F]{4,6}$/i.test(e)&&(t=parseInt(e,16))}let e={bullet:8226,checkbox:9744,checkmark:10003,circle:9675,square:9633,triangle:9650,triangledown:9660,triangleleft:9664,triangleright:9654,star:9733};e[s.toLowerCase()]&&(t=e[s.toLowerCase()])}}else t=e;break;case`TrueType`:if(this.useToFontChar){t=this.toFontChar[e]||e;break}var s=this.differences[e]||this.encoding[e];if(s||=on.StandardEncoding[e],qe(n)||(n=this.widths[s]),this.noUnicodeAdaptation){t=$n[s]||e;break}if(!this.hasEncoding||this.isSymbolicFont){t=this.useToFontChar?this.toFontChar[e]:e;break}t=s in this.glyphNameMap?this.glyphNameMap[s]:$n[s];break;default:V(`Unsupported font type: `+this.type)}var c=`toUnicode`in this&&this.toUnicode[e]||e;typeof c==`number`&&(c=String.fromCharCode(c)),n=qe(n)?n:this.defaultWidth,i=this.unicodeIsEnabled?!this.unicodeIsEnabled[t]:!1;var l=null;if(this.seacMap&&this.seacMap[t]){var u=this.seacMap[t];t=u.baseUnicode,l={fontChar:String.fromCharCode(u.accentUnicode),offset:u.accentOffset}}return{fontChar:String.fromCharCode(t),unicode:c,accent:l,width:n,vmetric:a,disabled:i,operatorList:r}},charsToGlyphs:function(e){var t=this.charsCache,n;if(t&&(n=t[e],n))return n;t||=this.charsCache=Object.create(null),n=[];var r=e,i,a=this.cidEncoding;if(a&&(i=dn[a],i?e=i(e):a.indexOf(`Uni`)!==0&&a.indexOf(`Identity-`)!==0&&V(`Unsupported CMap: `+a)),!i&&this.cmap)for(var o=0;o<e.length;){var s=this.cmap.readCharCode(e,o),c=s[0],l=s[1];o+=l;var u=this.charToGlyph(c);n.push(u),l===1&&e.charCodeAt(o-1)===32&&n.push(null)}else for(var o=0,d=e.length;o<d;++o){var c=e.charCodeAt(o),u=this.charToGlyph(c);n.push(u),c==32&&n.push(null)}return t[r]=n}},e})(),Mn=(function(){function e(e){this.error=e}return e.prototype={charsToGlyphs:function(){return[]},exportData:function(){return{error:this.error}}},e})(),Nn=(function(){var e={hstem:[1],vstem:[3],vmoveto:[4],rlineto:[5],hlineto:[6],vlineto:[7],rrcurveto:[8],callsubr:[10],flex:[12,35],drop:[12,18],endchar:[14],rmoveto:[21],hmoveto:[22],vhcurveto:[30],hvcurveto:[31]};function t(){this.width=0,this.lsb=0,this.flexing=!1,this.output=[],this.stack=[]}return t.prototype={convert:function(t,n){for(var r=t.length,i=!1,a=0;a<r;a++){var o=t[a];if(o<32){switch(o===12&&(o=(o<<8)+t[++a]),o){case 1:this.stack=[];break;case 3:this.stack=[];break;case 4:if(this.flexing){if(this.stack.length<1){i=!0;break}var s=this.stack.pop();this.stack.push(0,s);break}i=this.executeCommand(1,e.vmoveto);break;case 5:i=this.executeCommand(2,e.rlineto);break;case 6:i=this.executeCommand(1,e.hlineto);break;case 7:i=this.executeCommand(1,e.vlineto);break;case 8:i=this.executeCommand(6,e.rrcurveto);break;case 9:this.stack=[];break;case 10:if(this.stack.length<1){i=!0;break}var c=this.stack.pop();i=this.convert(n[c],n);break;case 11:return i;case 13:if(this.stack.length<2){i=!0;break}var l=this.stack.pop(),u=this.stack.pop();this.lsb=u,this.width=l,this.stack.push(u),i=this.executeCommand(1,e.hmoveto);break;case 14:this.output.push(e.endchar[0]);break;case 21:if(this.flexing)break;i=this.executeCommand(2,e.rmoveto);break;case 22:if(this.flexing){this.stack.push(0);break}i=this.executeCommand(1,e.hmoveto);break;case 30:i=this.executeCommand(4,e.vhcurveto);break;case 31:i=this.executeCommand(4,e.hvcurveto);break;case 3072:this.stack=[];break;case 3073:this.stack=[];break;case 3074:this.stack=[];break;case 3078:i=this.executeCommand(4,e.endchar);break;case 3079:if(this.stack.length<4){i=!0;break}this.stack.pop();var l=this.stack.pop(),d=this.stack.pop(),u=this.stack.pop();this.lsb=u,this.width=l,this.stack.push(u,d),i=this.executeCommand(2,e.rmoveto);break;case 3084:if(this.stack.length<2){i=!0;break}var f=this.stack.pop(),p=this.stack.pop();this.stack.push(p/f);break;case 3088:if(this.stack.length<2){i=!0;break}var c=this.stack.pop(),m=this.stack.pop();if(c===0&&m===3){var h=this.stack.splice(this.stack.length-17,17);this.stack.push(h[2]+h[0],h[3]+h[1],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14]),i=this.executeCommand(13,e.flex,!0),this.flexing=!1,this.stack.push(h[15],h[16])}else c===1&&m===0&&(this.flexing=!0);break;case 3089:break;case 3105:this.stack=[];break;default:V(`Unknown type 1 charstring command of "`+o+`"`)}if(i)break}else o<=246?o-=139:o=o<=250?(o-247)*256+t[++a]+108:o<=254?-((o-251)*256)-t[++a]-108:(t[++a]&255)<<24|(t[++a]&255)<<16|(t[++a]&255)<<8|t[++a]&255,this.stack.push(o)}return i},executeCommand:function(e,t,n){var r=this.stack.length;if(e>r)return!0;for(var i=r-e,a=i;a<r;a++){var o=this.stack[a];o===(o|0)?this.output.push(28,o>>8&255,o&255):(o=65536*o|0,this.output.push(255,o>>24&255,o>>16&255,o>>8&255,o&255))}return this.output.push.apply(this.output,t),n?this.stack.splice(i,e):this.stack=[],!1}},t})(),Pn=(function(){var e=4330;function t(e,t,n){for(var r=t,i=52845,a=22719,o=[],s=``,c=e.length,l=0;l<c;l++)s=e[l],o[l]=s^r>>8,r=(s+r)*i+a&65535;return o.slice(n)}function n(e){return e===47||e===91||e===93||e===123||e===125||e===40||e===41}function r(e,n){n&&(e=new sr(t(e.getBytes(),55665,4))),this.stream=e,this.nextChar()}return r.prototype={readNumberArray:function(){this.getToken();for(var e=[];;){var t=this.getToken();if(t===null||t===`]`||t===`}`)break;e.push(parseFloat(t||0))}return e},readNumber:function(){var e=this.getToken();return parseFloat(e||0)},readInt:function(){var e=this.getToken();return parseInt(e||0,10)|0},readBoolean:function(){return+(this.getToken()===`true`)},nextChar:function(){return this.currentChar=this.stream.getByte()},getToken:function(){for(var e=!1,t=this.currentChar;;){if(t===-1)return null;if(e)(t===10||t===13)&&(e=!1);else if(t===37)e=!0;else if(!ar.isSpace(t))break;t=this.nextChar()}if(n(t))return this.nextChar(),String.fromCharCode(t);var r=``;do r+=String.fromCharCode(t),t=this.nextChar();while(t>=0&&!ar.isSpace(t)&&!n(t));return r},extractFontProgram:function(){for(var n=this.stream,r=[],i=[],a={subrs:[],charstrings:[],properties:{privateData:{lenIV:4}}},o;(o=this.getToken())!==null;)if(o===`/`)switch(o=this.getToken(),o){case`CharStrings`:for(this.getToken(),this.getToken(),this.getToken(),this.getToken();o=this.getToken(),o!==null&&o!==`end`;)if(o===`/`){var s=this.getToken(),c=this.readInt();this.getToken();var l=n.makeSubStream(n.pos,c),u=a.properties.privateData.lenIV,d=t(l.getBytes(),e,u);n.skip(c),this.nextChar(),o=this.getToken(),o===`noaccess`&&this.getToken(),i.push({glyph:s,encoded:d})}break;case`Subrs`:for(this.readInt(),this.getToken();(o=this.getToken())===`dup`;){var f=this.readInt(),c=this.readInt();this.getToken();var l=n.makeSubStream(n.pos,c),u=a.properties.privateData.lenIV,d=t(l.getBytes(),e,u);n.skip(c),this.nextChar(),o=this.getToken(),o===`noaccess`&&this.getToken(),r[f]=d}break;case`BlueValues`:case`OtherBlues`:case`FamilyBlues`:case`FamilyOtherBlues`:var p=this.readNumberArray();p.length>0&&p.length%2;break;case`StemSnapH`:case`StemSnapV`:a.properties.privateData[o]=this.readNumberArray();break;case`StdHW`:case`StdVW`:a.properties.privateData[o]=this.readNumberArray()[0];break;case`BlueShift`:case`lenIV`:case`BlueFuzz`:case`BlueScale`:case`LanguageGroup`:case`ExpansionFactor`:a.properties.privateData[o]=this.readNumber();break;case`ForceBold`:a.properties.privateData[o]=this.readBoolean()}for(var m=0;m<i.length;m++){var s=i[m].glyph,d=i[m].encoded,h=new Nn,g=h.convert(d,r),_=h.output;g&&(_=[14]),a.charstrings.push({glyph:s,data:_,seac:h.seac,lsb:h.lsb,width:h.width})}return a},extractFontHeader:function(e){for(var t;(t=this.getToken())!==null;)if(t===`/`)switch(t=this.getToken(),t){case`FontMatrix`:e.fontMatrix=this.readNumberArray();break;case`Encoding`:var n=this.getToken(),r;if(!/^\d+$/.test(n))r=on[n];else{r=[];var i=parseInt(n,10)|0;this.getToken();for(var a=0;a<i;a++){for(var t=this.getToken();t!==`dup`&&t!==`def`;)if(t=this.getToken(),t===null)return;if(t===`def`)break;var o=this.readInt();this.getToken();var s=this.getToken();r[o]=s,this.getToken()}}if(e.overridableEncoding&&r){e.baseEncoding=r;break}break;case`FontBBox`:var c=this.readNumberArray();e.ascent=c[3],e.descent=c[1],e.ascentScaled=!0}}},r})(),Fn=`.notdef,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quoteright,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,quoteleft,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,exclamdown,cent,sterling,fraction,yen,florin,section,currency,quotesingle,quotedblleft,guillemotleft,guilsinglleft,guilsinglright,fi,fl,endash,dagger,daggerdbl,periodcentered,paragraph,bullet,quotesinglbase,quotedblbase,quotedblright,guillemotright,ellipsis,perthousand,questiondown,grave,acute,circumflex,tilde,macron,breve,dotaccent,dieresis,ring,cedilla,hungarumlaut,ogonek,caron,emdash,AE,ordfeminine,Lslash,Oslash,OE,ordmasculine,ae,dotlessi,lslash,oslash,oe,germandbls,onesuperior,logicalnot,mu,trademark,Eth,onehalf,plusminus,Thorn,onequarter,divide,brokenbar,degree,thorn,threequarters,twosuperior,registered,minus,eth,multiply,threesuperior,copyright,Aacute,Acircumflex,Adieresis,Agrave,Aring,Atilde,Ccedilla,Eacute,Ecircumflex,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Ntilde,Oacute,Ocircumflex,Odieresis,Ograve,Otilde,Scaron,Uacute,Ucircumflex,Udieresis,Ugrave,Yacute,Ydieresis,Zcaron,aacute,acircumflex,adieresis,agrave,aring,atilde,ccedilla,eacute,ecircumflex,edieresis,egrave,iacute,icircumflex,idieresis,igrave,ntilde,oacute,ocircumflex,odieresis,ograve,otilde,scaron,uacute,ucircumflex,udieresis,ugrave,yacute,ydieresis,zcaron,exclamsmall,Hungarumlautsmall,dollaroldstyle,dollarsuperior,ampersandsmall,Acutesmall,parenleftsuperior,parenrightsuperior,266 ff,onedotenleader,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,commasuperior,threequartersemdash,periodsuperior,questionsmall,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,ffi,ffl,parenleftinferior,parenrightinferior,Circumflexsmall,hyphensuperior,Gravesmall,Asmall,Bsmall,Csmall,Dsmall,Esmall,Fsmall,Gsmall,Hsmall,Ismall,Jsmall,Ksmall,Lsmall,Msmall,Nsmall,Osmall,Psmall,Qsmall,Rsmall,Ssmall,Tsmall,Usmall,Vsmall,Wsmall,Xsmall,Ysmall,Zsmall,colonmonetary,onefitted,rupiah,Tildesmall,exclamdownsmall,centoldstyle,Lslashsmall,Scaronsmall,Zcaronsmall,Dieresissmall,Brevesmall,Caronsmall,Dotaccentsmall,Macronsmall,figuredash,hypheninferior,Ogoneksmall,Ringsmall,Cedillasmall,questiondownsmall,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior,Agravesmall,Aacutesmall,Acircumflexsmall,Atildesmall,Adieresissmall,Aringsmall,AEsmall,Ccedillasmall,Egravesmall,Eacutesmall,Ecircumflexsmall,Edieresissmall,Igravesmall,Iacutesmall,Icircumflexsmall,Idieresissmall,Ethsmall,Ntildesmall,Ogravesmall,Oacutesmall,Ocircumflexsmall,Otildesmall,Odieresissmall,OEsmall,Oslashsmall,Ugravesmall,Uacutesmall,Ucircumflexsmall,Udieresissmall,Yacutesmall,Thornsmall,Ydieresissmall,001.000,001.001,001.002,001.003,Black,Bold,Book,Light,Medium,Regular,Roman,Semibold`.split(`,`),In=function(e,t,n){var r=6,i=n.length1,a=n.length2,o=t.peekBytes(r),s=o[0]==128&&o[1]==1;s&&(t.skip(r),i=o[5]<<24|o[4]<<16|o[3]<<8|o[2]),new Pn(new sr(t.getBytes(i))).extractFontHeader(n),s&&(o=t.getBytes(r),a=o[5]<<24|o[4]<<16|o[3]<<8|o[2]);var c=new Pn(new sr(t.getBytes(a)),!0).extractFontProgram();for(var l in c.properties)n[l]=c.properties[l];var u=this.getOrderedCharStrings(c.charstrings,n),d=this.getType2Charstrings(u),f=this.getType2Subrs(c.subrs);this.charstrings=u,this.data=this.wrap(e,d,this.charstrings,f,n),this.seacs=this.getSeacs(c.charstrings)};In.prototype={getOrderedCharStrings:function(e,t){var n=[],r=[],i,a,o,s=en;for(i=0,a=e.length;i<a;i++){for(var c=e[i],o=c.glyph,l=(o in $n)?$n[o]:s++;r[l];)l=s++;r[l]=!0,n.push({glyph:o,unicode:l,gid:i,charstring:c.data,width:c.width,lsb:c.lsb})}return n.sort(function(e,t){return e.unicode-t.unicode}),n},getSeacs:function(e){var t,n,r=[];for(t=0,n=e.length;t<n;t++){var i=e[t];i.seac&&(r[t]=i.seac)}return r},getType2Charstrings:function(e){for(var t=[],n=0,r=e.length;n<r;n++)t.push(e[n].charstring);return t},getType2Subrs:function(e){var t=0,n=e.length;t=n<1133?107:n<33769?1131:32768;for(var r=[],i=0;i<t;i++)r.push([11]);for(var i=0;i<n;i++)r.push(e[i]);return r},wrap:function(e,t,n,r,i){var a=new zn;a.header=new Bn(1,0,4,4),a.names=[e];var o=new Wn;o.setByName(`version`,391),o.setByName(`Notice`,392),o.setByName(`FullName`,393),o.setByName(`FamilyName`,394),o.setByName(`Weight`,395),o.setByName(`Encoding`,null),o.setByName(`FontMatrix`,i.fontMatrix),o.setByName(`FontBBox`,i.bbox),o.setByName(`charset`,null),o.setByName(`CharStrings`,null),o.setByName(`Private`,null),a.topDict=o;var s=new Vn;s.add(`Version 0.11`),s.add(`See original notice`),s.add(e),s.add(e),s.add(`Medium`),a.strings=s,a.globalSubrIndex=new Hn;for(var c=t.length,l=[0],u=0;u<c;u++){var d=Fn.indexOf(n[u].glyph);d==-1&&(d=0),l.push(d>>8&255,d&255)}a.charset=new qn(!1,0,[],l);var f=new Hn;f.add([139,14]);for(var u=0;u<c;u++)f.add(t[u]);a.charStrings=f;var p=new Gn;p.setByName(`Subrs`,null);for(var m=[`BlueValues`,`OtherBlues`,`FamilyBlues`,`FamilyOtherBlues`,`StemSnapH`,`StemSnapV`,`BlueShift`,`BlueFuzz`,`BlueScale`,`LanguageGroup`,`ExpansionFactor`,`ForceBold`,`StdHW`,`StdVW`],u=0,h=m.length;u<h;u++){var g=m[u];if(i.privateData.hasOwnProperty(g)){var _=i.privateData[g];if(G(_))for(var v=_.length-1;v>0;v--)_[v]-=_[v-1];p.setByName(g,_)}}a.topDict.privateDict=p;for(var y=new Hn,u=0,h=r.length;u<h;u++)y.add(r[u]);return p.subrsIndex=y,new Zn(a).compile()}};var Ln=(function(){function e(e,t){this.properties=t;var n=new Rn(e,t);this.cff=n.parse();var r=new Zn(this.cff);this.readExtra();try{this.data=r.compile()}catch{V(`Failed to compile font `+t.loadedName),this.data=e}}return e.prototype={readExtra:function(){for(var e=this.getCharStrings(),t=[],n=0,r=e.length;n<r;n++)t.push(e[n].gid);this.charstrings=e,this.glyphIds=t,this.seacs=this.cff.seacs},getCharStrings:function(){var e=this.cff,t=e.charset.charset,n=e.encoding?e.encoding.encoding:null,r=[],i=[],a=[],o=[],s=0;if(t[0]===`.notdef`&&(s=1),this.properties.subtype===`CIDFontType0C`){if(this.cff.isCIDFont)o=t;else{o=[];for(var c=0,l=e.charStrings.count;c<l;c++)o.push(c);t=o}}else for(var u in n){var d=n[u];if(d in o){var f=o[d];G(f)||(o[d]=[f]),o[d].push(u|0)}else o[d]=u|0}for(var c=s,l=t.length;c<l;c++){var p=t[c],m=o[c];G(m)||(m=[m]);for(var h=0;h<m.length;h++){var g=m[h];!g||En(g)?a.push(c,g):(r.push({unicode:g,code:g,gid:c,glyph:p}),i[g]=!0)}}for(var _=en,h=0,v=a.length;h<v;h+=2){for(var c=a[h];_ in i;)_++;var y=_++;r.push({unicode:y,code:a[h+1]||0,gid:c,glyph:t[c]})}return r.sort(function(e,t){return e.unicode-t.unicode}),r}},e})(),Rn=(function(){var e=[null,{id:`hstem`,min:2,resetStack:!0,stem:!0},null,{id:`vstem`,min:2,resetStack:!0,stem:!0},{id:`vmoveto`,min:1,resetStack:!0},{id:`rlineto`,min:2,resetStack:!0},{id:`hlineto`,min:1,resetStack:!0},{id:`vlineto`,min:1,resetStack:!0},{id:`rrcurveto`,min:6,resetStack:!0},null,{id:`callsubr`,min:1,undefStack:!0},{id:`return`,min:0,undefStack:!0},null,null,null,null,null,null,{id:`hstemhm`,min:2,resetStack:!0,stem:!0},null,null,{id:`rmoveto`,min:2,resetStack:!0},{id:`hmoveto`,min:1,resetStack:!0},{id:`vstemhm`,min:2,resetStack:!0,stem:!0},{id:`rcurveline`,min:8,resetStack:!0},{id:`rlinecurve`,min:8,resetStack:!0},{id:`vvcurveto`,min:4,resetStack:!0},{id:`hhcurveto`,min:4,resetStack:!0},null,{id:`callgsubr`,min:1,undefStack:!0},{id:`vhcurveto`,min:4,resetStack:!0},{id:`hvcurveto`,min:4,resetStack:!0}],t=[null,null,null,{id:`and`,min:2,stackDelta:-1},{id:`or`,min:2,stackDelta:-1},{id:`not`,min:1,stackDelta:0},null,null,null,{id:`abs`,min:1,stackDelta:0},{id:`add`,min:2,stackDelta:-1,stackFn:function(e,t){e[t-2]=e[t-2]+e[t-1]}},{id:`sub`,min:2,stackDelta:-1,stackFn:function(e,t){e[t-2]=e[t-2]-e[t-1]}},{id:`div`,min:2,stackDelta:-1,stackFn:function(e,t){e[t-2]=e[t-2]/e[t-1]}},null,{id:`neg`,min:1,stackDelta:0,stackFn:function(e,t){e[t-1]=-e[t-1]}},{id:`eq`,min:2,stackDelta:-1},null,null,{id:`drop`,min:1,stackDelta:-1},null,{id:`put`,min:2,stackDelta:-2},{id:`get`,min:1,stackDelta:0},{id:`ifelse`,min:4,stackDelta:-3},{id:`random`,min:0,stackDelta:1},{id:`mul`,min:2,stackDelta:-1,stackFn:function(e,t){e[t-2]=e[t-2]*e[t-1]}},null,{id:`sqrt`,min:1,stackDelta:0},{id:`dup`,min:1,stackDelta:1},{id:`exch`,min:2,stackDelta:0},{id:`index`,min:2,stackDelta:0},{id:`roll`,min:3,stackDelta:-2},null,null,null,{id:`hflex`,min:7,resetStack:!0},{id:`flex`,min:13,resetStack:!0},{id:`hflex1`,min:9,resetStack:!0},{id:`flex1`,min:11,resetStack:!0}];function n(e,t){this.bytes=e.getBytes(),this.properties=t}return n.prototype={parse:function(){var e=this.properties,t=new zn;this.cff=t;var n=this.parseHeader(),r=this.parseIndex(n.endPos),i=this.parseIndex(r.endPos),a=this.parseIndex(i.endPos),o=this.parseIndex(a.endPos),s=this.parseDict(i.obj.get(0)),c=this.createDict(Wn,s,t.strings);t.header=n.obj,t.names=this.parseNameIndex(r.obj),t.strings=this.parseStringIndex(a.obj),t.topDict=c,t.globalSubrIndex=o.obj,this.parsePrivateDict(t.topDict),t.isCIDFont=c.hasName(`ROS`);var l=c.getByName(`CharStrings`),u=this.parseCharStrings(l);t.charStrings=u.charStrings,t.seacs=u.seacs;var d=c.getByName(`FontMatrix`);d&&(e.fontMatrix=d);var f=c.getByName(`FontBBox`);f&&(e.ascent=f[3],e.descent=f[1],e.ascentScaled=!0);var p,m;if(t.isCIDFont){for(var h=this.parseIndex(c.getByName(`FDArray`)).obj,g=0,_=h.count;g<_;++g){var v=h.get(g),y=this.createDict(Wn,this.parseDict(v),t.strings);this.parsePrivateDict(y),t.fdArray.push(y)}m=null,p=this.parseCharsets(c.getByName(`charset`),t.charStrings.count,t.strings,!0),t.fdSelect=this.parseFDSelect(c.getByName(`FDSelect`),t.charStrings.count)}else p=this.parseCharsets(c.getByName(`charset`),t.charStrings.count,t.strings,!1),m=this.parseEncoding(c.getByName(`Encoding`),e,t.strings,p.charset);return t.charset=p,t.encoding=m,t},parseHeader:function(){for(var e=this.bytes,t=0;e[t]!=1;)++t;t!==0&&(B(`cff data is shifted`),e=e.subarray(t),this.bytes=e);var n=e[0],r=e[1],i=e[2],a=e[3];return{obj:new Bn(n,r,i,a),endPos:i}},parseDict:function(e){var t=0;function n(){var n=e[t++];return n===30?r(t):n===28?(n=e[t++],n=(n<<24|e[t++]<<16)>>16,n):n===29?(n=e[t++],n=n<<8|e[t++],n=n<<8|e[t++],n=n<<8|e[t++],n):n>=32&&n<=246?n-139:n>=247&&n<=250?(n-247)*256+e[t++]+108:n>=251&&n<=254?-((n-251)*256)-e[t++]-108:(H(`255 is not a valid DICT command`),-1)}function r(){for(var n=``,r=15,i=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`.`,`E`,`E-`,null,`-`],a=e.length;t<a;){var o=e[t++],s=o>>4,c=o&15;if(s==r||(n+=i[s],c==r))break;n+=i[c]}return parseFloat(n)}for(var i=[],a=[],t=0,o=e.length;t<o;){var s=e[t];s<=21?(s===12&&(s=s<<8|e[++t]),a.push([s,i]),i=[],++t):i.push(n())}return a},parseIndex:function(e){var t=new Hn,n=this.bytes,r=n[e++]<<8|n[e++],i=[],a=e;if(r!==0){for(var o=n[e++],s=e+(r+1)*o-1,c=0,l=r+1;c<l;++c){for(var u=0,d=0;d<o;++d)u<<=8,u+=n[e++];i.push(s+u)}a=i[r]}for(var c=0,l=i.length-1;c<l;++c){var f=i[c],p=i[c+1];t.add(n.subarray(f,p))}return{obj:t,endPos:a}},parseNameIndex:function(e){for(var t=[],n=0,r=e.count;n<r;++n){for(var i=e.get(n),a=Math.min(i.length,127),o=[],s=0;s<a;++s){var c=i[s];s===0&&c===0?o[s]=c:c<33||c>126||c===91||c===93||c===40||c===41||c===123||c===125||c===60||c===62||c===47||c===37?o[s]=95:o[s]=c}t.push(String.fromCharCode.apply(null,o))}return t},parseStringIndex:function(e){for(var t=new Vn,n=0,r=e.count;n<r;++n){var i=e.get(n);t.add(String.fromCharCode.apply(null,i))}return t},createDict:function(e,t,n){var r=new e(n);r.types;for(var i=0,a=t.length;i<a;++i){var o=t[i],s=o[0],c=o[1];r.setByKey(s,c)}return r},parseCharStrings:function(n){for(var r=this.parseIndex(n).obj,i=[],a=r.count,o=0;o<a;o++){for(var s=r.get(o),c=0,l=[],u=!0,d=0,f=!0,p=s,m=p.length,h=0;h<m;){var g=p[h++],_=null;if(g==12){var v=p[h++];v===0?(p[h-2]=139,p[h-1]=22,c=0):_=t[v]}else g===28?(l[c]=(p[h]<<24|p[h+1]<<16)>>16,h+=2,c++):g==14?c>=4&&(c-=4):g>=32&&g<=246?(l[c]=g-139,c++):g>=247&&g<=254?(l[c]=g<251?(g-247<<8)+p[h]+108:-(g-251<<8)-p[h]-108,h++,c++):g==255?(l[c]=(p[h]<<24|p[h+1]<<16|p[h+2]<<8|p[h+3])/65536,h+=4,c++):g==19||g==20?(d+=c>>1,h+=d+7>>3,c=0):_=e[g];if(_){if(_.stem&&(d+=c>>1),`min`in _&&!u&&c<_.min){V(`Not enough parameters for `+_.id+`; actual: `+c+`, expected: `+_.min),f=!1;break}`stackDelta`in _?(`stackFn`in _&&_.stackFn(l,c),c+=_.stackDelta):_.resetStack?(c=0,u=!1):_.undefStack&&(c=0,u=!0)}}f||r.set(o,new Uint8Array([14]))}return{charStrings:r,seacs:i}},emptyPrivateDictionary:function(e){var t=this.createDict(Gn,[],e.strings);e.setByKey(18,[0,0]),e.privateDict=t},parsePrivateDict:function(e){if(!e.hasName(`Private`))this.emptyPrivateDictionary(e);else{var t=e.getByName(`Private`);if(!G(t)||t.length!==2)e.removeByName(`Private`);else{var n=t[0],r=t[1];if(n===0||r>=this.bytes.length)this.emptyPrivateDictionary(e);else{var i=r+n,a=this.bytes.subarray(r,i),o=this.parseDict(a),s=this.createDict(Gn,o,e.strings);if(e.privateDict=s,s.getByName(`Subrs`)){var c=s.getByName(`Subrs`),l=r+c;c===0||l>=this.bytes.length?this.emptyPrivateDictionary(e):s.subrsIndex=this.parseIndex(l).obj}}}}},parseCharsets:function(e,t,n,r){if(e===0)return new qn(!0,Kn.ISO_ADOBE,Vt);if(e==1)return new qn(!0,Kn.EXPERT,Ht);if(e==2)return new qn(!0,Kn.EXPERT_SUBSET,Ut);var i=this.bytes,a=e,o=i[e++],s=[`.notdef`];switch(--t,o){case 0:for(var c=0;c<t;c++){var l=i[e++]<<8|i[e++];s.push(r?l:n.get(l))}break;case 1:for(;s.length<=t;)for(var l=i[e++]<<8|i[e++],u=i[e++],c=0;c<=u;c++)s.push(r?l++:n.get(l++));break;case 2:for(;s.length<=t;)for(var l=i[e++]<<8|i[e++],u=i[e++]<<8|i[e++],c=0;c<=u;c++)s.push(r?l++:n.get(l++));break;default:H(`Unknown charset format`)}var d=e;return new qn(!1,o,s,i.subarray(a,d))},parseEncoding:function(e,t,n,r){var i={},a=this.bytes,o=!1,s,c=null;function l(){for(var t=a[e++],o=0;o<t;o++){var s=a[e++],c=(a[e++]<<8)+(a[e++]&255);i[s]=r.indexOf(n.get(c))}}if(e===0||e==1){o=!0,s=e;for(var u=e?on.ExpertEncoding:on.StandardEncoding,d=0,f=r.length;d<f;d++){var p=u.indexOf(r[d]);p!=-1&&(i[p]=d)}}else{var m=e,s=a[e++];switch(s&127){case 0:for(var h=a[e++],d=1;d<=h;d++)i[a[e++]]=d;break;case 1:for(var g=a[e++],_=1,d=0;d<g;d++)for(var v=a[e++],y=a[e++],b=v;b<=v+y;b++)i[b]=_++;break;default:H(`Unknow encoding format: `+s+` in CFF`)}var x=e;s&128&&(a[m]&=127,l()),c=a.subarray(m,x)}return s&=127,new Jn(o,s,i,c)},parseFDSelect:function(e,t){var n=e,r=this.bytes,i=r[e++],a=[];switch(i){case 0:for(var o=0;o<t;++o){var s=r[e++];a.push(s)}break;case 3:for(var c=r[e++]<<8|r[e++],o=0;o<c;++o)for(var l=r[e++]<<8|r[e++],u=r[e++],d=r[e]<<8|r[e+1],f=l;f<d;++f)a.push(u);e+=2;break;default:H(`Unknown fdselect format `+i)}var p=e;return new Yn(a,r.subarray(n,p))}},n})(),zn=(function(){function e(){this.header=null,this.names=[],this.topDict=null,this.strings=new Vn,this.globalSubrIndex=null,this.encoding=null,this.charset=null,this.charStrings=null,this.fdArray=[],this.fdSelect=null,this.isCIDFont=!1}return e})(),Bn=(function(){function e(e,t,n,r){this.major=e,this.minor=t,this.hdrSize=n,this.offSize=r}return e})(),Vn=(function(){function e(){this.strings=[]}return e.prototype={get:function(e){return e>=0&&e<=390?Fn[e]:e-391<=this.strings.length?this.strings[e-391]:Fn[0]},add:function(e){this.strings.push(e)},get count(){return this.strings.length}},e})(),Hn=(function(){function e(){this.objects=[],this.length=0}return e.prototype={add:function(e){this.length+=e.length,this.objects.push(e)},set:function(e,t){this.length+=t.length-this.objects[e].length,this.objects[e]=t},get:function(e){return this.objects[e]},get count(){return this.objects.length}},e})(),Un=(function(){function e(e,t){this.keyToNameMap=e.keyToNameMap,this.nameToKeyMap=e.nameToKeyMap,this.defaults=e.defaults,this.types=e.types,this.opcodes=e.opcodes,this.order=e.order,this.strings=t,this.values={}}return e.prototype={setByKey:function(e,t){if(!(e in this.keyToNameMap))return!1;if(t.length===0)return!0;var n=this.types[e];return(n===`num`||n===`sid`||n===`offset`)&&(t=t[0]),this.values[e]=t,!0},setByName:function(e,t){e in this.nameToKeyMap||H(`Invalid dictionary name "`+e+`"`),this.values[this.nameToKeyMap[e]]=t},hasName:function(e){return this.nameToKeyMap[e]in this.values},getByName:function(e){e in this.nameToKeyMap||H(`Invalid dictionary name "`+e+`"`);var t=this.nameToKeyMap[e];return t in this.values?this.values[t]:this.defaults[t]},removeByName:function(e){delete this.values[this.nameToKeyMap[e]]}},e.createTables=function(e){for(var t={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]},n=0,r=e.length;n<r;++n){var i=e[n],a=G(i[0])?(i[0][0]<<8)+i[0][1]:i[0];t.keyToNameMap[a]=i[1],t.nameToKeyMap[i[1]]=a,t.types[a]=i[2],t.defaults[a]=i[3],t.opcodes[a]=G(i[0])?i[0]:[i[0]],t.order.push(a)}return t},e})(),Wn=(function(){var e=[[[12,30],`ROS`,[`sid`,`sid`,`num`],null],[[12,20],`SyntheticBase`,`num`,null],[0,`version`,`sid`,null],[1,`Notice`,`sid`,null],[[12,0],`Copyright`,`sid`,null],[2,`FullName`,`sid`,null],[3,`FamilyName`,`sid`,null],[4,`Weight`,`sid`,null],[[12,1],`isFixedPitch`,`num`,0],[[12,2],`ItalicAngle`,`num`,0],[[12,3],`UnderlinePosition`,`num`,-100],[[12,4],`UnderlineThickness`,`num`,50],[[12,5],`PaintType`,`num`,0],[[12,6],`CharstringType`,`num`,2],[[12,7],`FontMatrix`,[`num`,`num`,`num`,`num`,`num`,`num`],[.001,0,0,.001,0,0]],[13,`UniqueID`,`num`,null],[5,`FontBBox`,[`num`,`num`,`num`,`num`],[0,0,0,0]],[[12,8],`StrokeWidth`,`num`,0],[14,`XUID`,`array`,null],[15,`charset`,`offset`,0],[16,`Encoding`,`offset`,0],[17,`CharStrings`,`offset`,0],[18,`Private`,[`offset`,`offset`],null],[[12,21],`PostScript`,`sid`,null],[[12,22],`BaseFontName`,`sid`,null],[[12,23],`BaseFontBlend`,`delta`,null],[[12,31],`CIDFontVersion`,`num`,0],[[12,32],`CIDFontRevision`,`num`,0],[[12,33],`CIDFontType`,`num`,0],[[12,34],`CIDCount`,`num`,8720],[[12,35],`UIDBase`,`num`,null],[[12,37],`FDSelect`,`offset`,null],[[12,36],`FDArray`,`offset`,null],[[12,38],`FontName`,`sid`,null]],t=null;function n(n){t===null&&(t=Un.createTables(e)),Un.call(this,t,n),this.privateDict=null}return n.prototype=Object.create(Un.prototype),n})(),Gn=(function(){var e=[[6,`BlueValues`,`delta`,null],[7,`OtherBlues`,`delta`,null],[8,`FamilyBlues`,`delta`,null],[9,`FamilyOtherBlues`,`delta`,null],[[12,9],`BlueScale`,`num`,.039625],[[12,10],`BlueShift`,`num`,7],[[12,11],`BlueFuzz`,`num`,1],[10,`StdHW`,`num`,null],[11,`StdVW`,`num`,null],[[12,12],`StemSnapH`,`delta`,null],[[12,13],`StemSnapV`,`delta`,null],[[12,14],`ForceBold`,`num`,0],[[12,17],`LanguageGroup`,`num`,0],[[12,18],`ExpansionFactor`,`num`,.06],[[12,19],`initialRandomSeed`,`num`,0],[20,`defaultWidthX`,`num`,0],[21,`nominalWidthX`,`num`,0],[19,`Subrs`,`offset`,null]],t=null;function n(n){t===null&&(t=Un.createTables(e)),Un.call(this,t,n),this.subrsIndex=null}return n.prototype=Object.create(Un.prototype),n})(),Kn={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2},qn=(function(){function e(e,t,n,r){this.predefined=e,this.format=t,this.charset=n,this.raw=r}return e})(),Jn=(function(){function e(e,t,n,r){this.predefined=e,this.format=t,this.encoding=n,this.raw=r}return e})(),Yn=(function(){function e(e,t){this.fdSelect=e,this.raw=t}return e})(),Xn=(function(){function e(){this.offsets={}}return e.prototype={isTracking:function(e){return e in this.offsets},track:function(e,t){e in this.offsets&&H(`Already tracking location of `+e),this.offsets[e]=t},offset:function(e){for(var t in this.offsets)this.offsets[t]+=e},setEntryLocation:function(e,t,n){e in this.offsets||H(`Not tracking location of `+e);for(var r=n.data,i=this.offsets[e],a=5,o=0,s=t.length;o<s;++o){var c=o*a+i,l=c+1,u=c+2,d=c+3,f=c+4;(r[c]!==29||r[l]!==0||r[u]!==0||r[d]!==0||r[f]!==0)&&H(`writing to an offset that is not empty`);var p=t[o];r[c]=29,r[l]=p>>24&255,r[u]=p>>16&255,r[d]=p>>8&255,r[f]=p&255}}},e})(),Zn=(function(){function e(e){for(var t=[],n=0,r=e.length;n<r;++n)t[n]=e.charCodeAt(n);return t}function t(e){this.cff=e}return t.prototype={compile:function(){var e=this.cff,t={data:[],length:0,add:function(e){this.data=this.data.concat(e),this.length=this.data.length}},n=this.compileHeader(e.header);t.add(n);var r=this.compileNameIndex(e.names);if(t.add(r),e.isCIDFont&&e.topDict.hasName(`FontMatrix`)){var i=e.topDict.getByName(`FontMatrix`);e.topDict.removeByName(`FontMatrix`);for(var a=0,o=e.fdArray.length;a<o;a++){var s=e.fdArray[a],c=i.slice(0);s.hasName(`FontMatrix`)&&(c=U.transform(c,s.getByName(`FontMatrix`))),s.setByName(`FontMatrix`,c)}}var l=this.compileTopDicts([e.topDict],t.length,e.isCIDFont);t.add(l.output);var u=l.trackers[0],d=this.compileStringIndex(e.strings.strings);t.add(d);var f=this.compileIndex(e.globalSubrIndex);if(t.add(f),e.encoding&&e.topDict.hasName(`Encoding`)){if(e.encoding.predefined)u.setEntryLocation(`Encoding`,[e.encoding.format],t);else{var p=this.compileEncoding(e.encoding);u.setEntryLocation(`Encoding`,[t.length],t),t.add(p)}}if(e.charset&&e.topDict.hasName(`charset`)){if(e.charset.predefined)u.setEntryLocation(`charset`,[e.charset.format],t);else{var m=this.compileCharset(e.charset);u.setEntryLocation(`charset`,[t.length],t),t.add(m)}}var h=this.compileCharStrings(e.charStrings);if(u.setEntryLocation(`CharStrings`,[t.length],t),t.add(h),e.isCIDFont){u.setEntryLocation(`FDSelect`,[t.length],t);var g=this.compileFDSelect(e.fdSelect.raw);t.add(g);var l=this.compileTopDicts(e.fdArray,t.length,!0);u.setEntryLocation(`FDArray`,[t.length],t),t.add(l.output);var _=l.trackers;this.compilePrivateDicts(e.fdArray,_,t)}return this.compilePrivateDicts([e.topDict],[u],t),t.add([0]),t.data},encodeNumber:function(e){return parseFloat(e)==parseInt(e,10)&&!isNaN(e)?this.encodeInteger(e):this.encodeFloat(e)},encodeFloat:function(e){var t=e.toString(),n=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(n){var r=parseFloat(`1e`+((n[2]?+n[2]:0)+n[1].length));t=(Math.round(e*r)/r).toString()}for(var i=``,a=0,o=t.length;a<o;++a){var s=t[a];i+=s===`e`?t[++a]===`-`?`c`:`b`:s===`.`?`a`:s===`-`?`e`:s}i+=i.length&1?`f`:`ff`;for(var c=[30],a=0,o=i.length;a<o;a+=2)c.push(parseInt(i.substring(a,a+2),16));return c},encodeInteger:function(e){var t;return e>=-107&&e<=107?t=[e+139]:e>=108&&e<=1131?(e=[e-108],t=[(e>>8)+247,e&255]):e>=-1131&&e<=-108?(e=-e-108,t=[(e>>8)+251,e&255]):t=e>=-32768&&e<=32767?[28,e>>8&255,e&255]:[29,e>>24&255,e>>16&255,e>>8&255,e&255],t},compileHeader:function(e){return[e.major,e.minor,e.hdrSize,e.offSize]},compileNameIndex:function(t){for(var n=new Hn,r=0,i=t.length;r<i;++r)n.add(e(t[r]));return this.compileIndex(n)},compileTopDicts:function(e,t,n){for(var r=[],i=new Hn,a=0,o=e.length;a<o;++a){var s=e[a];n&&(s.removeByName(`CIDFontVersion`),s.removeByName(`CIDFontRevision`),s.removeByName(`CIDFontType`),s.removeByName(`CIDCount`),s.removeByName(`UIDBase`));var c=new Xn,l=this.compileDict(s,c);r.push(c),i.add(l),c.offset(t)}return i=this.compileIndex(i,r),{trackers:r,output:i}},compilePrivateDicts:function(e,t,n){for(var r=0,i=e.length;r<i;++r){var a=e[r];Te(a.privateDict&&a.hasName(`Private`),`There must be an private dictionary.`);var o=a.privateDict,s=new Xn,c=this.compileDict(o,s),l=n.length;if(s.offset(l),c.length||(l=0),t[r].setEntryLocation(`Private`,[c.length,l],n),n.add(c),o.subrsIndex&&o.hasName(`Subrs`)){var u=this.compileIndex(o.subrsIndex);s.setEntryLocation(`Subrs`,[c.length],n),n.add(u)}}},compileDict:function(e,t){for(var n=[],r=e.order,i=0;i<r.length;++i){var a=r[i];if(a in e.values){var o=e.values[a],s=e.types[a];if(G(s)||(s=[s]),G(o)||(o=[o]),o.length!==0){for(var c=0,l=s.length;c<l;++c){var u=s[c],d=o[c];switch(u){case`num`:case`sid`:n=n.concat(this.encodeNumber(d));break;case`offset`:var f=e.keyToNameMap[a];t.isTracking(f)||t.track(f,n.length),n=n.concat([29,0,0,0,0]);break;case`array`:case`delta`:n=n.concat(this.encodeNumber(d));for(var p=1,m=o.length;p<m;++p)n=n.concat(this.encodeNumber(o[p]));break;default:H(`Unknown data type of `+u)}}n=n.concat(e.opcodes[a])}}}return n},compileStringIndex:function(t){for(var n=new Hn,r=0,i=t.length;r<i;++r)n.add(e(t[r]));return this.compileIndex(n)},compileGlobalSubrIndex:function(){var e=this.cff.globalSubrIndex;this.out.writeByteArray(this.compileIndex(e))},compileCharStrings:function(e){return this.compileIndex(e)},compileCharset:function(e){return this.compileTypedArray(e.raw)},compileEncoding:function(e){return this.compileTypedArray(e.raw)},compileFDSelect:function(e){return this.compileTypedArray(e)},compileTypedArray:function(e){for(var t=[],n=0,r=e.length;n<r;++n)t[n]=e[n];return t},compileIndex:function(e,t){t||=[];var n=e.objects,r=n.length;if(r===0)return[0,0,0];for(var i=[r>>8&255,r&255],a=1,o=0;o<r;++o)a+=n[o].length;var s=a<256?1:a<65536?2:a<16777216?3:4;i.push(s);for(var c=1,o=0;o<r+1;o++)s===1?i.push(c&255):s===2?i.push(c>>8&255,c&255):s===3?i.push(c>>16&255,c>>8&255,c&255):i.push(c>>>24&255,c>>16&255,c>>8&255,c&255),n[o]&&(c+=n[o].length);i.length;for(var o=0;o<r;o++){t[o]&&t[o].offset(i.length);for(var l=0,u=n[o].length;l<u;l++)i.push(n[o][l])}return i}},t})(),Qn=(function(){function e(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function t(e,t){return e[t]<<8|e[t+1]}function n(n,r,i){var a=t(n,r+2)===1?e(n,r+8):e(n,r+16),o=t(n,r+a);if(o===4){t(n,r+a+2);for(var s=t(n,r+a+6)>>1,c=r+a+14,l=[],u=0;u<s;u++,c+=2)l[u]={end:t(n,c)};c+=2;for(var u=0;u<s;u++,c+=2)l[u].start=t(n,c);for(var u=0;u<s;u++,c+=2)l[u].idDelta=t(n,c);for(var u=0;u<s;u++,c+=2){var d=t(n,c);if(d!==0){l[u].ids=[];for(var f=0,p=l[u].end-l[u].start+1;f<p;f++)l[u].ids[f]=t(n,c+d),d+=2}}return l}if(o===12){e(n,r+a+4);for(var m=e(n,r+a+12),c=r+a+16,l=[],u=0;u<m;u++)l.push({start:e(n,c),end:e(n,c+4),idDelta:e(n,c+8)-e(n,c)}),c+=12;return l}H(`not supported cmap: `+o)}function r(e,t,n){var r=new Rn(new sr(e,t,n-t),{}).parse();return{glyphs:r.charStrings.objects,subrs:r.topDict.privateDict&&r.topDict.privateDict.subrsIndex&&r.topDict.privateDict.subrsIndex.objects,gsubrs:r.globalSubrIndex&&r.globalSubrIndex.objects}}function i(e,t,n){var r,i;n?(r=4,i=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}):(r=2,i=function(e,t){return e[t]<<9|e[t+1]<<1});for(var a=[],o=i(t,0),s=r;s<t.length;s+=r){var c=i(t,s);a.push(e.subarray(o,c)),o=c}return a}function a(e,t){for(var n=t.charCodeAt(0),r=0,i=e.length-1;r<i;){var a=r+i+1>>1;n<e[a].start?i=a-1:r=a}return e[r].start<=n&&n<=e[r].end?e[r].idDelta+(e[r].ids?e[r].ids[n-e[r].start]:n)&65535:0}function o(e,t,n){function r(e,n){t.push(`c.moveTo(`+e+`,`+n+`);`)}function i(e,n){t.push(`c.lineTo(`+e+`,`+n+`);`)}function a(e,n,r,i){t.push(`c.quadraticCurveTo(`+e+`,`+n+`,`+r+`,`+i+`);`)}var s=0,c=(e[s]<<24|e[s+1]<<16)>>16;if((e[s+2]<<24|e[s+3]<<16)>>16,(e[s+4]<<24|e[s+5]<<16)>>16,(e[s+6]<<24|e[s+7]<<16)>>16,(e[s+8]<<24|e[s+9]<<16)>>16,s+=10,c<0){var l=0,u=0;do{var d=e[s]<<8|e[s+1],f=e[s+2]<<8|e[s+3];s+=4;var p,m;d&1?(p=(e[s]<<24|e[s+1]<<16)>>16,m=(e[s+2]<<24|e[s+3]<<16)>>16,s+=4):(p=e[s++],m=e[s++]),d&2?(l=p,u=m):(l=0,u=0);var h=1,g=1,_=0,v=0;d&8?(h=g=(e[s]<<24|e[s+1]<<16)/1073741824,s+=2):d&64?(h=(e[s]<<24|e[s+1]<<16)/1073741824,g=(e[s+2]<<24|e[s+3]<<16)/1073741824,s+=4):d&128&&(h=(e[s]<<24|e[s+1]<<16)/1073741824,_=(e[s+2]<<24|e[s+3]<<16)/1073741824,v=(e[s+4]<<24|e[s+5]<<16)/1073741824,g=(e[s+6]<<24|e[s+7]<<16)/1073741824,s+=8);var y=n.glyphs[f];y&&(t.push(`c.save();`),t.push(`c.transform(`+h+`,`+_+`,`+v+`,`+g+`,`+l+`,`+u+`);`),o(y,t,n),t.push(`c.restore();`))}while(d&32)}else{for(var b=[],x=0;x<c;x++)b.push(e[s]<<8|e[s+1]),s+=2;var S=e[s]<<8|e[s+1];s+=2+S;for(var C=b[b.length-1]+1,w=[];w.length<C;){var d=e[s++],T=1;for(d&8&&(T+=e[s++]);T-->0;)w.push({flags:d})}for(var l=0,u=0,x=0;x<C;x++){switch(w[x].flags&18){case 0:l+=(e[s]<<24|e[s+1]<<16)>>16,s+=2;break;case 2:l-=e[s++];break;case 18:l+=e[s++]}w[x].x=l}for(var x=0;x<C;x++){switch(w[x].flags&36){case 0:u+=(e[s]<<24|e[s+1]<<16)>>16,s+=2;break;case 4:u-=e[s++];break;case 36:u+=e[s++]}w[x].y=u}for(var E=0,s=0;s<c;s++){var D=b[s],O=w.slice(E,D+1);if(O[0].flags&1)O.push(O[0]);else if(O[O.length-1].flags&1)O.unshift(O[O.length-1]);else{var k={flags:1,x:(O[0].x+O[O.length-1].x)/2,y:(O[0].y+O[O.length-1].y)/2};O.unshift(k),O.push(k)}r(O[0].x,O[0].y);for(var x=1,A=O.length;x<A;x++)O[x].flags&1?i(O[x].x,O[x].y):O[x+1].flags&1?(a(O[x].x,O[x].y,O[x+1].x,O[x+1].y),x++):a(O[x].x,O[x].y,(O[x].x+O[x+1].x)/2,(O[x].y+O[x+1].y)/2);E=D+1}}}function s(e,t,n){var r=[],i=0,o=0,c=0;function l(e,n){t.push(`c.moveTo(`+e+`,`+n+`);`)}function u(e,n){t.push(`c.lineTo(`+e+`,`+n+`);`)}function d(e,n,r,i,a,o){t.push(`c.bezierCurveTo(`+e+`,`+n+`,`+r+`,`+i+`,`+a+`,`+o+`);`)}function f(e){for(var p=0;p<e.length;){var m=!1,h=e[p++];switch(h){case 1:c+=r.length>>1,m=!0;break;case 3:c+=r.length>>1,m=!0;break;case 4:o+=r.pop(),l(i,o),m=!0;break;case 5:for(;r.length>0;)i+=r.shift(),o+=r.shift(),u(i,o);break;case 6:for(;r.length>0&&(i+=r.shift(),u(i,o),r.length!==0);)o+=r.shift(),u(i,o);break;case 7:for(;r.length>0&&(o+=r.shift(),u(i,o),r.length!==0);)i+=r.shift(),u(i,o);break;case 8:for(;r.length>0;){var g=i+r.shift(),_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v+r.shift(),o=y+r.shift(),d(g,_,v,y,i,o)}break;case 10:var b=r.pop()+n.subrsBias,x=n.subrs[b];x&&f(x);break;case 11:return;case 12:switch(h=e[p++],h){case 34:var g=i+r.shift(),v=g+r.shift(),S=o+r.shift();i=v+r.shift(),d(g,o,v,S,i,S);var g=i+r.shift(),v=g+r.shift();i=v+r.shift(),d(g,S,v,o,i,o);break;case 35:var g=i+r.shift(),_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v+r.shift(),o=y+r.shift(),d(g,_,v,y,i,o);var g=i+r.shift(),_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v+r.shift(),o=y+r.shift(),d(g,_,v,y,i,o),r.pop();break;case 36:var g=i+r.shift(),S=o+r.shift(),v=g+r.shift(),C=S+r.shift();i=v+r.shift(),d(g,S,v,C,i,C);var g=i+r.shift(),v=g+r.shift(),w=C+r.shift();i=v+r.shift(),d(g,C,v,w,i,o);break;case 37:var T=i,E=o,g=i+r.shift(),_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v+r.shift(),o=y+r.shift(),d(g,_,v,y,i,o);var g=i+r.shift(),_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v,o=y,Math.abs(i-T)>Math.abs(o-E)?i+=r.shift():o+=r.shift(),d(g,_,v,y,i,o);break;default:H(`unknown operator: 12 `+h)}break;case 14:if(r.length>=4){var D=r.pop(),O=r.pop();o=r.pop(),i=r.pop(),t.push(`c.save();`),t.push(`c.translate(`+i+`,`+o+`);`);var k=a(n.cmap,String.fromCharCode(n.glyphNameMap[on.StandardEncoding[D]]));s(n.glyphs[k],t,n),t.push(`c.restore();`),k=a(n.cmap,String.fromCharCode(n.glyphNameMap[on.StandardEncoding[O]])),s(n.glyphs[k],t,n)}return;case 18:c+=r.length>>1,m=!0;break;case 19:c+=r.length>>1,p+=c+7>>3,m=!0;break;case 20:c+=r.length>>1,p+=c+7>>3,m=!0;break;case 21:o+=r.pop(),i+=r.pop(),l(i,o),m=!0;break;case 22:i+=r.pop(),l(i,o),m=!0;break;case 23:c+=r.length>>1,m=!0;break;case 24:for(;r.length>2;){var g=i+r.shift(),_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v+r.shift(),o=y+r.shift(),d(g,_,v,y,i,o)}i+=r.shift(),o+=r.shift(),u(i,o);break;case 25:for(;r.length>6;)i+=r.shift(),o+=r.shift(),u(i,o);var g=i+r.shift(),_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v+r.shift(),o=y+r.shift(),d(g,_,v,y,i,o);break;case 26:for(r.length%2&&(i+=r.shift());r.length>0;){var g=i,_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v,o=y+r.shift(),d(g,_,v,y,i,o)}break;case 27:for(r.length%2&&(o+=r.shift());r.length>0;){var g=i+r.shift(),_=o,v=g+r.shift(),y=_+r.shift();i=v+r.shift(),o=y,d(g,_,v,y,i,o)}break;case 28:r.push((e[p]<<24|e[p+1]<<16)>>16),p+=2;break;case 29:var b=r.pop()+n.gsubrsBias,x=n.gsubrs[b];x&&f(x);break;case 30:for(;r.length>0;){var g=i,_=o+r.shift(),v=g+r.shift(),y=_+r.shift();if(i=v+r.shift(),o=y+(r.length===1?r.shift():0),d(g,_,v,y,i,o),r.length===0)break;var g=i+r.shift(),_=o,v=g+r.shift(),y=_+r.shift();o=y+r.shift(),i=v+(r.length===1?r.shift():0),d(g,_,v,y,i,o)}break;case 31:for(;r.length>0;){var g=i+r.shift(),_=o,v=g+r.shift(),y=_+r.shift();if(o=y+r.shift(),i=v+(r.length===1?r.shift():0),d(g,_,v,y,i,o),r.length===0)break;var g=i,_=o+r.shift(),v=g+r.shift(),y=_+r.shift();i=v+r.shift(),o=y+(r.length===1?r.shift():0),d(g,_,v,y,i,o)}break;default:h<32&&H(`unknown operator: `+h),h<247?r.push(h-139):h<251?r.push((h-247)*256+e[p++]+108):h<255?r.push(-(h-251)*256-e[p++]-108):(r.push((e[p]<<24|e[p+1]<<16|e[p+2]<<8|e[p+3])/65536),p+=4)}m&&(r.length=0)}}f(e)}function c(e){this.compiledGlyphs={},this.fontMatrix=e}c.prototype={getPathJs:function(e){var t=a(this.cmap,e),n=this.compiledGlyphs[t];return n||(this.compiledGlyphs[t]=n=this.compileGlyph(this.glyphs[t])),n},compileGlyph:function(e){if(!e||e.length===0||e[0]===14)return``;var t=[];return t.push(`c.save();`),t.push(`c.transform(`+this.fontMatrix.join(`,`)+`);`),t.push(`c.scale(size, -size);`),this.compileGlyphImpl(e,t),t.push(`c.restore();`),t.join(`
|
|
@@ -58,5 +58,5 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
58
58
|
`)}`,this.#l();let d=new Range,f=Math.sumPrecise(l.map(e=>e.length));for(let{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){let t=e.nodeValue.length;if(f<=t){d.setStart(e,f),d.setEnd(e,f);break}f-=t}a.removeAllRanges(),a.addRange(d)}#l(){if(this.editorDiv.replaceChildren(),this.#e)for(let e of this.#e.split(`
|
|
59
59
|
`)){let t=document.createElement(`div`);t.append(e?document.createTextNode(e):document.createElement(`br`)),this.editorDiv.append(t)}}#u(){return this.#e.replaceAll(`\xA0`,` `)}static#d(e){return e.replaceAll(` `,`\xA0`)}get contentDiv(){return this.editorDiv}getPDFRect(){let t=e._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,n,r){let i=null;if(t instanceof mm){let{data:{defaultAppearanceData:{fontSize:e,fontColor:n},rect:r,rotation:a,id:o,popupRef:s,richText:c,contentsObj:l,creationDate:u,modificationDate:d},textContent:f,textPosition:p,parent:{page:{pageNumber:m}}}=t;if(!f?.length)return null;i=t={annotationType:Y.FREETEXT,color:Array.from(n),fontSize:e,value:f.join(`
|
|
60
60
|
`),position:p,pageIndex:m-1,rect:r.slice(0),rotation:a,annotationElementId:o,id:o,deleted:!1,popupRef:s,comment:l?.str||null,richText:c,creationDate:u,modificationDate:d}}let a=await super.deserialize(t,n,r);return a.#r=t.fontSize,a.color=Q.makeHexColor(...t.color),a.#e=e.#d(t.value),a._initialData=i,t.comment&&a.setCommentData(t),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let t=Xu._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:t,fontSize:this.#r,value:this.#u()});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!this.#f(n)?null:(n.id=this.annotationElementId,n)}#f(e){let{value:t,fontSize:n,color:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((e,t)=>e!==r[t])||e.pageIndex!==i}renderAnnotationElement(e){let t=super.renderAnnotationElement(e);if(!t)return null;let{style:n}=t;n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,t.replaceChildren();for(let e of this.#e.split(`
|
|
61
|
-
`)){let n=document.createElement(`div`);n.append(e?document.createTextNode(e):document.createElement(`br`)),t.append(n)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}},Mm=class{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(let[t,n]of Object.entries(e))t.startsWith(`_`)||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){wl(`Not implemented`)}},Nm=class e extends Xu{#e=null;#t;_clipPathId=null;_colorPicker=null;_drawId=null;_drawOutlines=null;_focusDrawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#r=null;static#i=null;static#a=null;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(e){e.drawOutlines&&(this.#o(e),this.#m())}#o({drawOutlines:e,drawId:t,drawingOptions:n,clipPathId:r}){this._drawOutlines=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(Xu._l10nAlert[this.editorType]),t>=0?(this._drawId=t,this._clipPathId=r??null,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties),this.#c(this.parent)):this._drawId=this.#s(e,this.parent),this.#_(e.box)}#s(t,n){let{id:r,clipPathId:i}=n.drawLayer.draw(e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,this.constructor._hasClipPath);return this.constructor._hasClipPath&&(this._clipPathId=i),this.#c(n),r}#c(e){let t=this._drawOutlines.getFocusSVGProperties(this.#f);t&&(this._focusDrawId=e.drawLayer.drawOutline(t,this._drawOutlines.focusMustRemoveSelfIntersections))}#l(e=this.#f){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e))}#u(e){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,{rootClass:e})}#d(){let{parent:e,_drawId:t,_focusDrawId:n,_isVisible:r}=this;if(!e||t===null)return;let i={hidden:!r};e.drawLayer.updateProperties(t,{rootClass:i}),n!==null&&e.drawLayer.updateProperties(n,{rootClass:i})}static _mergeSVGProperties(e,t){let n=new Set(Object.keys(e));for(let[r,i]of Object.entries(t))n.has(r)?Object.assign(e[r],i):e[r]=i;return e}static getDefaultDrawingOptions(e){wl(`Not implemented`)}static get typesMap(){wl(`Not implemented`)}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}get#f(){return(this.parentRotation-this._drawRotation+360)%360}static updateDefaultParams(t,n){let r=this.typesMap.get(t);r&&this._defaultDrawingOptions.updateProperty(r,n),this._currentParent&&(e.#n.updateProperty(r,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,n){let r=this._drawingOptions,i=r[t],a=n=>{r.updateProperty(t,n);let i=this._drawOutlines.updateProperty(t,n);i&&this.#_(i),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:a.bind(this,n),undo:a.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,t,n=this.colorAndOpacityType){let r=this.constructor.typesMap.get(this.colorType),i=this._opacityName,a=this._drawingOptions,o=a[r],s=a[i],c=(e,t)=>{a.updateProperty(r,e),a.updateProperty(i,t),this._drawOutlines.updateProperty(r,e),this._drawOutlines.updateProperty(i,t),this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:c.bind(this,e,t),undo:c.bind(this,o,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:n,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(this.#g()),{bbox:this.#v()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(this.#g()),{bbox:this.#v()})),this.#l()}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#v()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(this.#g(),this.parentDimensions),{bbox:this.#v()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(this.disableEditMode(),this.disableEditing())}disableEditing(){super.disableEditing(),this.div.classList.toggle(`disabled`,!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle(`disabled`,!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),this.#p(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#m(),this.#_(this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#p()):e&&(this._uiManager.addShouldRescale(this),this.#m(e),t=!this.parent&&this.div?.classList.contains(`selectedEditor`)),super.setParent(e),this.#d(),t&&this.select()}#p(){if(this._drawId===null||!this.parent)return;let{drawLayer:e}=this.parent;e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(e.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()}#m(e=this.parent){if(this._drawId===null||this.parent!==e){if(this._drawId!==null){let{drawLayer:t}=this.parent;t.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null&&t.updateParent(this._focusDrawId,e.drawLayer)}else this._drawingOptions.updateAll(),this._drawId=this.#s(this._drawOutlines,e),this._clipPathId&&this.#e&&(this.#e.style.clipPath=this._clipPathId)}}#h([e,t,n,r]){let{parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[t,1-e,a/i*n,i/a*r];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,a/i*n,i/a*r];default:return[e,t,n,r]}}#g(){let{x:e,y:t,width:n,height:r,parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[1-t,e,i/a*n,a/i*r];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,i/a*n,a/i*r];default:return[e,t,n,r]}}#_(e){[this.x,this.y,this.width,this.height]=this.#h(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#v(e=this.parentRotation){let{x:t,y:n,width:r,height:i,_drawRotation:a,parentDimensions:[o,s]}=this;switch((a*4+e)/90){case 1:return[1-n-i,t,i,r];case 2:return[1-t-r,1-n-i,r,i];case 3:return[n,1-t-r,i,r];case 4:return[t,n-o/s*r,s/o*i,o/s*r];case 5:return[1-n,t,o/s*r,s/o*i];case 6:return[1-t-s/o*i,1-n,s/o*i,o/s*r];case 7:return[n-o/s*r,1-t-s/o*i,o/s*r,s/o*i];case 8:return[t-r,n-i,r,i];case 9:return[1-n,t-r,i,r];case 10:return[1-t,1-n,r,i];case 11:return[n-i,1-t,i,r];case 12:return[t-s/o*i,n,s/o*i,o/s*r];case 13:return[1-n-o/s*r,t-s/o*i,o/s*r,s/o*i];case 14:return[1-t,1-n-o/s*r,s/o*i,o/s*r];case 15:return[n,1-t,o/s*r,s/o*i];default:return[t,n,r,i]}}rotate(t=this.parentRotation){if(!this.parent||this._drawId===null)return;let n=(t-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties({bbox:this.#v(t)},this._drawOutlines.updateRotation(n))),this.#l(n)}show(e=this._isVisible){super.show(e),this.#d()}select(){super.select(),this.#u({hovered:!1,selected:!0})}unselect(){super.unselect(),this.#u({selected:!1})}pointerover(){this.isSelected||this.#u({hovered:!0})}pointerleave(){this.isSelected||this.#u({hovered:!1})}onScaleChanging(){if(!this.parent)return;let e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);e&&this.#_(e)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);let n=super.render();this.constructor._hasDrawClass&&n.classList.add(`draw`);let r=this.#e=document.createElement(`div`);return n.append(r),r.setAttribute(`aria-hidden`,`true`),r.className=`internal`,this._clipPathId&&(r.style.clipPath=this._clipPathId),Iu(this,r,[`pointerover`,`pointerleave`]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e){wl(`Not implemented`)}static _getDrawingTarget(e,{target:t}){return t}static _getPointerCoords({offsetX:e,offsetY:t,clientX:n,clientY:r},i=null){if(!i)return[e,t];let a=n-i.clientX,o=r-i.clientY;switch(this._currentParent.viewport.rotation){case 90:[a,o]=[o,-a];break;case 180:[a,o]=[-a,-o];break;case 270:[a,o]=[-o,a]}return[i.offsetX+a,i.offsetY+o]}static _addDrawingListeners(e,t){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(t,n,r,i){let{pointerId:a,pointerType:o}=i;if(Lu.isInitializedAndDifferentPointerType(o))return;let s=this._getDrawingTarget(t,i),[c,l]=this._getPointerCoords(i),{viewport:{rotation:u}}=t,{x:d,y:f,width:p,height:m}=s.getBoundingClientRect(),h=e.#r=new AbortController,g=t.combinedSignal(h);if(Lu.setPointer(o,a),window.addEventListener(`pointerup`,e=>{Lu.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:g}),window.addEventListener(`pointercancel`,e=>{Lu.isSamePointerIdOrRemove(e.pointerId)&&this._endDrawingSession()},{signal:g}),window.addEventListener(`pointerdown`,t=>{Lu.isSamePointerType(t.pointerType)&&(Lu.initializeAndAddPointerId(t.pointerId),e.#n.isCancellable()&&(e.#n.removeLastElement(),e.#n.isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener(`contextmenu`,du,{signal:g}),s.addEventListener(`pointermove`,this._drawMove.bind(this),{signal:g}),s.addEventListener(`touchmove`,e=>{Lu.isSameTimeStamp(e.timeStamp)&&fu(e)},{signal:g}),this._addDrawingListeners(s,g),t.toggleDrawing(),n._editorUndoBar?.hide(),e.#n){t.drawLayer.updateProperties(this._currentDrawId,e.#n.startNew(c,l,p,m,u));return}n.updateUIForDefaultProperties(this),e.#n=this.createDrawerInstance({x:c,y:l,box:[d,f,p,m],rotation:u,parent:t,isLTR:r}),e.#i=this.getDefaultDrawingOptions(),this._currentParent=t;let{id:_,clipPathId:v}=t.drawLayer.draw(this._mergeSVGProperties(e.#i.toSVGProperties(),e.#n.defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=_,e.#a=this._hasClipPath?v:null}static _drawMove(t){if(Lu.isSameTimeStamp(t.timeStamp),!e.#n||!Lu.isSamePointerId(t.pointerId))return;if(Lu.isUsingMultiplePointers()){this._endDraw(t);return}let n,r=t.getCoalescedEvents?.();if(r?.length){let i=[];for(let e of r)i.push(...this._getPointerCoords(e,t));n=e.#n.addPoints(i)}else n=e.#n.add(...this._getPointerCoords(t));this._currentParent.drawLayer.updateProperties(this._currentDrawId,n),Lu.setTimeStamp(t.timeStamp),fu(t)}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#n=null,e.#i=null,e.#a=null,Lu.clearTimeStamp()),e.#r&&(e.#r.abort(),e.#r=null,Lu.clearPointerIds())}static _endDraw(t){let n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),n.drawLayer.updateProperties(this._currentDrawId,t?.target===n.div?e.#n.end(...this._getPointerCoords(t)):e.#n.end()),this.supportMultipleDrawings){let t=e.#n,r=this._currentDrawId,i=t.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(r,t.setLastElement(i))},undo:()=>{n.drawLayer.updateProperties(r,t.removeLastElement())},mustExec:!1,type:ul.DRAW_STEP})}else this.endDrawing(!1)}}static endDrawing(t){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(ul.DRAW_STEP),!e.#n.isEmpty()){let{pageDimensions:[r,i],scale:a}=n,o=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:e.#a,drawOutlines:e.#n.getOutlines(r*a,i*a,a,this._INNER_MARGIN),drawingOptions:e.#i,mustBeCommitted:!t});return this._cleanup(!0),o}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,i,a,o){wl(`Not implemented`)}static async deserialize(e,t,n){let{rawDims:{pageWidth:r,pageHeight:i,pageX:a,pageY:o}}=t.viewport,s=this.deserializeDraw(a,o,r,i,this._INNER_MARGIN,e,n),c=await super.deserialize(e,t,n);return c.createDrawingOptions(e),c.#o({drawOutlines:s}),c.#m(),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){let[t,n]=this.pageTranslation,[r,i]=this.pageDimensions;return this._drawOutlines.serialize([t,n,r,i],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},$=class{static PRECISION=1e-4;focusOutline=null;toSVGPath(){wl("Abstract method `toSVGPath` must be implemented.")}get box(){wl("Abstract getter `box` must be implemented.")}serialize(e,t){wl("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){wl("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,t){return null}updateParentDimensions(e,t){return null}serializeQuadPoints(e,t){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,t){return{}}static _rotateBox([e,t,n,r],i){switch(i){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}static _rescale(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o]*r,a[o+1]=n+e[o+1]*i;return a}static _rescaleAndSwap(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o+1]*r,a[o+1]=n+e[o]*i;return a}static _translate(e,t,n,r){r||=new Float32Array(e.length);for(let i=0,a=e.length;i<a;i+=2)r[i]=t+e[i],r[i+1]=n+e[i+1];return r}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,r,i){switch(i){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static createBezierPoints(e,t,n,r,i,a){return[(e+5*n)/6,(t+5*r)/6,(5*n+i)/6,(5*r+a)/6,(n+i)/2,(r+a)/2]}},Pm=class e{#e;#t=[];#n;#r;#i=[];#a=new Float32Array(18);#o;#s;#c;#l;#u;#d;#f=[];static#p=8;static#m=2;static#h=e.#p+e.#m;constructor(t,n,r,i,a,o,s=0){this.#e=r,this.#d=a*i,this.#r=o,this.#a.set([NaN,NaN,NaN,NaN,t,n],6),this.#n=s,this.#l=e.#p*i,this.#c=e.#h*i,this.#u=i,this.#f.push(t,n)}isEmpty(){return isNaN(this.#a[8])}isCancellable(){return this.#f.length<=10}removeLastElement(){return this.#a.fill(NaN),this.#i.length=this.#t.length=this.#f.length=0,{path:{d:``}}}#g(){let e=this.#a.subarray(4,6),t=this.#a.subarray(16,18),[n,r,i,a]=this.#e;return[(this.#o+(e[0]-t[0])/2-n)/i,(this.#s+(e[1]-t[1])/2-r)/a,(this.#o+(t[0]-e[0])/2-n)/i,(this.#s+(t[1]-e[1])/2-r)/a]}add(e,t){this.#o=e,this.#s=t;let[n,r,i,a]=this.#e,[o,s,c,l]=this.#a.subarray(8,12),u=e-c,d=t-l,f=Math.hypot(u,d);if(f<this.#c)return!1;let p=f-this.#l,m=p/f,h=m*u,g=m*d,_=o,v=s;o=c,s=l,c+=h,l+=g,this.#f?.push(e,t);let y=-g/p,b=h/p,x=y*this.#d,S=b*this.#d;return this.#a.set(this.#a.subarray(2,8),0),this.#a.set([c+x,l+S],4),this.#a.set(this.#a.subarray(14,18),12),this.#a.set([c-x,l-S],16),isNaN(this.#a[6])?(this.#i.length===0&&(this.#a.set([o+x,s+S],2),this.#i.push(NaN,NaN,NaN,NaN,(o+x-n)/i,(s+S-r)/a),this.#a.set([o-x,s-S],14),this.#t.push(NaN,NaN,NaN,NaN,(o-x-n)/i,(s-S-r)/a)),this.#a.set([_,v,o,s,c,l],6),!this.isEmpty()):(this.#a.set([_,v,o,s,c,l],6),Math.abs(Math.atan2(v-s,_-o)-Math.atan2(g,h))<Math.PI/2?([o,s,c,l]=this.#a.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/i,((s+l)/2-r)/a),[o,s,_,v]=this.#a.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((_+o)/2-n)/i,((v+s)/2-r)/a),!0):([_,v,o,s,c,l]=this.#a.subarray(0,6),this.#i.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),[c,l,o,s,_,v]=this.#a.subarray(12,18),this.#t.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),!0))}toSVGPath(){if(this.isEmpty())return``;let e=this.#i,t=this.#t;if(isNaN(this.#a[6])&&!this.isEmpty())return this.#_();let n=[];n.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?n.push(`L${e[t+4]} ${e[t+5]}`):n.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#y(n);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#v(n),n.join(` `)}#_(){let[e,t,n,r]=this.#e,[i,a,o,s]=this.#g();return`M${(this.#a[2]-e)/n} ${(this.#a[3]-t)/r} L${(this.#a[4]-e)/n} ${(this.#a[5]-t)/r} L${i} ${a} L${o} ${s} L${(this.#a[16]-e)/n} ${(this.#a[17]-t)/r} L${(this.#a[14]-e)/n} ${(this.#a[15]-t)/r} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,r,i]=this.#e,a=this.#a.subarray(4,6),o=this.#a.subarray(16,18),[s,c,l,u]=this.#g();e.push(`L${(a[0]-t)/r} ${(a[1]-n)/i} L${s} ${c} L${l} ${u} L${(o[0]-t)/r} ${(o[1]-n)/i}`)}newFreeDrawOutline(e,t,n,r,i,a){return new Fm(e,t,n,r,i,a)}getOutlines(){let e=this.#i,t=this.#t,n=this.#a,[r,i,a,o]=this.#e,s=new Float32Array((this.#f?.length??0)+2);for(let e=0,t=s.length-2;e<t;e+=2)s[e]=(this.#f[e]-r)/a,s[e+1]=(this.#f[e+1]-i)/o;if(s[s.length-2]=(this.#o-r)/a,s[s.length-1]=(this.#s-i)/o,isNaN(n[6])&&!this.isEmpty())return this.#b(s);let c=new Float32Array(this.#i.length+24+this.#t.length),l=e.length;for(let t=0;t<l;t+=2)isNaN(e[t])?c[t]=c[t+1]=NaN:(c[t]=e[t],c[t+1]=e[t+1]);l=this.#S(c,l);for(let e=t.length-6;e>=6;e-=6)for(let n=0;n<6;n+=2)isNaN(t[e+n])?(c[l]=c[l+1]=NaN,l+=2):(c[l]=t[e+n],c[l+1]=t[e+n+1],l+=2);return this.#x(c,l),this.newFreeDrawOutline(c,s,this.#e,this.#u,this.#n,this.#r)}#b(e){let t=this.#a,[n,r,i,a]=this.#e,[o,s,c,l]=this.#g(),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-n)/i,(t[3]-r)/a,NaN,NaN,NaN,NaN,(t[4]-n)/i,(t[5]-r)/a,NaN,NaN,NaN,NaN,o,s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,(t[16]-n)/i,(t[17]-r)/a,NaN,NaN,NaN,NaN,(t[14]-n)/i,(t[15]-r)/a],0),this.newFreeDrawOutline(u,e,this.#e,this.#u,this.#n,this.#r)}#x(e,t){let n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#S(e,t){let n=this.#a.subarray(4,6),r=this.#a.subarray(16,18),[i,a,o,s]=this.#e,[c,l,u,d]=this.#g();return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-a)/s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(r[0]-i)/o,(r[1]-a)/s],t),t+=24}},Fm=class extends ${#e;#t=new Float32Array(4);#n;#r;#i;#a;#o;constructor(e,t,n,r,i,a){super(),this.#o=e,this.#i=t,this.#e=n,this.#a=r,this.#n=i,this.#r=a,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#s(a);let[o,s,c,l]=this.#t;for(let t=0,n=e.length;t<n;t+=2)e[t]=(e[t]-o)/c,e[t+1]=(e[t+1]-s)/l;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-o)/c,t[e+1]=(t[e+1]-s)/l}toSVGPath(){let e=[`M${this.#o[4]} ${this.#o[5]}`];for(let t=6,n=this.#o.length;t<n;t+=6)isNaN(this.#o[t])?e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`):e.push(`C${this.#o[t]} ${this.#o[t+1]} ${this.#o[t+2]} ${this.#o[t+3]} ${this.#o[t+4]} ${this.#o[t+5]}`);return e.push(`Z`),e.join(` `)}serialize([e,t,n,r],i){let a=n-e,o=r-t,s,c;switch(i){case 0:s=$._rescale(this.#o,e,r,a,-o),c=$._rescale(this.#i,e,r,a,-o);break;case 90:s=$._rescaleAndSwap(this.#o,e,t,a,o),c=$._rescaleAndSwap(this.#i,e,t,a,o);break;case 180:s=$._rescale(this.#o,n,t,-a,o),c=$._rescale(this.#i,n,t,-a,o);break;case 270:s=$._rescaleAndSwap(this.#o,n,r,-a,-o),c=$._rescaleAndSwap(this.#i,n,r,-a,-o)}return{outline:Array.from(s),points:[Array.from(c)]}}#s(e){let t=this.#o,n=t[4],r=t[5],i=[n,r,n,r],a=n,o=r,s=n,c=r,l=e?Math.max:Math.min,u=new Float32Array(4);for(let e=6,d=t.length;e<d;e+=6){let d=t[e+4],f=t[e+5];isNaN(t[e])?(Q.pointBoundingBox(d,f,i),o>f?(a=d,o=f):o===f&&(a=l(a,d)),c<f?(s=d,c=f):c===f&&(s=l(s,d))):(u.set(nl,0),Q.bezierBoundingBox(n,r,...t.slice(e,e+6),u),Q.rectBoundingBox(...u,i),o>u[1]?(a=u[0],o=u[1]):o===u[1]&&(a=l(a,u[0])),c<u[3]?(s=u[2],c=u[3]):c===u[3]&&(s=l(s,u[2]))),n=d,r=f}let d=this.#t;d[0]=i[0]-this.#n,d[1]=i[1]-this.#n,d[2]=i[2]-i[0]+2*this.#n,d[3]=i[3]-i[1]+2*this.#n,this.firstPoint=[a,o],this.lastPoint=[s,c]}get box(){return this.#t}newOutliner(e,t,n,r,i,a,o=0){return new Pm(e,t,n,r,i,a,o)}updateThickness(e){let t=this.getNewOutline(e);return this.#o=t.#o,this.#i=t.#i,this.#t.set(t.#t),this.firstPoint=t.firstPoint,this.lastPoint=t.lastPoint,this.#t}getNewOutline(e,t){let[n,r,i,a]=this.#t,[o,s,c,l]=this.#e,u=i*c,d=a*l,f=n*c+o,p=r*l+s,m=this.#i,h=this.newOutliner(m[0]*u+f,m[1]*d+p,this.#e,this.#a,e,this.#r,t??this.#n);for(let e=2,t=m.length;e<t;e+=2)h.add(m[e]*u+f,m[e+1]*d+p);return h.getOutlines()}};function Im(e){return{bbox:e.box,root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:e.isFree},path:{d:e.toSVGPath()}}}function Lm(e,t){let{focusOutline:n}=e;return{bbox:$._rotateBox(n.box,t),root:{"data-main-rotation":t},rootClass:{highlightOutline:!0,free:e.isFree},path:{d:n.toSVGPath()}}}var Rm=class{#e;#t;#n;#r=[];#i=[];constructor(e,t=0,n=0,r=!0){let i=nl.slice(),a=10**-4;for(let{x:n,y:r,width:o,height:s}of e){let e=Math.floor((n-t)/a)*a,c=Math.ceil((n+o+t)/a)*a,l=Math.floor((r-t)/a)*a,u=Math.ceil((r+s+t)/a)*a,d=[e,l,u,!0],f=[c,l,u,!1];this.#r.push(d,f),Q.rectBoundingBox(e,l,c,u,i)}let o=i[2]-i[0]+2*n,s=i[3]-i[1]+2*n,c=i[0]-n,l=i[1]-n,u=r?-1/0:1/0,d=1/0,f=this.#r.at(r?-1:-2),p=[f[0],f[2]];for(let e of this.#r){let[t,n,i,a]=e;!a&&r?n<d?(d=n,u=t):n===d&&(u=Math.max(u,t)):a&&!r&&(n<d?(d=n,u=t):n===d&&(u=Math.min(u,t))),e[0]=(t-c)/o,e[1]=(n-l)/s,e[2]=(i-l)/s}this.#e=new Float32Array([c,l,o,s]),this.#t=[u,d],this.#n=p}getOutlines(){this.#r.sort((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]);let e=[];for(let t of this.#r)t[3]?(e.push(...this.#l(t)),this.#s(t)):(this.#c(t),e.push(...this.#l(t)));return this.#a(e)}#a(e){let t=[],n=new Set;for(let n of e){let[e,r,i]=n;t.push([e,r,n],[e,i,n])}t.sort((e,t)=>e[1]-t[1]||e[0]-t[0]);for(let e=0,r=t.length;e<r;e+=2){let r=t[e][2],i=t[e+1][2];r.push(i),i.push(r),n.add(r),n.add(i)}let r=[];for(;n.size>0;){let e=n.values().next().value,[t,i,a,o,s]=e;n.delete(e);let c=t,l=i,u=[t,a];for(r.push(u);;){let e;if(n.has(o))e=o;else if(n.has(s))e=s;else break;n.delete(e),[t,i,a,o,s]=e,c!==t&&(u.push(c,l,t,l===i?i:a),c=t),l=l===i?a:i}u.push(c,l)}return new zm(r,this.#e,this.#t,this.#n)}#o(e){let t=this.#i,n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i][0];if(a===e)return i;a<e?n=i+1:r=i-1}return r+1}#s([,e,t]){let n=this.#o(e);this.#i.splice(n,0,[e,t])}#c([,e,t]){let n=this.#o(e);for(let r=n;r<this.#i.length;r++){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}for(let r=n-1;r>=0;r--){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}}#l(e){let[t,n,r]=e,i=[[t,n,r]],a=this.#o(r);for(let e=0;e<a;e++){let[n,r]=this.#i[e];for(let e=0,a=i.length;e<a;e++){let[,o,s]=i[e];if(!(r<=o||s<=n)){if(o>=n){if(s>r)i[e][1]=r;else{if(a===1)return[];i.splice(e,1),e--,a--}}else i[e][2]=n,s>r&&i.push([t,r,s])}}}return i}},zm=class extends ${#e;#t=null;#n;constructor(e,t,n,r){super(),this.#n=e,this.#e=t,this.firstPoint=n,this.lastPoint=r}static build(e,t){let n=new Rm(e,.001).getOutlines();return n.#t=e,n.focusOutline=new Rm(e,.0025,.001,t).getOutlines(),n}get isFree(){return!1}get defaultSVGProperties(){return Im(this)}getFocusSVGProperties(e){return Lm(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,t],[n,r]){let i=this.#t,a=new Float32Array(i.length*8),o=0;for(let{x:s,y:c,width:l,height:u}of i){let i=s*n+e,d=(1-c)*r+t;a[o]=a[o+4]=i,a[o+1]=a[o+3]=d,a[o+2]=a[o+6]=i+l*n,a[o+5]=a[o+7]=d-u*r,o+=8}return a}toSVGPath(){let e=[];for(let t of this.#n){let[n,r]=t;e.push(`M${n} ${r}`);for(let i=2;i<t.length;i+=2){let a=t[i],o=t[i+1];a===n?(e.push(`V${o}`),r=o):o===r&&(e.push(`H${a}`),n=a)}e.push(`Z`)}return e.join(` `)}serialize([e,t,n,r],i){let a=[],o=n-e,s=r-t;for(let t of this.#n){let n=Array(t.length);for(let i=0;i<t.length;i+=2)n[i]=e+t[i]*o,n[i+1]=r-t[i+1]*s;a.push(n)}return a}get box(){return this.#e}},Bm=class extends Pm{newFreeDrawOutline(e,t,n,r,i,a){return new Hm(e,t,n,r,i,a)}},Vm=class{#e;#t;constructor(e,t,n,r,i,a,o){this.#e=new Bm(e,t,n,r,i,a,o),this.#t=i}add(e,t){return this.#e.add(e,t)?{path:{d:this.#e.toSVGPath()}}:null}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)t=this.#e.add(e[n],e[n+1])||t;return t?{path:{d:this.#e.toSVGPath()}}:null}end(e,t){return e===void 0?null:this.add(e,t)}isEmpty(){return this.#e.isEmpty()}isCancellable(){return this.#e.isCancellable()}removeLastElement(){return this.#e.removeLastElement()}updateProperty(e,t){return null}getOutlines(){let e=this.#e.getOutlines();return e.buildFocusOutline(2*this.#t),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:!0},path:{d:this.#e.toSVGPath()}}}},Hm=class e extends Fm{static#e=1.5;newOutliner(e,t,n,r,i,a,o=0){return new Bm(e,t,n,r,i,a,o)}get isFree(){return!0}buildFocusOutline(t){this.focusOutline=this.getNewOutline(t/2+e.#e,.0025)}get defaultSVGProperties(){return Im(this)}getFocusSVGProperties(e){return Lm(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,t){if(e!==`thickness`)return null;let n=this.updateThickness(t/2);return this.buildFocusOutline(t),n}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}},Um=class e extends Mm{constructor(e=null){super(),super.updateProperties(e)}updateSVGProperty(e,t){e!==`thickness`&&super.updateSVGProperty(e,t)}clone(){let t=new e;return t.updateAll(this),t}},Wm=class e extends Nm{#e=null;#t=0;#n=null;#r=0;#i=``;#a=``;static _DEFAULT_OPACITY=1;static _DEFAULT_THICKNESS=12;static _defaultDrawingOptions=null;static _type=`highlight`;static _editorType=Y.HIGHLIGHT;static get _keyboardManager(){let t=e.prototype;return Z(this,`_keyboardManager`,new Vu([[[`ArrowLeft`],t._moveCaret,{args:[0]}],[[`ArrowRight`],t._moveCaret,{args:[1]}],[[`ArrowUp`],t._moveCaret,{args:[2]}],[[`ArrowDown`],t._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:`highlightEditor`}),this.#e=e.anchorNode||null,this.#t=e.anchorOffset||0,this.#n=e.focusNode||null,this.#r=e.focusOffset||0,this.#i=e.methodOfCreation||(this._drawOutlines?.isFree?`main_toolbar`:``),this.#a=e.text||``,this._isDraggable=!1,this.defaultL10nId=`pdfjs-editor-highlight-editor`,this.rotate()}static initialize(t,n){Xu.initialize(t,n),this._defaultDrawingOptions||=new Um({fill:n.highlightColors?.values().next().value||`#fff066`,"fill-opacity":e._DEFAULT_OPACITY,thickness:e._DEFAULT_THICKNESS})}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get typesMap(){return Z(this,`typesMap`,new Map([[ul.HIGHLIGHT_COLOR,`fill`],[ul.HIGHLIGHT_THICKNESS,`thickness`]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(t){let{boxes:n,drawOutlines:r}=t;(n||r)&&(this._drawingOptions||=t.drawingOptions||e.getDefaultDrawingOptions(),n&&(t={...t,drawOutlines:zm.build(n,this._uiManager.direction===`ltr`)}),super._addOutlines(t))}get colorType(){return ul.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions[`fill-opacity`]}get _opacityName(){return`fill-opacity`}get _drawRotation(){return this._drawOutlines?.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){return!this._drawOutlines?.isFree}get telemetryInitialData(){return{action:`added`,type:this._drawOutlines.isFree?`free_highlight`:`highlight`,color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:this.#i}}get telemetryFinalData(){return{type:`highlight`,color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get(`color`).size}}translateInPage(e,t){}get toolbarPosition(){return this.#o(this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return this.#o(this._drawOutlines.firstPoint)}#o([e,t]){let[n,r,i,a]=this._drawOutlines.box;return[(e-n)/i,(t-r)/a]}updateParams(t,n){switch(t){case ul.HIGHLIGHT_COLOR:this._updateColorAndOpacity(n,e._DEFAULT_OPACITY,t),this._reportTelemetry({action:`color_changed`,color:this._uiManager.getNonHCMColorName(n)},!0);break;case ul.HIGHLIGHT_THICKNESS:super.updateParams(t,n),this._reportTelemetry({action:`thickness_changed`,thickness:n},!0)}}get propertiesToUpdate(){let e=super.propertiesToUpdate;return e.push([ul.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new Wp({editor:this}),[[`colorPicker`,this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,t){return super.getRect(e,t,this._drawRotation)}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this._reportTelemetry({action:`deleted`}),super.remove()}render(){if(this.div)return this.div;let e=super.render();return this.#a&&(e.setAttribute(`aria-label`,this.#a),e.setAttribute(`role`,`mark`)),this._drawOutlines.isFree?e.classList.add(`free`):e.addEventListener(`keydown`,this.#s.bind(this),{signal:this._uiManager._signal}),this.enableEditing(),e}#s(t){e._keyboardManager.exec(this,t)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#c(!0);break;case 1:case 3:this.#c(!1)}}#c(e){if(!this.#e)return;let t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#n,this.#r)}unselect(){super.unselect(),this._drawOutlines.isFree||this.#c(!1)}static createDrawerInstance({x:e,y:t,box:n,parent:r,isLTR:i}){return new Vm(e,t,n,r.scale,this._defaultDrawingOptions.thickness/2,i,.001)}static _getDrawingTarget(e,{target:t}){return t.closest(`.textLayer`)}static _getPointerCoords({x:e,y:t}){return[e,t]}static _addDrawingListeners(e,t){e.classList.add(`free`),t.addEventListener(`abort`,()=>e.classList.remove(`free`),{once:!0}),window.addEventListener(`blur`,()=>this._endDraw(null),{signal:t}),window.addEventListener(`pointerdown`,fu,{capture:!0,passive:!1,signal:t})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:t,opacity:n,thickness:r}){let{_defaultDrawingOptions:i,_DEFAULT_OPACITY:a}=e;this._drawingOptions=e.getDefaultDrawingOptions({fill:Q.makeHexColor(...t),"fill-opacity":n||a,thickness:r||i.thickness})}static deserializeDraw(e,t,n,r,i,a,o){let{quadPoints:s}=a;if(s){let i=[];for(let a=0,o=s.length;a<o;a+=8)i.push({x:(s[a]-e)/n,y:1-(s[a+1]-t)/r,width:(s[a+2]-s[a])/n,height:(s[a+1]-s[a+5])/r});return zm.build(i,o.direction===`ltr`)}let c=a.thickness||this._defaultDrawingOptions.thickness,l=(a.inkLists||a.outlines.points)[0],u=new Bm(l[0]-e,r-(l[1]-t),[0,0,n,r],1,c/2,!0,.001);for(let n=0,i=l.length;n<i;n+=2)u.add(l[n]-e,r-(l[n+1]-t));let d=u.getOutlines();return d.buildFocusOutline(c),d}static async deserialize(e,t,n){let r=null;if(e instanceof Sm){let{data:{quadPoints:t,rect:n,rotation:i,id:a,color:o,opacity:s,popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:Y.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}else if(e instanceof xm){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,borderStyle:{rawWidth:s},popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:Y.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=super.serialize(e);return Object.assign(t,{color:Xu._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(t.rect,this._drawRotation)}),this.addComment(t),this.annotationElementId&&!this.#l(t)?null:(t.id=this.annotationElementId,t)}#l(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((e,n)=>e!==t[n])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},Gm=class{#e=new Float64Array(6);#t=new Float64Array(2);#n;#r;#i;#a;#o;#s=``;#c=0;#l=new Km;#u;#d;constructor(e,t,n,r,i,a){this.#u=n,this.#d=r,this.#i=i,this.#a=a,[e,t]=this.#f(e,t);let o=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#r=[{line:o,points:this.#o}],this.#e.set(o,0),this.#t.set([e,t],0)}updateProperty(e,t){e===`stroke-width`&&(this.#a=t)}#f(e,t){return $._normalizePoint(e,t,this.#u,this.#d,this.#i)}isEmpty(){return!this.#r?.length}isCancellable(){return this.#o.length<=10}add(e,t){return this.#p(e,t)&&this.toSVGPath(),{path:{d:this.#m()}}}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)this.#p(e[n],e[n+1])&&(t=!0,this.#o.length<=6&&(this.toSVGPath(),t=!1));return t&&this.toSVGPath(),{path:{d:this.#m()}}}#p(e,t){[e,t]=this.#f(e,t),this.#t.set([e,t],0);let[n,r,i,a]=this.#e.subarray(2,6),o=e-i,s=t-a;return Math.hypot(this.#u*o,this.#d*s)<=2?!1:(this.#o.push(e,t),isNaN(n)?(this.#e.set([i,a,e,t],2),this.#n.push(NaN,NaN,NaN,NaN,e,t),!0):(isNaN(this.#e[0])&&this.#n.splice(6,6),this.#e.set([n,r,i,a,e,t],0),this.#n.push(...$.createBezierPoints(n,r,i,a,e,t)),!0))}end(e,t){return e!==void 0&&this.#p(e,t)||this.#o.length===2?{path:{d:this.toSVGPath()}}:{path:{d:this.#s}}}startNew(e,t,n,r,i){this.#u=n,this.#d=r,this.#i=i,[e,t]=this.#f(e,t);let a=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#t.set([e,t],0);let o=this.#r.at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),this.#r.push({line:a,points:this.#o}),this.#e.set(a,0),this.#c=0,this.toSVGPath(),null}getLastElement(){return this.#r.at(-1)}setLastElement(e){return this.#r?(this.#r.push(e),this.#n=e.line,this.#o=e.points,this.#c=0,{path:{d:this.toSVGPath()}}):this.#l.setLastElement(e)}removeLastElement(){if(!this.#r)return this.#l.removeLastElement();this.#r.pop(),this.#s=``;for(let e=0,t=this.#r.length;e<t;e++){let{line:t,points:n}=this.#r[e];this.#n=t,this.#o=n,this.#c=0,this.toSVGPath()}return{path:{d:this.#s}}}#m(){let e=$.svgRound(this.#t[0]),t=$.svgRound(this.#t[1]);if(this.#o.length===2){let n=$.svgRound(this.#n[4]),r=$.svgRound(this.#n[5]);return`${this.#s} M ${n} ${r} L ${e} ${t}`}return`${this.#s} L ${e} ${t}`}toSVGPath(){let e=$.svgRound(this.#n[4]),t=$.svgRound(this.#n[5]);if(this.#o.length===2)return this.#s=`${this.#s} M ${e} ${t} Z`,this.#s;if(this.#o.length<=6){let n=this.#s.lastIndexOf(`M`);this.#s=`${this.#s.slice(0,n)} M ${e} ${t}`,this.#c=6}if(this.#o.length===4){let e=$.svgRound(this.#n[10]),t=$.svgRound(this.#n[11]);return this.#s=`${this.#s} L ${e} ${t}`,this.#c=12,this.#s}let n=[];this.#c===0&&(n.push(`M ${e} ${t}`),this.#c=6);for(let e=this.#c,t=this.#n.length;e<t;e+=6){let[t,r,i,a,o,s]=this.#n.slice(e,e+6).map($.svgRound);n.push(`C${t} ${r} ${i} ${a} ${o} ${s}`)}return this.#s+=n.join(` `),this.#c=this.#n.length,this.#s}getOutlines(e,t,n,r){let i=this.#r.at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),this.#l.build(this.#r,e,t,n,this.#i,this.#a,r),this.#e=null,this.#n=null,this.#r=null,this.#s=null,this.#l}get defaultSVGProperties(){return{root:{viewBox:`0 0 10000 10000`},rootClass:{draw:!0},bbox:[0,0,1,1]}}},Km=class extends ${#e;#t=0;#n;#r;#i;#a;#o;#s;#c;build(e,t,n,r,i,a,o){this.#i=t,this.#a=n,this.#o=r,this.#s=i,this.#c=a,this.#n=o??0,this.#r=e,this.#d()}get thickness(){return this.#c}setLastElement(e){return this.#r.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#r.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of this.#r)if(e.push(`M${$.svgRound(t[4])} ${$.svgRound(t[5])}`),t.length===6)e.push(`Z`);else if(t.length===12&&isNaN(t[6]))e.push(`L${$.svgRound(t[10])} ${$.svgRound(t[11])}`);else for(let n=6,r=t.length;n<r;n+=6){let[r,i,a,o,s,c]=t.subarray(n,n+6).map($.svgRound);e.push(`C${r} ${i} ${a} ${o} ${s} ${c}`)}return e.join(``)}serialize([e,t,n,r],i){let a=[],o=[],[s,c,l,u]=this.#u(),d,f,p,m,h,g,_,v,y;switch(this.#s){case 0:y=$._rescale,d=e,f=t+r,p=n,m=-r,h=e+s*n,g=t+(1-c-u)*r,_=e+(s+l)*n,v=t+(1-c)*r;break;case 90:y=$._rescaleAndSwap,d=e,f=t,p=n,m=r,h=e+c*n,g=t+s*r,_=e+(c+u)*n,v=t+(s+l)*r;break;case 180:y=$._rescale,d=e+n,f=t,p=-n,m=r,h=e+(1-s-l)*n,g=t+c*r,_=e+(1-s)*n,v=t+(c+u)*r;break;case 270:y=$._rescaleAndSwap,d=e+n,f=t+r,p=-n,m=-r,h=e+(1-c-u)*n,g=t+(1-s-l)*r,_=e+(1-c)*n,v=t+(1-s)*r}for(let{line:e,points:t}of this.#r)a.push(y(e,d,f,p,m,i?Array(e.length):null)),o.push(y(t,d,f,p,m,i?Array(t.length):null));return{lines:a,points:o,rect:[h,g,_,v]}}static deserialize(e,t,n,r,i,{paths:{lines:a,points:o},rotation:s,thickness:c}){let l=[],u,d,f,p,m;switch(s){case 0:m=$._rescale,u=-e/n,d=t/r+1,f=1/n,p=-1/r;break;case 90:m=$._rescaleAndSwap,u=-t/r,d=-e/n,f=1/r,p=1/n;break;case 180:m=$._rescale,u=e/n+1,d=-t/r,f=-1/n,p=1/r;break;case 270:m=$._rescaleAndSwap,u=t/r+1,d=e/n+1,f=-1/r,p=-1/n}if(!a){a=[];for(let e of o){let t=e.length;if(t===2){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(t===4){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}let n=new Float32Array(3*(t-2));a.push(n);let[r,i,o,s]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,i],0);for(let a=4;a<t;a+=2){let t=e[a],c=e[a+1];n.set($.createBezierPoints(r,i,o,s,t,c),(a-2)*3),[r,i,o,s]=[o,s,t,c]}}}for(let e=0,t=a.length;e<t;e++)l.push({line:m(a[e].map(e=>e??NaN),u,d,f,p),points:m(o[e].map(e=>e??NaN),u,d,f,p)});let h=new this.prototype.constructor;return h.build(l,n,r,1,s,c,i),h}#l(e=this.#c){let t=this.#n+e/2*this.#o;return this.#s%180==0?[t/this.#i,t/this.#a]:[t/this.#a,t/this.#i]}#u(){let[e,t,n,r]=this.#e,[i,a]=this.#l(0);return[e+i,t+a,n-2*i,r-2*a]}#d(){let e=this.#e=rl.slice();for(let{line:t}of this.#r){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6)Q.pointBoundingBox(t[n],t[n+1],e);continue}let n=t[4],r=t[5];for(let i=6,a=t.length;i<a;i+=6){let[a,o,s,c,l,u]=t.subarray(i,i+6);Q.bezierBoundingBox(n,r,a,o,s,c,l,u,e),n=l,r=u}}let[t,n]=this.#l();e[0]=Xl(e[0]-t,0,1),e[1]=Xl(e[1]-n,0,1),e[2]=Xl(e[2]+t,0,1),e[3]=Xl(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e===`stroke-width`?this.#f(t):null}#f(e){let[t,n]=this.#l();this.#c=e;let[r,i]=this.#l(),[a,o]=[r-t,i-n],s=this.#e;return s[0]-=a,s[1]-=o,s[2]+=2*a,s[3]+=2*o,s}updateParentDimensions([e,t],n){let[r,i]=this.#l();this.#i=e,this.#a=t,this.#o=n;let[a,o]=this.#l(),s=a-r,c=o-i,l=this.#e;return l[0]-=s,l[1]-=c,l[2]+=2*s,l[3]+=2*c,l}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map($.svgRound).join(` `)}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=this.#e,n=0,r=0,i=0,a=0,o=0,s=0;switch(this.#t){case 90:r=t/e,i=-e/t,o=e;break;case 180:n=-1,a=-1,o=e,s=t;break;case 270:r=-t/e,i=e/t,s=t;break;default:return``}return`matrix(${n} ${r} ${i} ${a} ${$.svgRound(o)} ${$.svgRound(s)})`}getPathResizingSVGProperties([e,t,n,r]){let[i,a]=this.#l(),[o,s,c,l]=this.#e;if(Math.abs(c-i)<=$.PRECISION||Math.abs(l-a)<=$.PRECISION){let i=e+n/2-(o+c/2),a=t+r/2-(s+l/2);return{path:{"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`,transform:`${this.rotationTransform} translate(${i} ${a})`}}}let u=(n-2*i)/(c-2*i),d=(r-2*a)/(l-2*a),f=c/n,p=l/r;return{path:{"transform-origin":`${$.svgRound(o)} ${$.svgRound(s)}`,transform:`${this.rotationTransform} scale(${f} ${p}) translate(${$.svgRound(i)} ${$.svgRound(a)}) scale(${u} ${d}) translate(${$.svgRound(-i)} ${$.svgRound(-a)})`}}}getPathResizedSVGProperties([e,t,n,r]){let[i,a]=this.#l(),o=this.#e,[s,c,l,u]=o;if(o[0]=e,o[1]=t,o[2]=n,o[3]=r,Math.abs(l-i)<=$.PRECISION||Math.abs(u-a)<=$.PRECISION){let i=e+n/2-(s+l/2),a=t+r/2-(c+u/2);for(let{line:e,points:t}of this.#r)$._translate(e,i,a,e),$._translate(t,i,a,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*i)/(l-2*i),f=(r-2*a)/(u-2*a),p=-d*(s+i)+e+i,m=-f*(c+a)+t+a;if(d!==1||f!==1||p!==0||m!==0)for(let{line:e,points:t}of this.#r)$._rescale(e,p,m,d,f,e),$._rescale(t,p,m,d,f,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){let[r,i]=n,a=this.#e,o=e-a[0],s=t-a[1];if(this.#i===r&&this.#a===i)for(let{line:e,points:t}of this.#r)$._translate(e,o,s,e),$._translate(t,o,s,t);else{let e=this.#i/r,t=this.#a/i;this.#i=r,this.#a=i;for(let{line:n,points:r}of this.#r)$._rescale(n,o,s,e,t,n),$._rescale(r,o,s,e,t,r);a[2]*=e,a[3]*=t}return a[0]=e,a[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${$.svgRound(e[0])} ${$.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}},qm=class e extends Mm{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:`none`,stroke:Xu._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-miterlimit":10})}updateSVGProperty(e,t){e===`stroke-width`&&(t??=this[`stroke-width`],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},Jm=class e extends Nm{static _type=`ink`;static _editorType=Y.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:`inkEditor`}),this._willKeepAspectRatio=!0,this.defaultL10nId=`pdfjs-editor-ink-editor`}static initialize(e,t){Xu.initialize(e,t),this._defaultDrawingOptions=new qm(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return Z(this,`typesMap`,new Map([[ul.INK_THICKNESS,`stroke-width`],[ul.INK_COLOR,`stroke`],[ul.INK_OPACITY,`stroke-opacity`]]))}static createDrawerInstance({x:e,y:t,box:[,,n,r],rotation:i}){return new Gm(e,t,n,r,i,this._defaultDrawingOptions[`stroke-width`])}static deserializeDraw(e,t,n,r,i,a){return Km.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=null;if(e instanceof xm){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,opacity:s,borderStyle:{rawWidth:c},popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},parent:{page:{pageNumber:m}}}=e;r=e={annotationType:Y.INK,color:Array.from(o),thickness:c,opacity:s,paths:{points:t},boxes:null,pageIndex:m-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}get toolbarButtons(){return this._colorPicker||=new Gp(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return ul.INK_COLOR}get colorAndOpacityType(){return ul.INK_COLOR_AND_OPACITY}get opacityType(){return ul.INK_OPACITY}updateParams(e,t){e===ul.INK_COLOR_AND_OPACITY?this._updateColorAndOpacity(t.color,t.opacity):super.updateParams(e,t)}static updateDefaultParams(e,t){e===ul.INK_COLOR_AND_OPACITY?(super.updateDefaultParams(ul.INK_COLOR,t.color),super.updateDefaultParams(ul.INK_OPACITY,t.opacity)):super.updateDefaultParams(e,t)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions[`stroke-opacity`]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty(`stroke-width`),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty(`stroke-width`),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:n,opacity:r}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:Q.makeHexColor(...t),"stroke-width":n,"stroke-opacity":r})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:r,"stroke-opacity":i,"stroke-width":a}}=this,o=Object.assign(super.serialize(e),{color:Xu._colorManager.convert(r),opacity:i,thickness:a,paths:{lines:t,points:n}});return this.addComment(o),e?(o.isCopy=!0,o):this.annotationElementId&&!this.#e(o)?null:(o.id=this.annotationElementId,o)}#e(e){let{color:t,thickness:n,opacity:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((e,n)=>e!==t[n])||e.thickness!==n||e.opacity!==r||e.pageIndex!==i}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions[`stroke-width`],points:t,popup:this.comment}),null}},Ym=class extends Km{toSVGPath(){let e=super.toSVGPath();return e.endsWith(`Z`)||(e+=`Z`),e}};Kc();var Xm=8,Zm=3,Qm=class{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,r){return n-=e,r-=t,n===0?r>0?0:4:n===1?r+6:2-r}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#r(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(-i+s-o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#i(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(i+s+o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#a(e,t,n,r){let i=e.length,a=new Int32Array(i);for(let t=0;t<i;t++)a[t]=+(e[t]<=r);for(let e=1;e<n-1;e++)a[e*t]=a[e*t+t-1]=0;for(let e=0;e<t;e++)a[e]=a[t*n-1-e]=0;let o=1,s,c=[];for(let e=1;e<n-1;e++){s=1;for(let n=1;n<t-1;n++){let r=e*t+n,i=a[r];if(i===0)continue;let l=e,u=n;if(i===1&&a[r-1]===0)o+=1,--u;else if(i>=1&&a[r+1]===0)o+=1,u+=1,i>1&&(s=i);else{i!==1&&(s=Math.abs(i));continue}let d=[n,e],f=u===n+1,p={isHole:f,points:d,id:o,parent:0};c.push(p);let m;for(let e of c)if(e.id===s){m=e;break}p.parent=m?m.isHole?f?m.parent:s:f?s:m.parent:f?s:0;let h=this.#r(a,t,e,n,l,u,0);if(h===-1){a[r]=-o,a[r]!==1&&(s=Math.abs(a[r]));continue}let g=this.#n[2*h],_=this.#n[2*h+1],v=e+g,y=n+_;l=v,u=y;let b=e,x=n;for(;;){let i=this.#i(a,t,b,x,l,u,1);g=this.#n[2*i],_=this.#n[2*i+1];let c=b+g,f=x+_;d.push(f,c);let p=b*t+x;if(a[p+1]===0?a[p]=-o:a[p]===1&&(a[p]=o),c===e&&f===n&&b===v&&x===y){a[r]!==1&&(s=Math.abs(a[r]));break}l=b,u=x,b=c,x=f}}}return c}static#o(e,t,n,r){if(n-t<=4){for(let i=t;i<n-2;i+=2)r.push(e[i],e[i+1]);return}let i=e[t],a=e[t+1],o=e[n-4]-i,s=e[n-3]-a,c=Math.hypot(o,s),l=o/c,u=s/c,d=l*a-u*i,f=s/o,p=1/c,m=Math.atan(f),h=Math.cos(m),g=Math.sin(m),_=p*(Math.abs(h)+Math.abs(g)),v=p*(1-_+_**2),y=Math.max(Math.atan(Math.abs(g+h)*v),Math.atan(Math.abs(g-h)*v)),b=0,x=t;for(let r=t+2;r<n-2;r+=2){let t=Math.abs(d-l*e[r+1]+u*e[r]);t>b&&(x=r,b=t)}b>(c*y)**2?(this.#o(e,t,x+2,r),this.#o(e,x,n,r)):r.push(i,a)}static#s(e){let t=[],n=e.length;return this.#o(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#c(e,t,n,r,i,a){let o=new Float32Array(a**2),s=-2*r**2,c=a>>1;for(let e=0;e<a;e++){let t=(e-c)**2;for(let n=0;n<a;n++)o[e*a+n]=Math.exp((t+(n-c)**2)/s)}let l=new Float32Array(256),u=-2*i**2;for(let e=0;e<256;e++)l[e]=Math.exp(e**2/u);let d=e.length,f=new Uint8Array(d),p=new Uint32Array(256);for(let r=0;r<n;r++)for(let i=0;i<t;i++){let s=r*t+i,u=e[s],d=0,m=0;for(let s=0;s<a;s++){let f=r+s-c;if(!(f<0||f>=n))for(let n=0;n<a;n++){let r=i+n-c;if(r<0||r>=t)continue;let p=e[f*t+r],h=o[s*a+n]*l[Math.abs(p-u)];d+=p*h,m+=h}}let h=f[s]=Math.round(d/m);p[h]++}return[f,p]}static#l(e){let t=new Uint32Array(256);for(let n of e)t[n]++;return t}static#u(e){let t=e.length,n=new Uint8ClampedArray(t>>2),r=-1/0,i=1/0;for(let t=0,a=n.length;t<a;t++){let a=n[t]=e[t<<2];r=Math.max(r,a),i=Math.min(i,a)}let a=255/(r-i);for(let e=0,t=n.length;e<t;e++)n[e]=(n[e]-i)*a;return n}static#d(e){let t,n=-1/0,r=-1/0,i=e.findIndex(e=>e!==0),a=i,o=i;for(t=i;t<256;t++){let i=e[t];i>n&&(t-a>r&&(r=t-a,o=t-1),n=i,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){let t=e,{width:n,height:r}=e,{maxDim:i}=this.#e,a=n,o=r;if(n>i||r>i){let s=n,c=r,l=Math.log2(Math.max(n,r)/i),u=Math.floor(l);l=l===u?u-1:u;for(let n=0;n<l;n++){a=Math.ceil(s/2),o=Math.ceil(c/2);let n=new OffscreenCanvas(a,o);n.getContext(`2d`).drawImage(e,0,0,s,c,0,0,a,o),s=a,c=o,e!==t&&e.close(),e=n.transferToImageBitmap()}let d=Math.min(i/a,i/o);a=Math.round(a*d),o=Math.round(o*d)}let s=new OffscreenCanvas(a,o).getContext(`2d`,{willReadFrequently:!0});s.fillStyle=`white`,s.fillRect(0,0,a,o),s.filter=`grayscale(1)`,s.drawImage(e,0,0,e.width,e.height,0,0,a,o);let c=s.getImageData(0,0,a,o).data;return[this.#u(c),a,o]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:r},i,a,o,s){let c=new OffscreenCanvas(1,1),l=c.getContext(`2d`,{alpha:!1}),u=l.font=`${n} ${r} 200px ${t}`,{actualBoundingBoxLeft:d,actualBoundingBoxRight:f,actualBoundingBoxAscent:p,actualBoundingBoxDescent:m,fontBoundingBoxAscent:h,fontBoundingBoxDescent:g,width:_}=l.measureText(e),v=1.5,y=Math.ceil(Math.max(Math.abs(d)+Math.abs(f)||0,_)*v),b=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||200,Math.abs(h)+Math.abs(g)||200)*v);c=new OffscreenCanvas(y,b),l=c.getContext(`2d`,{alpha:!0,willReadFrequently:!0}),l.font=u,l.filter=`grayscale(1)`,l.fillStyle=`white`,l.fillRect(0,0,y,b),l.fillStyle=`black`,l.fillText(e,y*.5/2,b*1.5/2);let x=this.#u(l.getImageData(0,0,y,b).data),S=this.#l(x),C=this.#d(S),w=this.#a(x,y,b,C);return this.processDrawnLines({lines:{curves:w,width:y,height:b},pageWidth:i,pageHeight:a,rotation:o,innerMargin:s,mustSmooth:!0,areContours:!0})}static process(e,t,n,r,i){let[a,o,s]=this.#f(e),[c,l]=this.#c(a,o,s,Math.hypot(o,s)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),u=this.#d(l),d=this.#a(c,o,s,u);return this.processDrawnLines({lines:{curves:d,width:o,height:s},pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:a,areContours:o}){r%180!=0&&([t,n]=[n,t]);let{curves:s,width:c,height:l}=e,u=e.thickness??0,d=[],f=Math.min(t/c,n/l),p=f/t,m=f/n,h=[];for(let{points:e}of s){let t=a?this.#s(e):e;if(!t)continue;h.push(t);let n=t.length,r=new Float32Array(n),i=new Float32Array(3*(n===2?2:n-2));if(d.push({line:i,points:r}),n===2){r[0]=t[0]*p,r[1]=t[1]*m,i.set([NaN,NaN,NaN,NaN,r[0],r[1]],0);continue}let[o,s,c,l]=t;o*=p,s*=m,c*=p,l*=m,r.set([o,s,c,l],0),i.set([NaN,NaN,NaN,NaN,o,s],0);for(let e=4;e<n;e+=2){let n=r[e]=t[e]*p,a=r[e+1]=t[e+1]*m;i.set($.createBezierPoints(o,s,c,l,n,a),(e-2)*3),[o,s,c,l]=[c,l,n,a]}}if(d.length===0)return null;let g=o?new Ym:new Km;return g.build(d,t,n,1,r,o?0:u,i),{outline:g,newCurves:h,areContours:o,thickness:u,width:c,height:l}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:r,height:i}){let a=1/0,o=-1/0,s=0;for(let t of e){s+=t.length;for(let e=2,n=t.length;e<n;e++){let n=t[e]-t[e-2];a=Math.min(a,n),o=Math.max(o,n)}}let c;c=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let l=e.length,u=Xm+Zm*l,d=new Uint32Array(u),f=0;d[f++]=u*Uint32Array.BYTES_PER_ELEMENT+(s-2*l)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=r,d[f++]=i,d[f++]=+!t,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=l,d[f++]=c.BYTES_PER_ELEMENT;for(let t of e)d[f++]=t.length-2,d[f++]=t[0],d[f++]=t[1];let p=new CompressionStream(`deflate-raw`),m=p.writable.getWriter();await m.ready,m.write(d);let h=c.prototype.constructor;for(let t of e){let e=new h(t.length-2);for(let n=2,r=t.length;n<r;n++)e[n-2]=t[n]-t[n-2];m.write(e)}return m.close(),(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(e){try{let t=Uint8Array.fromBase64(e),{readable:n,writable:r}=new DecompressionStream(`deflate-raw`),i=r.getWriter();await i.ready,i.write(t).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let a=null,o=0;for await(let e of n)a||=new Uint8Array(new Uint32Array(e.buffer,0,4)[0]),a.set(e,o),o+=e.length;let s=new Uint32Array(a.buffer,0,a.length>>2),c=s[1];if(c!==0)throw Error(`Invalid version: ${c}`);let l=s[2],u=s[3],d=s[4]===0,f=s[5],p=s[6],m=s[7],h=[],g=(Xm+Zm*p)*Uint32Array.BYTES_PER_ELEMENT,_;switch(m){case Int8Array.BYTES_PER_ELEMENT:_=new Int8Array(a.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:_=new Int16Array(a.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:_=new Int32Array(a.buffer,g)}o=0;for(let e=0;e<p;e++){let t=s[Zm*e+Xm],n=new Float32Array(t+2);h.push(n);for(let t=0;t<2;t++)n[t]=s[Zm*e+Xm+t+1];for(let e=0;e<t;e++)n[e+2]=n[e]+_[o++]}return{areContours:d,thickness:f,outlines:h,width:l,height:u}}catch(e){return X(`decompressSignature: ${e}`),null}}},$m=class e extends Mm{constructor(){super(),super.updateProperties({fill:Xu._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},eh=class e extends qm{constructor(e){super(e),super.updateProperties({stroke:Xu._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},th=class e extends Nm{#e=!1;#t=null;#n=null;#r=null;static _type=`signature`;static _editorType=Y.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:`signatureEditor`}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId=`pdfjs-editor-signature-editor1`}static initialize(e,t){Xu.initialize(e,t),this._defaultDrawingOptions=new $m,this._defaultDrawnSignatureOptions=new eh(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return Z(this,`typesMap`,new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:`signature`,hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let t=e.get(`hasDescription`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,n,{_isCopy:r}=this;if(r&&(this._isCopy=!1,t=this.x,n=this.y),super.render(),this._drawId===null){if(this.#n){let{lines:t,mustSmooth:n,areContours:r,description:i,uuid:a,heightInPage:o}=this.#n,{rawDims:{pageWidth:s,pageHeight:c},rotation:l}=this.parent.viewport,u=Qm.processDrawnLines({lines:t,pageWidth:s,pageHeight:c,rotation:l,innerMargin:e._INNER_MARGIN,mustSmooth:n,areContours:r});this.addSignature(u,o,i,a)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:``})),this.div.hidden=!0,this._uiManager.getSignature(this)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:this.#t||``}));return r&&(this._isCopy=!0,this._moveAfterPaste(t,n)),this.div}setUuid(e){this.#r=e,this.addEditToolbar()}getUuid(){return this.#r}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:r,height:i}=this.#n,a=Math.max(r,i);return{areContours:t,outline:Qm.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:n,width:r,height:i},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[[`editSignature`,this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){let{x:a,y:o}=this,{outline:s}=this.#n=t;this.#e=s instanceof Ym,this.description=r;let c;this.#e?c=e.getDefaultDrawingOptions():(c=e._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":s.thickness})),this._addOutlines({drawOutlines:s,drawingOptions:c});let[,l]=this.pageDimensions,u=n/l;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:`pdfjs.signature.inserted`,data:{hasBeenSaved:!!i,hasDescription:!!r}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return Qm.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return Qm.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return Qm.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,i=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:r});return this.addComment(i),e?(i.paths={lines:t,points:n},i.uuid=this.#r,i.isCopy=!0):i.lines=t,this.#t&&(i.accessibilityData={type:`Figure`,alt:this.#t}),i}static deserializeDraw(e,t,n,r,i,a){return a.areContours?Ym.deserialize(e,t,n,r,i,a):Km.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=await super.deserialize(e,t,n);return r.#e=e.areContours,r.description=e.accessibilityData?.alt||``,r.#r=e.uuid,r}},nh=class extends Xu{#e=null;#t=null;#n=null;#r=null;#i=null;#a=``;#o=null;#s=!1;#c=null;#l=!1;#u=!1;static _type=`stamp`;static _editorType=Y.STAMP;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId=`pdfjs-editor-stamp-editor`}static initialize(e,t){Xu.initialize(e,t)}static isHandlingMimeForPasting(e){return xu.has(e)}static paste(e,t){t.pasteEditor({mode:Y.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:`stamp`,hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let t=e.get(`hasAltText`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#d(e,t=!1){e?(this.#e=e.bitmap,t||(this.#t=e.id,this.#l=e.isSvg),e.file&&(this.#a=e.file.name),this.#m()):this.remove()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e)this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:`pdfjs.image.image_added`,data:{alt_text_modal:!1,alt_text_type:`empty`}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw Error(`No ML.`);if(!await n.isEnabledFor(`altText`))throw Error(`ML isn't enabled for alt text.`);let{data:r,width:i,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:`altText`,request:{data:r,width:i,height:a,channels:r.length/(i*a)}});if(!o)throw Error(`No response from the AI service.`);if(o.error)throw Error(`Error from the AI service.`);if(o.cancel)return null;if(!o.output)throw Error(`No valid response from the AI service.`);let s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#p(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#d(e,!0)).finally(()=>this.#f());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#d(e)).finally(()=>this.#f());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#d(e)).finally(()=>this.#f());return}let e=document.createElement(`input`);e.type=`file`,e.accept=xu.keys().join(`,`);let t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:`pdfjs.image.image_selected`,data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(t)}n()},{signal:t}),e.addEventListener(`cancel`,()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&=(clearTimeout(this.#c),null)),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))):this.#t&&this.#p()}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i||this.#t||this.#s)}get toolbarButtons(){return[[`altText`,this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#s||(this.#e?this.#m():this.#p()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:n,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,r&&(this.#e=r),this.#s=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(this.#c!==null&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#c=null,this.#g()},200))}#m(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}this._uiManager.enableWaiting(!1);let o=this.#o=document.createElement(`canvas`);o.setAttribute(`role`,`img`),this.addContainer(o),this.width=t/r,this.height=n/i,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#g(),this.#u||=(this.parent.addUndoableEditor(this),!0),this._reportTelemetry({action:`inserted_image`}),this.#a&&this.div.setAttribute(`aria-description`,this.#a),this.annotationElementId||this._uiManager.a11yAlert(Xu._l10nAlert.stamp)}copyCanvas(e,t,n=!1){e||=224;let{width:r,height:i}=this.#e,a=new bu,o=this.#e,s=r,c=i,l=null;if(t){if(r>t||i>t){let e=Math.min(t/r,t/i);s=Math.floor(r*e),c=Math.floor(i*e)}l=document.createElement(`canvas`);let e=l.width=Math.ceil(s*a.sx),n=l.height=Math.ceil(c*a.sy);this.#l||(o=this.#h(e,n));let u=l.getContext(`2d`);u.filter=this._uiManager.hcmFilter;let d=`white`,f=`#cfcfd8`;this._uiManager.hcmFilter===`none`?Su.isDarkMode&&(d=`#8f8f9d`,f=`#42414d`):f=`black`;let p=15*a.sx,m=15*a.sy,h=new OffscreenCanvas(p*2,m*2),g=h.getContext(`2d`);g.fillStyle=d,g.fillRect(0,0,p*2,m*2),g.fillStyle=f,g.fillRect(0,0,p,m),g.fillRect(p,m,p,m),u.fillStyle=u.createPattern(h,`repeat`),u.fillRect(0,0,e,n),u.drawImage(o,0,0,o.width,o.height,0,0,e,n)}let u=null;if(n){let t,n;if(a.symmetric&&o.width<e&&o.height<e)t=o.width,n=o.height;else if(o=this.#e,r>e||i>e){let a=Math.min(e/r,e/i);t=Math.floor(r*a),n=Math.floor(i*a),this.#l||(o=this.#h(t,n))}let s=new OffscreenCanvas(t,n).getContext(`2d`,{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,t,n),u={width:t,height:n,data:s.getImageData(0,0,t,n).data}}return{canvas:l,width:s,height:c,imageData:u}}#h(e,t){let{width:n,height:r}=this.#e,i=n,a=r,o=this.#e;for(;i>2*e||a>2*t;){let n=i,r=a;i>2*e&&(i=Math.ceil(i/2)),a>2*t&&(a=Math.ceil(a/2));let s=new OffscreenCanvas(i,a);s.getContext(`2d`).drawImage(o,0,0,n,r,0,0,i,a),o=s.transferToImageBitmap()}return o}#g(){let[e,t]=this.parentDimensions,{width:n,height:r}=this,i=new bu,a=Math.ceil(n*e*i.sx),o=Math.ceil(r*t*i.sy),s=this.#o;if(!s||s.width===a&&s.height===o)return;s.width=a,s.height=o;let c=this.#l?this.#e:this.#h(a,o),l=s.getContext(`2d`);l.filter=this._uiManager.hcmFilter,l.drawImage(c,0,0,c.width,c.height,0,0,a,o)}#_(e){if(e){if(this.#l){let e=this._uiManager.imageManager.getSvgUrl(this.#t);if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=this.#e,e.getContext(`2d`).drawImage(this.#e,0,0),e.toDataURL()}if(this.#l){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*nu.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*nu.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let r=null,i=!1;if(e instanceof Em){let{data:{rect:a,rotation:o,id:s,structParent:c,popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},container:m,parent:{page:{pageNumber:h}},canvas:g}=e,_,v;g?(delete e.canvas,{id:_,bitmap:v}=n.imageManager.getFromCanvas(m.id,g),g.remove()):(i=!0,e._hasNoCanvas=!0);let y=(await t._structTree.getAriaAttributes(`${cl}${s}`))?.get(`aria-label`)||``;r=e={annotationType:Y.STAMP,bitmapId:_,bitmap:v,pageIndex:h-1,rect:a.slice(0),rotation:o,annotationElementId:s,id:s,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:c,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let a=await super.deserialize(e,t,n),{rect:o,bitmap:s,bitmapUrl:c,bitmapId:l,isSvg:u,accessibilityData:d}=e;i?(n.addMissingCanvas(e.id,a),a.#s=!0):l&&n.imageManager.isValidId(l)?(a.#t=l,s&&(a.#e=s)):a.#r=c,a.#l=u;let[f,p]=a.pageDimensions;return a.width=(o[2]-o[0])/f,a.height=(o[3]-o[1])/p,d&&(a.altTextData=d),a._initialData=r,e.comment&&a.setCommentData(e),a.#u=!!r,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#l});if(this.addComment(n),e)return n.bitmapUrl=this.#_(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:r,altText:i}=this.serializeAltText(!1);if(!r&&i&&(n.accessibilityData={type:`Figure`,alt:i}),this.annotationElementId){let e=this.#v(n);return e.isSame?null:(e.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;let a=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:a,serialized:n}),n.bitmap=this.#_(!1);else if(this.#l){let e=t.stamps.get(this.#t);a>e.area&&(e.area=a,e.serialized.bitmap.close(),e.serialized.bitmap=this.#_(!1))}return n}#v(e){let{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===t,i=(e.accessibilityData?.alt||``)===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&i,isSameAltText:i}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},rh=class e{#e;#t=!1;#n=null;#r=null;#i=null;#a=new Map;#o=!1;#s=!1;#c=!1;#l=null;#u=null;#d=null;#f=null;#p=null;#m=-1;#h;static _initialized=!1;static#g=new Map([jm,Jm,nh,Wm,th].map(e=>[e._editorType,e]));constructor({uiManager:t,pageIndex:n,div:r,structTreeLayer:i,accessibilityManager:a,annotationLayer:o,drawLayer:s,textLayer:c,viewport:l,l10n:u}){let d=[...e.#g.values()];if(!e._initialized){e._initialized=!0;for(let e of d)e.initialize(u,t)}t.registerEditorTypes(d),this.#h=t,this.pageIndex=n,this.div=r,this.#e=a,this.#n=o,this.viewport=l,this.#d=c,this.drawLayer=s,this._structTree=i,this.#h.addLayer(this)}get isEmpty(){return this.#a.size===0}get isInvisible(){return this.isEmpty&&this.#h.getMode()===Y.NONE}updateToolbar(e){this.#h.updateToolbar(e)}updateMode(t=this.#h.getMode()){switch(this.#S(),t){case Y.NONE:this.div.classList.toggle(`nonEditing`,!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Y.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Y.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:n}=this.div;if(n.toggle(`nonEditing`,!1),t===Y.POPUP)n.toggle(`commentEditing`,!0);else{n.toggle(`commentEditing`,!1);for(let r of e.#g.values())n.toggle(`${r._type}Editing`,t===r._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#d?.div}setEditingState(e){this.#h.setEditingState(e)}addCommands(e){this.#h.addCommands(e)}cleanUndoStack(e){this.#h.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle(`drawing`,!e)}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#_(){return this.#a.size===0?this.#h.getEditors(this.pageIndex):this.#a.values()}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle(`nonEditing`,!1),this.#p?.abort(),this.#p=null;let e=new Set;for(let t of this.#_)t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#h.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));let t=this.#n;if(t)for(let n of t.getEditableAnnotations()){if(n.hide(),this.#h.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}this.#c=!1,this.#h._eventBus.dispatch(`editorsrendered`,{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#s=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle(`nonEditing`,!0),this.#d&&!this.#p){this.#p=new AbortController;let e=this.#h.combinedSignal(this.#p);this.#d.div.addEventListener(`pointerdown`,e=>{let{clientX:t,clientY:n,timeStamp:r}=e;if(r-this.#m>500){this.#m=r;return}this.#m=-1;let{classList:i}=this.div;i.toggle(`getElements`,!0);let a=document.elementsFromPoint(t,n);if(i.toggle(`getElements`,!1),!this.div.contains(a[0]))return;let o,s=RegExp(`^${ll}[0-9]+$`);for(let e of a)if(s.test(e.id)){o=e.id;break}if(!o)return;let c=this.#a.get(o);c?.annotationElementId===null&&(fu(e),c.dblclick(e))},{signal:e,capture:!0})}let t=this.#n,n=[];if(t){let e=new Map,r=new Map;for(let t of this.#_)t.disableEditing(),t.annotationElementId?t.serialize()===null?(r.set(t.annotationElementId,t),this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()):e.set(t.annotationElementId,t):n.push(t);for(let n of t.getEditableAnnotations()){let{id:t}=n.data;if(this.#h.isDeletedAnnotationElement(t)){n.updateEdited({deleted:!0});continue}let i=r.get(t);i?(i.resetAnnotationElement(n),i.show(!1),n.show()):(i=e.get(t),i&&(this.#h.addChangedExistingAnnotation(i),i.renderAnnotationElement(n)&&i.show(!1)),n.show())}}this.#S(),this.isEmpty&&(this.div.hidden=!0);let{classList:r}=this.div;for(let t of e.#g.values())r.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(n),this.#s=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#h.getActive()!==e&&this.#h.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#f){this.#f=new AbortController;let e=this.#h.combinedSignal(this.#f);this.#d.div.addEventListener(`pointerdown`,this.#v.bind(this),{signal:e}),this.#d.div.classList.add(`highlighting`)}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#d.div.classList.remove(`highlighting`))}#v(e){this.#h.unselectAll();let{target:t}=e;if(t===this.#d.div||(t.getAttribute(`role`)===`img`||t.classList.contains(`endOfContent`)||t.classList.contains(`textLayerImages`)||t.classList.contains(`textLayerImagePlaceholder`))&&this.#d.div.contains(t)){let{isMac:t}=zl.platform;if(e.button!==0||e.ctrlKey&&t)return;this.#h.showAllEditors(`highlight`,!0,!0),Wm.startDrawing(this,this.#h,this.#h.direction===`ltr`,e),e.preventDefault()}}enableClick(){if(this.#r)return;this.#r=new AbortController;let e=this.#h.combinedSignal(this.#r);this.div.addEventListener(`pointerdown`,this.pointerdown.bind(this),{signal:e});let t=this.pointerup.bind(this);this.div.addEventListener(`pointerup`,t,{signal:e}),this.div.addEventListener(`pointercancel`,t,{signal:e})}disableClick(){this.#r?.abort(),this.#r=null}attach(e){this.#a.set(e.id,e);let{annotationElementId:t}=e;t&&this.#h.isDeletedAnnotationElement(t)&&this.#h.removeDeletedAnnotationElement(e)}detach(e){this.#a.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#s&&e.annotationElementId&&this.#h.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#h.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#h.addDeletedAnnotationElement(e),Xu.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#h.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#c),this.#h.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#h._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getEditorByUID(e){for(let t of this.#a.values())if(t.uid===e)return t;return null}get#y(){return e.#g.get(this.#h.getMode())}combinedSignal(e){return this.#h.combinedSignal(e)}#b(e){let t=this.#y;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#h.updateMode(e.mode);let{offsetX:n,offsetY:r}=this.#x(),i=this.#h.getId(),a=this.#b({parent:this,id:i,x:n,y:r,uiManager:this.#h,isCentered:!0,...t});a&&this.add(a)}async deserialize(t){return await e.#g.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#h)||null}createAndAddNewEditor(e,t,n={}){let r=this.#h.getId(),i=this.#b({parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:this.#h,isCentered:t,...n});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}#x(){let{x:e,y:t,width:n,height:r}=this.boundingClientRect,i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}addNewEditor(e={}){this.createAndAddNewEditor(this.#x(),!0,e)}setSelected(e){this.#h.setSelected(e)}toggleSelected(e){this.#h.toggleSelected(e)}unselect(e){this.#h.unselect(e)}pointerup(e){let{isMac:t}=zl.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#o||(this.#o=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}let n=this.#h.getMode();n===Y.STAMP||n===Y.POPUP||n===Y.SIGNATURE?this.#h.unselectAll():this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#h.getMode()===Y.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:t}=zl.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#o=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let n=this.#h.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#h,!1,e);return}this.#h.setCurrentDrawingSession(this),this.#l=new AbortController;let t=this.#h.combinedSignal(this.#l);this.div.addEventListener(`blur`,({relatedTarget:e})=>{e&&!this.div.contains(e)&&(this.#u=null,this.commitOrRemove())},{signal:t}),this.#y.startDrawing(this,this.#h,!1,e)}pause(e){if(e){let{activeElement:e}=document;this.div.contains(e)&&(this.#u=e)}else this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){return this.#l?(this.#h.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#u=null,this.#y.endDrawing(e)):null}findNewParent(e,t,n){let r=this.#h.findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#h.getActive()?.parent===this&&(this.#h.commitOrRemove(),this.#h.setActiveEditor(null)),this.#i&&=(clearTimeout(this.#i),null);for(let e of this.#a.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#a.clear(),this.#h.removeLayer(this)}#S(){for(let e of this.#a.values())e.isEmpty()&&e.remove()}async render({viewport:e}){this.viewport=e,yu(this.div,e);for(let e of this.#h.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#h.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#h.commitOrRemove(),this.#S();let t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,yu(this.div,{rotation:n}),t!==n)for(let e of this.#a.values())e.rotate(n)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#h.viewParameters.realScale}};jc();function ih(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function ah(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(`.textLayer`):e.parentElement?.closest(`.textLayer`)||null:null}function oh(e,t,n,r){if(e===n)return t<=r;let i=e.compareDocumentPosition(n);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function sh(e,t,n){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains(`textLayer`)||t!==e.childNodes.length)return{container:e,offset:t};let r=e.lastChild;return r?.nodeType===Node.ELEMENT_NODE&&r.classList.contains(`endOfContent`)&&(r=r.previousSibling),!r||!n.contains(r)?null:r.nodeType===Node.TEXT_NODE?{container:r,offset:r.textContent.length}:{container:r,offset:r.childNodes.length}}var ch=class e{#e=null;#t=new Map;#n=null;#r=null;#i=null;#a=null;#o=new Map;static#s=0;static#c=0;static#l=null;static#u=new Set;static#d=!1;static#f=new Set;static#p=new WeakMap;constructor({filterFactory:t=null,pageColors:n=null,pageIndex:r,textLayer:i=null}){if(this.pageIndex=r,this.#r=t,this.#i=n,i){let t=e.#p.get(i);if(t?.selectionDiv&&(t.selectionDiv.remove(),e.#u.delete(t.selectionDiv)),e.#p.set(i,{drawLayer:this}),e.#f.add(i),this.#n=i,this.#a=new MutationObserver(t=>{if(this.#e&&this.#n?.isConnected&&e.#h()){for(let{addedNodes:n}of t)for(let t of n)if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){e.#_();return}}}),this.#a.observe(i,{childList:!0}),e.#l===null){e.#l=new AbortController;let{signal:t}=e.#l;document.addEventListener(`selectionchange`,e.#_.bind(e),{signal:t}),document.addEventListener(`pointerdown`,()=>{e.#d=!0},{signal:t}),document.addEventListener(`pointerup`,()=>{e.#d=!1},{signal:t}),window.addEventListener(`blur`,()=>{e.#d=!1},{signal:t})}}}setParent(t){if(!this.#e)this.#e=t,this.#n?.isConnected&&e.#h()&&e.#_();else if(this.#e!==t){if(this.#t.size>0)for(let e of this.#t.values())e.remove(),t.append(e);this.#e=t}}static#m(e){let t=this.#p.get(e);t?.selectionDiv&&(t.selectionDiv.remove(),this.#u.delete(t.selectionDiv),t.selectionDiv=null,t.path=null)}static#h(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#g(){return this.#f.keys().filter(e=>e.isConnected).toArray().sort(ih)}static#_(){let t=document.getSelection();if(!t||t.isCollapsed){for(let e of this.#u)e.remove();this.#u.clear();return}let n=new WeakMap,r=this.#g(),i=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(n.collapsed)continue;let{startContainer:a,startOffset:o,endContainer:s,endOffset:c}=n,l=ah(a),u=ah(s),d=l===null,f=u===null;if(this.#d&&d!==f)return;if(t.rangeCount===1){let{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:i}=t,d=ah(e),f=ah(r),p=oh(e,n,r,i);d&&f&&p!==null&&(p?(a=e,o=n,l=d,s=r,c=i,u=f):(a=r,o=i,l=f,s=e,c=n,u=d))}let p=r.filter(e=>n.intersectsNode(e));if(p.length===0)continue;let m=!1;if(l||(l=p[0],a=l,o=0,m=!0),u||(u=p.at(-1),s=u,c=u.childNodes.length,m=!0),s.nodeType===Node.ELEMENT_NODE){if(s.classList.contains(`endOfContent`)){let e=s.previousSibling;if(!e)continue;s=e,c=e.nodeType===Node.TEXT_NODE?e.textContent.length:e.childNodes.length}else if(s.classList.contains(`textLayer`)&&s.childNodes.length===c){let e=sh(s,c,u);if(!e)continue;s=e.container,c=e.offset}}if(a.nodeType===Node.ELEMENT_NODE){let e=sh(a,o,l);if(!e)continue;a=e.container,o=e.offset}if(l===u&&!m&&p.includes(l))i.push([n,l]);else for(let e of p){let t=e.firstChild;if(!t)continue;let n=document.createRange();if(e===l?n.setStart(a,o):n.setStartBefore(t),e===u)n.setEnd(s,c);else{let t=e.lastChild;if(!t)continue;if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){let e=t.previousSibling;if(!e)continue;n.setEndAfter(e)}else n.setEndAfter(t)}n.collapsed||i.push([n,e])}}let a=new Set(i.map(e=>e[1]));for(let e of this.#f)a.has(e)||this.#m(e);for(let[t,r]of i){let i=e.#p.get(r);if(!i)continue;let a=n.get(r);if(!a){let e=r.getBoundingClientRect();a=(t,n,r,i)=>({x:(t-e.x)/e.width,y:(n-e.y)/e.height,width:r/e.width,height:i/e.height}),n.set(r,a)}let o=[];for(let{x:e,y:n,width:r,height:i}of t.getClientRects())r!==0&&i!==0&&({x:e,y:n,width:r,height:i}=a(e,n,r,i),(r!==1||i!==1)&&o.push(`M${e} ${n} h${r} v${i} h-${r} Z`));if(o.length===0)continue;let s=i.drawLayer,c=i.selectionDiv,l=i.path;if(!c){let t=`clip_selection_${e.#c++}`;c=document.createElement(`div`),c.className=`selection`,c.style.clipPath=`url(#${t})`;let n=s.#r?.createSelectionStyle(s.#i);if(n)for(let[e,t]of Object.entries(n))c.style.setProperty(e,t);let r=e._svgFactory.create(1,1,!0);r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`);let a=e._svgFactory.createElement(`clipPath`);a.setAttribute(`id`,t),a.setAttribute(`clipPathUnits`,`objectBoundingBox`),l=e._svgFactory.createElement(`path`),a.append(l),r.append(a),c.append(r),i.path=l,i.selectionDiv=c}s.#e&&c.parentNode!==s.#e&&(s.#e.append(c),this.#u.add(c)),l.setAttribute(`d`,o.join(` `))}}static get _svgFactory(){return Z(this,`_svgFactory`,new Xp)}static#v(e,[t,n,r,i]){let{style:a}=e;a.top=`${100*n}%`,a.left=`${100*t}%`,a.width=`${100*r}%`,a.height=`${100*i}%`}#y(){let t=e._svgFactory.create(1,1,!0);return this.#e.append(t),t.setAttribute(`aria-hidden`,`true`),t}#b(t,n){let r=e._svgFactory.createElement(`clipPath`);t.append(r);let i=`clip_${n}`;r.setAttribute(`id`,i),r.setAttribute(`clipPathUnits`,`objectBoundingBox`);let a=e._svgFactory.createElement(`use`);return r.append(a),a.setAttribute(`href`,`#${n}`),a.classList.add(`clip`),i}#x(e,t){for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r)}draw(t,n=!1,r=!1){let i=e.#s++,a=this.#y(),o=e._svgFactory.createElement(`defs`);a.append(o);let s=e._svgFactory.createElement(`path`);o.append(s);let c=`path_${i}`;s.setAttribute(`id`,c),s.setAttribute(`vector-effect`,`non-scaling-stroke`),n&&this.#o.set(i,s);let l=r?this.#b(o,c):null,u=e._svgFactory.createElement(`use`);return a.append(u),u.setAttribute(`href`,`#${c}`),this.updateProperties(a,t),this.#t.set(i,a),{id:i,clipPathId:`url(#${l})`}}drawOutline(t,n){let r=e.#s++,i=this.#y(),a=e._svgFactory.createElement(`defs`);i.append(a);let o=e._svgFactory.createElement(`path`);a.append(o);let s=`path_${r}`;o.setAttribute(`id`,s),o.setAttribute(`vector-effect`,`non-scaling-stroke`);let c;if(n){let t=e._svgFactory.createElement(`mask`);a.append(t),c=`mask_${r}`,t.setAttribute(`id`,c),t.setAttribute(`maskUnits`,`objectBoundingBox`);let n=e._svgFactory.createElement(`rect`);t.append(n),n.setAttribute(`width`,`1`),n.setAttribute(`height`,`1`),n.setAttribute(`fill`,`white`);let i=e._svgFactory.createElement(`use`);t.append(i),i.setAttribute(`href`,`#${s}`),i.setAttribute(`stroke`,`none`),i.setAttribute(`fill`,`black`),i.setAttribute(`fill-rule`,`nonzero`),i.classList.add(`mask`)}let l=e._svgFactory.createElement(`use`);i.append(l),l.setAttribute(`href`,`#${s}`),c&&l.setAttribute(`mask`,`url(#${c})`);let u=l.cloneNode();return i.append(u),l.classList.add(`mainOutline`),u.classList.add(`secondaryOutline`),this.updateProperties(i,t),this.#t.set(r,i),r}finalizeDraw(e,t){this.#o.delete(e),this.updateProperties(e,t)}updateProperties(t,n){if(!n)return;let{root:r,bbox:i,rootClass:a,path:o}=n,s=typeof t==`number`?this.#t.get(t):t;if(s){if(r&&this.#x(s,r),i&&e.#v(s,i),a){let{classList:e}=s;for(let[t,n]of Object.entries(a))e.toggle(t,n)}if(o){let e=s.firstElementChild.firstElementChild;this.#x(e,o)}}}updateParent(e,t){if(t===this)return;let n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#o.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();this.#t.clear(),this.#o.clear(),this.#a?.disconnect(),this.#a=null,this.#n&&=(e.#p.get(this.#n)?.drawLayer===this&&(e.#m(this.#n),e.#p.delete(this.#n),e.#f.delete(this.#n),e.#f.size===0&&(e.#l?.abort(),e.#l=null,e.#d=!1)),null)}};function lh(e){return`${(e*100).toFixed(2)}%`}var uh=class e{#e=[];#t=new Map;#n=null;#r=0;#i=0;#a=0;static#o=null;constructor(e,t,n,r){this.#r=e,this.#e=t,this.#i=n.rawDims.pageWidth,this.#a=n.rawDims.pageHeight,this.#n=r}render(){let t=document.createElement(`div`);t.className=`textLayerImages`;for(let e=0;e<this.#e.length;e+=6){let n=this.#s(this.#e.subarray(e,e+6));n&&t.append(n)}return t.addEventListener(`contextmenu`,t=>{if(!(t.target instanceof HTMLCanvasElement))return;let n=t.target,r=this.#t.get(n);if(!r)return;let i=e.#o?.deref();if(i===n)return;i&&(i.width=0,i.height=0),e.#o=new WeakRef(n);let{inverseTransform:a,x1:o,y1:s,width:c,height:l}=r,u=this.#n(),d=Math.ceil(o*u.width),f=Math.ceil(s*u.height),p=Math.floor((o+c/this.#i)*u.width),m=Math.floor((s+l/this.#a)*u.height);n.width=p-d,n.height=m-f;let h=n.getContext(`2d`);h.setTransform(...a),h.translate(-d,-f),h.drawImage(u,0,0)}),t}#s([e,t,n,r,i,a]){let o=Math.hypot((i-e)*this.#i,(a-t)*this.#a),s=Math.hypot((n-e)*this.#i,(r-t)*this.#a);if(o<this.#r||s<this.#r)return null;let c=[(i-e)*this.#i/o,(a-t)*this.#a/o,(n-e)*this.#i/s,(r-t)*this.#a/s,0,0],l=Q.inverseTransform(c),u=document.createElement(`canvas`);return u.className=`textLayerImagePlaceholder`,u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:`absolute`,left:lh(e),top:lh(t),width:lh(o/this.#i),height:lh(s/this.#a),transformOrigin:`0% 0%`,transform:`matrix(${c.join(`,`)})`}),this.#t.set(u,{inverseTransform:l,width:o,height:s,x1:e,y1:t}),u}};globalThis._pdfjsTestingUtils={HighlightOutliner:Rm},globalThis.pdfjsLib={AbortException:Il,AnnotationEditorLayer:rh,AnnotationEditorParamsType:ul,AnnotationEditorType:Y,AnnotationEditorUIManager:Uu,AnnotationLayer:km,AnnotationMode:sl,AnnotationType:ml,applyOpacity:wu,build:Up,ColorPicker:Wp,createValidAbsoluteUrl:Dl,CSSConstants:Cu,DOMSVGFactory:Xp,DrawLayer:ch,FeatureTest:zl,fetchData:ru,findContrastColor:Au,getDocument:Np,getFilenameFromUrl:su,getPdfFilenameFromUrl:cu,getRGB:hu,getRGBA:mu,getUuid:Wl,GlobalWorkerOptions:bp,ImageKind:pl,InvalidPDFException:Nl,isDataScheme:au,isPdfFile:ou,isValidExplicitDest:Rd,makeArr:Kl,makeMap:ql,makeObj:Jl,makeSet:Yl,MathClamp:Xl,noContextMenu:du,normalizeUnicode:Ul,OPS:_l,OutputScale:bu,PasswordException:jl,PasswordResponses:yl,PDFDataRangeTransport:Fp,PDFDateString:pu,PDFWorker:Rp,PermissionFlag:dl,PixelsPerInch:nu,RenderingCancelledException:iu,renderRichText:ju,ResponseException:Pl,setLayerDimensions:yu,shadow:Z,SignatureExtractor:Qm,stopEvent:fu,SupportedImageMimeTypes:xu,TextLayer:jp,TextLayerImages:uh,TouchManager:Yu,updateUrlHash:Ol,Util:Q,VerbosityLevel:gl,version:Hp,XfaLayer:tu};var dh=`data:application/pdf;base64,`;async function fh(e){if(Buffer.isBuffer(e))return Uint8Array.from(e);if(e instanceof Uint8Array)return e;if(typeof e==`string`)return e.startsWith(dh)?Uint8Array.from(Buffer.from(e.slice(28),`base64`)):new Uint8Array((0,n.readFileSync)(e));if(typeof e==`object`&&e&&Symbol.asyncIterator in e)return new Uint8Array(await(0,n.arrayBuffer)(e));throw Error(`pdf-to-img received an unexpected input. Provide a path to file, a data URL, a Uint8Array, a Buffer, or a ReadableStream.`)}var ph=n.default.dirname((0,n.createRequire)({}.url).resolve(`pdfjs-dist/package.json`)),mh=e=>{let t=JSON.parse(JSON.stringify(e));for(let e in t)typeof t[e]==`string`&&(t[e]=t[e].replaceAll(/(^þÿ|\u0000)/g,``));return t};async function hh(e,t={}){let r=await fh(e),i=await Np({password:t.password,standardFontDataUrl:n.default.join(ph,`standard_fonts${n.default.sep}`),cMapUrl:n.default.join(ph,`cmaps${n.default.sep}`),cMapPacked:!0,...t.docInitParams,data:r}).promise,a=await i.getMetadata();async function o(e){let n=await i.getPage(e);if(n.destroyed)throw Error(`page is already destroyed`);let r=n.getViewport({scale:t.scale??1}),{canvas:a}=i.canvasFactory.create(r.width,r.height,!!t.renderParams?.background);return await n.render({canvas:a,viewport:r,...t.renderParams}).promise,t.format===`jpg`||t.format===`jpeg`?a.toBuffer(`image/jpeg`):a.toBuffer(`image/png`)}async function s(){i.loadingTask.destroyed||await i.loadingTask.destroy()}return{length:i.numPages,metadata:mh(a.info),getPage:o,get isDestroyed(){return i.loadingTask.destroyed},destroy:s,[Symbol.asyncDispose]:s,[Symbol.asyncIterator](){return{pg:0,async next(){return this.pg<i.numPages?(this.pg+=1,{done:!1,value:await o(this.pg)}):{done:!0,value:void 0}}}}}}function gh(e,t,n,r,i,a={}){let{threshold:o=.1,alpha:s=.1,aaColor:c=[255,255,0],diffColor:l=[255,0,0],checkerboard:u=!0,includeAA:d,diffColorAlt:f,diffMask:p}=a;if(!_h(e)||!_h(t)||n&&!_h(n))throw Error(`Image data: Uint8Array, Uint8ClampedArray or Buffer expected.`);if(e.length!==t.length||n&&n.length!==e.length)throw Error(`Image sizes do not match. Image 1 size: ${e.length}, image 2 size: ${t.length}`);if(e.length!==r*i*4)throw Error(`Image data size does not match width/height. Expecting ${r*i*4}. Got ${e.length}`);let m=r*i,h=new Uint32Array(e.buffer,e.byteOffset,m),g=new Uint32Array(t.buffer,t.byteOffset,m),_=!0;for(let e=0;e<m;e++)if(h[e]!==g[e]){_=!1;break}if(_){if(n&&!p)for(let t=0,r=0;t<m;t++,r+=4)Ch(e,r,s,n);return 0}let v=35215*o*o,[y,b,x]=c,[S,C,w]=l,[T,E,D]=f||l,O=0;for(let a=0,o=0;a<m;a++,o+=4){let c=h[a]===g[a]?0:bh(e,t,o,o,u);if(Math.abs(c)>v){let s=a%r,l=a/r|0;!d&&(vh(e,s,l,r,i,h,g,u)||vh(t,s,l,r,i,g,h,u))?n&&!p&&Sh(n,o,y,b,x):(n&&(c<0?Sh(n,o,T,E,D):Sh(n,o,S,C,w)),O++)}else n&&!p&&Ch(e,o,s,n)}return O}function _h(e){return ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1}function vh(e,t,n,r,i,a,o,s){let c=Math.max(t-1,0),l=Math.max(n-1,0),u=Math.min(t+1,r-1),d=Math.min(n+1,i-1),f=(n*r+t)*4,p=e[f],m=e[f+1],h=e[f+2],g=e[f+3],_=+(t===c||t===u||n===l||n===d),v=0,y=0,b=0,x=0,S=0,C=0;for(let i=c;i<=u;i++)for(let a=l;a<=d;a++){if(i===t&&a===n)continue;let o=xh(e,f,(a*r+i)*4,p,m,h,g,s);if(o===0){if(_++,_>2)return!1}else o<v?(v=o,b=i,x=a):o>y&&(y=o,S=i,C=a)}return v===0||y===0?!1:yh(a,b,x,r,i)&&yh(o,b,x,r,i)||yh(a,S,C,r,i)&&yh(o,S,C,r,i)}function yh(e,t,n,r,i){let a=Math.max(t-1,0),o=Math.max(n-1,0),s=Math.min(t+1,r-1),c=Math.min(n+1,i-1),l=e[n*r+t],u=+(t===a||t===s||n===o||n===c);for(let i=a;i<=s;i++)for(let a=o;a<=c;a++)if((i!==t||a!==n)&&(u+=+(l===e[a*r+i]),u>2))return!0;return!1}function bh(e,t,n,r,i){let a=e[n],o=e[n+1],s=e[n+2],c=e[n+3],l=t[r],u=t[r+1],d=t[r+2],f=t[r+3],p=a-l,m=o-u,h=s-d,g=c-f;if(c<255||f<255){let e=255,t=255,r=255;i&&(e=48+n%2*159,t=48+159*((n/1.618033988749895|0)%2),r=48+159*((n/2.618033988749895|0)%2)),p=(a*c-l*f-e*g)/255,m=(o*c-u*f-t*g)/255,h=(s*c-d*f-r*g)/255}let _=p*.29889531+m*.58662247+h*.11448223,v=p*.59597799-m*.2741761-h*.32180189,y=p*.21147017-m*.52261711+h*.31114694,b=.5053*_*_+.299*v*v+.1957*y*y;return _>0?-b:b}function xh(e,t,n,r,i,a,o,s){let c=e[n],l=e[n+1],u=e[n+2],d=e[n+3],f=r-c,p=i-l,m=a-u,h=o-d;if(!f&&!p&&!m&&!h)return 0;if(o<255||d<255){let e=255,n=255,g=255;s&&(e=48+t%2*159,n=48+159*((t/1.618033988749895|0)%2),g=48+159*((t/2.618033988749895|0)%2)),f=(r*o-c*d-e*h)/255,p=(i*o-l*d-n*h)/255,m=(a*o-u*d-g*h)/255}return f*.29889531+p*.58662247+m*.11448223}function Sh(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=i,e[t+3]=255}function Ch(e,t,n,r){let i=255+(e[t]*.29889531+e[t+1]*.58662247+e[t+2]*.11448223-255)*n*e[t+3]/255;Sh(r,t,i,i,i)}var wh=e.t(((e,n)=>{var r=t(),i=t(),a=n.exports=function(){i.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding=`utf8`,this.writable=!0};r.inherits(a,i),a.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t}),process.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit(`drain`))}.bind(this))},a.prototype.write=function(e,t){if(!this.writable)return this.emit(`error`,Error(`Stream not writable`)),!1;let n;return n=Buffer.isBuffer(e)?e:Buffer.from(e,t||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&this._reads.length===0&&(this._paused=!0),this.writable&&!this._paused},a.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(this._buffers.length===0?this._end():(this._buffers.push(null),this._process()))},a.prototype.destroySoon=a.prototype.end,a.prototype._end=function(){this._reads.length>0&&this.emit(`error`,Error(`Unexpected end of input`)),this.destroy()},a.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit(`close`))},a.prototype._processReadAllowingLess=function(e){this._reads.shift();let t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},a.prototype._processRead=function(e){this._reads.shift();let t=0,n=0,r=Buffer.alloc(e.length);for(;t<e.length;){let i=this._buffers[n++],a=Math.min(i.length,e.length-t);i.copy(r,t,0,a),t+=a,a!==i.length&&(this._buffers[--n]=i.slice(a))}n>0&&this._buffers.splice(0,n),this._buffered-=e.length,e.func.call(this,r)},a.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else if(this._buffered>=e.length)this._processRead(e);else break}this._buffers&&!this.writable&&this._end()}catch(e){this.emit(`error`,e)}}})),Th=e.t((e=>{var t=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];e.getImagePasses=function(e,n){let r=[],i=e%8,a=n%8,o=(e-i)/8,s=(n-a)/8;for(let e=0;e<t.length;e++){let n=t[e],c=o*n.x.length,l=s*n.y.length;for(let e=0;e<n.x.length&&n.x[e]<i;e++)c++;for(let e=0;e<n.y.length&&n.y[e]<a;e++)l++;c>0&&l>0&&r.push({width:c,height:l,index:e})}return r},e.getInterlaceIterator=function(e){return function(n,r,i){let a=n%t[i].x.length,o=(n-a)/t[i].x.length*8+t[i].x[a],s=r%t[i].y.length,c=(r-s)/t[i].y.length*8+t[i].y[s];return o*4+c*e*4}}})),Eh=e.t(((e,t)=>{t.exports=function(e,t,n){let r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}})),Dh=e.t(((e,t)=>{var n=Th(),r=Eh();function i(e,t,n){let r=e*t;return n!==8&&(r=Math.ceil(r/(8/n))),r}var a=t.exports=function(e,t){let r=e.width,a=e.height,o=e.interlace,s=e.bpp,c=e.depth;if(this.read=t.read,this.write=t.write,this.complete=t.complete,this._imageIndex=0,this._images=[],o){let e=n.getImagePasses(r,a);for(let t=0;t<e.length;t++)this._images.push({byteWidth:i(e[t].width,s,c),height:e[t].height,lineIndex:0})}else this._images.push({byteWidth:i(r,s,c),height:a,lineIndex:0});this._xComparison=c===8?s:c===16?s*2:1};a.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},a.prototype._unFilterType1=function(e,t,n){let r=this._xComparison,i=r-1;for(let a=0;a<n;a++){let n=e[1+a],o=a>i?t[a-r]:0;t[a]=n+o}},a.prototype._unFilterType2=function(e,t,n){let r=this._lastLine;for(let i=0;i<n;i++){let n=e[1+i],a=r?r[i]:0;t[i]=n+a}},a.prototype._unFilterType3=function(e,t,n){let r=this._xComparison,i=r-1,a=this._lastLine;for(let o=0;o<n;o++){let n=e[1+o],s=a?a[o]:0,c=o>i?t[o-r]:0,l=Math.floor((c+s)/2);t[o]=n+l}},a.prototype._unFilterType4=function(e,t,n){let i=this._xComparison,a=i-1,o=this._lastLine;for(let s=0;s<n;s++){let n=e[1+s],c=o?o[s]:0,l=r(s>a?t[s-i]:0,c,s>a&&o?o[s-i]:0);t[s]=n+l}},a.prototype._reverseFilterLine=function(e){let t=e[0],n,r=this._images[this._imageIndex],i=r.byteWidth;if(t===0)n=e.slice(1,i+1);else switch(n=Buffer.alloc(i),t){case 1:this._unFilterType1(e,n,i);break;case 2:this._unFilterType2(e,n,i);break;case 3:this._unFilterType3(e,n,i);break;case 4:this._unFilterType4(e,n,i);break;default:throw Error(`Unrecognised filter type - `+t)}this.write(n),r.lineIndex++,r.lineIndex>=r.height?(this._lastLine=null,this._imageIndex++,r=this._images[this._imageIndex]):this._lastLine=n,r?this.read(r.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}})),Oh=e.t(((e,n)=>{var r=t(),i=wh(),a=Dh(),o=n.exports=function(e){i.call(this);let t=[],n=this;this._filter=new a(e,{read:this.read.bind(this),write:function(e){t.push(e)},complete:function(){n.emit(`complete`,Buffer.concat(t))}}),this._filter.start()};r.inherits(o,i)})),kh=e.t(((e,t)=>{t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}})),Ah=e.t(((e,t)=>{var n=[];(function(){for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t>>>=1;n[e]=t}})();var r=t.exports=function(){this._crc=-1};r.prototype.write=function(e){for(let t=0;t<e.length;t++)this._crc=n[(this._crc^e[t])&255]^this._crc>>>8;return!0},r.prototype.crc32=function(){return this._crc^-1},r.crc32=function(e){let t=-1;for(let r=0;r<e.length;r++)t=n[(t^e[r])&255]^t>>>8;return t^-1}})),jh=e.t(((e,t)=>{var n=kh(),r=Ah(),i=t.exports=function(e,t){this._options=e,e.checkCRC=e.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[n.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[n.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[n.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[n.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[n.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[n.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.finished=t.finished,this.simpleTransparency=t.simpleTransparency,this.headersFinished=t.headersFinished||function(){}};i.prototype.start=function(){this.read(n.PNG_SIGNATURE.length,this._parseSignature.bind(this))},i.prototype._parseSignature=function(e){let t=n.PNG_SIGNATURE;for(let n=0;n<t.length;n++)if(e[n]!==t[n]){this.error(Error(`Invalid file signature`));return}this.read(8,this._parseChunkBegin.bind(this))},i.prototype._parseChunkBegin=function(e){let t=e.readUInt32BE(0),i=e.readUInt32BE(4),a=``;for(let t=4;t<8;t++)a+=String.fromCharCode(e[t]);let o=!!(e[4]&32);if(!this._hasIHDR&&i!==n.TYPE_IHDR)this.error(Error(`Expected IHDR on beggining`));else{if(this._crc=new r,this._crc.write(Buffer.from(a)),this._chunks[i])return this._chunks[i](t);o?this.read(t+4,this._skipChunk.bind(this)):this.error(Error(`Unsupported critical chunk type `+a))}},i.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},i.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},i.prototype._parseChunkEnd=function(e){let t=e.readInt32BE(0),n=this._crc.crc32();this._options.checkCRC&&n!==t?this.error(Error(`Crc error - `+t+` - `+n)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},i.prototype._handleIHDR=function(e){this.read(e,this._parseIHDR.bind(this))},i.prototype._parseIHDR=function(e){this._crc.write(e);let t=e.readUInt32BE(0),r=e.readUInt32BE(4),i=e[8],a=e[9],o=e[10],s=e[11],c=e[12];if(i!==8&&i!==4&&i!==2&&i!==1&&i!==16){this.error(Error(`Unsupported bit depth `+i));return}if(!(a in n.COLORTYPE_TO_BPP_MAP)){this.error(Error(`Unsupported color type`));return}if(o!==0){this.error(Error(`Unsupported compression method`));return}if(s!==0){this.error(Error(`Unsupported filter method`));return}if(c!==0&&c!==1){this.error(Error(`Unsupported interlace method`));return}this._colorType=a;let l=n.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:t,height:r,depth:i,interlace:!!c,palette:!!(a&n.COLORTYPE_PALETTE),color:!!(a&n.COLORTYPE_COLOR),alpha:!!(a&n.COLORTYPE_ALPHA),bpp:l,colorType:a}),this._handleChunkEnd()},i.prototype._handlePLTE=function(e){this.read(e,this._parsePLTE.bind(this))},i.prototype._parsePLTE=function(e){this._crc.write(e);let t=Math.floor(e.length/3);for(let n=0;n<t;n++)this._palette.push([e[n*3],e[n*3+1],e[n*3+2],255]);this.palette(this._palette),this._handleChunkEnd()},i.prototype._handleTRNS=function(e){this.simpleTransparency(),this.read(e,this._parseTRNS.bind(this))},i.prototype._parseTRNS=function(e){if(this._crc.write(e),this._colorType===n.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(Error(`Transparency chunk must be after palette`));return}if(e.length>this._palette.length){this.error(Error(`More transparent colors than palette size`));return}for(let t=0;t<e.length;t++)this._palette[t][3]=e[t];this.palette(this._palette)}this._colorType===n.COLORTYPE_GRAYSCALE&&this.transColor([e.readUInt16BE(0)]),this._colorType===n.COLORTYPE_COLOR&&this.transColor([e.readUInt16BE(0),e.readUInt16BE(2),e.readUInt16BE(4)]),this._handleChunkEnd()},i.prototype._handleGAMA=function(e){this.read(e,this._parseGAMA.bind(this))},i.prototype._parseGAMA=function(e){this._crc.write(e),this.gamma(e.readUInt32BE(0)/n.GAMMA_DIVISION),this._handleChunkEnd()},i.prototype._handleIDAT=function(e){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-e,this._parseIDAT.bind(this,e))},i.prototype._parseIDAT=function(e,t){if(this._crc.write(t),this._colorType===n.COLORTYPE_PALETTE_COLOR&&this._palette.length===0)throw Error(`Expected palette not found`);this.inflateData(t);let r=e-t.length;r>0?this._handleIDAT(r):this._handleChunkEnd()},i.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},i.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}})),Mh=e.t((e=>{var t=Th(),n=[function(){},function(e,t,n,r){if(r===t.length)throw Error(`Ran out of data`);let i=t[r];e[n]=i,e[n+1]=i,e[n+2]=i,e[n+3]=255},function(e,t,n,r){if(r+1>=t.length)throw Error(`Ran out of data`);let i=t[r];e[n]=i,e[n+1]=i,e[n+2]=i,e[n+3]=t[r+1]},function(e,t,n,r){if(r+2>=t.length)throw Error(`Ran out of data`);e[n]=t[r],e[n+1]=t[r+1],e[n+2]=t[r+2],e[n+3]=255},function(e,t,n,r){if(r+3>=t.length)throw Error(`Ran out of data`);e[n]=t[r],e[n+1]=t[r+1],e[n+2]=t[r+2],e[n+3]=t[r+3]}],r=[function(){},function(e,t,n,r){let i=t[0];e[n]=i,e[n+1]=i,e[n+2]=i,e[n+3]=r},function(e,t,n){let r=t[0];e[n]=r,e[n+1]=r,e[n+2]=r,e[n+3]=t[1]},function(e,t,n,r){e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=r},function(e,t,n){e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=t[3]}];function i(e,t){let n=[],r=0;function i(){if(r===e.length)throw Error(`Ran out of data`);let i=e[r];r++;let a,o,s,c,l,u,d,f;switch(t){default:throw Error(`unrecognised depth`);case 16:d=e[r],r++,n.push((i<<8)+d);break;case 4:d=i&15,f=i>>4,n.push(f,d);break;case 2:l=i&3,u=i>>2&3,d=i>>4&3,f=i>>6&3,n.push(f,d,u,l);break;case 1:a=i&1,o=i>>1&1,s=i>>2&1,c=i>>3&1,l=i>>4&1,u=i>>5&1,d=i>>6&1,f=i>>7&1,n.push(f,d,u,l,c,s,o,a)}}return{get:function(e){for(;n.length<e;)i();let t=n.slice(0,e);return n=n.slice(e),t},resetAfterLine:function(){n.length=0},end:function(){if(r!==e.length)throw Error(`extra data found`)}}}function a(e,t,r,i,a,o){let s=e.width,c=e.height,l=e.index;for(let e=0;e<c;e++)for(let c=0;c<s;c++){let s=r(c,e,l);n[i](t,a,s,o),o+=i}return o}function o(e,t,n,i,a,o){let s=e.width,c=e.height,l=e.index;for(let e=0;e<c;e++){for(let c=0;c<s;c++){let s=a.get(i),u=n(c,e,l);r[i](t,s,u,o)}a.resetAfterLine()}}e.dataToBitMap=function(e,n){let r=n.width,s=n.height,c=n.depth,l=n.bpp,u=n.interlace,d;c!==8&&(d=i(e,c));let f;f=c<=8?Buffer.alloc(r*s*4):new Uint16Array(r*s*4);let p=2**c-1,m=0,h,g;if(u)h=t.getImagePasses(r,s),g=t.getInterlaceIterator(r,s);else{let e=0;g=function(){let t=e;return e+=4,t},h=[{width:r,height:s}]}for(let t=0;t<h.length;t++)c===8?m=a(h[t],f,g,l,e,m):o(h[t],f,g,l,d,p);if(c===8){if(m!==e.length)throw Error(`extra data found`)}else d.end();return f}})),Nh=e.t(((e,t)=>{function n(e,t,n,r,i){let a=0;for(let o=0;o<r;o++)for(let r=0;r<n;r++){let n=i[e[a]];if(!n)throw Error(`index `+e[a]+` not in palette`);for(let e=0;e<4;e++)t[a+e]=n[e];a+=4}}function r(e,t,n,r,i){let a=0;for(let o=0;o<r;o++)for(let r=0;r<n;r++){let n=!1;if(i.length===1?i[0]===e[a]&&(n=!0):i[0]===e[a]&&i[1]===e[a+1]&&i[2]===e[a+2]&&(n=!0),n)for(let e=0;e<4;e++)t[a+e]=0;a+=4}}function i(e,t,n,r,i){let a=2**i-1,o=0;for(let i=0;i<r;i++)for(let r=0;r<n;r++){for(let n=0;n<4;n++)t[o+n]=Math.floor(e[o+n]*255/a+.5);o+=4}}t.exports=function(e,t,a=!1){let o=t.depth,s=t.width,c=t.height,l=t.colorType,u=t.transColor,d=t.palette,f=e;return l===3?n(e,f,s,c,d):(u&&r(e,f,s,c,u),o!==8&&!a&&(o===16&&(f=Buffer.alloc(s*c*4)),i(e,f,s,c,o))),f}})),Ph=e.t(((e,n)=>{var r=t(),i=t(),a=wh(),o=Oh(),s=jh(),c=Mh(),l=Nh(),u=n.exports=function(e){a.call(this),this._parser=new s(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,`gamma`),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};r.inherits(u,a),u.prototype._handleError=function(e){this.emit(`error`,e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on(`error`,function(){})),this.errord=!0},u.prototype._inflateData=function(e){if(!this._inflate){if(this._bitmapInfo.interlace)this._inflate=i.createInflate(),this._inflate.on(`error`,this.emit.bind(this,`error`)),this._filter.on(`complete`,this._complete.bind(this)),this._inflate.pipe(this._filter);else{let e=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,t=Math.max(e,i.Z_MIN_CHUNK);this._inflate=i.createInflate({chunkSize:t});let n=e,r=this.emit.bind(this,`error`);this._inflate.on(`error`,function(e){n&&r(e)}),this._filter.on(`complete`,this._complete.bind(this));let a=this._filter.write.bind(this._filter);this._inflate.on(`data`,function(e){n&&(e.length>n&&(e=e.slice(0,n)),n-=e.length,a(e))}),this._inflate.on(`end`,this._filter.end.bind(this._filter))}}this._inflate.write(e)},u.prototype._handleMetaData=function(e){this._metaData=e,this._bitmapInfo=Object.create(e),this._filter=new o(this._bitmapInfo)},u.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},u.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},u.prototype._simpleTransparency=function(){this._metaData.alpha=!0},u.prototype._headersFinished=function(){this.emit(`metadata`,this._metaData)},u.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit(`error`,`No Inflate block`))},u.prototype._complete=function(e){if(this.errord)return;let t;try{let n=c.dataToBitMap(e,this._bitmapInfo);t=l(n,this._bitmapInfo,this._options.skipRescale),n=null}catch(e){this._handleError(e);return}this.emit(`parsed`,t)}})),Fh=e.t(((e,t)=>{var n=kh();t.exports=function(e,t,r,i){let a=[n.COLORTYPE_COLOR_ALPHA,n.COLORTYPE_ALPHA].indexOf(i.colorType)!==-1;if(i.colorType===i.inputColorType){let t=(function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]!==256})();if(i.bitDepth===8||i.bitDepth===16&&t)return e}let o=i.bitDepth===16?new Uint16Array(e.buffer):e,s=255,c=n.COLORTYPE_TO_BPP_MAP[i.inputColorType];c===4&&!i.inputHasAlpha&&(c=3);let l=n.COLORTYPE_TO_BPP_MAP[i.colorType];i.bitDepth===16&&(s=65535,l*=2);let u=Buffer.alloc(t*r*l),d=0,f=0,p=i.bgColor||{};p.red===void 0&&(p.red=s),p.green===void 0&&(p.green=s),p.blue===void 0&&(p.blue=s);function m(){let e,t,r,c=s;switch(i.inputColorType){case n.COLORTYPE_COLOR_ALPHA:c=o[d+3],e=o[d],t=o[d+1],r=o[d+2];break;case n.COLORTYPE_COLOR:e=o[d],t=o[d+1],r=o[d+2];break;case n.COLORTYPE_ALPHA:c=o[d+1],e=o[d],t=e,r=e;break;case n.COLORTYPE_GRAYSCALE:e=o[d],t=e,r=e;break;default:throw Error(`input color type:`+i.inputColorType+` is not supported at present`)}return i.inputHasAlpha&&(a||(c/=s,e=Math.min(Math.max(Math.round((1-c)*p.red+c*e),0),s),t=Math.min(Math.max(Math.round((1-c)*p.green+c*t),0),s),r=Math.min(Math.max(Math.round((1-c)*p.blue+c*r),0),s))),{red:e,green:t,blue:r,alpha:c}}for(let e=0;e<r;e++)for(let e=0;e<t;e++){let e=m(o,d);switch(i.colorType){case n.COLORTYPE_COLOR_ALPHA:case n.COLORTYPE_COLOR:i.bitDepth===8?(u[f]=e.red,u[f+1]=e.green,u[f+2]=e.blue,a&&(u[f+3]=e.alpha)):(u.writeUInt16BE(e.red,f),u.writeUInt16BE(e.green,f+2),u.writeUInt16BE(e.blue,f+4),a&&u.writeUInt16BE(e.alpha,f+6));break;case n.COLORTYPE_ALPHA:case n.COLORTYPE_GRAYSCALE:{let t=(e.red+e.green+e.blue)/3;i.bitDepth===8?(u[f]=t,a&&(u[f+1]=e.alpha)):(u.writeUInt16BE(t,f),a&&u.writeUInt16BE(e.alpha,f+2));break}default:throw Error(`unrecognised color Type `+i.colorType)}d+=c,f+=l}return u}})),Ih=e.t(((e,t)=>{var n=Eh();function r(e,t,n,r,i){for(let a=0;a<n;a++)r[i+a]=e[t+a]}function i(e,t,n){let r=0,i=t+n;for(let n=t;n<i;n++)r+=Math.abs(e[n]);return r}function a(e,t,n,r,i,a){for(let o=0;o<n;o++){let n=o>=a?e[t+o-a]:0,s=e[t+o]-n;r[i+o]=s}}function o(e,t,n,r){let i=0;for(let a=0;a<n;a++){let n=a>=r?e[t+a-r]:0,o=e[t+a]-n;i+=Math.abs(o)}return i}function s(e,t,n,r,i){for(let a=0;a<n;a++){let o=t>0?e[t+a-n]:0,s=e[t+a]-o;r[i+a]=s}}function c(e,t,n){let r=0,i=t+n;for(let a=t;a<i;a++){let i=t>0?e[a-n]:0,o=e[a]-i;r+=Math.abs(o)}return r}function l(e,t,n,r,i,a){for(let o=0;o<n;o++){let s=o>=a?e[t+o-a]:0,c=t>0?e[t+o-n]:0,l=e[t+o]-(s+c>>1);r[i+o]=l}}function u(e,t,n,r){let i=0;for(let a=0;a<n;a++){let o=a>=r?e[t+a-r]:0,s=t>0?e[t+a-n]:0,c=e[t+a]-(o+s>>1);i+=Math.abs(c)}return i}function d(e,t,r,i,a,o){for(let s=0;s<r;s++){let c=s>=o?e[t+s-o]:0,l=t>0?e[t+s-r]:0,u=t>0&&s>=o?e[t+s-(r+o)]:0,d=e[t+s]-n(c,l,u);i[a+s]=d}}function f(e,t,r,i){let a=0;for(let o=0;o<r;o++){let s=o>=i?e[t+o-i]:0,c=t>0?e[t+o-r]:0,l=t>0&&o>=i?e[t+o-(r+i)]:0,u=e[t+o]-n(s,c,l);a+=Math.abs(u)}return a}var p={0:r,1:a,2:s,3:l,4:d},m={0:i,1:o,2:c,3:u,4:f};t.exports=function(e,t,n,r,i){let a;if(!(`filterType`in r)||r.filterType===-1)a=[0,1,2,3,4];else if(typeof r.filterType==`number`)a=[r.filterType];else throw Error(`unrecognised filter types`);r.bitDepth===16&&(i*=2);let o=t*i,s=0,c=0,l=Buffer.alloc((o+1)*n),u=a[0];for(let t=0;t<n;t++){if(a.length>1){let t=1/0;for(let n=0;n<a.length;n++){let r=m[a[n]](e,c,o,i);r<t&&(u=a[n],t=r)}}l[s]=u,s++,p[u](e,c,o,l,s,i),s+=o,c+=o}return l}})),Lh=e.t(((e,n)=>{var r=kh(),i=Ah(),a=Fh(),o=Ih(),s=t(),c=n.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=e.deflateLevel==null?9:e.deflateLevel,e.deflateStrategy=e.deflateStrategy==null?3:e.deflateStrategy,e.inputHasAlpha=e.inputHasAlpha==null||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||s.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType=typeof e.colorType==`number`?e.colorType:r.COLORTYPE_COLOR_ALPHA,e.inputColorType=typeof e.inputColorType==`number`?e.inputColorType:r.COLORTYPE_COLOR_ALPHA,[r.COLORTYPE_GRAYSCALE,r.COLORTYPE_COLOR,r.COLORTYPE_COLOR_ALPHA,r.COLORTYPE_ALPHA].indexOf(e.colorType)===-1)throw Error(`option color type:`+e.colorType+` is not supported at present`);if([r.COLORTYPE_GRAYSCALE,r.COLORTYPE_COLOR,r.COLORTYPE_COLOR_ALPHA,r.COLORTYPE_ALPHA].indexOf(e.inputColorType)===-1)throw Error(`option input color type:`+e.inputColorType+` is not supported at present`);if(e.bitDepth!==8&&e.bitDepth!==16)throw Error(`option bit depth:`+e.bitDepth+` is not supported at present`)};c.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},c.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},c.prototype.filterData=function(e,t,n){let i=a(e,t,n,this._options),s=r.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(i,t,n,this._options,s)},c.prototype._packChunk=function(e,t){let n=t?t.length:0,r=Buffer.alloc(n+12);return r.writeUInt32BE(n,0),r.writeUInt32BE(e,4),t&&t.copy(r,8),r.writeInt32BE(i.crc32(r.slice(4,r.length-4)),r.length-4),r},c.prototype.packGAMA=function(e){let t=Buffer.alloc(4);return t.writeUInt32BE(Math.floor(e*r.GAMMA_DIVISION),0),this._packChunk(r.TYPE_gAMA,t)},c.prototype.packIHDR=function(e,t){let n=Buffer.alloc(13);return n.writeUInt32BE(e,0),n.writeUInt32BE(t,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(r.TYPE_IHDR,n)},c.prototype.packIDAT=function(e){return this._packChunk(r.TYPE_IDAT,e)},c.prototype.packIEND=function(){return this._packChunk(r.TYPE_IEND,null)}})),Rh=e.t(((e,n)=>{var r=t(),i=t(),a=kh(),o=Lh(),s=n.exports=function(e){i.call(this);let t=e||{};this._packer=new o(t),this._deflate=this._packer.createDeflate(),this.readable=!0};r.inherits(s,i),s.prototype.pack=function(e,t,n,r){this.emit(`data`,Buffer.from(a.PNG_SIGNATURE)),this.emit(`data`,this._packer.packIHDR(t,n)),r&&this.emit(`data`,this._packer.packGAMA(r));let i=this._packer.filterData(e,t,n);this._deflate.on(`error`,this.emit.bind(this,`error`)),this._deflate.on(`data`,function(e){this.emit(`data`,this._packer.packIDAT(e))}.bind(this)),this._deflate.on(`end`,function(){this.emit(`data`,this._packer.packIEND()),this.emit(`end`)}.bind(this)),this._deflate.end(i)}})),zh=e.t(((e,n)=>{var r=t().ok,i=t(),a=t(),o=t().kMaxLength;function s(e){if(!(this instanceof s))return new s(e);e&&e.chunkSize<i.Z_MIN_CHUNK&&(e.chunkSize=i.Z_MIN_CHUNK),i.Inflate.call(this,e),this._offset=this._offset===void 0?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,e&&e.maxLength!=null&&(this._maxLength=e.maxLength)}function c(e){return new s(e)}function l(e,t){t&&process.nextTick(t),e._handle&&=(e._handle.close(),null)}s.prototype._processChunk=function(e,t,n){if(typeof n==`function`)return i.Inflate._processChunk.call(this,e,t,n);let a=this,s=e&&e.length,c=this._chunkSize-this._offset,u=this._maxLength,d=0,f=[],p=0,m;this.on(`error`,function(e){m=e});function h(e,t){if(a._hadError)return;let n=c-t;if(r(n>=0,`have should not go down`),n>0){let e=a._buffer.slice(a._offset,a._offset+n);if(a._offset+=n,e.length>u&&(e=e.slice(0,u)),f.push(e),p+=e.length,u-=e.length,u===0)return!1}return(t===0||a._offset>=a._chunkSize)&&(c=a._chunkSize,a._offset=0,a._buffer=Buffer.allocUnsafe(a._chunkSize)),t===0&&(d+=s-e,s=e,!0)}r(this._handle,`zlib binding closed`);let g;do g=this._handle.writeSync(t,e,d,s,this._buffer,this._offset,c),g||=this._writeState;while(!this._hadError&&h(g[0],g[1]));if(this._hadError)throw m;if(p>=o)throw l(this),RangeError(`Cannot create final Buffer. It would be larger than 0x`+o.toString(16)+` bytes`);let _=Buffer.concat(f,p);return l(this),_},a.inherits(s,i.Inflate);function u(e,t){if(typeof t==`string`&&(t=Buffer.from(t)),!(t instanceof Buffer))throw TypeError(`Not a string or buffer`);let n=e._finishFlushFlag;return n??=i.Z_FINISH,e._processChunk(t,n)}function d(e,t){return u(new s(t),e)}n.exports=e=d,e.Inflate=s,e.createInflate=c,e.inflateSync=d})),Bh=e.t(((e,t)=>{var n=t.exports=function(e){this._buffer=e,this._reads=[]};n.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t})},n.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let e=this._reads[0];if(this._buffer.length&&(this._buffer.length>=e.length||e.allowLess)){this._reads.shift();let t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}else break}if(this._reads.length>0)throw Error(`There are some read requests waitng on finished stream`);if(this._buffer.length>0)throw Error(`unrecognised content at end of stream`)}})),Vh=e.t((e=>{var t=Bh(),n=Dh();e.process=function(e,r){let i=[],a=new t(e);return new n(r,{read:a.read.bind(a),write:function(e){i.push(e)},complete:function(){}}).start(),a.process(),Buffer.concat(i)}})),Hh=e.t(((e,n)=>{var r=!0,i=t(),a=zh();i.deflateSync||(r=!1);var o=Bh(),s=Vh(),c=jh(),l=Mh(),u=Nh();n.exports=function(e,t){if(!r)throw Error(`To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0`);let n;function d(e){n=e}let f;function p(e){f=e}function m(e){f.transColor=e}function h(e){f.palette=e}function g(){f.alpha=!0}let _;function v(e){_=e}let y=[];function b(e){y.push(e)}let x=new o(e);if(new c(t,{read:x.read.bind(x),error:d,metadata:p,gamma:v,palette:h,transColor:m,inflateData:b,simpleTransparency:g}).start(),x.process(),n)throw n;let S=Buffer.concat(y);y.length=0;let C;if(f.interlace)C=i.inflateSync(S);else{let e=((f.width*f.bpp*f.depth+7>>3)+1)*f.height;C=a(S,{chunkSize:e,maxLength:e})}if(S=null,!C||!C.length)throw Error(`bad png - invalid inflate data response`);let w=s.process(C,f);S=null;let T=l.dataToBitMap(w,f);w=null;let E=u(T,f,t.skipRescale);return f.data=E,f.gamma=_||0,f}})),Uh=e.t(((e,n)=>{var r=!0,i=t();i.deflateSync||(r=!1);var a=kh(),o=Lh();n.exports=function(e,t){if(!r)throw Error(`To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0`);let n=new o(t||{}),s=[];s.push(Buffer.from(a.PNG_SIGNATURE)),s.push(n.packIHDR(e.width,e.height)),e.gamma&&s.push(n.packGAMA(e.gamma));let c=n.filterData(e.data,e.width,e.height),l=i.deflateSync(c,n.getDeflateOptions());if(c=null,!l||!l.length)throw Error(`bad png - invalid compressed data response`);return s.push(n.packIDAT(l)),s.push(n.packIEND()),Buffer.concat(s)}})),Wh=e.t((e=>{var t=Hh(),n=Uh();e.read=function(e,n){return t(e,n||{})},e.write=function(e,t){return n(e,t)}})),Gh=e.t((e=>{var n=t(),r=t(),i=Ph(),a=Rh(),o=Wh(),s=e.PNG=function(e){r.call(this),e||={},this.width=e.width|0,this.height=e.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new i(e),this._parser.on(`error`,this.emit.bind(this,`error`)),this._parser.on(`close`,this._handleClose.bind(this)),this._parser.on(`metadata`,this._metadata.bind(this)),this._parser.on(`gamma`,this._gamma.bind(this)),this._parser.on(`parsed`,function(e){this.data=e,this.emit(`parsed`,e)}.bind(this)),this._packer=new a(e),this._packer.on(`data`,this.emit.bind(this,`data`)),this._packer.on(`end`,this.emit.bind(this,`end`)),this._parser.on(`close`,this._handleClose.bind(this)),this._packer.on(`error`,this.emit.bind(this,`error`))};n.inherits(s,r),s.sync=o,s.prototype.pack=function(){return!this.data||!this.data.length?(this.emit(`error`,`No data provided`),this):(process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this)},s.prototype.parse=function(e,t){if(t){let e,n;e=function(e){this.removeListener(`error`,n),this.data=e,t(null,this)}.bind(this),n=function(n){this.removeListener(`parsed`,e),t(n,null)}.bind(this),this.once(`parsed`,e),this.once(`error`,n)}return this.end(e),this},s.prototype.write=function(e){return this._parser.write(e),!0},s.prototype.end=function(e){this._parser.end(e)},s.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit(`metadata`,e)},s.prototype._gamma=function(e){this.gamma=e},s.prototype._handleClose=function(){!this._parser.writable&&!this._packer.readable&&this.emit(`close`)},s.bitblt=function(e,t,n,r,i,a,o,s){if(n|=0,r|=0,i|=0,a|=0,o|=0,s|=0,n>e.width||r>e.height||n+i>e.width||r+a>e.height)throw Error(`bitblt reading outside image`);if(o>t.width||s>t.height||o+i>t.width||s+a>t.height)throw Error(`bitblt writing outside image`);for(let c=0;c<a;c++)e.data.copy(t.data,(s+c)*t.width+o<<2,(r+c)*e.width+n<<2,(r+c)*e.width+n+i<<2)},s.prototype.bitblt=function(e,t,n,r,i,a,o){return s.bitblt(this,e,t,n,r,i,a,o),this},s.adjustGamma=function(e){if(e.gamma){for(let t=0;t<e.height;t++)for(let n=0;n<e.width;n++){let r=e.width*t+n<<2;for(let t=0;t<3;t++){let n=e.data[r+t]/255;n**=1/2.2/e.gamma,e.data[r+t]=Math.round(n*255)}}e.gamma=0}},s.prototype.adjustGamma=function(){s.adjustGamma(this)}}))();async function Kh(e,t=2){let n=[],r=await hh(e,{scale:t});for await(let e of r)n.push(e);return n}async function qh(e,t){let{scale:r=2,threshold:i=.1,snapshotsDir:a,snapshotName:o,updateSnapshots:s=!1}=t;(0,n.mkdirSync)(a,{recursive:!0});let c=await Kh(e,r),l=[];for(let e=0;e<c.length;e++){let t=e+1,r=(0,n.resolve)(a,`${o}-page${t}.png`),u=(0,n.resolve)(a,`${o}-page${t}-diff.png`);if(!(0,n.existsSync)(r)||s){(0,n.writeFileSync)(r,c[e]),l.push({page:t,mismatchedPixels:0,totalPixels:0,mismatchPercent:0,snapshotCreated:!0});continue}let d=Gh.PNG.sync.read(c[e]),f=Gh.PNG.sync.read((0,n.readFileSync)(r));if(d.width!==f.width||d.height!==f.height){(0,n.writeFileSync)((0,n.resolve)(a,`${o}-page${t}-actual.png`),c[e]),l.push({page:t,mismatchedPixels:d.width*d.height,totalPixels:d.width*d.height,mismatchPercent:100,snapshotCreated:!1});continue}let p=new Gh.PNG({width:d.width,height:d.height}),m=gh(d.data,f.data,p.data,d.width,d.height,{threshold:i}),h=d.width*d.height,g=m/h*100;m>0&&(0,n.writeFileSync)(u,Gh.PNG.sync.write(p)),l.push({page:t,mismatchedPixels:m,totalPixels:h,mismatchPercent:g,diffPath:m>0?u:void 0,snapshotCreated:!1})}return l}async function Jh(e,t,r,i=`a`,a=`b`,o=2,s=.1){(0,n.mkdirSync)(r,{recursive:!0});let c=await Kh(e,o),l=await Kh(t,o),u=Math.max(c.length,l.length),d=[];for(let e=0;e<u;e++){let t=e+1;if(!c[e]||!l[e]){d.push({page:t,mismatchedPixels:-1,totalPixels:0,mismatchPercent:100,snapshotCreated:!1});continue}(0,n.writeFileSync)((0,n.resolve)(r,`${i}-page${t}.png`),c[e]),(0,n.writeFileSync)((0,n.resolve)(r,`${a}-page${t}.png`),l[e]);let o=Gh.PNG.sync.read(c[e]),u=Gh.PNG.sync.read(l[e]),f=Math.min(o.width,u.width),p=Math.min(o.height,u.height);if(o.width!==u.width||o.height!==u.height){d.push({page:t,mismatchedPixels:-1,totalPixels:f*p,mismatchPercent:-1,snapshotCreated:!1});continue}let m=new Gh.PNG({width:f,height:p}),h=gh(o.data,u.data,m.data,f,p,{threshold:s}),g=f*p;(0,n.writeFileSync)((0,n.resolve)(r,`diff-page${t}.png`),Gh.PNG.sync.write(m)),d.push({page:t,mismatchedPixels:h,totalPixels:g,mismatchPercent:h/g*100,diffPath:(0,n.resolve)(r,`diff-page${t}.png`),snapshotCreated:!1})}return d}exports.classifyText=ca,exports.cleanMergedText=ma,exports.clusterCoordinates=Vi,exports.comparePdfToSnapshot=qh,exports.comparetwoPdfs=Jh,exports.detectRegions=Wi,exports.extractDrawFromPage=ha,exports.extractDrawMerged=Sa,exports.extractPlayerName=ua,exports.extractSeedValue=da,exports.findClusterIndex=Ui,exports.mergeTextItems=fa,exports.parsePdfBuffer=zi,exports.pdfToImages=Kh;
|
|
61
|
+
`)){let n=document.createElement(`div`);n.append(e?document.createTextNode(e):document.createElement(`br`)),t.append(n)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}},Mm=class{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(let[t,n]of Object.entries(e))t.startsWith(`_`)||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){wl(`Not implemented`)}},Nm=class e extends Xu{#e=null;#t;_clipPathId=null;_colorPicker=null;_drawId=null;_drawOutlines=null;_focusDrawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#r=null;static#i=null;static#a=null;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(e){e.drawOutlines&&(this.#o(e),this.#m())}#o({drawOutlines:e,drawId:t,drawingOptions:n,clipPathId:r}){this._drawOutlines=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(Xu._l10nAlert[this.editorType]),t>=0?(this._drawId=t,this._clipPathId=r??null,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties),this.#c(this.parent)):this._drawId=this.#s(e,this.parent),this.#_(e.box)}#s(t,n){let{id:r,clipPathId:i}=n.drawLayer.draw(e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,this.constructor._hasClipPath);return this.constructor._hasClipPath&&(this._clipPathId=i),this.#c(n),r}#c(e){let t=this._drawOutlines.getFocusSVGProperties(this.#f);t&&(this._focusDrawId=e.drawLayer.drawOutline(t,this._drawOutlines.focusMustRemoveSelfIntersections))}#l(e=this.#f){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e))}#u(e){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,{rootClass:e})}#d(){let{parent:e,_drawId:t,_focusDrawId:n,_isVisible:r}=this;if(!e||t===null)return;let i={hidden:!r};e.drawLayer.updateProperties(t,{rootClass:i}),n!==null&&e.drawLayer.updateProperties(n,{rootClass:i})}static _mergeSVGProperties(e,t){let n=new Set(Object.keys(e));for(let[r,i]of Object.entries(t))n.has(r)?Object.assign(e[r],i):e[r]=i;return e}static getDefaultDrawingOptions(e){wl(`Not implemented`)}static get typesMap(){wl(`Not implemented`)}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}get#f(){return(this.parentRotation-this._drawRotation+360)%360}static updateDefaultParams(t,n){let r=this.typesMap.get(t);r&&this._defaultDrawingOptions.updateProperty(r,n),this._currentParent&&(e.#n.updateProperty(r,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,n){let r=this._drawingOptions,i=r[t],a=n=>{r.updateProperty(t,n);let i=this._drawOutlines.updateProperty(t,n);i&&this.#_(i),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:a.bind(this,n),undo:a.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,t,n=this.colorAndOpacityType){let r=this.constructor.typesMap.get(this.colorType),i=this._opacityName,a=this._drawingOptions,o=a[r],s=a[i],c=(e,t)=>{a.updateProperty(r,e),a.updateProperty(i,t),this._drawOutlines.updateProperty(r,e),this._drawOutlines.updateProperty(i,t),this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:c.bind(this,e,t),undo:c.bind(this,o,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:n,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(this.#g()),{bbox:this.#v()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(this.#g()),{bbox:this.#v()})),this.#l()}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#v()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(this.#g(),this.parentDimensions),{bbox:this.#v()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(this.disableEditMode(),this.disableEditing())}disableEditing(){super.disableEditing(),this.div.classList.toggle(`disabled`,!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle(`disabled`,!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),this.#p(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#m(),this.#_(this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#p()):e&&(this._uiManager.addShouldRescale(this),this.#m(e),t=!this.parent&&this.div?.classList.contains(`selectedEditor`)),super.setParent(e),this.#d(),t&&this.select()}#p(){if(this._drawId===null||!this.parent)return;let{drawLayer:e}=this.parent;e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(e.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()}#m(e=this.parent){if(this._drawId===null||this.parent!==e){if(this._drawId!==null){let{drawLayer:t}=this.parent;t.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null&&t.updateParent(this._focusDrawId,e.drawLayer)}else this._drawingOptions.updateAll(),this._drawId=this.#s(this._drawOutlines,e),this._clipPathId&&this.#e&&(this.#e.style.clipPath=this._clipPathId)}}#h([e,t,n,r]){let{parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[t,1-e,a/i*n,i/a*r];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,a/i*n,i/a*r];default:return[e,t,n,r]}}#g(){let{x:e,y:t,width:n,height:r,parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[1-t,e,i/a*n,a/i*r];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,i/a*n,a/i*r];default:return[e,t,n,r]}}#_(e){[this.x,this.y,this.width,this.height]=this.#h(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#v(e=this.parentRotation){let{x:t,y:n,width:r,height:i,_drawRotation:a,parentDimensions:[o,s]}=this;switch((a*4+e)/90){case 1:return[1-n-i,t,i,r];case 2:return[1-t-r,1-n-i,r,i];case 3:return[n,1-t-r,i,r];case 4:return[t,n-o/s*r,s/o*i,o/s*r];case 5:return[1-n,t,o/s*r,s/o*i];case 6:return[1-t-s/o*i,1-n,s/o*i,o/s*r];case 7:return[n-o/s*r,1-t-s/o*i,o/s*r,s/o*i];case 8:return[t-r,n-i,r,i];case 9:return[1-n,t-r,i,r];case 10:return[1-t,1-n,r,i];case 11:return[n-i,1-t,i,r];case 12:return[t-s/o*i,n,s/o*i,o/s*r];case 13:return[1-n-o/s*r,t-s/o*i,o/s*r,s/o*i];case 14:return[1-t,1-n-o/s*r,s/o*i,o/s*r];case 15:return[n,1-t,o/s*r,s/o*i];default:return[t,n,r,i]}}rotate(t=this.parentRotation){if(!this.parent||this._drawId===null)return;let n=(t-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties({bbox:this.#v(t)},this._drawOutlines.updateRotation(n))),this.#l(n)}show(e=this._isVisible){super.show(e),this.#d()}select(){super.select(),this.#u({hovered:!1,selected:!0})}unselect(){super.unselect(),this.#u({selected:!1})}pointerover(){this.isSelected||this.#u({hovered:!0})}pointerleave(){this.isSelected||this.#u({hovered:!1})}onScaleChanging(){if(!this.parent)return;let e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);e&&this.#_(e)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);let n=super.render();this.constructor._hasDrawClass&&n.classList.add(`draw`);let r=this.#e=document.createElement(`div`);return n.append(r),r.setAttribute(`aria-hidden`,`true`),r.className=`internal`,this._clipPathId&&(r.style.clipPath=this._clipPathId),Iu(this,r,[`pointerover`,`pointerleave`]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e){wl(`Not implemented`)}static _getDrawingTarget(e,{target:t}){return t}static _getPointerCoords({offsetX:e,offsetY:t,clientX:n,clientY:r},i=null){if(!i)return[e,t];let a=n-i.clientX,o=r-i.clientY;switch(this._currentParent.viewport.rotation){case 90:[a,o]=[o,-a];break;case 180:[a,o]=[-a,-o];break;case 270:[a,o]=[-o,a]}return[i.offsetX+a,i.offsetY+o]}static _addDrawingListeners(e,t){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(t,n,r,i){let{pointerId:a,pointerType:o}=i;if(Lu.isInitializedAndDifferentPointerType(o))return;let s=this._getDrawingTarget(t,i),[c,l]=this._getPointerCoords(i),{viewport:{rotation:u}}=t,{x:d,y:f,width:p,height:m}=s.getBoundingClientRect(),h=e.#r=new AbortController,g=t.combinedSignal(h);if(Lu.setPointer(o,a),window.addEventListener(`pointerup`,e=>{Lu.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:g}),window.addEventListener(`pointercancel`,e=>{Lu.isSamePointerIdOrRemove(e.pointerId)&&this._endDrawingSession()},{signal:g}),window.addEventListener(`pointerdown`,t=>{Lu.isSamePointerType(t.pointerType)&&(Lu.initializeAndAddPointerId(t.pointerId),e.#n.isCancellable()&&(e.#n.removeLastElement(),e.#n.isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener(`contextmenu`,du,{signal:g}),s.addEventListener(`pointermove`,this._drawMove.bind(this),{signal:g}),s.addEventListener(`touchmove`,e=>{Lu.isSameTimeStamp(e.timeStamp)&&fu(e)},{signal:g}),this._addDrawingListeners(s,g),t.toggleDrawing(),n._editorUndoBar?.hide(),e.#n){t.drawLayer.updateProperties(this._currentDrawId,e.#n.startNew(c,l,p,m,u));return}n.updateUIForDefaultProperties(this),e.#n=this.createDrawerInstance({x:c,y:l,box:[d,f,p,m],rotation:u,parent:t,isLTR:r}),e.#i=this.getDefaultDrawingOptions(),this._currentParent=t;let{id:_,clipPathId:v}=t.drawLayer.draw(this._mergeSVGProperties(e.#i.toSVGProperties(),e.#n.defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=_,e.#a=this._hasClipPath?v:null}static _drawMove(t){if(Lu.isSameTimeStamp(t.timeStamp),!e.#n||!Lu.isSamePointerId(t.pointerId))return;if(Lu.isUsingMultiplePointers()){this._endDraw(t);return}let n,r=t.getCoalescedEvents?.();if(r?.length){let i=[];for(let e of r)i.push(...this._getPointerCoords(e,t));n=e.#n.addPoints(i)}else n=e.#n.add(...this._getPointerCoords(t));this._currentParent.drawLayer.updateProperties(this._currentDrawId,n),Lu.setTimeStamp(t.timeStamp),fu(t)}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#n=null,e.#i=null,e.#a=null,Lu.clearTimeStamp()),e.#r&&(e.#r.abort(),e.#r=null,Lu.clearPointerIds())}static _endDraw(t){let n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),n.drawLayer.updateProperties(this._currentDrawId,t?.target===n.div?e.#n.end(...this._getPointerCoords(t)):e.#n.end()),this.supportMultipleDrawings){let t=e.#n,r=this._currentDrawId,i=t.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(r,t.setLastElement(i))},undo:()=>{n.drawLayer.updateProperties(r,t.removeLastElement())},mustExec:!1,type:ul.DRAW_STEP})}else this.endDrawing(!1)}}static endDrawing(t){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(ul.DRAW_STEP),!e.#n.isEmpty()){let{pageDimensions:[r,i],scale:a}=n,o=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:e.#a,drawOutlines:e.#n.getOutlines(r*a,i*a,a,this._INNER_MARGIN),drawingOptions:e.#i,mustBeCommitted:!t});return this._cleanup(!0),o}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,i,a,o){wl(`Not implemented`)}static async deserialize(e,t,n){let{rawDims:{pageWidth:r,pageHeight:i,pageX:a,pageY:o}}=t.viewport,s=this.deserializeDraw(a,o,r,i,this._INNER_MARGIN,e,n),c=await super.deserialize(e,t,n);return c.createDrawingOptions(e),c.#o({drawOutlines:s}),c.#m(),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){let[t,n]=this.pageTranslation,[r,i]=this.pageDimensions;return this._drawOutlines.serialize([t,n,r,i],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},$=class{static PRECISION=1e-4;focusOutline=null;toSVGPath(){wl("Abstract method `toSVGPath` must be implemented.")}get box(){wl("Abstract getter `box` must be implemented.")}serialize(e,t){wl("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){wl("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,t){return null}updateParentDimensions(e,t){return null}serializeQuadPoints(e,t){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,t){return{}}static _rotateBox([e,t,n,r],i){switch(i){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}static _rescale(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o]*r,a[o+1]=n+e[o+1]*i;return a}static _rescaleAndSwap(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o+1]*r,a[o+1]=n+e[o]*i;return a}static _translate(e,t,n,r){r||=new Float32Array(e.length);for(let i=0,a=e.length;i<a;i+=2)r[i]=t+e[i],r[i+1]=n+e[i+1];return r}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,r,i){switch(i){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static createBezierPoints(e,t,n,r,i,a){return[(e+5*n)/6,(t+5*r)/6,(5*n+i)/6,(5*r+a)/6,(n+i)/2,(r+a)/2]}},Pm=class e{#e;#t=[];#n;#r;#i=[];#a=new Float32Array(18);#o;#s;#c;#l;#u;#d;#f=[];static#p=8;static#m=2;static#h=e.#p+e.#m;constructor(t,n,r,i,a,o,s=0){this.#e=r,this.#d=a*i,this.#r=o,this.#a.set([NaN,NaN,NaN,NaN,t,n],6),this.#n=s,this.#l=e.#p*i,this.#c=e.#h*i,this.#u=i,this.#f.push(t,n)}isEmpty(){return isNaN(this.#a[8])}isCancellable(){return this.#f.length<=10}removeLastElement(){return this.#a.fill(NaN),this.#i.length=this.#t.length=this.#f.length=0,{path:{d:``}}}#g(){let e=this.#a.subarray(4,6),t=this.#a.subarray(16,18),[n,r,i,a]=this.#e;return[(this.#o+(e[0]-t[0])/2-n)/i,(this.#s+(e[1]-t[1])/2-r)/a,(this.#o+(t[0]-e[0])/2-n)/i,(this.#s+(t[1]-e[1])/2-r)/a]}add(e,t){this.#o=e,this.#s=t;let[n,r,i,a]=this.#e,[o,s,c,l]=this.#a.subarray(8,12),u=e-c,d=t-l,f=Math.hypot(u,d);if(f<this.#c)return!1;let p=f-this.#l,m=p/f,h=m*u,g=m*d,_=o,v=s;o=c,s=l,c+=h,l+=g,this.#f?.push(e,t);let y=-g/p,b=h/p,x=y*this.#d,S=b*this.#d;return this.#a.set(this.#a.subarray(2,8),0),this.#a.set([c+x,l+S],4),this.#a.set(this.#a.subarray(14,18),12),this.#a.set([c-x,l-S],16),isNaN(this.#a[6])?(this.#i.length===0&&(this.#a.set([o+x,s+S],2),this.#i.push(NaN,NaN,NaN,NaN,(o+x-n)/i,(s+S-r)/a),this.#a.set([o-x,s-S],14),this.#t.push(NaN,NaN,NaN,NaN,(o-x-n)/i,(s-S-r)/a)),this.#a.set([_,v,o,s,c,l],6),!this.isEmpty()):(this.#a.set([_,v,o,s,c,l],6),Math.abs(Math.atan2(v-s,_-o)-Math.atan2(g,h))<Math.PI/2?([o,s,c,l]=this.#a.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/i,((s+l)/2-r)/a),[o,s,_,v]=this.#a.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((_+o)/2-n)/i,((v+s)/2-r)/a),!0):([_,v,o,s,c,l]=this.#a.subarray(0,6),this.#i.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),[c,l,o,s,_,v]=this.#a.subarray(12,18),this.#t.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),!0))}toSVGPath(){if(this.isEmpty())return``;let e=this.#i,t=this.#t;if(isNaN(this.#a[6])&&!this.isEmpty())return this.#_();let n=[];n.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?n.push(`L${e[t+4]} ${e[t+5]}`):n.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#y(n);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#v(n),n.join(` `)}#_(){let[e,t,n,r]=this.#e,[i,a,o,s]=this.#g();return`M${(this.#a[2]-e)/n} ${(this.#a[3]-t)/r} L${(this.#a[4]-e)/n} ${(this.#a[5]-t)/r} L${i} ${a} L${o} ${s} L${(this.#a[16]-e)/n} ${(this.#a[17]-t)/r} L${(this.#a[14]-e)/n} ${(this.#a[15]-t)/r} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,r,i]=this.#e,a=this.#a.subarray(4,6),o=this.#a.subarray(16,18),[s,c,l,u]=this.#g();e.push(`L${(a[0]-t)/r} ${(a[1]-n)/i} L${s} ${c} L${l} ${u} L${(o[0]-t)/r} ${(o[1]-n)/i}`)}newFreeDrawOutline(e,t,n,r,i,a){return new Fm(e,t,n,r,i,a)}getOutlines(){let e=this.#i,t=this.#t,n=this.#a,[r,i,a,o]=this.#e,s=new Float32Array((this.#f?.length??0)+2);for(let e=0,t=s.length-2;e<t;e+=2)s[e]=(this.#f[e]-r)/a,s[e+1]=(this.#f[e+1]-i)/o;if(s[s.length-2]=(this.#o-r)/a,s[s.length-1]=(this.#s-i)/o,isNaN(n[6])&&!this.isEmpty())return this.#b(s);let c=new Float32Array(this.#i.length+24+this.#t.length),l=e.length;for(let t=0;t<l;t+=2)isNaN(e[t])?c[t]=c[t+1]=NaN:(c[t]=e[t],c[t+1]=e[t+1]);l=this.#S(c,l);for(let e=t.length-6;e>=6;e-=6)for(let n=0;n<6;n+=2)isNaN(t[e+n])?(c[l]=c[l+1]=NaN,l+=2):(c[l]=t[e+n],c[l+1]=t[e+n+1],l+=2);return this.#x(c,l),this.newFreeDrawOutline(c,s,this.#e,this.#u,this.#n,this.#r)}#b(e){let t=this.#a,[n,r,i,a]=this.#e,[o,s,c,l]=this.#g(),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-n)/i,(t[3]-r)/a,NaN,NaN,NaN,NaN,(t[4]-n)/i,(t[5]-r)/a,NaN,NaN,NaN,NaN,o,s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,(t[16]-n)/i,(t[17]-r)/a,NaN,NaN,NaN,NaN,(t[14]-n)/i,(t[15]-r)/a],0),this.newFreeDrawOutline(u,e,this.#e,this.#u,this.#n,this.#r)}#x(e,t){let n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#S(e,t){let n=this.#a.subarray(4,6),r=this.#a.subarray(16,18),[i,a,o,s]=this.#e,[c,l,u,d]=this.#g();return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-a)/s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(r[0]-i)/o,(r[1]-a)/s],t),t+=24}},Fm=class extends ${#e;#t=new Float32Array(4);#n;#r;#i;#a;#o;constructor(e,t,n,r,i,a){super(),this.#o=e,this.#i=t,this.#e=n,this.#a=r,this.#n=i,this.#r=a,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#s(a);let[o,s,c,l]=this.#t;for(let t=0,n=e.length;t<n;t+=2)e[t]=(e[t]-o)/c,e[t+1]=(e[t+1]-s)/l;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-o)/c,t[e+1]=(t[e+1]-s)/l}toSVGPath(){let e=[`M${this.#o[4]} ${this.#o[5]}`];for(let t=6,n=this.#o.length;t<n;t+=6)isNaN(this.#o[t])?e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`):e.push(`C${this.#o[t]} ${this.#o[t+1]} ${this.#o[t+2]} ${this.#o[t+3]} ${this.#o[t+4]} ${this.#o[t+5]}`);return e.push(`Z`),e.join(` `)}serialize([e,t,n,r],i){let a=n-e,o=r-t,s,c;switch(i){case 0:s=$._rescale(this.#o,e,r,a,-o),c=$._rescale(this.#i,e,r,a,-o);break;case 90:s=$._rescaleAndSwap(this.#o,e,t,a,o),c=$._rescaleAndSwap(this.#i,e,t,a,o);break;case 180:s=$._rescale(this.#o,n,t,-a,o),c=$._rescale(this.#i,n,t,-a,o);break;case 270:s=$._rescaleAndSwap(this.#o,n,r,-a,-o),c=$._rescaleAndSwap(this.#i,n,r,-a,-o)}return{outline:Array.from(s),points:[Array.from(c)]}}#s(e){let t=this.#o,n=t[4],r=t[5],i=[n,r,n,r],a=n,o=r,s=n,c=r,l=e?Math.max:Math.min,u=new Float32Array(4);for(let e=6,d=t.length;e<d;e+=6){let d=t[e+4],f=t[e+5];isNaN(t[e])?(Q.pointBoundingBox(d,f,i),o>f?(a=d,o=f):o===f&&(a=l(a,d)),c<f?(s=d,c=f):c===f&&(s=l(s,d))):(u.set(nl,0),Q.bezierBoundingBox(n,r,...t.slice(e,e+6),u),Q.rectBoundingBox(...u,i),o>u[1]?(a=u[0],o=u[1]):o===u[1]&&(a=l(a,u[0])),c<u[3]?(s=u[2],c=u[3]):c===u[3]&&(s=l(s,u[2]))),n=d,r=f}let d=this.#t;d[0]=i[0]-this.#n,d[1]=i[1]-this.#n,d[2]=i[2]-i[0]+2*this.#n,d[3]=i[3]-i[1]+2*this.#n,this.firstPoint=[a,o],this.lastPoint=[s,c]}get box(){return this.#t}newOutliner(e,t,n,r,i,a,o=0){return new Pm(e,t,n,r,i,a,o)}updateThickness(e){let t=this.getNewOutline(e);return this.#o=t.#o,this.#i=t.#i,this.#t.set(t.#t),this.firstPoint=t.firstPoint,this.lastPoint=t.lastPoint,this.#t}getNewOutline(e,t){let[n,r,i,a]=this.#t,[o,s,c,l]=this.#e,u=i*c,d=a*l,f=n*c+o,p=r*l+s,m=this.#i,h=this.newOutliner(m[0]*u+f,m[1]*d+p,this.#e,this.#a,e,this.#r,t??this.#n);for(let e=2,t=m.length;e<t;e+=2)h.add(m[e]*u+f,m[e+1]*d+p);return h.getOutlines()}};function Im(e){return{bbox:e.box,root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:e.isFree},path:{d:e.toSVGPath()}}}function Lm(e,t){let{focusOutline:n}=e;return{bbox:$._rotateBox(n.box,t),root:{"data-main-rotation":t},rootClass:{highlightOutline:!0,free:e.isFree},path:{d:n.toSVGPath()}}}var Rm=class{#e;#t;#n;#r=[];#i=[];constructor(e,t=0,n=0,r=!0){let i=nl.slice(),a=10**-4;for(let{x:n,y:r,width:o,height:s}of e){let e=Math.floor((n-t)/a)*a,c=Math.ceil((n+o+t)/a)*a,l=Math.floor((r-t)/a)*a,u=Math.ceil((r+s+t)/a)*a,d=[e,l,u,!0],f=[c,l,u,!1];this.#r.push(d,f),Q.rectBoundingBox(e,l,c,u,i)}let o=i[2]-i[0]+2*n,s=i[3]-i[1]+2*n,c=i[0]-n,l=i[1]-n,u=r?-1/0:1/0,d=1/0,f=this.#r.at(r?-1:-2),p=[f[0],f[2]];for(let e of this.#r){let[t,n,i,a]=e;!a&&r?n<d?(d=n,u=t):n===d&&(u=Math.max(u,t)):a&&!r&&(n<d?(d=n,u=t):n===d&&(u=Math.min(u,t))),e[0]=(t-c)/o,e[1]=(n-l)/s,e[2]=(i-l)/s}this.#e=new Float32Array([c,l,o,s]),this.#t=[u,d],this.#n=p}getOutlines(){this.#r.sort((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]);let e=[];for(let t of this.#r)t[3]?(e.push(...this.#l(t)),this.#s(t)):(this.#c(t),e.push(...this.#l(t)));return this.#a(e)}#a(e){let t=[],n=new Set;for(let n of e){let[e,r,i]=n;t.push([e,r,n],[e,i,n])}t.sort((e,t)=>e[1]-t[1]||e[0]-t[0]);for(let e=0,r=t.length;e<r;e+=2){let r=t[e][2],i=t[e+1][2];r.push(i),i.push(r),n.add(r),n.add(i)}let r=[];for(;n.size>0;){let e=n.values().next().value,[t,i,a,o,s]=e;n.delete(e);let c=t,l=i,u=[t,a];for(r.push(u);;){let e;if(n.has(o))e=o;else if(n.has(s))e=s;else break;n.delete(e),[t,i,a,o,s]=e,c!==t&&(u.push(c,l,t,l===i?i:a),c=t),l=l===i?a:i}u.push(c,l)}return new zm(r,this.#e,this.#t,this.#n)}#o(e){let t=this.#i,n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i][0];if(a===e)return i;a<e?n=i+1:r=i-1}return r+1}#s([,e,t]){let n=this.#o(e);this.#i.splice(n,0,[e,t])}#c([,e,t]){let n=this.#o(e);for(let r=n;r<this.#i.length;r++){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}for(let r=n-1;r>=0;r--){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}}#l(e){let[t,n,r]=e,i=[[t,n,r]],a=this.#o(r);for(let e=0;e<a;e++){let[n,r]=this.#i[e];for(let e=0,a=i.length;e<a;e++){let[,o,s]=i[e];if(!(r<=o||s<=n)){if(o>=n){if(s>r)i[e][1]=r;else{if(a===1)return[];i.splice(e,1),e--,a--}}else i[e][2]=n,s>r&&i.push([t,r,s])}}}return i}},zm=class extends ${#e;#t=null;#n;constructor(e,t,n,r){super(),this.#n=e,this.#e=t,this.firstPoint=n,this.lastPoint=r}static build(e,t){let n=new Rm(e,.001).getOutlines();return n.#t=e,n.focusOutline=new Rm(e,.0025,.001,t).getOutlines(),n}get isFree(){return!1}get defaultSVGProperties(){return Im(this)}getFocusSVGProperties(e){return Lm(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,t],[n,r]){let i=this.#t,a=new Float32Array(i.length*8),o=0;for(let{x:s,y:c,width:l,height:u}of i){let i=s*n+e,d=(1-c)*r+t;a[o]=a[o+4]=i,a[o+1]=a[o+3]=d,a[o+2]=a[o+6]=i+l*n,a[o+5]=a[o+7]=d-u*r,o+=8}return a}toSVGPath(){let e=[];for(let t of this.#n){let[n,r]=t;e.push(`M${n} ${r}`);for(let i=2;i<t.length;i+=2){let a=t[i],o=t[i+1];a===n?(e.push(`V${o}`),r=o):o===r&&(e.push(`H${a}`),n=a)}e.push(`Z`)}return e.join(` `)}serialize([e,t,n,r],i){let a=[],o=n-e,s=r-t;for(let t of this.#n){let n=Array(t.length);for(let i=0;i<t.length;i+=2)n[i]=e+t[i]*o,n[i+1]=r-t[i+1]*s;a.push(n)}return a}get box(){return this.#e}},Bm=class extends Pm{newFreeDrawOutline(e,t,n,r,i,a){return new Hm(e,t,n,r,i,a)}},Vm=class{#e;#t;constructor(e,t,n,r,i,a,o){this.#e=new Bm(e,t,n,r,i,a,o),this.#t=i}add(e,t){return this.#e.add(e,t)?{path:{d:this.#e.toSVGPath()}}:null}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)t=this.#e.add(e[n],e[n+1])||t;return t?{path:{d:this.#e.toSVGPath()}}:null}end(e,t){return e===void 0?null:this.add(e,t)}isEmpty(){return this.#e.isEmpty()}isCancellable(){return this.#e.isCancellable()}removeLastElement(){return this.#e.removeLastElement()}updateProperty(e,t){return null}getOutlines(){let e=this.#e.getOutlines();return e.buildFocusOutline(2*this.#t),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:!0},path:{d:this.#e.toSVGPath()}}}},Hm=class e extends Fm{static#e=1.5;newOutliner(e,t,n,r,i,a,o=0){return new Bm(e,t,n,r,i,a,o)}get isFree(){return!0}buildFocusOutline(t){this.focusOutline=this.getNewOutline(t/2+e.#e,.0025)}get defaultSVGProperties(){return Im(this)}getFocusSVGProperties(e){return Lm(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,t){if(e!==`thickness`)return null;let n=this.updateThickness(t/2);return this.buildFocusOutline(t),n}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}},Um=class e extends Mm{constructor(e=null){super(),super.updateProperties(e)}updateSVGProperty(e,t){e!==`thickness`&&super.updateSVGProperty(e,t)}clone(){let t=new e;return t.updateAll(this),t}},Wm=class e extends Nm{#e=null;#t=0;#n=null;#r=0;#i=``;#a=``;static _DEFAULT_OPACITY=1;static _DEFAULT_THICKNESS=12;static _defaultDrawingOptions=null;static _type=`highlight`;static _editorType=Y.HIGHLIGHT;static get _keyboardManager(){let t=e.prototype;return Z(this,`_keyboardManager`,new Vu([[[`ArrowLeft`],t._moveCaret,{args:[0]}],[[`ArrowRight`],t._moveCaret,{args:[1]}],[[`ArrowUp`],t._moveCaret,{args:[2]}],[[`ArrowDown`],t._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:`highlightEditor`}),this.#e=e.anchorNode||null,this.#t=e.anchorOffset||0,this.#n=e.focusNode||null,this.#r=e.focusOffset||0,this.#i=e.methodOfCreation||(this._drawOutlines?.isFree?`main_toolbar`:``),this.#a=e.text||``,this._isDraggable=!1,this.defaultL10nId=`pdfjs-editor-highlight-editor`,this.rotate()}static initialize(t,n){Xu.initialize(t,n),this._defaultDrawingOptions||=new Um({fill:n.highlightColors?.values().next().value||`#fff066`,"fill-opacity":e._DEFAULT_OPACITY,thickness:e._DEFAULT_THICKNESS})}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get typesMap(){return Z(this,`typesMap`,new Map([[ul.HIGHLIGHT_COLOR,`fill`],[ul.HIGHLIGHT_THICKNESS,`thickness`]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(t){let{boxes:n,drawOutlines:r}=t;(n||r)&&(this._drawingOptions||=t.drawingOptions||e.getDefaultDrawingOptions(),n&&(t={...t,drawOutlines:zm.build(n,this._uiManager.direction===`ltr`)}),super._addOutlines(t))}get colorType(){return ul.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions[`fill-opacity`]}get _opacityName(){return`fill-opacity`}get _drawRotation(){return this._drawOutlines?.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){return!this._drawOutlines?.isFree}get telemetryInitialData(){return{action:`added`,type:this._drawOutlines.isFree?`free_highlight`:`highlight`,color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:this.#i}}get telemetryFinalData(){return{type:`highlight`,color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get(`color`).size}}translateInPage(e,t){}get toolbarPosition(){return this.#o(this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return this.#o(this._drawOutlines.firstPoint)}#o([e,t]){let[n,r,i,a]=this._drawOutlines.box;return[(e-n)/i,(t-r)/a]}updateParams(t,n){switch(t){case ul.HIGHLIGHT_COLOR:this._updateColorAndOpacity(n,e._DEFAULT_OPACITY,t),this._reportTelemetry({action:`color_changed`,color:this._uiManager.getNonHCMColorName(n)},!0);break;case ul.HIGHLIGHT_THICKNESS:super.updateParams(t,n),this._reportTelemetry({action:`thickness_changed`,thickness:n},!0)}}get propertiesToUpdate(){let e=super.propertiesToUpdate;return e.push([ul.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new Wp({editor:this}),[[`colorPicker`,this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,t){return super.getRect(e,t,this._drawRotation)}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this._reportTelemetry({action:`deleted`}),super.remove()}render(){if(this.div)return this.div;let e=super.render();return this.#a&&(e.setAttribute(`aria-label`,this.#a),e.setAttribute(`role`,`mark`)),this._drawOutlines.isFree?e.classList.add(`free`):e.addEventListener(`keydown`,this.#s.bind(this),{signal:this._uiManager._signal}),this.enableEditing(),e}#s(t){e._keyboardManager.exec(this,t)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#c(!0);break;case 1:case 3:this.#c(!1)}}#c(e){if(!this.#e)return;let t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#n,this.#r)}unselect(){super.unselect(),this._drawOutlines.isFree||this.#c(!1)}static createDrawerInstance({x:e,y:t,box:n,parent:r,isLTR:i}){return new Vm(e,t,n,r.scale,this._defaultDrawingOptions.thickness/2,i,.001)}static _getDrawingTarget(e,{target:t}){return t.closest(`.textLayer`)}static _getPointerCoords({x:e,y:t}){return[e,t]}static _addDrawingListeners(e,t){e.classList.add(`free`),t.addEventListener(`abort`,()=>e.classList.remove(`free`),{once:!0}),window.addEventListener(`blur`,()=>this._endDraw(null),{signal:t}),window.addEventListener(`pointerdown`,fu,{capture:!0,passive:!1,signal:t})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:t,opacity:n,thickness:r}){let{_defaultDrawingOptions:i,_DEFAULT_OPACITY:a}=e;this._drawingOptions=e.getDefaultDrawingOptions({fill:Q.makeHexColor(...t),"fill-opacity":n||a,thickness:r||i.thickness})}static deserializeDraw(e,t,n,r,i,a,o){let{quadPoints:s}=a;if(s){let i=[];for(let a=0,o=s.length;a<o;a+=8)i.push({x:(s[a]-e)/n,y:1-(s[a+1]-t)/r,width:(s[a+2]-s[a])/n,height:(s[a+1]-s[a+5])/r});return zm.build(i,o.direction===`ltr`)}let c=a.thickness||this._defaultDrawingOptions.thickness,l=(a.inkLists||a.outlines.points)[0],u=new Bm(l[0]-e,r-(l[1]-t),[0,0,n,r],1,c/2,!0,.001);for(let n=0,i=l.length;n<i;n+=2)u.add(l[n]-e,r-(l[n+1]-t));let d=u.getOutlines();return d.buildFocusOutline(c),d}static async deserialize(e,t,n){let r=null;if(e instanceof Sm){let{data:{quadPoints:t,rect:n,rotation:i,id:a,color:o,opacity:s,popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:Y.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}else if(e instanceof xm){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,borderStyle:{rawWidth:s},popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:Y.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=super.serialize(e);return Object.assign(t,{color:Xu._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(t.rect,this._drawRotation)}),this.addComment(t),this.annotationElementId&&!this.#l(t)?null:(t.id=this.annotationElementId,t)}#l(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((e,n)=>e!==t[n])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},Gm=class{#e=new Float64Array(6);#t=new Float64Array(2);#n;#r;#i;#a;#o;#s=``;#c=0;#l=new Km;#u;#d;constructor(e,t,n,r,i,a){this.#u=n,this.#d=r,this.#i=i,this.#a=a,[e,t]=this.#f(e,t);let o=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#r=[{line:o,points:this.#o}],this.#e.set(o,0),this.#t.set([e,t],0)}updateProperty(e,t){e===`stroke-width`&&(this.#a=t)}#f(e,t){return $._normalizePoint(e,t,this.#u,this.#d,this.#i)}isEmpty(){return!this.#r?.length}isCancellable(){return this.#o.length<=10}add(e,t){return this.#p(e,t)&&this.toSVGPath(),{path:{d:this.#m()}}}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)this.#p(e[n],e[n+1])&&(t=!0,this.#o.length<=6&&(this.toSVGPath(),t=!1));return t&&this.toSVGPath(),{path:{d:this.#m()}}}#p(e,t){[e,t]=this.#f(e,t),this.#t.set([e,t],0);let[n,r,i,a]=this.#e.subarray(2,6),o=e-i,s=t-a;return Math.hypot(this.#u*o,this.#d*s)<=2?!1:(this.#o.push(e,t),isNaN(n)?(this.#e.set([i,a,e,t],2),this.#n.push(NaN,NaN,NaN,NaN,e,t),!0):(isNaN(this.#e[0])&&this.#n.splice(6,6),this.#e.set([n,r,i,a,e,t],0),this.#n.push(...$.createBezierPoints(n,r,i,a,e,t)),!0))}end(e,t){return e!==void 0&&this.#p(e,t)||this.#o.length===2?{path:{d:this.toSVGPath()}}:{path:{d:this.#s}}}startNew(e,t,n,r,i){this.#u=n,this.#d=r,this.#i=i,[e,t]=this.#f(e,t);let a=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#t.set([e,t],0);let o=this.#r.at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),this.#r.push({line:a,points:this.#o}),this.#e.set(a,0),this.#c=0,this.toSVGPath(),null}getLastElement(){return this.#r.at(-1)}setLastElement(e){return this.#r?(this.#r.push(e),this.#n=e.line,this.#o=e.points,this.#c=0,{path:{d:this.toSVGPath()}}):this.#l.setLastElement(e)}removeLastElement(){if(!this.#r)return this.#l.removeLastElement();this.#r.pop(),this.#s=``;for(let e=0,t=this.#r.length;e<t;e++){let{line:t,points:n}=this.#r[e];this.#n=t,this.#o=n,this.#c=0,this.toSVGPath()}return{path:{d:this.#s}}}#m(){let e=$.svgRound(this.#t[0]),t=$.svgRound(this.#t[1]);if(this.#o.length===2){let n=$.svgRound(this.#n[4]),r=$.svgRound(this.#n[5]);return`${this.#s} M ${n} ${r} L ${e} ${t}`}return`${this.#s} L ${e} ${t}`}toSVGPath(){let e=$.svgRound(this.#n[4]),t=$.svgRound(this.#n[5]);if(this.#o.length===2)return this.#s=`${this.#s} M ${e} ${t} Z`,this.#s;if(this.#o.length<=6){let n=this.#s.lastIndexOf(`M`);this.#s=`${this.#s.slice(0,n)} M ${e} ${t}`,this.#c=6}if(this.#o.length===4){let e=$.svgRound(this.#n[10]),t=$.svgRound(this.#n[11]);return this.#s=`${this.#s} L ${e} ${t}`,this.#c=12,this.#s}let n=[];this.#c===0&&(n.push(`M ${e} ${t}`),this.#c=6);for(let e=this.#c,t=this.#n.length;e<t;e+=6){let[t,r,i,a,o,s]=this.#n.slice(e,e+6).map($.svgRound);n.push(`C${t} ${r} ${i} ${a} ${o} ${s}`)}return this.#s+=n.join(` `),this.#c=this.#n.length,this.#s}getOutlines(e,t,n,r){let i=this.#r.at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),this.#l.build(this.#r,e,t,n,this.#i,this.#a,r),this.#e=null,this.#n=null,this.#r=null,this.#s=null,this.#l}get defaultSVGProperties(){return{root:{viewBox:`0 0 10000 10000`},rootClass:{draw:!0},bbox:[0,0,1,1]}}},Km=class extends ${#e;#t=0;#n;#r;#i;#a;#o;#s;#c;build(e,t,n,r,i,a,o){this.#i=t,this.#a=n,this.#o=r,this.#s=i,this.#c=a,this.#n=o??0,this.#r=e,this.#d()}get thickness(){return this.#c}setLastElement(e){return this.#r.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#r.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of this.#r)if(e.push(`M${$.svgRound(t[4])} ${$.svgRound(t[5])}`),t.length===6)e.push(`Z`);else if(t.length===12&&isNaN(t[6]))e.push(`L${$.svgRound(t[10])} ${$.svgRound(t[11])}`);else for(let n=6,r=t.length;n<r;n+=6){let[r,i,a,o,s,c]=t.subarray(n,n+6).map($.svgRound);e.push(`C${r} ${i} ${a} ${o} ${s} ${c}`)}return e.join(``)}serialize([e,t,n,r],i){let a=[],o=[],[s,c,l,u]=this.#u(),d,f,p,m,h,g,_,v,y;switch(this.#s){case 0:y=$._rescale,d=e,f=t+r,p=n,m=-r,h=e+s*n,g=t+(1-c-u)*r,_=e+(s+l)*n,v=t+(1-c)*r;break;case 90:y=$._rescaleAndSwap,d=e,f=t,p=n,m=r,h=e+c*n,g=t+s*r,_=e+(c+u)*n,v=t+(s+l)*r;break;case 180:y=$._rescale,d=e+n,f=t,p=-n,m=r,h=e+(1-s-l)*n,g=t+c*r,_=e+(1-s)*n,v=t+(c+u)*r;break;case 270:y=$._rescaleAndSwap,d=e+n,f=t+r,p=-n,m=-r,h=e+(1-c-u)*n,g=t+(1-s-l)*r,_=e+(1-c)*n,v=t+(1-s)*r}for(let{line:e,points:t}of this.#r)a.push(y(e,d,f,p,m,i?Array(e.length):null)),o.push(y(t,d,f,p,m,i?Array(t.length):null));return{lines:a,points:o,rect:[h,g,_,v]}}static deserialize(e,t,n,r,i,{paths:{lines:a,points:o},rotation:s,thickness:c}){let l=[],u,d,f,p,m;switch(s){case 0:m=$._rescale,u=-e/n,d=t/r+1,f=1/n,p=-1/r;break;case 90:m=$._rescaleAndSwap,u=-t/r,d=-e/n,f=1/r,p=1/n;break;case 180:m=$._rescale,u=e/n+1,d=-t/r,f=-1/n,p=1/r;break;case 270:m=$._rescaleAndSwap,u=t/r+1,d=e/n+1,f=-1/r,p=-1/n}if(!a){a=[];for(let e of o){let t=e.length;if(t===2){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(t===4){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}let n=new Float32Array(3*(t-2));a.push(n);let[r,i,o,s]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,i],0);for(let a=4;a<t;a+=2){let t=e[a],c=e[a+1];n.set($.createBezierPoints(r,i,o,s,t,c),(a-2)*3),[r,i,o,s]=[o,s,t,c]}}}for(let e=0,t=a.length;e<t;e++)l.push({line:m(a[e].map(e=>e??NaN),u,d,f,p),points:m(o[e].map(e=>e??NaN),u,d,f,p)});let h=new this.prototype.constructor;return h.build(l,n,r,1,s,c,i),h}#l(e=this.#c){let t=this.#n+e/2*this.#o;return this.#s%180==0?[t/this.#i,t/this.#a]:[t/this.#a,t/this.#i]}#u(){let[e,t,n,r]=this.#e,[i,a]=this.#l(0);return[e+i,t+a,n-2*i,r-2*a]}#d(){let e=this.#e=rl.slice();for(let{line:t}of this.#r){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6)Q.pointBoundingBox(t[n],t[n+1],e);continue}let n=t[4],r=t[5];for(let i=6,a=t.length;i<a;i+=6){let[a,o,s,c,l,u]=t.subarray(i,i+6);Q.bezierBoundingBox(n,r,a,o,s,c,l,u,e),n=l,r=u}}let[t,n]=this.#l();e[0]=Xl(e[0]-t,0,1),e[1]=Xl(e[1]-n,0,1),e[2]=Xl(e[2]+t,0,1),e[3]=Xl(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e===`stroke-width`?this.#f(t):null}#f(e){let[t,n]=this.#l();this.#c=e;let[r,i]=this.#l(),[a,o]=[r-t,i-n],s=this.#e;return s[0]-=a,s[1]-=o,s[2]+=2*a,s[3]+=2*o,s}updateParentDimensions([e,t],n){let[r,i]=this.#l();this.#i=e,this.#a=t,this.#o=n;let[a,o]=this.#l(),s=a-r,c=o-i,l=this.#e;return l[0]-=s,l[1]-=c,l[2]+=2*s,l[3]+=2*c,l}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map($.svgRound).join(` `)}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=this.#e,n=0,r=0,i=0,a=0,o=0,s=0;switch(this.#t){case 90:r=t/e,i=-e/t,o=e;break;case 180:n=-1,a=-1,o=e,s=t;break;case 270:r=-t/e,i=e/t,s=t;break;default:return``}return`matrix(${n} ${r} ${i} ${a} ${$.svgRound(o)} ${$.svgRound(s)})`}getPathResizingSVGProperties([e,t,n,r]){let[i,a]=this.#l(),[o,s,c,l]=this.#e;if(Math.abs(c-i)<=$.PRECISION||Math.abs(l-a)<=$.PRECISION){let i=e+n/2-(o+c/2),a=t+r/2-(s+l/2);return{path:{"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`,transform:`${this.rotationTransform} translate(${i} ${a})`}}}let u=(n-2*i)/(c-2*i),d=(r-2*a)/(l-2*a),f=c/n,p=l/r;return{path:{"transform-origin":`${$.svgRound(o)} ${$.svgRound(s)}`,transform:`${this.rotationTransform} scale(${f} ${p}) translate(${$.svgRound(i)} ${$.svgRound(a)}) scale(${u} ${d}) translate(${$.svgRound(-i)} ${$.svgRound(-a)})`}}}getPathResizedSVGProperties([e,t,n,r]){let[i,a]=this.#l(),o=this.#e,[s,c,l,u]=o;if(o[0]=e,o[1]=t,o[2]=n,o[3]=r,Math.abs(l-i)<=$.PRECISION||Math.abs(u-a)<=$.PRECISION){let i=e+n/2-(s+l/2),a=t+r/2-(c+u/2);for(let{line:e,points:t}of this.#r)$._translate(e,i,a,e),$._translate(t,i,a,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*i)/(l-2*i),f=(r-2*a)/(u-2*a),p=-d*(s+i)+e+i,m=-f*(c+a)+t+a;if(d!==1||f!==1||p!==0||m!==0)for(let{line:e,points:t}of this.#r)$._rescale(e,p,m,d,f,e),$._rescale(t,p,m,d,f,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){let[r,i]=n,a=this.#e,o=e-a[0],s=t-a[1];if(this.#i===r&&this.#a===i)for(let{line:e,points:t}of this.#r)$._translate(e,o,s,e),$._translate(t,o,s,t);else{let e=this.#i/r,t=this.#a/i;this.#i=r,this.#a=i;for(let{line:n,points:r}of this.#r)$._rescale(n,o,s,e,t,n),$._rescale(r,o,s,e,t,r);a[2]*=e,a[3]*=t}return a[0]=e,a[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${$.svgRound(e)} ${$.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${$.svgRound(e[0])} ${$.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}},qm=class e extends Mm{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:`none`,stroke:Xu._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-miterlimit":10})}updateSVGProperty(e,t){e===`stroke-width`&&(t??=this[`stroke-width`],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},Jm=class e extends Nm{static _type=`ink`;static _editorType=Y.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:`inkEditor`}),this._willKeepAspectRatio=!0,this.defaultL10nId=`pdfjs-editor-ink-editor`}static initialize(e,t){Xu.initialize(e,t),this._defaultDrawingOptions=new qm(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return Z(this,`typesMap`,new Map([[ul.INK_THICKNESS,`stroke-width`],[ul.INK_COLOR,`stroke`],[ul.INK_OPACITY,`stroke-opacity`]]))}static createDrawerInstance({x:e,y:t,box:[,,n,r],rotation:i}){return new Gm(e,t,n,r,i,this._defaultDrawingOptions[`stroke-width`])}static deserializeDraw(e,t,n,r,i,a){return Km.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=null;if(e instanceof xm){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,opacity:s,borderStyle:{rawWidth:c},popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},parent:{page:{pageNumber:m}}}=e;r=e={annotationType:Y.INK,color:Array.from(o),thickness:c,opacity:s,paths:{points:t},boxes:null,pageIndex:m-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}get toolbarButtons(){return this._colorPicker||=new Gp(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return ul.INK_COLOR}get colorAndOpacityType(){return ul.INK_COLOR_AND_OPACITY}get opacityType(){return ul.INK_OPACITY}updateParams(e,t){e===ul.INK_COLOR_AND_OPACITY?this._updateColorAndOpacity(t.color,t.opacity):super.updateParams(e,t)}static updateDefaultParams(e,t){e===ul.INK_COLOR_AND_OPACITY?(super.updateDefaultParams(ul.INK_COLOR,t.color),super.updateDefaultParams(ul.INK_OPACITY,t.opacity)):super.updateDefaultParams(e,t)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions[`stroke-opacity`]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty(`stroke-width`),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty(`stroke-width`),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:n,opacity:r}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:Q.makeHexColor(...t),"stroke-width":n,"stroke-opacity":r})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:r,"stroke-opacity":i,"stroke-width":a}}=this,o=Object.assign(super.serialize(e),{color:Xu._colorManager.convert(r),opacity:i,thickness:a,paths:{lines:t,points:n}});return this.addComment(o),e?(o.isCopy=!0,o):this.annotationElementId&&!this.#e(o)?null:(o.id=this.annotationElementId,o)}#e(e){let{color:t,thickness:n,opacity:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((e,n)=>e!==t[n])||e.thickness!==n||e.opacity!==r||e.pageIndex!==i}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions[`stroke-width`],points:t,popup:this.comment}),null}},Ym=class extends Km{toSVGPath(){let e=super.toSVGPath();return e.endsWith(`Z`)||(e+=`Z`),e}};Kc();var Xm=8,Zm=3,Qm=class{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,r){return n-=e,r-=t,n===0?r>0?0:4:n===1?r+6:2-r}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#r(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(-i+s-o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#i(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(i+s+o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#a(e,t,n,r){let i=e.length,a=new Int32Array(i);for(let t=0;t<i;t++)a[t]=+(e[t]<=r);for(let e=1;e<n-1;e++)a[e*t]=a[e*t+t-1]=0;for(let e=0;e<t;e++)a[e]=a[t*n-1-e]=0;let o=1,s,c=[];for(let e=1;e<n-1;e++){s=1;for(let n=1;n<t-1;n++){let r=e*t+n,i=a[r];if(i===0)continue;let l=e,u=n;if(i===1&&a[r-1]===0)o+=1,--u;else if(i>=1&&a[r+1]===0)o+=1,u+=1,i>1&&(s=i);else{i!==1&&(s=Math.abs(i));continue}let d=[n,e],f=u===n+1,p={isHole:f,points:d,id:o,parent:0};c.push(p);let m;for(let e of c)if(e.id===s){m=e;break}p.parent=m?m.isHole?f?m.parent:s:f?s:m.parent:f?s:0;let h=this.#r(a,t,e,n,l,u,0);if(h===-1){a[r]=-o,a[r]!==1&&(s=Math.abs(a[r]));continue}let g=this.#n[2*h],_=this.#n[2*h+1],v=e+g,y=n+_;l=v,u=y;let b=e,x=n;for(;;){let i=this.#i(a,t,b,x,l,u,1);g=this.#n[2*i],_=this.#n[2*i+1];let c=b+g,f=x+_;d.push(f,c);let p=b*t+x;if(a[p+1]===0?a[p]=-o:a[p]===1&&(a[p]=o),c===e&&f===n&&b===v&&x===y){a[r]!==1&&(s=Math.abs(a[r]));break}l=b,u=x,b=c,x=f}}}return c}static#o(e,t,n,r){if(n-t<=4){for(let i=t;i<n-2;i+=2)r.push(e[i],e[i+1]);return}let i=e[t],a=e[t+1],o=e[n-4]-i,s=e[n-3]-a,c=Math.hypot(o,s),l=o/c,u=s/c,d=l*a-u*i,f=s/o,p=1/c,m=Math.atan(f),h=Math.cos(m),g=Math.sin(m),_=p*(Math.abs(h)+Math.abs(g)),v=p*(1-_+_**2),y=Math.max(Math.atan(Math.abs(g+h)*v),Math.atan(Math.abs(g-h)*v)),b=0,x=t;for(let r=t+2;r<n-2;r+=2){let t=Math.abs(d-l*e[r+1]+u*e[r]);t>b&&(x=r,b=t)}b>(c*y)**2?(this.#o(e,t,x+2,r),this.#o(e,x,n,r)):r.push(i,a)}static#s(e){let t=[],n=e.length;return this.#o(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#c(e,t,n,r,i,a){let o=new Float32Array(a**2),s=-2*r**2,c=a>>1;for(let e=0;e<a;e++){let t=(e-c)**2;for(let n=0;n<a;n++)o[e*a+n]=Math.exp((t+(n-c)**2)/s)}let l=new Float32Array(256),u=-2*i**2;for(let e=0;e<256;e++)l[e]=Math.exp(e**2/u);let d=e.length,f=new Uint8Array(d),p=new Uint32Array(256);for(let r=0;r<n;r++)for(let i=0;i<t;i++){let s=r*t+i,u=e[s],d=0,m=0;for(let s=0;s<a;s++){let f=r+s-c;if(!(f<0||f>=n))for(let n=0;n<a;n++){let r=i+n-c;if(r<0||r>=t)continue;let p=e[f*t+r],h=o[s*a+n]*l[Math.abs(p-u)];d+=p*h,m+=h}}let h=f[s]=Math.round(d/m);p[h]++}return[f,p]}static#l(e){let t=new Uint32Array(256);for(let n of e)t[n]++;return t}static#u(e){let t=e.length,n=new Uint8ClampedArray(t>>2),r=-1/0,i=1/0;for(let t=0,a=n.length;t<a;t++){let a=n[t]=e[t<<2];r=Math.max(r,a),i=Math.min(i,a)}let a=255/(r-i);for(let e=0,t=n.length;e<t;e++)n[e]=(n[e]-i)*a;return n}static#d(e){let t,n=-1/0,r=-1/0,i=e.findIndex(e=>e!==0),a=i,o=i;for(t=i;t<256;t++){let i=e[t];i>n&&(t-a>r&&(r=t-a,o=t-1),n=i,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){let t=e,{width:n,height:r}=e,{maxDim:i}=this.#e,a=n,o=r;if(n>i||r>i){let s=n,c=r,l=Math.log2(Math.max(n,r)/i),u=Math.floor(l);l=l===u?u-1:u;for(let n=0;n<l;n++){a=Math.ceil(s/2),o=Math.ceil(c/2);let n=new OffscreenCanvas(a,o);n.getContext(`2d`).drawImage(e,0,0,s,c,0,0,a,o),s=a,c=o,e!==t&&e.close(),e=n.transferToImageBitmap()}let d=Math.min(i/a,i/o);a=Math.round(a*d),o=Math.round(o*d)}let s=new OffscreenCanvas(a,o).getContext(`2d`,{willReadFrequently:!0});s.fillStyle=`white`,s.fillRect(0,0,a,o),s.filter=`grayscale(1)`,s.drawImage(e,0,0,e.width,e.height,0,0,a,o);let c=s.getImageData(0,0,a,o).data;return[this.#u(c),a,o]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:r},i,a,o,s){let c=new OffscreenCanvas(1,1),l=c.getContext(`2d`,{alpha:!1}),u=l.font=`${n} ${r} 200px ${t}`,{actualBoundingBoxLeft:d,actualBoundingBoxRight:f,actualBoundingBoxAscent:p,actualBoundingBoxDescent:m,fontBoundingBoxAscent:h,fontBoundingBoxDescent:g,width:_}=l.measureText(e),v=1.5,y=Math.ceil(Math.max(Math.abs(d)+Math.abs(f)||0,_)*v),b=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||200,Math.abs(h)+Math.abs(g)||200)*v);c=new OffscreenCanvas(y,b),l=c.getContext(`2d`,{alpha:!0,willReadFrequently:!0}),l.font=u,l.filter=`grayscale(1)`,l.fillStyle=`white`,l.fillRect(0,0,y,b),l.fillStyle=`black`,l.fillText(e,y*.5/2,b*1.5/2);let x=this.#u(l.getImageData(0,0,y,b).data),S=this.#l(x),C=this.#d(S),w=this.#a(x,y,b,C);return this.processDrawnLines({lines:{curves:w,width:y,height:b},pageWidth:i,pageHeight:a,rotation:o,innerMargin:s,mustSmooth:!0,areContours:!0})}static process(e,t,n,r,i){let[a,o,s]=this.#f(e),[c,l]=this.#c(a,o,s,Math.hypot(o,s)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),u=this.#d(l),d=this.#a(c,o,s,u);return this.processDrawnLines({lines:{curves:d,width:o,height:s},pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:a,areContours:o}){r%180!=0&&([t,n]=[n,t]);let{curves:s,width:c,height:l}=e,u=e.thickness??0,d=[],f=Math.min(t/c,n/l),p=f/t,m=f/n,h=[];for(let{points:e}of s){let t=a?this.#s(e):e;if(!t)continue;h.push(t);let n=t.length,r=new Float32Array(n),i=new Float32Array(3*(n===2?2:n-2));if(d.push({line:i,points:r}),n===2){r[0]=t[0]*p,r[1]=t[1]*m,i.set([NaN,NaN,NaN,NaN,r[0],r[1]],0);continue}let[o,s,c,l]=t;o*=p,s*=m,c*=p,l*=m,r.set([o,s,c,l],0),i.set([NaN,NaN,NaN,NaN,o,s],0);for(let e=4;e<n;e+=2){let n=r[e]=t[e]*p,a=r[e+1]=t[e+1]*m;i.set($.createBezierPoints(o,s,c,l,n,a),(e-2)*3),[o,s,c,l]=[c,l,n,a]}}if(d.length===0)return null;let g=o?new Ym:new Km;return g.build(d,t,n,1,r,o?0:u,i),{outline:g,newCurves:h,areContours:o,thickness:u,width:c,height:l}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:r,height:i}){let a=1/0,o=-1/0,s=0;for(let t of e){s+=t.length;for(let e=2,n=t.length;e<n;e++){let n=t[e]-t[e-2];a=Math.min(a,n),o=Math.max(o,n)}}let c;c=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let l=e.length,u=Xm+Zm*l,d=new Uint32Array(u),f=0;d[f++]=u*Uint32Array.BYTES_PER_ELEMENT+(s-2*l)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=r,d[f++]=i,d[f++]=+!t,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=l,d[f++]=c.BYTES_PER_ELEMENT;for(let t of e)d[f++]=t.length-2,d[f++]=t[0],d[f++]=t[1];let p=new CompressionStream(`deflate-raw`),m=p.writable.getWriter();await m.ready,m.write(d);let h=c.prototype.constructor;for(let t of e){let e=new h(t.length-2);for(let n=2,r=t.length;n<r;n++)e[n-2]=t[n]-t[n-2];m.write(e)}return m.close(),(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(e){try{let t=Uint8Array.fromBase64(e),{readable:n,writable:r}=new DecompressionStream(`deflate-raw`),i=r.getWriter();await i.ready,i.write(t).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let a=null,o=0;for await(let e of n)a||=new Uint8Array(new Uint32Array(e.buffer,0,4)[0]),a.set(e,o),o+=e.length;let s=new Uint32Array(a.buffer,0,a.length>>2),c=s[1];if(c!==0)throw Error(`Invalid version: ${c}`);let l=s[2],u=s[3],d=s[4]===0,f=s[5],p=s[6],m=s[7],h=[],g=(Xm+Zm*p)*Uint32Array.BYTES_PER_ELEMENT,_;switch(m){case Int8Array.BYTES_PER_ELEMENT:_=new Int8Array(a.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:_=new Int16Array(a.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:_=new Int32Array(a.buffer,g)}o=0;for(let e=0;e<p;e++){let t=s[Zm*e+Xm],n=new Float32Array(t+2);h.push(n);for(let t=0;t<2;t++)n[t]=s[Zm*e+Xm+t+1];for(let e=0;e<t;e++)n[e+2]=n[e]+_[o++]}return{areContours:d,thickness:f,outlines:h,width:l,height:u}}catch(e){return X(`decompressSignature: ${e}`),null}}},$m=class e extends Mm{constructor(){super(),super.updateProperties({fill:Xu._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},eh=class e extends qm{constructor(e){super(e),super.updateProperties({stroke:Xu._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},th=class e extends Nm{#e=!1;#t=null;#n=null;#r=null;static _type=`signature`;static _editorType=Y.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:`signatureEditor`}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId=`pdfjs-editor-signature-editor1`}static initialize(e,t){Xu.initialize(e,t),this._defaultDrawingOptions=new $m,this._defaultDrawnSignatureOptions=new eh(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return Z(this,`typesMap`,new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:`signature`,hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let t=e.get(`hasDescription`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,n,{_isCopy:r}=this;if(r&&(this._isCopy=!1,t=this.x,n=this.y),super.render(),this._drawId===null){if(this.#n){let{lines:t,mustSmooth:n,areContours:r,description:i,uuid:a,heightInPage:o}=this.#n,{rawDims:{pageWidth:s,pageHeight:c},rotation:l}=this.parent.viewport,u=Qm.processDrawnLines({lines:t,pageWidth:s,pageHeight:c,rotation:l,innerMargin:e._INNER_MARGIN,mustSmooth:n,areContours:r});this.addSignature(u,o,i,a)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:``})),this.div.hidden=!0,this._uiManager.getSignature(this)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:this.#t||``}));return r&&(this._isCopy=!0,this._moveAfterPaste(t,n)),this.div}setUuid(e){this.#r=e,this.addEditToolbar()}getUuid(){return this.#r}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:r,height:i}=this.#n,a=Math.max(r,i);return{areContours:t,outline:Qm.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:n,width:r,height:i},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[[`editSignature`,this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){let{x:a,y:o}=this,{outline:s}=this.#n=t;this.#e=s instanceof Ym,this.description=r;let c;this.#e?c=e.getDefaultDrawingOptions():(c=e._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":s.thickness})),this._addOutlines({drawOutlines:s,drawingOptions:c});let[,l]=this.pageDimensions,u=n/l;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:`pdfjs.signature.inserted`,data:{hasBeenSaved:!!i,hasDescription:!!r}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return Qm.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return Qm.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return Qm.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,i=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:r});return this.addComment(i),e?(i.paths={lines:t,points:n},i.uuid=this.#r,i.isCopy=!0):i.lines=t,this.#t&&(i.accessibilityData={type:`Figure`,alt:this.#t}),i}static deserializeDraw(e,t,n,r,i,a){return a.areContours?Ym.deserialize(e,t,n,r,i,a):Km.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=await super.deserialize(e,t,n);return r.#e=e.areContours,r.description=e.accessibilityData?.alt||``,r.#r=e.uuid,r}},nh=class extends Xu{#e=null;#t=null;#n=null;#r=null;#i=null;#a=``;#o=null;#s=!1;#c=null;#l=!1;#u=!1;static _type=`stamp`;static _editorType=Y.STAMP;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId=`pdfjs-editor-stamp-editor`}static initialize(e,t){Xu.initialize(e,t)}static isHandlingMimeForPasting(e){return xu.has(e)}static paste(e,t){t.pasteEditor({mode:Y.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:`stamp`,hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let t=e.get(`hasAltText`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#d(e,t=!1){e?(this.#e=e.bitmap,t||(this.#t=e.id,this.#l=e.isSvg),e.file&&(this.#a=e.file.name),this.#m()):this.remove()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e)this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:`pdfjs.image.image_added`,data:{alt_text_modal:!1,alt_text_type:`empty`}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw Error(`No ML.`);if(!await n.isEnabledFor(`altText`))throw Error(`ML isn't enabled for alt text.`);let{data:r,width:i,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:`altText`,request:{data:r,width:i,height:a,channels:r.length/(i*a)}});if(!o)throw Error(`No response from the AI service.`);if(o.error)throw Error(`Error from the AI service.`);if(o.cancel)return null;if(!o.output)throw Error(`No valid response from the AI service.`);let s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#p(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#d(e,!0)).finally(()=>this.#f());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#d(e)).finally(()=>this.#f());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#d(e)).finally(()=>this.#f());return}let e=document.createElement(`input`);e.type=`file`,e.accept=xu.keys().join(`,`);let t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:`pdfjs.image.image_selected`,data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(t)}n()},{signal:t}),e.addEventListener(`cancel`,()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&=(clearTimeout(this.#c),null)),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))):this.#t&&this.#p()}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i||this.#t||this.#s)}get toolbarButtons(){return[[`altText`,this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#s||(this.#e?this.#m():this.#p()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:n,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,r&&(this.#e=r),this.#s=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(this.#c!==null&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#c=null,this.#g()},200))}#m(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}this._uiManager.enableWaiting(!1);let o=this.#o=document.createElement(`canvas`);o.setAttribute(`role`,`img`),this.addContainer(o),this.width=t/r,this.height=n/i,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#g(),this.#u||=(this.parent.addUndoableEditor(this),!0),this._reportTelemetry({action:`inserted_image`}),this.#a&&this.div.setAttribute(`aria-description`,this.#a),this.annotationElementId||this._uiManager.a11yAlert(Xu._l10nAlert.stamp)}copyCanvas(e,t,n=!1){e||=224;let{width:r,height:i}=this.#e,a=new bu,o=this.#e,s=r,c=i,l=null;if(t){if(r>t||i>t){let e=Math.min(t/r,t/i);s=Math.floor(r*e),c=Math.floor(i*e)}l=document.createElement(`canvas`);let e=l.width=Math.ceil(s*a.sx),n=l.height=Math.ceil(c*a.sy);this.#l||(o=this.#h(e,n));let u=l.getContext(`2d`);u.filter=this._uiManager.hcmFilter;let d=`white`,f=`#cfcfd8`;this._uiManager.hcmFilter===`none`?Su.isDarkMode&&(d=`#8f8f9d`,f=`#42414d`):f=`black`;let p=15*a.sx,m=15*a.sy,h=new OffscreenCanvas(p*2,m*2),g=h.getContext(`2d`);g.fillStyle=d,g.fillRect(0,0,p*2,m*2),g.fillStyle=f,g.fillRect(0,0,p,m),g.fillRect(p,m,p,m),u.fillStyle=u.createPattern(h,`repeat`),u.fillRect(0,0,e,n),u.drawImage(o,0,0,o.width,o.height,0,0,e,n)}let u=null;if(n){let t,n;if(a.symmetric&&o.width<e&&o.height<e)t=o.width,n=o.height;else if(o=this.#e,r>e||i>e){let a=Math.min(e/r,e/i);t=Math.floor(r*a),n=Math.floor(i*a),this.#l||(o=this.#h(t,n))}let s=new OffscreenCanvas(t,n).getContext(`2d`,{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,t,n),u={width:t,height:n,data:s.getImageData(0,0,t,n).data}}return{canvas:l,width:s,height:c,imageData:u}}#h(e,t){let{width:n,height:r}=this.#e,i=n,a=r,o=this.#e;for(;i>2*e||a>2*t;){let n=i,r=a;i>2*e&&(i=Math.ceil(i/2)),a>2*t&&(a=Math.ceil(a/2));let s=new OffscreenCanvas(i,a);s.getContext(`2d`).drawImage(o,0,0,n,r,0,0,i,a),o=s.transferToImageBitmap()}return o}#g(){let[e,t]=this.parentDimensions,{width:n,height:r}=this,i=new bu,a=Math.ceil(n*e*i.sx),o=Math.ceil(r*t*i.sy),s=this.#o;if(!s||s.width===a&&s.height===o)return;s.width=a,s.height=o;let c=this.#l?this.#e:this.#h(a,o),l=s.getContext(`2d`);l.filter=this._uiManager.hcmFilter,l.drawImage(c,0,0,c.width,c.height,0,0,a,o)}#_(e){if(e){if(this.#l){let e=this._uiManager.imageManager.getSvgUrl(this.#t);if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=this.#e,e.getContext(`2d`).drawImage(this.#e,0,0),e.toDataURL()}if(this.#l){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*nu.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*nu.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let r=null,i=!1;if(e instanceof Em){let{data:{rect:a,rotation:o,id:s,structParent:c,popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},container:m,parent:{page:{pageNumber:h}},canvas:g}=e,_,v;g?(delete e.canvas,{id:_,bitmap:v}=n.imageManager.getFromCanvas(m.id,g),g.remove()):(i=!0,e._hasNoCanvas=!0);let y=(await t._structTree.getAriaAttributes(`${cl}${s}`))?.get(`aria-label`)||``;r=e={annotationType:Y.STAMP,bitmapId:_,bitmap:v,pageIndex:h-1,rect:a.slice(0),rotation:o,annotationElementId:s,id:s,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:c,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let a=await super.deserialize(e,t,n),{rect:o,bitmap:s,bitmapUrl:c,bitmapId:l,isSvg:u,accessibilityData:d}=e;i?(n.addMissingCanvas(e.id,a),a.#s=!0):l&&n.imageManager.isValidId(l)?(a.#t=l,s&&(a.#e=s)):a.#r=c,a.#l=u;let[f,p]=a.pageDimensions;return a.width=(o[2]-o[0])/f,a.height=(o[3]-o[1])/p,d&&(a.altTextData=d),a._initialData=r,e.comment&&a.setCommentData(e),a.#u=!!r,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#l});if(this.addComment(n),e)return n.bitmapUrl=this.#_(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:r,altText:i}=this.serializeAltText(!1);if(!r&&i&&(n.accessibilityData={type:`Figure`,alt:i}),this.annotationElementId){let e=this.#v(n);return e.isSame?null:(e.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;let a=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:a,serialized:n}),n.bitmap=this.#_(!1);else if(this.#l){let e=t.stamps.get(this.#t);a>e.area&&(e.area=a,e.serialized.bitmap.close(),e.serialized.bitmap=this.#_(!1))}return n}#v(e){let{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===t,i=(e.accessibilityData?.alt||``)===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&i,isSameAltText:i}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},rh=class e{#e;#t=!1;#n=null;#r=null;#i=null;#a=new Map;#o=!1;#s=!1;#c=!1;#l=null;#u=null;#d=null;#f=null;#p=null;#m=-1;#h;static _initialized=!1;static#g=new Map([jm,Jm,nh,Wm,th].map(e=>[e._editorType,e]));constructor({uiManager:t,pageIndex:n,div:r,structTreeLayer:i,accessibilityManager:a,annotationLayer:o,drawLayer:s,textLayer:c,viewport:l,l10n:u}){let d=[...e.#g.values()];if(!e._initialized){e._initialized=!0;for(let e of d)e.initialize(u,t)}t.registerEditorTypes(d),this.#h=t,this.pageIndex=n,this.div=r,this.#e=a,this.#n=o,this.viewport=l,this.#d=c,this.drawLayer=s,this._structTree=i,this.#h.addLayer(this)}get isEmpty(){return this.#a.size===0}get isInvisible(){return this.isEmpty&&this.#h.getMode()===Y.NONE}updateToolbar(e){this.#h.updateToolbar(e)}updateMode(t=this.#h.getMode()){switch(this.#S(),t){case Y.NONE:this.div.classList.toggle(`nonEditing`,!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Y.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Y.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:n}=this.div;if(n.toggle(`nonEditing`,!1),t===Y.POPUP)n.toggle(`commentEditing`,!0);else{n.toggle(`commentEditing`,!1);for(let r of e.#g.values())n.toggle(`${r._type}Editing`,t===r._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#d?.div}setEditingState(e){this.#h.setEditingState(e)}addCommands(e){this.#h.addCommands(e)}cleanUndoStack(e){this.#h.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle(`drawing`,!e)}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#_(){return this.#a.size===0?this.#h.getEditors(this.pageIndex):this.#a.values()}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle(`nonEditing`,!1),this.#p?.abort(),this.#p=null;let e=new Set;for(let t of this.#_)t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#h.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));let t=this.#n;if(t)for(let n of t.getEditableAnnotations()){if(n.hide(),this.#h.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}this.#c=!1,this.#h._eventBus.dispatch(`editorsrendered`,{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#s=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle(`nonEditing`,!0),this.#d&&!this.#p){this.#p=new AbortController;let e=this.#h.combinedSignal(this.#p);this.#d.div.addEventListener(`pointerdown`,e=>{let{clientX:t,clientY:n,timeStamp:r}=e;if(r-this.#m>500){this.#m=r;return}this.#m=-1;let{classList:i}=this.div;i.toggle(`getElements`,!0);let a=document.elementsFromPoint(t,n);if(i.toggle(`getElements`,!1),!this.div.contains(a[0]))return;let o,s=RegExp(`^${ll}[0-9]+$`);for(let e of a)if(s.test(e.id)){o=e.id;break}if(!o)return;let c=this.#a.get(o);c?.annotationElementId===null&&(fu(e),c.dblclick(e))},{signal:e,capture:!0})}let t=this.#n,n=[];if(t){let e=new Map,r=new Map;for(let t of this.#_)t.disableEditing(),t.annotationElementId?t.serialize()===null?(r.set(t.annotationElementId,t),this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()):e.set(t.annotationElementId,t):n.push(t);for(let n of t.getEditableAnnotations()){let{id:t}=n.data;if(this.#h.isDeletedAnnotationElement(t)){n.updateEdited({deleted:!0});continue}let i=r.get(t);i?(i.resetAnnotationElement(n),i.show(!1),n.show()):(i=e.get(t),i&&(this.#h.addChangedExistingAnnotation(i),i.renderAnnotationElement(n)&&i.show(!1)),n.show())}}this.#S(),this.isEmpty&&(this.div.hidden=!0);let{classList:r}=this.div;for(let t of e.#g.values())r.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(n),this.#s=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#h.getActive()!==e&&this.#h.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#f){this.#f=new AbortController;let e=this.#h.combinedSignal(this.#f);this.#d.div.addEventListener(`pointerdown`,this.#v.bind(this),{signal:e}),this.#d.div.classList.add(`highlighting`)}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#d.div.classList.remove(`highlighting`))}#v(e){this.#h.unselectAll();let{target:t}=e;if(t===this.#d.div||(t.getAttribute(`role`)===`img`||t.classList.contains(`endOfContent`)||t.classList.contains(`textLayerImages`)||t.classList.contains(`textLayerImagePlaceholder`))&&this.#d.div.contains(t)){let{isMac:t}=zl.platform;if(e.button!==0||e.ctrlKey&&t)return;this.#h.showAllEditors(`highlight`,!0,!0),Wm.startDrawing(this,this.#h,this.#h.direction===`ltr`,e),e.preventDefault()}}enableClick(){if(this.#r)return;this.#r=new AbortController;let e=this.#h.combinedSignal(this.#r);this.div.addEventListener(`pointerdown`,this.pointerdown.bind(this),{signal:e});let t=this.pointerup.bind(this);this.div.addEventListener(`pointerup`,t,{signal:e}),this.div.addEventListener(`pointercancel`,t,{signal:e})}disableClick(){this.#r?.abort(),this.#r=null}attach(e){this.#a.set(e.id,e);let{annotationElementId:t}=e;t&&this.#h.isDeletedAnnotationElement(t)&&this.#h.removeDeletedAnnotationElement(e)}detach(e){this.#a.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#s&&e.annotationElementId&&this.#h.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#h.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#h.addDeletedAnnotationElement(e),Xu.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#h.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#c),this.#h.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#h._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getEditorByUID(e){for(let t of this.#a.values())if(t.uid===e)return t;return null}get#y(){return e.#g.get(this.#h.getMode())}combinedSignal(e){return this.#h.combinedSignal(e)}#b(e){let t=this.#y;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#h.updateMode(e.mode);let{offsetX:n,offsetY:r}=this.#x(),i=this.#h.getId(),a=this.#b({parent:this,id:i,x:n,y:r,uiManager:this.#h,isCentered:!0,...t});a&&this.add(a)}async deserialize(t){return await e.#g.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#h)||null}createAndAddNewEditor(e,t,n={}){let r=this.#h.getId(),i=this.#b({parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:this.#h,isCentered:t,...n});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}#x(){let{x:e,y:t,width:n,height:r}=this.boundingClientRect,i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}addNewEditor(e={}){this.createAndAddNewEditor(this.#x(),!0,e)}setSelected(e){this.#h.setSelected(e)}toggleSelected(e){this.#h.toggleSelected(e)}unselect(e){this.#h.unselect(e)}pointerup(e){let{isMac:t}=zl.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#o||(this.#o=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}let n=this.#h.getMode();n===Y.STAMP||n===Y.POPUP||n===Y.SIGNATURE?this.#h.unselectAll():this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#h.getMode()===Y.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:t}=zl.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#o=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let n=this.#h.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#h,!1,e);return}this.#h.setCurrentDrawingSession(this),this.#l=new AbortController;let t=this.#h.combinedSignal(this.#l);this.div.addEventListener(`blur`,({relatedTarget:e})=>{e&&!this.div.contains(e)&&(this.#u=null,this.commitOrRemove())},{signal:t}),this.#y.startDrawing(this,this.#h,!1,e)}pause(e){if(e){let{activeElement:e}=document;this.div.contains(e)&&(this.#u=e)}else this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){return this.#l?(this.#h.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#u=null,this.#y.endDrawing(e)):null}findNewParent(e,t,n){let r=this.#h.findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#h.getActive()?.parent===this&&(this.#h.commitOrRemove(),this.#h.setActiveEditor(null)),this.#i&&=(clearTimeout(this.#i),null);for(let e of this.#a.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#a.clear(),this.#h.removeLayer(this)}#S(){for(let e of this.#a.values())e.isEmpty()&&e.remove()}async render({viewport:e}){this.viewport=e,yu(this.div,e);for(let e of this.#h.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#h.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#h.commitOrRemove(),this.#S();let t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,yu(this.div,{rotation:n}),t!==n)for(let e of this.#a.values())e.rotate(n)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#h.viewParameters.realScale}};jc();function ih(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function ah(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(`.textLayer`):e.parentElement?.closest(`.textLayer`)||null:null}function oh(e,t,n,r){if(e===n)return t<=r;let i=e.compareDocumentPosition(n);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function sh(e,t,n){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains(`textLayer`)||t!==e.childNodes.length)return{container:e,offset:t};let r=e.lastChild;return r?.nodeType===Node.ELEMENT_NODE&&r.classList.contains(`endOfContent`)&&(r=r.previousSibling),!r||!n.contains(r)?null:r.nodeType===Node.TEXT_NODE?{container:r,offset:r.textContent.length}:{container:r,offset:r.childNodes.length}}var ch=class e{#e=null;#t=new Map;#n=null;#r=null;#i=null;#a=null;#o=new Map;static#s=0;static#c=0;static#l=null;static#u=new Set;static#d=!1;static#f=new Set;static#p=new WeakMap;constructor({filterFactory:t=null,pageColors:n=null,pageIndex:r,textLayer:i=null}){if(this.pageIndex=r,this.#r=t,this.#i=n,i){let t=e.#p.get(i);if(t?.selectionDiv&&(t.selectionDiv.remove(),e.#u.delete(t.selectionDiv)),e.#p.set(i,{drawLayer:this}),e.#f.add(i),this.#n=i,this.#a=new MutationObserver(t=>{if(this.#e&&this.#n?.isConnected&&e.#h()){for(let{addedNodes:n}of t)for(let t of n)if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){e.#_();return}}}),this.#a.observe(i,{childList:!0}),e.#l===null){e.#l=new AbortController;let{signal:t}=e.#l;document.addEventListener(`selectionchange`,e.#_.bind(e),{signal:t}),document.addEventListener(`pointerdown`,()=>{e.#d=!0},{signal:t}),document.addEventListener(`pointerup`,()=>{e.#d=!1},{signal:t}),window.addEventListener(`blur`,()=>{e.#d=!1},{signal:t})}}}setParent(t){if(!this.#e)this.#e=t,this.#n?.isConnected&&e.#h()&&e.#_();else if(this.#e!==t){if(this.#t.size>0)for(let e of this.#t.values())e.remove(),t.append(e);this.#e=t}}static#m(e){let t=this.#p.get(e);t?.selectionDiv&&(t.selectionDiv.remove(),this.#u.delete(t.selectionDiv),t.selectionDiv=null,t.path=null)}static#h(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#g(){return this.#f.keys().filter(e=>e.isConnected).toArray().sort(ih)}static#_(){let t=document.getSelection();if(!t||t.isCollapsed){for(let e of this.#u)e.remove();this.#u.clear();return}let n=new WeakMap,r=this.#g(),i=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(n.collapsed)continue;let{startContainer:a,startOffset:o,endContainer:s,endOffset:c}=n,l=ah(a),u=ah(s),d=l===null,f=u===null;if(this.#d&&d!==f)return;if(t.rangeCount===1){let{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:i}=t,d=ah(e),f=ah(r),p=oh(e,n,r,i);d&&f&&p!==null&&(p?(a=e,o=n,l=d,s=r,c=i,u=f):(a=r,o=i,l=f,s=e,c=n,u=d))}let p=r.filter(e=>n.intersectsNode(e));if(p.length===0)continue;let m=!1;if(l||(l=p[0],a=l,o=0,m=!0),u||(u=p.at(-1),s=u,c=u.childNodes.length,m=!0),s.nodeType===Node.ELEMENT_NODE){if(s.classList.contains(`endOfContent`)){let e=s.previousSibling;if(!e)continue;s=e,c=e.nodeType===Node.TEXT_NODE?e.textContent.length:e.childNodes.length}else if(s.classList.contains(`textLayer`)&&s.childNodes.length===c){let e=sh(s,c,u);if(!e)continue;s=e.container,c=e.offset}}if(a.nodeType===Node.ELEMENT_NODE){let e=sh(a,o,l);if(!e)continue;a=e.container,o=e.offset}if(l===u&&!m&&p.includes(l))i.push([n,l]);else for(let e of p){let t=e.firstChild;if(!t)continue;let n=document.createRange();if(e===l?n.setStart(a,o):n.setStartBefore(t),e===u)n.setEnd(s,c);else{let t=e.lastChild;if(!t)continue;if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){let e=t.previousSibling;if(!e)continue;n.setEndAfter(e)}else n.setEndAfter(t)}n.collapsed||i.push([n,e])}}let a=new Set(i.map(e=>e[1]));for(let e of this.#f)a.has(e)||this.#m(e);for(let[t,r]of i){let i=e.#p.get(r);if(!i)continue;let a=n.get(r);if(!a){let e=r.getBoundingClientRect();a=(t,n,r,i)=>({x:(t-e.x)/e.width,y:(n-e.y)/e.height,width:r/e.width,height:i/e.height}),n.set(r,a)}let o=[];for(let{x:e,y:n,width:r,height:i}of t.getClientRects())r!==0&&i!==0&&({x:e,y:n,width:r,height:i}=a(e,n,r,i),(r!==1||i!==1)&&o.push(`M${e} ${n} h${r} v${i} h-${r} Z`));if(o.length===0)continue;let s=i.drawLayer,c=i.selectionDiv,l=i.path;if(!c){let t=`clip_selection_${e.#c++}`;c=document.createElement(`div`),c.className=`selection`,c.style.clipPath=`url(#${t})`;let n=s.#r?.createSelectionStyle(s.#i);if(n)for(let[e,t]of Object.entries(n))c.style.setProperty(e,t);let r=e._svgFactory.create(1,1,!0);r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`);let a=e._svgFactory.createElement(`clipPath`);a.setAttribute(`id`,t),a.setAttribute(`clipPathUnits`,`objectBoundingBox`),l=e._svgFactory.createElement(`path`),a.append(l),r.append(a),c.append(r),i.path=l,i.selectionDiv=c}s.#e&&c.parentNode!==s.#e&&(s.#e.append(c),this.#u.add(c)),l.setAttribute(`d`,o.join(` `))}}static get _svgFactory(){return Z(this,`_svgFactory`,new Xp)}static#v(e,[t,n,r,i]){let{style:a}=e;a.top=`${100*n}%`,a.left=`${100*t}%`,a.width=`${100*r}%`,a.height=`${100*i}%`}#y(){let t=e._svgFactory.create(1,1,!0);return this.#e.append(t),t.setAttribute(`aria-hidden`,`true`),t}#b(t,n){let r=e._svgFactory.createElement(`clipPath`);t.append(r);let i=`clip_${n}`;r.setAttribute(`id`,i),r.setAttribute(`clipPathUnits`,`objectBoundingBox`);let a=e._svgFactory.createElement(`use`);return r.append(a),a.setAttribute(`href`,`#${n}`),a.classList.add(`clip`),i}#x(e,t){for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r)}draw(t,n=!1,r=!1){let i=e.#s++,a=this.#y(),o=e._svgFactory.createElement(`defs`);a.append(o);let s=e._svgFactory.createElement(`path`);o.append(s);let c=`path_${i}`;s.setAttribute(`id`,c),s.setAttribute(`vector-effect`,`non-scaling-stroke`),n&&this.#o.set(i,s);let l=r?this.#b(o,c):null,u=e._svgFactory.createElement(`use`);return a.append(u),u.setAttribute(`href`,`#${c}`),this.updateProperties(a,t),this.#t.set(i,a),{id:i,clipPathId:`url(#${l})`}}drawOutline(t,n){let r=e.#s++,i=this.#y(),a=e._svgFactory.createElement(`defs`);i.append(a);let o=e._svgFactory.createElement(`path`);a.append(o);let s=`path_${r}`;o.setAttribute(`id`,s),o.setAttribute(`vector-effect`,`non-scaling-stroke`);let c;if(n){let t=e._svgFactory.createElement(`mask`);a.append(t),c=`mask_${r}`,t.setAttribute(`id`,c),t.setAttribute(`maskUnits`,`objectBoundingBox`);let n=e._svgFactory.createElement(`rect`);t.append(n),n.setAttribute(`width`,`1`),n.setAttribute(`height`,`1`),n.setAttribute(`fill`,`white`);let i=e._svgFactory.createElement(`use`);t.append(i),i.setAttribute(`href`,`#${s}`),i.setAttribute(`stroke`,`none`),i.setAttribute(`fill`,`black`),i.setAttribute(`fill-rule`,`nonzero`),i.classList.add(`mask`)}let l=e._svgFactory.createElement(`use`);i.append(l),l.setAttribute(`href`,`#${s}`),c&&l.setAttribute(`mask`,`url(#${c})`);let u=l.cloneNode();return i.append(u),l.classList.add(`mainOutline`),u.classList.add(`secondaryOutline`),this.updateProperties(i,t),this.#t.set(r,i),r}finalizeDraw(e,t){this.#o.delete(e),this.updateProperties(e,t)}updateProperties(t,n){if(!n)return;let{root:r,bbox:i,rootClass:a,path:o}=n,s=typeof t==`number`?this.#t.get(t):t;if(s){if(r&&this.#x(s,r),i&&e.#v(s,i),a){let{classList:e}=s;for(let[t,n]of Object.entries(a))e.toggle(t,n)}if(o){let e=s.firstElementChild.firstElementChild;this.#x(e,o)}}}updateParent(e,t){if(t===this)return;let n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#o.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();this.#t.clear(),this.#o.clear(),this.#a?.disconnect(),this.#a=null,this.#n&&=(e.#p.get(this.#n)?.drawLayer===this&&(e.#m(this.#n),e.#p.delete(this.#n),e.#f.delete(this.#n),e.#f.size===0&&(e.#l?.abort(),e.#l=null,e.#d=!1)),null)}};function lh(e){return`${(e*100).toFixed(2)}%`}var uh=class e{#e=[];#t=new Map;#n=null;#r=0;#i=0;#a=0;static#o=null;constructor(e,t,n,r){this.#r=e,this.#e=t,this.#i=n.rawDims.pageWidth,this.#a=n.rawDims.pageHeight,this.#n=r}render(){let t=document.createElement(`div`);t.className=`textLayerImages`;for(let e=0;e<this.#e.length;e+=6){let n=this.#s(this.#e.subarray(e,e+6));n&&t.append(n)}return t.addEventListener(`contextmenu`,t=>{if(!(t.target instanceof HTMLCanvasElement))return;let n=t.target,r=this.#t.get(n);if(!r)return;let i=e.#o?.deref();if(i===n)return;i&&(i.width=0,i.height=0),e.#o=new WeakRef(n);let{inverseTransform:a,x1:o,y1:s,width:c,height:l}=r,u=this.#n(),d=Math.ceil(o*u.width),f=Math.ceil(s*u.height),p=Math.floor((o+c/this.#i)*u.width),m=Math.floor((s+l/this.#a)*u.height);n.width=p-d,n.height=m-f;let h=n.getContext(`2d`);h.setTransform(...a),h.translate(-d,-f),h.drawImage(u,0,0)}),t}#s([e,t,n,r,i,a]){let o=Math.hypot((i-e)*this.#i,(a-t)*this.#a),s=Math.hypot((n-e)*this.#i,(r-t)*this.#a);if(o<this.#r||s<this.#r)return null;let c=[(i-e)*this.#i/o,(a-t)*this.#a/o,(n-e)*this.#i/s,(r-t)*this.#a/s,0,0],l=Q.inverseTransform(c),u=document.createElement(`canvas`);return u.className=`textLayerImagePlaceholder`,u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:`absolute`,left:lh(e),top:lh(t),width:lh(o/this.#i),height:lh(s/this.#a),transformOrigin:`0% 0%`,transform:`matrix(${c.join(`,`)})`}),this.#t.set(u,{inverseTransform:l,width:o,height:s,x1:e,y1:t}),u}};globalThis._pdfjsTestingUtils={HighlightOutliner:Rm},globalThis.pdfjsLib={AbortException:Il,AnnotationEditorLayer:rh,AnnotationEditorParamsType:ul,AnnotationEditorType:Y,AnnotationEditorUIManager:Uu,AnnotationLayer:km,AnnotationMode:sl,AnnotationType:ml,applyOpacity:wu,build:Up,ColorPicker:Wp,createValidAbsoluteUrl:Dl,CSSConstants:Cu,DOMSVGFactory:Xp,DrawLayer:ch,FeatureTest:zl,fetchData:ru,findContrastColor:Au,getDocument:Np,getFilenameFromUrl:su,getPdfFilenameFromUrl:cu,getRGB:hu,getRGBA:mu,getUuid:Wl,GlobalWorkerOptions:bp,ImageKind:pl,InvalidPDFException:Nl,isDataScheme:au,isPdfFile:ou,isValidExplicitDest:Rd,makeArr:Kl,makeMap:ql,makeObj:Jl,makeSet:Yl,MathClamp:Xl,noContextMenu:du,normalizeUnicode:Ul,OPS:_l,OutputScale:bu,PasswordException:jl,PasswordResponses:yl,PDFDataRangeTransport:Fp,PDFDateString:pu,PDFWorker:Rp,PermissionFlag:dl,PixelsPerInch:nu,RenderingCancelledException:iu,renderRichText:ju,ResponseException:Pl,setLayerDimensions:yu,shadow:Z,SignatureExtractor:Qm,stopEvent:fu,SupportedImageMimeTypes:xu,TextLayer:jp,TextLayerImages:uh,TouchManager:Yu,updateUrlHash:Ol,Util:Q,VerbosityLevel:gl,version:Hp,XfaLayer:tu};var dh=`data:application/pdf;base64,`;async function fh(e){if(Buffer.isBuffer(e))return Uint8Array.from(e);if(e instanceof Uint8Array)return e;if(typeof e==`string`)return e.startsWith(dh)?Uint8Array.from(Buffer.from(e.slice(28),`base64`)):new Uint8Array((0,n.readFileSync)(e));if(typeof e==`object`&&e&&Symbol.asyncIterator in e)return new Uint8Array(await(0,n.arrayBuffer)(e));throw Error(`pdf-to-img received an unexpected input. Provide a path to file, a data URL, a Uint8Array, a Buffer, or a ReadableStream.`)}var ph=n.default.dirname((0,n.createRequire)({}.url).resolve(`pdfjs-dist/package.json`)),mh=e=>{let t=JSON.parse(JSON.stringify(e));for(let e in t)typeof t[e]==`string`&&(t[e]=t[e].replaceAll(/(^þÿ|\u0000)/g,``));return t};async function hh(e,t={}){let r=await fh(e),i=await Np({password:t.password,standardFontDataUrl:n.default.join(ph,`standard_fonts${n.default.sep}`),cMapUrl:n.default.join(ph,`cmaps${n.default.sep}`),cMapPacked:!0,...t.docInitParams,data:r}).promise,a=await i.getMetadata();async function o(e){let n=await i.getPage(e);if(n.destroyed)throw Error(`page is already destroyed`);let r=n.getViewport({scale:t.scale??1}),{canvas:a}=i.canvasFactory.create(r.width,r.height,!!t.renderParams?.background);return await n.render({canvas:a,viewport:r,...t.renderParams}).promise,t.format===`jpg`||t.format===`jpeg`?a.toBuffer(`image/jpeg`):a.toBuffer(`image/png`)}async function s(){i.loadingTask.destroyed||await i.loadingTask.destroy()}return{length:i.numPages,metadata:mh(a.info),getPage:o,get isDestroyed(){return i.loadingTask.destroyed},destroy:s,[Symbol.asyncDispose]:s,[Symbol.asyncIterator](){return{pg:0,async next(){return this.pg<i.numPages?(this.pg+=1,{done:!1,value:await o(this.pg)}):{done:!0,value:void 0}}}}}}function gh(e,t,n,r,i,a={}){let{threshold:o=.1,alpha:s=.1,aaColor:c=[255,255,0],diffColor:l=[255,0,0],checkerboard:u=!0,windowSize:d=1/0,includeAA:f,diffColorAlt:p,diffMask:m,ignoreMask:h}=a;if(!_h(e)||!_h(t)||n&&!_h(n)||h&&!_h(h))throw Error(`Image data: Uint8Array, Uint8ClampedArray or Buffer expected.`);if(e.length!==t.length||n&&n.length!==e.length)throw Error(`Image sizes do not match. Image 1 size: ${e.length}, image 2 size: ${t.length}`);let g=r*i;if(e.length!==g*4)throw Error(`Image data size does not match width/height. Expecting ${g*4}. Got ${e.length}`);if(h&&h.length!==g)throw Error(`Ignore mask size does not match image width/height. Expecting ${g}. Got ${h.length}`);let _=new Uint32Array(e.buffer,e.byteOffset,g),v=new Uint32Array(t.buffer,t.byteOffset,g),y=!0;for(let e=0;e<g;e++)if(_[e]!==v[e]&&(!h||!h[e])){y=!1;break}if(y){if(n&&!m)for(let t=0,r=0;t<g;t++,r+=4)Yh(n,r,e,s);return 0}let[b,x,S]=c,[C,w,T]=l,[E,D,O]=p||l,k=0,A=Number.isFinite(d)?new Uint8Array(g):null,j=-1,M=0;for(let a=0,c=0;a<g;a++,c+=4){let l=_[a]===v[a]||h&&h[a]?0:Hh(e,t,c,u,o);if(l){let o=a%r,s=a/r|0;!f&&(vh(e,o,s,r,i,_,v)||vh(t,o,s,r,i,v,_))?(n&&!m&&Jh(n,c,b,x,S),A&&(A[a]=2)):(n&&(l<0?Jh(n,c,E,D,O):Jh(n,c,C,w,T)),A&&(A[a]=1,j<0&&(j=s),M=s),k++)}else n&&!m&&Yh(n,c,e,s)}if(!A||!k)return k;let N=Math.min(Math.max(Math.floor(d),1),r,i),P=new Uint16Array(r),F=0,I=0,L=Math.min(i-1,M+N-1);for(let e=j;e<=L;e++){let t=e*r,n=e-N;if(n>=0){let e=n*r;for(let n=0;n<r;n++){let r=(A[t+n]&1)-(A[e+n]&1);P[n]+=r,I+=r}}else{for(let e=0;e<r;e++){let n=A[t+e]&1;P[e]+=n,I+=n}if(e<N-1)continue}if(I<=F)continue;let i=0;for(let e=0;e<N-1;e++)i+=P[e];for(let e=N-1;e<r;e++)i+=P[e],i>F&&(F=i),i-=P[e-N+1]}return F}function _h(e){return ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1}function vh(e,t,n,r,i,a,o){let s=t>0?t-1:0,c=n>0?n-1:0,l=t<r-1?t+1:r-1,u=n<i-1?n+1:i-1,d=(n*r+t)*4,f=e[d],p=e[d+1],m=e[d+2],h=e[d+3],g=+(t===s||t===l||n===c||n===u),_=0,v=0,y=0,b=0,x=0,S=0,C=r*4;for(let i=s;i<=l;i++){let a=(c*r+i)*4;for(let r=c;r<=u;r++,a+=C){if(i===t&&r===n)continue;let o=qh(e,a,f,p,m,h);if(o===0){if(g++,g>2)return!1}else o<_?(_=o,y=i,b=r):o>v&&(v=o,x=i,S=r)}}return _===0||v===0?!1:yh(a,y,b,r,i)&&yh(o,y,b,r,i)||yh(a,x,S,r,i)&&yh(o,x,S,r,i)}function yh(e,t,n,r,i){let a=n*r+t,o=e[a];if(t>0&&t<r-1&&n>0&&n<i-1)return+(o===e[a-r-1])+ +(o===e[a-1])+ +(o===e[a+r-1])+ +(o===e[a-r])+ +(o===e[a+r])+ +(o===e[a-r+1])+ +(o===e[a+1])+ +(o===e[a+r+1])>2;let s=t>0?t-1:0,c=n>0?n-1:0,l=t<r-1?t+1:r-1,u=n<i-1?n+1:i-1,d=+(t===s||t===l||n===c||n===u);for(let i=s;i<=l;i++){let a=c*r+i;for(let s=c;s<=u;s++,a+=r)if((i!==t||s!==n)&&(d+=+(o===e[a]),d>2))return!0}return!1}var bh=new Float64Array(257);for(let e=0;e<256;e++){let t=e/255;bh[e]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}bh[256]=bh[255];var xh=new Float64Array(256),Sh=new Float64Array(256),Ch=new Float64Array(256),wh=new Float64Array(256),Th=new Float64Array(256),Eh=new Float64Array(256),Dh=new Float64Array(256),Oh=new Float64Array(256),kh=new Float64Array(256);for(let e=0;e<256;e++){let t=bh[e];xh[e]=.4122214708*t,wh[e]=.2119034982*t,Dh[e]=.0883024619*t,Sh[e]=.5363325363*t,Th[e]=.6806995451*t,Oh[e]=.2817188376*t,Ch[e]=.0514459929*t,Eh[e]=.1073969566*t,kh[e]=.6299787005*t}function Ah(e){let t=e|0;return bh[t]+(bh[t+1]-bh[t])*(e-t)}var jh=4096,Mh=new Float64Array(4098);for(let e=0;e<=4097;e++)Mh[e]=Math.cbrt(e/jh);var Nh=8;function Ph(e){let t=e*jh,n=t|0;return n<Nh?Math.cbrt(e):Mh[n]+(Mh[n+1]-Mh[n])*(t-n)}var Fh=20,Ih=4096,Lh=new Uint32Array(Ih),Rh=new Float64Array(Ih*4),zh=.206,Bh=.03,Vh=1.206/1.03;function Hh(e,t,n,r,i){let a=e[n],o=e[n+1],s=e[n+2],c=e[n+3],l=t[n],u=t[n+1],d=t[n+2],f=t[n+3];return c===255&&f===255?Uh(a,o,s,l,u,d,i):Wh(a,o,s,c,l,u,d,f,n,r,i)}function Uh(e,t,n,r,i,a,o){let s=e<<16|t<<8|n,c=Math.imul(s,2654435761)>>>Fh,l=s+1,u=c*4,d,f,p,m;Lh[c]===l?(d=Rh[u],f=Rh[u+1],p=Rh[u+2],m=Rh[u+3]):(d=Ph(xh[e]+Sh[t]+Ch[n]),f=Ph(wh[e]+Th[t]+Eh[n]),p=Ph(Dh[e]+Oh[t]+kh[n]),m=Kh(d,f,p),Lh[c]=l,Rh[u]=d,Rh[u+1]=f,Rh[u+2]=p,Rh[u+3]=m);let h=r<<16|i<<8|a,g=Math.imul(h,2654435761)>>>Fh,_=h+1,v=g*4,y,b,x,S;return Lh[g]===_?(y=Rh[v],b=Rh[v+1],x=Rh[v+2],S=Rh[v+3]):(y=Ph(xh[r]+Sh[i]+Ch[a]),b=Ph(wh[r]+Th[i]+Eh[a]),x=Ph(Dh[r]+Oh[i]+kh[a]),S=Kh(y,b,x),Lh[g]=_,Rh[v]=y,Rh[v+1]=b,Rh[v+2]=x,Rh[v+3]=S),Gh(m-S,d-y,f-b,p-x,o)}function Wh(e,t,n,r,i,a,o,s,c,l,u){let d=255,f=255,p=255;if(l){let e=Math.imul(c>>2,2654435761);d=48+159*(e>>>31),f=48+159*(e>>>30&1),p=48+159*(e>>>29&1)}e=(e*r+d*(255-r))/255,t=(t*r+f*(255-r))/255,n=(n*r+p*(255-r))/255,i=(i*s+d*(255-s))/255,a=(a*s+f*(255-s))/255,o=(o*s+p*(255-s))/255;let m=Ah(e),h=Ah(t),g=Ah(n),_=Ah(i),v=Ah(a),y=Ah(o),b=Ph(.4122214708*m+.5363325363*h+.0514459929*g),x=Ph(.2119034982*m+.6806995451*h+.1073969566*g),S=Ph(.0883024619*m+.2817188376*h+.6299787005*g),C=Ph(.4122214708*_+.5363325363*v+.0514459929*y),w=Ph(.2119034982*_+.6806995451*v+.1073969566*y),T=Ph(.0883024619*_+.2817188376*v+.6299787005*y);return Gh(Kh(b,x,S)-Kh(C,w,T),b-C,x-w,S-T,u)}function Gh(e,t,n,r,i){let a=i-Math.abs(e);if(a>=0){let e=1.9779984951*t-2.428592205*n+.4505937099*r,i=.0259040371*t+.7827717662*n-.808675766*r;if(e*e+i*i<=a*a)return 0}return e>0?-1:1}function Kh(e,t,n){let r=.2104542553*e+.793617785*t-.0040720468*n,i=Vh*r-zh;return .5*(i+Math.sqrt(i*i+4*Bh*Vh*r))}function qh(e,t,n,r,i,a){let o=e[t],s=e[t+1],c=e[t+2],l=e[t+3],u=n-o,d=r-s,f=i-c,p=a-l;if(!u&&!d&&!f&&!p)return 0;if(a<255||l<255){u=(n*a-o*l-255*p)/255,d=(r*a-s*l-255*p)/255,f=(i*a-c*l-255*p)/255;let e=u*.29889531+d*.58662247+f*.11448223;return e===0&&p?p/2:e}return u*.29889531+d*.58662247+f*.11448223}function Jh(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=i,e[t+3]=255}function Yh(e,t,n,r){let i=255+(n[t]*.29889531+n[t+1]*.58662247+n[t+2]*.11448223-255)*r*n[t+3]/255;Jh(e,t,i,i,i)}var Xh=e.t(((e,n)=>{var r=t(),i=t(),a=n.exports=function(){i.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding=`utf8`,this.writable=!0};r.inherits(a,i),a.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t}),process.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit(`drain`))}.bind(this))},a.prototype.write=function(e,t){if(!this.writable)return this.emit(`error`,Error(`Stream not writable`)),!1;let n;return n=Buffer.isBuffer(e)?e:Buffer.from(e,t||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&this._reads.length===0&&(this._paused=!0),this.writable&&!this._paused},a.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(this._buffers.length===0?this._end():(this._buffers.push(null),this._process()))},a.prototype.destroySoon=a.prototype.end,a.prototype._end=function(){this._reads.length>0&&this.emit(`error`,Error(`Unexpected end of input`)),this.destroy()},a.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit(`close`))},a.prototype._processReadAllowingLess=function(e){this._reads.shift();let t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},a.prototype._processRead=function(e){this._reads.shift();let t=0,n=0,r=Buffer.alloc(e.length);for(;t<e.length;){let i=this._buffers[n++],a=Math.min(i.length,e.length-t);i.copy(r,t,0,a),t+=a,a!==i.length&&(this._buffers[--n]=i.slice(a))}n>0&&this._buffers.splice(0,n),this._buffered-=e.length,e.func.call(this,r)},a.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else if(this._buffered>=e.length)this._processRead(e);else break}this._buffers&&!this.writable&&this._end()}catch(e){this.emit(`error`,e)}}})),Zh=e.t((e=>{var t=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];e.getImagePasses=function(e,n){let r=[],i=e%8,a=n%8,o=(e-i)/8,s=(n-a)/8;for(let e=0;e<t.length;e++){let n=t[e],c=o*n.x.length,l=s*n.y.length;for(let e=0;e<n.x.length&&n.x[e]<i;e++)c++;for(let e=0;e<n.y.length&&n.y[e]<a;e++)l++;c>0&&l>0&&r.push({width:c,height:l,index:e})}return r},e.getInterlaceIterator=function(e){return function(n,r,i){let a=n%t[i].x.length,o=(n-a)/t[i].x.length*8+t[i].x[a],s=r%t[i].y.length,c=(r-s)/t[i].y.length*8+t[i].y[s];return o*4+c*e*4}}})),Qh=e.t(((e,t)=>{t.exports=function(e,t,n){let r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}})),$h=e.t(((e,t)=>{var n=Zh(),r=Qh();function i(e,t,n){let r=e*t;return n!==8&&(r=Math.ceil(r/(8/n))),r}var a=t.exports=function(e,t){let r=e.width,a=e.height,o=e.interlace,s=e.bpp,c=e.depth;if(this.read=t.read,this.write=t.write,this.complete=t.complete,this._imageIndex=0,this._images=[],o){let e=n.getImagePasses(r,a);for(let t=0;t<e.length;t++)this._images.push({byteWidth:i(e[t].width,s,c),height:e[t].height,lineIndex:0})}else this._images.push({byteWidth:i(r,s,c),height:a,lineIndex:0});this._xComparison=c===8?s:c===16?s*2:1};a.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},a.prototype._unFilterType1=function(e,t,n){let r=this._xComparison,i=r-1;for(let a=0;a<n;a++){let n=e[1+a],o=a>i?t[a-r]:0;t[a]=n+o}},a.prototype._unFilterType2=function(e,t,n){let r=this._lastLine;for(let i=0;i<n;i++){let n=e[1+i],a=r?r[i]:0;t[i]=n+a}},a.prototype._unFilterType3=function(e,t,n){let r=this._xComparison,i=r-1,a=this._lastLine;for(let o=0;o<n;o++){let n=e[1+o],s=a?a[o]:0,c=o>i?t[o-r]:0,l=Math.floor((c+s)/2);t[o]=n+l}},a.prototype._unFilterType4=function(e,t,n){let i=this._xComparison,a=i-1,o=this._lastLine;for(let s=0;s<n;s++){let n=e[1+s],c=o?o[s]:0,l=r(s>a?t[s-i]:0,c,s>a&&o?o[s-i]:0);t[s]=n+l}},a.prototype._reverseFilterLine=function(e){let t=e[0],n,r=this._images[this._imageIndex],i=r.byteWidth;if(t===0)n=e.slice(1,i+1);else switch(n=Buffer.alloc(i),t){case 1:this._unFilterType1(e,n,i);break;case 2:this._unFilterType2(e,n,i);break;case 3:this._unFilterType3(e,n,i);break;case 4:this._unFilterType4(e,n,i);break;default:throw Error(`Unrecognised filter type - `+t)}this.write(n),r.lineIndex++,r.lineIndex>=r.height?(this._lastLine=null,this._imageIndex++,r=this._images[this._imageIndex]):this._lastLine=n,r?this.read(r.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}})),eg=e.t(((e,n)=>{var r=t(),i=Xh(),a=$h(),o=n.exports=function(e){i.call(this);let t=[],n=this;this._filter=new a(e,{read:this.read.bind(this),write:function(e){t.push(e)},complete:function(){n.emit(`complete`,Buffer.concat(t))}}),this._filter.start()};r.inherits(o,i)})),tg=e.t(((e,t)=>{t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}})),ng=e.t(((e,t)=>{var n=[];(function(){for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t>>>=1;n[e]=t}})();var r=t.exports=function(){this._crc=-1};r.prototype.write=function(e){for(let t=0;t<e.length;t++)this._crc=n[(this._crc^e[t])&255]^this._crc>>>8;return!0},r.prototype.crc32=function(){return this._crc^-1},r.crc32=function(e){let t=-1;for(let r=0;r<e.length;r++)t=n[(t^e[r])&255]^t>>>8;return t^-1}})),rg=e.t(((e,t)=>{var n=tg(),r=ng(),i=t.exports=function(e,t){this._options=e,e.checkCRC=e.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[n.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[n.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[n.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[n.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[n.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[n.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.finished=t.finished,this.simpleTransparency=t.simpleTransparency,this.headersFinished=t.headersFinished||function(){}};i.prototype.start=function(){this.read(n.PNG_SIGNATURE.length,this._parseSignature.bind(this))},i.prototype._parseSignature=function(e){let t=n.PNG_SIGNATURE;for(let n=0;n<t.length;n++)if(e[n]!==t[n]){this.error(Error(`Invalid file signature`));return}this.read(8,this._parseChunkBegin.bind(this))},i.prototype._parseChunkBegin=function(e){let t=e.readUInt32BE(0),i=e.readUInt32BE(4),a=``;for(let t=4;t<8;t++)a+=String.fromCharCode(e[t]);let o=!!(e[4]&32);if(!this._hasIHDR&&i!==n.TYPE_IHDR)this.error(Error(`Expected IHDR on beggining`));else{if(this._crc=new r,this._crc.write(Buffer.from(a)),this._chunks[i])return this._chunks[i](t);o?this.read(t+4,this._skipChunk.bind(this)):this.error(Error(`Unsupported critical chunk type `+a))}},i.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},i.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},i.prototype._parseChunkEnd=function(e){let t=e.readInt32BE(0),n=this._crc.crc32();this._options.checkCRC&&n!==t?this.error(Error(`Crc error - `+t+` - `+n)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},i.prototype._handleIHDR=function(e){this.read(e,this._parseIHDR.bind(this))},i.prototype._parseIHDR=function(e){this._crc.write(e);let t=e.readUInt32BE(0),r=e.readUInt32BE(4),i=e[8],a=e[9],o=e[10],s=e[11],c=e[12];if(i!==8&&i!==4&&i!==2&&i!==1&&i!==16){this.error(Error(`Unsupported bit depth `+i));return}if(!(a in n.COLORTYPE_TO_BPP_MAP)){this.error(Error(`Unsupported color type`));return}if(o!==0){this.error(Error(`Unsupported compression method`));return}if(s!==0){this.error(Error(`Unsupported filter method`));return}if(c!==0&&c!==1){this.error(Error(`Unsupported interlace method`));return}this._colorType=a;let l=n.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:t,height:r,depth:i,interlace:!!c,palette:!!(a&n.COLORTYPE_PALETTE),color:!!(a&n.COLORTYPE_COLOR),alpha:!!(a&n.COLORTYPE_ALPHA),bpp:l,colorType:a}),this._handleChunkEnd()},i.prototype._handlePLTE=function(e){this.read(e,this._parsePLTE.bind(this))},i.prototype._parsePLTE=function(e){this._crc.write(e);let t=Math.floor(e.length/3);for(let n=0;n<t;n++)this._palette.push([e[n*3],e[n*3+1],e[n*3+2],255]);this.palette(this._palette),this._handleChunkEnd()},i.prototype._handleTRNS=function(e){this.simpleTransparency(),this.read(e,this._parseTRNS.bind(this))},i.prototype._parseTRNS=function(e){if(this._crc.write(e),this._colorType===n.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(Error(`Transparency chunk must be after palette`));return}if(e.length>this._palette.length){this.error(Error(`More transparent colors than palette size`));return}for(let t=0;t<e.length;t++)this._palette[t][3]=e[t];this.palette(this._palette)}this._colorType===n.COLORTYPE_GRAYSCALE&&this.transColor([e.readUInt16BE(0)]),this._colorType===n.COLORTYPE_COLOR&&this.transColor([e.readUInt16BE(0),e.readUInt16BE(2),e.readUInt16BE(4)]),this._handleChunkEnd()},i.prototype._handleGAMA=function(e){this.read(e,this._parseGAMA.bind(this))},i.prototype._parseGAMA=function(e){this._crc.write(e),this.gamma(e.readUInt32BE(0)/n.GAMMA_DIVISION),this._handleChunkEnd()},i.prototype._handleIDAT=function(e){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-e,this._parseIDAT.bind(this,e))},i.prototype._parseIDAT=function(e,t){if(this._crc.write(t),this._colorType===n.COLORTYPE_PALETTE_COLOR&&this._palette.length===0)throw Error(`Expected palette not found`);this.inflateData(t);let r=e-t.length;r>0?this._handleIDAT(r):this._handleChunkEnd()},i.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},i.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}})),ig=e.t((e=>{var t=Zh(),n=[function(){},function(e,t,n,r){if(r===t.length)throw Error(`Ran out of data`);let i=t[r];e[n]=i,e[n+1]=i,e[n+2]=i,e[n+3]=255},function(e,t,n,r){if(r+1>=t.length)throw Error(`Ran out of data`);let i=t[r];e[n]=i,e[n+1]=i,e[n+2]=i,e[n+3]=t[r+1]},function(e,t,n,r){if(r+2>=t.length)throw Error(`Ran out of data`);e[n]=t[r],e[n+1]=t[r+1],e[n+2]=t[r+2],e[n+3]=255},function(e,t,n,r){if(r+3>=t.length)throw Error(`Ran out of data`);e[n]=t[r],e[n+1]=t[r+1],e[n+2]=t[r+2],e[n+3]=t[r+3]}],r=[function(){},function(e,t,n,r){let i=t[0];e[n]=i,e[n+1]=i,e[n+2]=i,e[n+3]=r},function(e,t,n){let r=t[0];e[n]=r,e[n+1]=r,e[n+2]=r,e[n+3]=t[1]},function(e,t,n,r){e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=r},function(e,t,n){e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=t[3]}];function i(e,t){let n=[],r=0;function i(){if(r===e.length)throw Error(`Ran out of data`);let i=e[r];r++;let a,o,s,c,l,u,d,f;switch(t){default:throw Error(`unrecognised depth`);case 16:d=e[r],r++,n.push((i<<8)+d);break;case 4:d=i&15,f=i>>4,n.push(f,d);break;case 2:l=i&3,u=i>>2&3,d=i>>4&3,f=i>>6&3,n.push(f,d,u,l);break;case 1:a=i&1,o=i>>1&1,s=i>>2&1,c=i>>3&1,l=i>>4&1,u=i>>5&1,d=i>>6&1,f=i>>7&1,n.push(f,d,u,l,c,s,o,a)}}return{get:function(e){for(;n.length<e;)i();let t=n.slice(0,e);return n=n.slice(e),t},resetAfterLine:function(){n.length=0},end:function(){if(r!==e.length)throw Error(`extra data found`)}}}function a(e,t,r,i,a,o){let s=e.width,c=e.height,l=e.index;for(let e=0;e<c;e++)for(let c=0;c<s;c++){let s=r(c,e,l);n[i](t,a,s,o),o+=i}return o}function o(e,t,n,i,a,o){let s=e.width,c=e.height,l=e.index;for(let e=0;e<c;e++){for(let c=0;c<s;c++){let s=a.get(i),u=n(c,e,l);r[i](t,s,u,o)}a.resetAfterLine()}}e.dataToBitMap=function(e,n){let r=n.width,s=n.height,c=n.depth,l=n.bpp,u=n.interlace,d;c!==8&&(d=i(e,c));let f;f=c<=8?Buffer.alloc(r*s*4):new Uint16Array(r*s*4);let p=2**c-1,m=0,h,g;if(u)h=t.getImagePasses(r,s),g=t.getInterlaceIterator(r,s);else{let e=0;g=function(){let t=e;return e+=4,t},h=[{width:r,height:s}]}for(let t=0;t<h.length;t++)c===8?m=a(h[t],f,g,l,e,m):o(h[t],f,g,l,d,p);if(c===8){if(m!==e.length)throw Error(`extra data found`)}else d.end();return f}})),ag=e.t(((e,t)=>{function n(e,t,n,r,i){let a=0;for(let o=0;o<r;o++)for(let r=0;r<n;r++){let n=i[e[a]];if(!n)throw Error(`index `+e[a]+` not in palette`);for(let e=0;e<4;e++)t[a+e]=n[e];a+=4}}function r(e,t,n,r,i){let a=0;for(let o=0;o<r;o++)for(let r=0;r<n;r++){let n=!1;if(i.length===1?i[0]===e[a]&&(n=!0):i[0]===e[a]&&i[1]===e[a+1]&&i[2]===e[a+2]&&(n=!0),n)for(let e=0;e<4;e++)t[a+e]=0;a+=4}}function i(e,t,n,r,i){let a=2**i-1,o=0;for(let i=0;i<r;i++)for(let r=0;r<n;r++){for(let n=0;n<4;n++)t[o+n]=Math.floor(e[o+n]*255/a+.5);o+=4}}t.exports=function(e,t,a=!1){let o=t.depth,s=t.width,c=t.height,l=t.colorType,u=t.transColor,d=t.palette,f=e;return l===3?n(e,f,s,c,d):(u&&r(e,f,s,c,u),o!==8&&!a&&(o===16&&(f=Buffer.alloc(s*c*4)),i(e,f,s,c,o))),f}})),og=e.t(((e,n)=>{var r=t(),i=t(),a=Xh(),o=eg(),s=rg(),c=ig(),l=ag(),u=n.exports=function(e){a.call(this),this._parser=new s(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,`gamma`),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};r.inherits(u,a),u.prototype._handleError=function(e){this.emit(`error`,e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on(`error`,function(){})),this.errord=!0},u.prototype._inflateData=function(e){if(!this._inflate){if(this._bitmapInfo.interlace)this._inflate=i.createInflate(),this._inflate.on(`error`,this.emit.bind(this,`error`)),this._filter.on(`complete`,this._complete.bind(this)),this._inflate.pipe(this._filter);else{let e=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,t=Math.max(e,i.Z_MIN_CHUNK);this._inflate=i.createInflate({chunkSize:t});let n=e,r=this.emit.bind(this,`error`);this._inflate.on(`error`,function(e){n&&r(e)}),this._filter.on(`complete`,this._complete.bind(this));let a=this._filter.write.bind(this._filter);this._inflate.on(`data`,function(e){n&&(e.length>n&&(e=e.slice(0,n)),n-=e.length,a(e))}),this._inflate.on(`end`,this._filter.end.bind(this._filter))}}this._inflate.write(e)},u.prototype._handleMetaData=function(e){this._metaData=e,this._bitmapInfo=Object.create(e),this._filter=new o(this._bitmapInfo)},u.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},u.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},u.prototype._simpleTransparency=function(){this._metaData.alpha=!0},u.prototype._headersFinished=function(){this.emit(`metadata`,this._metaData)},u.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit(`error`,`No Inflate block`))},u.prototype._complete=function(e){if(this.errord)return;let t;try{let n=c.dataToBitMap(e,this._bitmapInfo);t=l(n,this._bitmapInfo,this._options.skipRescale),n=null}catch(e){this._handleError(e);return}this.emit(`parsed`,t)}})),sg=e.t(((e,t)=>{var n=tg();t.exports=function(e,t,r,i){let a=[n.COLORTYPE_COLOR_ALPHA,n.COLORTYPE_ALPHA].indexOf(i.colorType)!==-1;if(i.colorType===i.inputColorType){let t=(function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]!==256})();if(i.bitDepth===8||i.bitDepth===16&&t)return e}let o=i.bitDepth===16?new Uint16Array(e.buffer):e,s=255,c=n.COLORTYPE_TO_BPP_MAP[i.inputColorType];c===4&&!i.inputHasAlpha&&(c=3);let l=n.COLORTYPE_TO_BPP_MAP[i.colorType];i.bitDepth===16&&(s=65535,l*=2);let u=Buffer.alloc(t*r*l),d=0,f=0,p=i.bgColor||{};p.red===void 0&&(p.red=s),p.green===void 0&&(p.green=s),p.blue===void 0&&(p.blue=s);function m(){let e,t,r,c=s;switch(i.inputColorType){case n.COLORTYPE_COLOR_ALPHA:c=o[d+3],e=o[d],t=o[d+1],r=o[d+2];break;case n.COLORTYPE_COLOR:e=o[d],t=o[d+1],r=o[d+2];break;case n.COLORTYPE_ALPHA:c=o[d+1],e=o[d],t=e,r=e;break;case n.COLORTYPE_GRAYSCALE:e=o[d],t=e,r=e;break;default:throw Error(`input color type:`+i.inputColorType+` is not supported at present`)}return i.inputHasAlpha&&(a||(c/=s,e=Math.min(Math.max(Math.round((1-c)*p.red+c*e),0),s),t=Math.min(Math.max(Math.round((1-c)*p.green+c*t),0),s),r=Math.min(Math.max(Math.round((1-c)*p.blue+c*r),0),s))),{red:e,green:t,blue:r,alpha:c}}for(let e=0;e<r;e++)for(let e=0;e<t;e++){let e=m(o,d);switch(i.colorType){case n.COLORTYPE_COLOR_ALPHA:case n.COLORTYPE_COLOR:i.bitDepth===8?(u[f]=e.red,u[f+1]=e.green,u[f+2]=e.blue,a&&(u[f+3]=e.alpha)):(u.writeUInt16BE(e.red,f),u.writeUInt16BE(e.green,f+2),u.writeUInt16BE(e.blue,f+4),a&&u.writeUInt16BE(e.alpha,f+6));break;case n.COLORTYPE_ALPHA:case n.COLORTYPE_GRAYSCALE:{let t=(e.red+e.green+e.blue)/3;i.bitDepth===8?(u[f]=t,a&&(u[f+1]=e.alpha)):(u.writeUInt16BE(t,f),a&&u.writeUInt16BE(e.alpha,f+2));break}default:throw Error(`unrecognised color Type `+i.colorType)}d+=c,f+=l}return u}})),cg=e.t(((e,t)=>{var n=Qh();function r(e,t,n,r,i){for(let a=0;a<n;a++)r[i+a]=e[t+a]}function i(e,t,n){let r=0,i=t+n;for(let n=t;n<i;n++)r+=Math.abs(e[n]);return r}function a(e,t,n,r,i,a){for(let o=0;o<n;o++){let n=o>=a?e[t+o-a]:0,s=e[t+o]-n;r[i+o]=s}}function o(e,t,n,r){let i=0;for(let a=0;a<n;a++){let n=a>=r?e[t+a-r]:0,o=e[t+a]-n;i+=Math.abs(o)}return i}function s(e,t,n,r,i){for(let a=0;a<n;a++){let o=t>0?e[t+a-n]:0,s=e[t+a]-o;r[i+a]=s}}function c(e,t,n){let r=0,i=t+n;for(let a=t;a<i;a++){let i=t>0?e[a-n]:0,o=e[a]-i;r+=Math.abs(o)}return r}function l(e,t,n,r,i,a){for(let o=0;o<n;o++){let s=o>=a?e[t+o-a]:0,c=t>0?e[t+o-n]:0,l=e[t+o]-(s+c>>1);r[i+o]=l}}function u(e,t,n,r){let i=0;for(let a=0;a<n;a++){let o=a>=r?e[t+a-r]:0,s=t>0?e[t+a-n]:0,c=e[t+a]-(o+s>>1);i+=Math.abs(c)}return i}function d(e,t,r,i,a,o){for(let s=0;s<r;s++){let c=s>=o?e[t+s-o]:0,l=t>0?e[t+s-r]:0,u=t>0&&s>=o?e[t+s-(r+o)]:0,d=e[t+s]-n(c,l,u);i[a+s]=d}}function f(e,t,r,i){let a=0;for(let o=0;o<r;o++){let s=o>=i?e[t+o-i]:0,c=t>0?e[t+o-r]:0,l=t>0&&o>=i?e[t+o-(r+i)]:0,u=e[t+o]-n(s,c,l);a+=Math.abs(u)}return a}var p={0:r,1:a,2:s,3:l,4:d},m={0:i,1:o,2:c,3:u,4:f};t.exports=function(e,t,n,r,i){let a;if(!(`filterType`in r)||r.filterType===-1)a=[0,1,2,3,4];else if(typeof r.filterType==`number`)a=[r.filterType];else throw Error(`unrecognised filter types`);r.bitDepth===16&&(i*=2);let o=t*i,s=0,c=0,l=Buffer.alloc((o+1)*n),u=a[0];for(let t=0;t<n;t++){if(a.length>1){let t=1/0;for(let n=0;n<a.length;n++){let r=m[a[n]](e,c,o,i);r<t&&(u=a[n],t=r)}}l[s]=u,s++,p[u](e,c,o,l,s,i),s+=o,c+=o}return l}})),lg=e.t(((e,n)=>{var r=tg(),i=ng(),a=sg(),o=cg(),s=t(),c=n.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=e.deflateLevel==null?9:e.deflateLevel,e.deflateStrategy=e.deflateStrategy==null?3:e.deflateStrategy,e.inputHasAlpha=e.inputHasAlpha==null||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||s.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType=typeof e.colorType==`number`?e.colorType:r.COLORTYPE_COLOR_ALPHA,e.inputColorType=typeof e.inputColorType==`number`?e.inputColorType:r.COLORTYPE_COLOR_ALPHA,[r.COLORTYPE_GRAYSCALE,r.COLORTYPE_COLOR,r.COLORTYPE_COLOR_ALPHA,r.COLORTYPE_ALPHA].indexOf(e.colorType)===-1)throw Error(`option color type:`+e.colorType+` is not supported at present`);if([r.COLORTYPE_GRAYSCALE,r.COLORTYPE_COLOR,r.COLORTYPE_COLOR_ALPHA,r.COLORTYPE_ALPHA].indexOf(e.inputColorType)===-1)throw Error(`option input color type:`+e.inputColorType+` is not supported at present`);if(e.bitDepth!==8&&e.bitDepth!==16)throw Error(`option bit depth:`+e.bitDepth+` is not supported at present`)};c.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},c.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},c.prototype.filterData=function(e,t,n){let i=a(e,t,n,this._options),s=r.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(i,t,n,this._options,s)},c.prototype._packChunk=function(e,t){let n=t?t.length:0,r=Buffer.alloc(n+12);return r.writeUInt32BE(n,0),r.writeUInt32BE(e,4),t&&t.copy(r,8),r.writeInt32BE(i.crc32(r.slice(4,r.length-4)),r.length-4),r},c.prototype.packGAMA=function(e){let t=Buffer.alloc(4);return t.writeUInt32BE(Math.floor(e*r.GAMMA_DIVISION),0),this._packChunk(r.TYPE_gAMA,t)},c.prototype.packIHDR=function(e,t){let n=Buffer.alloc(13);return n.writeUInt32BE(e,0),n.writeUInt32BE(t,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(r.TYPE_IHDR,n)},c.prototype.packIDAT=function(e){return this._packChunk(r.TYPE_IDAT,e)},c.prototype.packIEND=function(){return this._packChunk(r.TYPE_IEND,null)}})),ug=e.t(((e,n)=>{var r=t(),i=t(),a=tg(),o=lg(),s=n.exports=function(e){i.call(this);let t=e||{};this._packer=new o(t),this._deflate=this._packer.createDeflate(),this.readable=!0};r.inherits(s,i),s.prototype.pack=function(e,t,n,r){this.emit(`data`,Buffer.from(a.PNG_SIGNATURE)),this.emit(`data`,this._packer.packIHDR(t,n)),r&&this.emit(`data`,this._packer.packGAMA(r));let i=this._packer.filterData(e,t,n);this._deflate.on(`error`,this.emit.bind(this,`error`)),this._deflate.on(`data`,function(e){this.emit(`data`,this._packer.packIDAT(e))}.bind(this)),this._deflate.on(`end`,function(){this.emit(`data`,this._packer.packIEND()),this.emit(`end`)}.bind(this)),this._deflate.end(i)}})),dg=e.t(((e,n)=>{var r=t().ok,i=t(),a=t(),o=t().kMaxLength;function s(e){if(!(this instanceof s))return new s(e);e&&e.chunkSize<i.Z_MIN_CHUNK&&(e.chunkSize=i.Z_MIN_CHUNK),i.Inflate.call(this,e),this._offset=this._offset===void 0?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,e&&e.maxLength!=null&&(this._maxLength=e.maxLength)}function c(e){return new s(e)}function l(e,t){t&&process.nextTick(t),e._handle&&=(e._handle.close(),null)}s.prototype._processChunk=function(e,t,n){if(typeof n==`function`)return i.Inflate._processChunk.call(this,e,t,n);let a=this,s=e&&e.length,c=this._chunkSize-this._offset,u=this._maxLength,d=0,f=[],p=0,m;this.on(`error`,function(e){m=e});function h(e,t){if(a._hadError)return;let n=c-t;if(r(n>=0,`have should not go down`),n>0){let e=a._buffer.slice(a._offset,a._offset+n);if(a._offset+=n,e.length>u&&(e=e.slice(0,u)),f.push(e),p+=e.length,u-=e.length,u===0)return!1}return(t===0||a._offset>=a._chunkSize)&&(c=a._chunkSize,a._offset=0,a._buffer=Buffer.allocUnsafe(a._chunkSize)),t===0&&(d+=s-e,s=e,!0)}r(this._handle,`zlib binding closed`);let g;do g=this._handle.writeSync(t,e,d,s,this._buffer,this._offset,c),g||=this._writeState;while(!this._hadError&&h(g[0],g[1]));if(this._hadError)throw m;if(p>=o)throw l(this),RangeError(`Cannot create final Buffer. It would be larger than 0x`+o.toString(16)+` bytes`);let _=Buffer.concat(f,p);return l(this),_},a.inherits(s,i.Inflate);function u(e,t){if(typeof t==`string`&&(t=Buffer.from(t)),!(t instanceof Buffer))throw TypeError(`Not a string or buffer`);let n=e._finishFlushFlag;return n??=i.Z_FINISH,e._processChunk(t,n)}function d(e,t){return u(new s(t),e)}n.exports=e=d,e.Inflate=s,e.createInflate=c,e.inflateSync=d})),fg=e.t(((e,t)=>{var n=t.exports=function(e){this._buffer=e,this._reads=[]};n.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t})},n.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let e=this._reads[0];if(this._buffer.length&&(this._buffer.length>=e.length||e.allowLess)){this._reads.shift();let t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}else break}if(this._reads.length>0)throw Error(`There are some read requests waitng on finished stream`);if(this._buffer.length>0)throw Error(`unrecognised content at end of stream`)}})),pg=e.t((e=>{var t=fg(),n=$h();e.process=function(e,r){let i=[],a=new t(e);return new n(r,{read:a.read.bind(a),write:function(e){i.push(e)},complete:function(){}}).start(),a.process(),Buffer.concat(i)}})),mg=e.t(((e,n)=>{var r=!0,i=t(),a=dg();i.deflateSync||(r=!1);var o=fg(),s=pg(),c=rg(),l=ig(),u=ag();n.exports=function(e,t){if(!r)throw Error(`To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0`);let n;function d(e){n=e}let f;function p(e){f=e}function m(e){f.transColor=e}function h(e){f.palette=e}function g(){f.alpha=!0}let _;function v(e){_=e}let y=[];function b(e){y.push(e)}let x=new o(e);if(new c(t,{read:x.read.bind(x),error:d,metadata:p,gamma:v,palette:h,transColor:m,inflateData:b,simpleTransparency:g}).start(),x.process(),n)throw n;let S=Buffer.concat(y);y.length=0;let C;if(f.interlace)C=i.inflateSync(S);else{let e=((f.width*f.bpp*f.depth+7>>3)+1)*f.height;C=a(S,{chunkSize:e,maxLength:e})}if(S=null,!C||!C.length)throw Error(`bad png - invalid inflate data response`);let w=s.process(C,f);S=null;let T=l.dataToBitMap(w,f);w=null;let E=u(T,f,t.skipRescale);return f.data=E,f.gamma=_||0,f}})),hg=e.t(((e,n)=>{var r=!0,i=t();i.deflateSync||(r=!1);var a=tg(),o=lg();n.exports=function(e,t){if(!r)throw Error(`To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0`);let n=new o(t||{}),s=[];s.push(Buffer.from(a.PNG_SIGNATURE)),s.push(n.packIHDR(e.width,e.height)),e.gamma&&s.push(n.packGAMA(e.gamma));let c=n.filterData(e.data,e.width,e.height),l=i.deflateSync(c,n.getDeflateOptions());if(c=null,!l||!l.length)throw Error(`bad png - invalid compressed data response`);return s.push(n.packIDAT(l)),s.push(n.packIEND()),Buffer.concat(s)}})),gg=e.t((e=>{var t=mg(),n=hg();e.read=function(e,n){return t(e,n||{})},e.write=function(e,t){return n(e,t)}})),_g=e.t((e=>{var n=t(),r=t(),i=og(),a=ug(),o=gg(),s=e.PNG=function(e){r.call(this),e||={},this.width=e.width|0,this.height=e.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new i(e),this._parser.on(`error`,this.emit.bind(this,`error`)),this._parser.on(`close`,this._handleClose.bind(this)),this._parser.on(`metadata`,this._metadata.bind(this)),this._parser.on(`gamma`,this._gamma.bind(this)),this._parser.on(`parsed`,function(e){this.data=e,this.emit(`parsed`,e)}.bind(this)),this._packer=new a(e),this._packer.on(`data`,this.emit.bind(this,`data`)),this._packer.on(`end`,this.emit.bind(this,`end`)),this._parser.on(`close`,this._handleClose.bind(this)),this._packer.on(`error`,this.emit.bind(this,`error`))};n.inherits(s,r),s.sync=o,s.prototype.pack=function(){return!this.data||!this.data.length?(this.emit(`error`,`No data provided`),this):(process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this)},s.prototype.parse=function(e,t){if(t){let e,n;e=function(e){this.removeListener(`error`,n),this.data=e,t(null,this)}.bind(this),n=function(n){this.removeListener(`parsed`,e),t(n,null)}.bind(this),this.once(`parsed`,e),this.once(`error`,n)}return this.end(e),this},s.prototype.write=function(e){return this._parser.write(e),!0},s.prototype.end=function(e){this._parser.end(e)},s.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit(`metadata`,e)},s.prototype._gamma=function(e){this.gamma=e},s.prototype._handleClose=function(){!this._parser.writable&&!this._packer.readable&&this.emit(`close`)},s.bitblt=function(e,t,n,r,i,a,o,s){if(n|=0,r|=0,i|=0,a|=0,o|=0,s|=0,n>e.width||r>e.height||n+i>e.width||r+a>e.height)throw Error(`bitblt reading outside image`);if(o>t.width||s>t.height||o+i>t.width||s+a>t.height)throw Error(`bitblt writing outside image`);for(let c=0;c<a;c++)e.data.copy(t.data,(s+c)*t.width+o<<2,(r+c)*e.width+n<<2,(r+c)*e.width+n+i<<2)},s.prototype.bitblt=function(e,t,n,r,i,a,o){return s.bitblt(this,e,t,n,r,i,a,o),this},s.adjustGamma=function(e){if(e.gamma){for(let t=0;t<e.height;t++)for(let n=0;n<e.width;n++){let r=e.width*t+n<<2;for(let t=0;t<3;t++){let n=e.data[r+t]/255;n**=1/2.2/e.gamma,e.data[r+t]=Math.round(n*255)}}e.gamma=0}},s.prototype.adjustGamma=function(){s.adjustGamma(this)}}))();async function vg(e,t=2){let n=[],r=await hh(e,{scale:t});for await(let e of r)n.push(e);return n}async function yg(e,t){let{scale:r=2,threshold:i=.1,snapshotsDir:a,snapshotName:o,updateSnapshots:s=!1}=t;(0,n.mkdirSync)(a,{recursive:!0});let c=await vg(e,r),l=[];for(let e=0;e<c.length;e++){let t=e+1,r=(0,n.resolve)(a,`${o}-page${t}.png`),u=(0,n.resolve)(a,`${o}-page${t}-diff.png`);if(!(0,n.existsSync)(r)||s){(0,n.writeFileSync)(r,c[e]),l.push({page:t,mismatchedPixels:0,totalPixels:0,mismatchPercent:0,snapshotCreated:!0});continue}let d=_g.PNG.sync.read(c[e]),f=_g.PNG.sync.read((0,n.readFileSync)(r));if(d.width!==f.width||d.height!==f.height){(0,n.writeFileSync)((0,n.resolve)(a,`${o}-page${t}-actual.png`),c[e]),l.push({page:t,mismatchedPixels:d.width*d.height,totalPixels:d.width*d.height,mismatchPercent:100,snapshotCreated:!1});continue}let p=new _g.PNG({width:d.width,height:d.height}),m=gh(d.data,f.data,p.data,d.width,d.height,{threshold:i}),h=d.width*d.height,g=m/h*100;m>0&&(0,n.writeFileSync)(u,_g.PNG.sync.write(p)),l.push({page:t,mismatchedPixels:m,totalPixels:h,mismatchPercent:g,diffPath:m>0?u:void 0,snapshotCreated:!1})}return l}async function bg(e,t,r,i=`a`,a=`b`,o=2,s=.1){(0,n.mkdirSync)(r,{recursive:!0});let c=await vg(e,o),l=await vg(t,o),u=Math.max(c.length,l.length),d=[];for(let e=0;e<u;e++){let t=e+1;if(!c[e]||!l[e]){d.push({page:t,mismatchedPixels:-1,totalPixels:0,mismatchPercent:100,snapshotCreated:!1});continue}(0,n.writeFileSync)((0,n.resolve)(r,`${i}-page${t}.png`),c[e]),(0,n.writeFileSync)((0,n.resolve)(r,`${a}-page${t}.png`),l[e]);let o=_g.PNG.sync.read(c[e]),u=_g.PNG.sync.read(l[e]),f=Math.min(o.width,u.width),p=Math.min(o.height,u.height);if(o.width!==u.width||o.height!==u.height){d.push({page:t,mismatchedPixels:-1,totalPixels:f*p,mismatchPercent:-1,snapshotCreated:!1});continue}let m=new _g.PNG({width:f,height:p}),h=gh(o.data,u.data,m.data,f,p,{threshold:s}),g=f*p;(0,n.writeFileSync)((0,n.resolve)(r,`diff-page${t}.png`),_g.PNG.sync.write(m)),d.push({page:t,mismatchedPixels:h,totalPixels:g,mismatchPercent:h/g*100,diffPath:(0,n.resolve)(r,`diff-page${t}.png`),snapshotCreated:!1})}return d}exports.classifyText=ca,exports.cleanMergedText=ma,exports.clusterCoordinates=Vi,exports.comparePdfToSnapshot=yg,exports.comparetwoPdfs=bg,exports.detectRegions=Wi,exports.extractDrawFromPage=ha,exports.extractDrawMerged=Sa,exports.extractPlayerName=ua,exports.extractSeedValue=da,exports.findClusterIndex=Ui,exports.mergeTextItems=fa,exports.parsePdfBuffer=zi,exports.pdfToImages=vg;
|
|
62
62
|
//# sourceMappingURL=parser.cjs.map
|