@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
12 lines • 959 kB
JavaScript
/*!
* filename: ej2-pdf.min.js
* version : 29.2.11
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
this.ej=this.ej||{},this.ej.pdf=function(t,e,i){"use strict";function r(t,e){return t&Math.pow(2,e)-1}function n(t){return t<<16>>16}function s(t){return t<<0}function a(t,e,i,r,n){void 0===r&&(r=0),void 0===n&&(n=i.length),r=Math.max(0,Math.min(i.length,r));var s=(n=Math.max(0,Math.min(i.length,n)))-r;t.length=Math.max(t.length,e+s);for(var a=0;a<s;a++)t[e+a]=i[r+a]}function o(t,e){return e.every(function(e,i){return e===t[i]})}function h(t){var e;if(o(t,[255,216]))e=new Rr(t);else{if(!o(t,[137,80,78,71,13,10,26,10]))throw new Error("Unsupported image format");e=new Nr(t)}return e}function c(e,i,r){var n=0;if(r=void 0===r||null===r?0:r,e.rotation===t.PdfRotationAngle.angle90)n=void 0===i||null===i?0:r;else if(e.rotation===t.PdfRotationAngle.angle180)n=void 0===i||null===i?0:i;else if(e.rotation===t.PdfRotationAngle.angle270){var s=e.size;n=void 0===i||null===i?0:s[0]-r}return n}function _(t,e){var i=-1;if(e&&e instanceof $r)for(var r=0;r<t.pageCount;r++){var n=t.getPage(r);if(n&&n._pageDictionary&&(n._pageDictionary===e||n._pageDictionary.objId===e.objId)){i=r;break}}return i}function d(e){var i=[];return 0!=(e&t.PdfAnnotationFlag.hidden)&&i.push("hidden"),0!=(e&t.PdfAnnotationFlag.invisible)&&i.push("invisible"),0!=(e&t.PdfAnnotationFlag.locked)&&i.push("locked"),0!=(e&t.PdfAnnotationFlag.noRotate)&&i.push("norotate"),0!=(e&t.PdfAnnotationFlag.noView)&&i.push("noview"),0!=(e&t.PdfAnnotationFlag.noZoom)&&i.push("nozoom"),0!=(e&t.PdfAnnotationFlag.print)&&i.push("print"),0!=(e&t.PdfAnnotationFlag.readOnly)&&i.push("readonly"),0!=(e&t.PdfAnnotationFlag.toggleNoView)&&i.push("togglenoview"),0!=(e&t.PdfAnnotationFlag.default)&&i.push("default"),i.join(",")}function l(e){switch(e){case"hidden":return t.PdfAnnotationFlag.hidden;case"invisible":return t.PdfAnnotationFlag.invisible;case"locked":return t.PdfAnnotationFlag.locked;case"norotate":return t.PdfAnnotationFlag.noRotate;case"noview":return t.PdfAnnotationFlag.noView;case"nozoom":return t.PdfAnnotationFlag.noZoom;case"print":return t.PdfAnnotationFlag.print;case"readonly":return t.PdfAnnotationFlag.readOnly;case"togglenoview":return t.PdfAnnotationFlag.toggleNoView;default:return t.PdfAnnotationFlag.default}}function f(t){if("string"==typeof t&&t.length>0&&t.charCodeAt(0)>="ï".charCodeAt(0)){var e=void 0;if("ï"===t[0]&&"»"===t[1]&&"¿"===t[2]?e="utf-8":"ÿ"===t[0]&&"þ"===t[1]?e="utf-16le":"þ"===t[0]&&"ÿ"===t[1]&&(e="utf-16be"),e)try{return new TextDecoder(e,{fatal:!0}).decode(p(t))}catch(t){}}for(var i=[],r=[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],n=0;n<t.length;n++){var s=r[t.charCodeAt(n)];i.push(s?String.fromCharCode(s):t.charAt(n))}return i.join("")}function p(t,e,i,r){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=[];if(r&&(n=r),i)for(s=0;s<t.length;s++)n.push(t.charCodeAt(s));else for(var s=0;s<t.length;s++){var a=t.charCodeAt(s);a<128?n.push(a):a<2048?(n.push(a>>6|192),n.push(63&a|128)):a<55296||a>=57344?(n.push(a>>12|224),n.push(a>>6&63|128),n.push(63&a|128)):(s++,a=65536+((1023&a)<<10|1023&t.charCodeAt(s)),n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(63&a|128))}return e?n:new Uint8Array(n)}function u(t,e){return t.length===e.length&&t.every(function(t,i){return t===e[i]})}function g(t){return Number.isInteger(t)?t.toString():t.toFixed(7)}function y(t,e){var i=!1;if(t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r]!==e[r]){i=!0;break}return i}function m(t,e){void 0===e&&(e=!1);var i=t.length,r=[];if(i<8192)return e?b(t):String.fromCharCode.apply(null,t);for(var n=0;n<i;n+=8192){var s=Math.min(n+8192,i),a=t.subarray(n,s);r.push(e?b(a):String.fromCharCode.apply(null,a))}return r.join("")}function b(t){for(var e="",i=0;i<t.length;){var r=t[i++];if(r<128)e+=String.fromCharCode(r);else if(r<224)e+=String.fromCharCode((31&r)<<6|63&t[i++]);else if(r<240)e+=String.fromCharCode((15&r)<<12|(63&t[i++])<<6|63&t[i++]);else{var n=(7&r)<<18|(63&t[i++])<<12|(63&t[i++])<<6|(63&t[i++])-65536;e+=String.fromCharCode(55296+(n>>10),56320+(1023&n))}}return e}function v(t){var e=[];if(null!==t&&void 0!==t)for(var i=0;i<t.length;i++){var r=t.charCodeAt(i);e.push(r/256>>>0),e.push(255&r)}return new Uint8Array(e)}function w(t){var e=[];return t.forEach(function(t){var i=t.toString(16).toUpperCase();i.length<2&&(i="0"+i),e.push(i)}),e.join("")}function S(t,e){void 0===e&&(e=!1);var i=[];if(t)for(var r=0;r<t.length;r+=2)i.push(parseInt(t.substring(r,r+2),16));return e?i:new Uint8Array(i)}function P(t){var e="";if(t&&"#"===t[0]){t=t.substring(1);for(var i=0;i<t.length;i+=2)e+=String.fromCharCode(parseInt(t.substring(i,i+2),16));return e}return t}function A(t){return 32===t||9===t||13===t||10===t}function x(t){var e,i,r,n,s,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,h=0,c=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;t.charAt(t.length-1)===a.charAt(64)&&c--;for(var _=new Array(0|c);o<t.length;)e=a.indexOf(t.charAt(o++))<<2|(n=a.indexOf(t.charAt(o++)))>>4,i=(15&n)<<4|(s=a.indexOf(t.charAt(o++)))>>2,r=(3&s)<<6|a.indexOf(t.charAt(o++)),h<c&&(_[h++]=e),h<c&&(_[h++]=i),h<c&&(_[h++]=r);return new Uint8Array(_)}function k(t,e){void 0===e&&(e=!1);if(t.length>=3e6){t=t.replace(/[^A-Za-z0-9+/=]/g,"");for(var i=[],r=0,n=0;n<t.length;n+=3e6){var s=x(_=t.substring(n,n+3e6));i.push(s),r+=s.length}for(var a=new Uint8Array(r),o=0,h=0,c=i;h<c.length;h++){var _=c[h];a.set(_,o),o+=_.length}return e?Array.from(a):a}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=void 0,f=void 0,p=void 0,u=void 0,g=void 0,n=0,y=0,r=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;t.charAt(t.length-1)===d.charAt(64)&&r--;for(a=new Array(0|r);n<t.length;)l=d.indexOf(t.charAt(n++))<<2|(u=d.indexOf(t.charAt(n++)))>>4,f=(15&u)<<4|(g=d.indexOf(t.charAt(n++)))>>2,p=(3&g)<<6|d.indexOf(t.charAt(n++)),y<r&&(a[y++]=l),y<r&&(a[y++]=f),y<r&&(a[y++]=p);return e?a:new Uint8Array(a)}function C(t,e){void 0===e&&(e=!1);for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[],n=t.length,s=0;s<n;){var a=t[s++],o=s<n?t[s++]:0,h=s<n?t[s++]:0;r.push(i[a>>2],i[(3&a)<<4|o>>4],s-1>n?"=":i[(15&o)<<2|h>>6],s>n?"=":i[63&h])}return e&&(n%3==1?(r[r.length-1]="=",r[r.length-2]="="):n%3==2&&(r[r.length-1]="=")),r.join("")}function T(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=t.length;if(i>=3e6){s=[];if(i>3e6)for(var r=0;r<i;r+=3e6){var n=t.subarray(r,Math.min(r+3e6,i));r+3e6>=i?s.push(C(n,!0)):s.push(C(n))}else s.push(C(t,!0));return s.join("")}for(var s="",a=0,o=0;o<t.length;o++)o%3==0?(s+=e[a=t[o]>>2],a=t[o]<<4&63):o%3==1?(s+=e[a+=t[o]>>4],a=t[o]<<2&63):o%3==2&&(s+=e[a+=t[o]>>6],s+=e[a=63&t[o]]);return t.length%3==1&&(s+=e[a]+"=="),t.length%3==2&&(s+=e[a]+"="),s}function R(t,e,i,r){void 0===i&&(i=!1),void 0===r&&(r=!0);for(var n=[],s=4;s<arguments.length;s++)n[s-4]=arguments[s];for(var a,o=new Set;t instanceof $r&&t.objId&&!o.has(t.objId);){t.objId&&o.add(t.objId);var h=i?t.getArray(e):t.get(e);if(void 0!==h){if(r)return h;a||(a=[]),a.push(h)}for(var c=0,_=!1;c<n.length;){var d=n[c];if(t.has(d)){t=t.get(d),_=!0;break}c++}if(!_)break}return a}function F(t,e){var i={x:0,y:0,width:0,height:0},r=t.getArray("Rect");if(r&&Array.isArray(r)){var n=r[0],s=r[1],a=r[2],o=r[3];void 0!==n&&void 0!==s&&void 0!==a&&void 0!==o&&(i.x=Math.min(n,a),i.y=Math.min(s,o),i.width=Math.max(n,a)-i.x,i.height=Math.max(s,o)-i.y,e&&(i.height=parseFloat(i.height.toFixed(3)),r[1]<0&&(i.y=r[1],r[1]>r[3]&&(i.y-=i.height))))}return i}function L(t,e){var i;if(t.has("Rect"))if(i=F(t),e){var r=e.size,n=e.mediaBox,s=e.cropBox;s&&Array.isArray(s)&&4===s.length&&e._pageDictionary.has("CropBox")?0===s[0]&&0===s[1]&&r[0]!==s[2]&&r[1]!==s[3]||i.x===s[0]?i.y=r[1]-(i.y+i.height):(i.x-=s[0],i.y=s[3]-(i.y+i.height)):n&&Array.isArray(n)&&4===n.length&&e._pageDictionary.has("MediaBox")&&(n[0]>0||n[1]>0||r[0]===n[2]||r[1]===n[3])?(i.x-=n[0],i.y=n[3]-(i.y+i.height)):i.y=r[1]-(i.y+i.height)}else i.y=i.y+i.height;return i}function D(t){return{x:Math.min(t[0],t[2]),y:Math.min(t[1],t[3]),width:Math.abs(t[0]-t[2]),height:Math.abs(t[1]-t[3])}}function B(t){return[t.x,t.y,t.x+t.width,t.y+t.height]}function O(t,e){var i=t[0],r=t[1],n=t[2],s=t[3];if(e){var a=e.size,o=a[0],h=a[1],c=e.mediaBox,_=e.cropBox;_&&Array.isArray(_)&&4===_.length?0!==_[0]||0!==_[1]||o===_[2]||h===_[3]?(i+=_[0],r=_[3]-(r+s)):r=h-(r+s):c&&Array.isArray(c)&&4===c.length&&(c[0]>0||c[1]>0||o===c[2]||h===c[3])?(i-=c[0],r=c[3]-(r+s)):r=h-(r+s)}return[i,r,i+n,r+s]}function I(t){var e=tt(t);if(!e){var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);i&&(e=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)])}return e}function M(t){var e;if(t)if(1===t.length){var i=t[0];if(void 0!==i){var r=Math.round(255*i);e=[r,r,r]}}else if(3===t.length){var n=t[0],s=t[1],a=t[2];void 0!==n&&void 0!==s&&void 0!==a&&(e=[Math.round(255*n),Math.round(255*s),Math.round(255*a)])}else if(4===t.length){var o=t[0],h=t[1],c=t[2],_=t[3];if(void 0!==o&&void 0!==h&&void 0!==c&&void 0!==_){var d=255*_;e=[Math.round(255-Math.min(255,o*(255-d)+d)),Math.round(255-Math.min(255,h*(255-d)+d)),Math.round(255-Math.min(255,c*(255-d)+d))]}}return e}function N(e){var i="S";switch(e){case t.PdfBorderStyle.dot:case t.PdfBorderStyle.dashed:i="D";break;case t.PdfBorderStyle.beveled:i="B";break;case t.PdfBorderStyle.inset:i="I";break;case t.PdfBorderStyle.underline:i="U"}return Xr.get(i)}function E(e){var i=t.PdfBorderEffectStyle.solid;switch(e){case"C":i=t.PdfBorderEffectStyle.cloudy}return i}function j(e){var i="None";if(void 0!==e)switch(e){case t.PdfLineEndingStyle.openArrow:i="OpenArrow";break;case t.PdfLineEndingStyle.closedArrow:i="ClosedArrow";break;case t.PdfLineEndingStyle.rOpenArrow:i="ROpenArrow";break;case t.PdfLineEndingStyle.rClosedArrow:i="RClosedArrow";break;case t.PdfLineEndingStyle.butt:i="Butt";break;case t.PdfLineEndingStyle.diamond:i="Diamond";break;case t.PdfLineEndingStyle.circle:i="Circle";break;case t.PdfLineEndingStyle.square:i="Square";break;case t.PdfLineEndingStyle.slash:i="Slash"}return i}function V(e){var i;switch(e.toLowerCase()){case"openarrow":i=t.PdfLineEndingStyle.openArrow;break;case"closedarrow":i=t.PdfLineEndingStyle.closedArrow;break;case"ropenarrow":i=t.PdfLineEndingStyle.rOpenArrow;break;case"rclosedarrow":i=t.PdfLineEndingStyle.rClosedArrow;break;case"butt":i=t.PdfLineEndingStyle.butt;break;case"diamond":i=t.PdfLineEndingStyle.diamond;break;case"circle":i=t.PdfLineEndingStyle.circle;break;case"square":i=t.PdfLineEndingStyle.square;break;case"slash":i=t.PdfLineEndingStyle.slash;break;default:i=t.PdfLineEndingStyle.none}return i}function z(e){switch(e){case"P":return t.PdfHighlightMode.push;case"N":return t.PdfHighlightMode.noHighlighting;case"O":return t.PdfHighlightMode.outline;default:return t.PdfHighlightMode.invert}}function U(e){switch(e){case t.PdfHighlightMode.push:return Xr.get("P");case t.PdfHighlightMode.noHighlighting:return Xr.get("N");case t.PdfHighlightMode.outline:return Xr.get("O");default:return Xr.get("I")}}function W(e){var i="Normal";switch(e){case t.PdfBlendMode.multiply:i="Multiply";break;case t.PdfBlendMode.screen:i="Screen";break;case t.PdfBlendMode.overlay:i="Overlay";break;case t.PdfBlendMode.darken:i="Darken";break;case t.PdfBlendMode.lighten:i="Lighten";break;case t.PdfBlendMode.colorDodge:i="ColorDodge";break;case t.PdfBlendMode.colorBurn:i="ColorBurn";break;case t.PdfBlendMode.hardLight:i="HardLight";break;case t.PdfBlendMode.softLight:i="SoftLight";break;case t.PdfBlendMode.difference:i="Difference";break;case t.PdfBlendMode.exclusion:i="Exclusion";break;case t.PdfBlendMode.hue:i="Hue";break;case t.PdfBlendMode.saturation:i="Saturation";break;case t.PdfBlendMode.color:i="Color";break;case t.PdfBlendMode.luminosity:i="Luminosity";break;default:i="Normal"}return Xr.get(i)}function H(e){var i=t.PdfBlendMode.normal;switch(e.name){case"Multiply":i=t.PdfBlendMode.multiply;break;case"Screen":i=t.PdfBlendMode.screen;break;case"Overlay":i=t.PdfBlendMode.overlay;break;case"Darken":i=t.PdfBlendMode.darken;break;case"Lighten":i=t.PdfBlendMode.lighten;break;case"ColorDodge":i=t.PdfBlendMode.colorDodge;break;case"ColorBurn":i=t.PdfBlendMode.colorBurn;break;case"HardLight":i=t.PdfBlendMode.hardLight;break;case"SoftLight":i=t.PdfBlendMode.softLight;break;case"Difference":i=t.PdfBlendMode.difference;break;case"Exclusion":i=t.PdfBlendMode.exclusion;break;case"Hue":i=t.PdfBlendMode.hue;break;case"Saturation":i=t.PdfBlendMode.saturation;break;case"Color":i=t.PdfBlendMode.color;break;case"Luminosity":i=t.PdfBlendMode.luminosity;break;default:i=t.PdfBlendMode.normal}return i}function G(t){var e=t.toFixed(2);return"0.00"===e&&(e=".00"),e}function K(t,e){var i=Xr.get(t);if(e.has("ProcSet")){var r=e.getArray("ProcSet");r&&-1===r.indexOf(i)&&(r.push(i),e.update("ProcSet",r))}else e.update("ProcSet",[i])}function X(){return"aaaaaaaa-aaaa-4aaa-baaa-aaaaaaaaaaaa".replace(/[ab]/g,function(t){var e=16*Math.random()|0;return("a"===t?e:3&e|8).toString(16)})}function q(t){for(var e=[],i=0,r=0;r<t.length;r++){var n=t.charCodeAt(r);(n<33||n>126||35===n||40===n||41===n||60===n||62===n||91===n||93===n||123===n||125===n||47===n||37===n)&&(i<r&&e.push(t.substring(i,r)),e.push("#"+n.toString(16)),i=r+1)}return 0===e.length?t:(i<t.length&&e.push(t.substring(i,t.length)),e.join(""))}function Q(t,e,i,r,n,s){if(t>i){a=t;t=i,i=a}if(r>e){var a=e;e=r,r=a}var o,h;Math.abs(s)<=90?(o=s,h=1):o=s/(h=Math.ceil(Math.abs(s)/90));for(var c=(t+i)/2,_=(e+r)/2,d=(i-t)/2,l=(r-e)/2,f=o*(Math.PI/360),p=Math.abs(4/3*(1-Math.cos(f))/Math.sin(f)),u=[],g=0;g<h;g++){var y=(n+g*o)*(Math.PI/180),m=(n+(g+1)*o)*(Math.PI/180),b=Math.cos(y),v=Math.cos(m),w=Math.sin(y),S=Math.sin(m);o>0?(u.push(c+d*b),u.push(_-l*w),u.push(c+d*(b-p*w)),u.push(_-l*(w+p*b)),u.push(c+d*(v+p*S)),u.push(_-l*(S-p*v)),u.push(c+d*v),u.push(_-l*S)):(u.push(c+d*b),u.push(_-l*w),u.push(c+d*(b+p*w)),u.push(_-l*(w-p*b)),u.push(c+d*(v-p*S)),u.push(_-l*(S+p*v)),u.push(c+d*v),u.push(_-l*S))}return u}function J(t,e){for(var i,r=0;r<t.pageCount&&void 0===i;r++){var n=t.getPage(r);if(n&&n._pageDictionary.has("Annots")){var s=n._pageDictionary.get("Annots");Array.isArray(s)&&void 0===i&&s.some(function(t){return t instanceof Qr&&t===e})&&(i=n)}}return i}function Y(t){var e=!1;if(t.has("AS")){var i=t.get("AS");if(i)e="Off"!==i.name;else{var r=t.get("V");r&&(e=r.name===Z(t))}}return e}function Z(t){var e,i="";if(t.has("AS")&&null!==(e=t.get("AS"))&&"Off"!==e.name&&(i=e.name),""===i&&t.has("AP")){var r=t.get("AP");if(r&&r.has("N")){var n=r.get("N");if(n instanceof rn&&(n=n.dictionary),n&&n instanceof $r){var s=!1;n.forEach(function(t,e){s||"off"===t||(i=t,s=!0)})}}}return i}function $(e,i){var r,n=e===t._PdfCheckFieldState.checked?Z(i._dictionary):"Off";if(i._dictionary.has("AP")){var s=i._dictionary.get("AP");if(s&&s.has("N")){var a=s.get("N");if(a&&a instanceof rn&&(a=a.dictionary),a&&a instanceof $r&&n&&""!==n&&a.has(n)){var o=a.get(n),h=a.getRaw(n);h&&(o.reference=h),o&&(r=new fe(o,i._crossReference))}}}return r}function tt(t){var e;switch(t){case"transparent":e=[255,255,255];break;case"aliceblue":e=[240,248,255];break;case"antiquewhite":e=[250,235,215];break;case"aqua":e=[0,255,255];break;case"aquamarine":e=[127,255,212];break;case"azure":e=[240,255,255];break;case"beige":e=[245,245,220];break;case"bisque":e=[255,228,196];break;case"black":e=[0,0,0];break;case"blanchedalmond":e=[255,235,205];break;case"blue":e=[0,0,255];break;case"blueviolet":e=[138,43,226];break;case"brown":e=[165,42,42];break;case"burlywood":e=[222,184,135];break;case"cadetBlue":e=[95,158,160];break;case"chartreuse":e=[127,255,0];break;case"chocolate":e=[210,105,30];break;case"coral":e=[255,127,80];break;case"cornflowerblue":e=[100,149,237];break;case"cornsilk":e=[255,248,220];break;case"crimson":e=[220,20,60];break;case"cyan":e=[0,255,255];break;case"darkblue":e=[0,0,139];break;case"darkcyan":e=[0,139,139];break;case"darkgoldenrod":e=[184,134,11];break;case"darkgray":e=[169,169,169];break;case"darkgreen":e=[0,100,0];break;case"darkkhaki":e=[189,183,107];break;case"darkmagenta":e=[139,0,139];break;case"darkolivegreen":e=[85,107,47];break;case"darkorange":e=[255,140,0];break;case"darkorchid":e=[153,50,204];break;case"darkred":e=[139,0,0];break;case"darksalmon":e=[233,150,122];break;case"darkseagreen":e=[143,188,139];break;case"darkslateblue":e=[72,61,139];break;case"darkslategray":e=[47,79,79];break;case"darkturquoise":e=[0,206,209];break;case"darkviolet":e=[148,0,211];break;case"deeppink":e=[255,20,147];break;case"deepskyblue":e=[0,191,255];break;case"dimgray":e=[105,105,105];break;case"dodgerblue":e=[30,144,255];break;case"firebrick":e=[178,34,34];break;case"floralwhite":e=[255,250,240];break;case"forestgreen":e=[34,139,34];break;case"fuchsia":e=[255,0,255];break;case"gainsboro":e=[220,220,220];break;case"ghostwhite":e=[248,248,255];break;case"gold":e=[255,215,0];break;case"goldenrod":e=[218,165,32];break;case"gray":e=[128,128,128];break;case"green":e=[0,128,0];break;case"greenyellow":e=[173,255,47];break;case"honeydew":e=[240,255,240];break;case"hotpink":e=[255,105,180];break;case"indianred":e=[205,92,92];break;case"indigo":e=[75,0,130];break;case"ivory":e=[255,255,240];break;case"khaki":e=[240,230,140];break;case"lavender":e=[230,230,250];break;case"lavenderblush":e=[255,240,245];break;case"lawngreen":e=[124,252,0];break;case"lemonchiffon":e=[255,250,205];break;case"lightblue":e=[173,216,230];break;case"lightcoral":e=[240,128,128];break;case"lightcyan":e=[224,255,255];break;case"lightgoldenrodyellow":e=[250,250,210];break;case"lightgreen":e=[144,238,144];break;case"lightgray":e=[211,211,211];break;case"LightPink":e=[255,182,193];break;case"lightsalmon":e=[255,160,122];break;case"lightseagreen":e=[32,178,170];break;case"lightskyblue":e=[135,206,250];break;case"lightslategray":e=[119,136,153];break;case"lightsteelblue":e=[176,196,222];break;case"lightyellow":e=[255,255,224];break;case"lime":e=[0,255,0];break;case"limeGreen":e=[50,205,50];break;case"linen":e=[250,240,230];break;case"magenta":e=[255,0,255];break;case"maroon":e=[128,0,0];break;case"mediumaquamarine":e=[102,205,170];break;case"mediumblue":e=[0,0,205];break;case"mediumorchid":e=[186,85,211];break;case"mediumpurple":e=[147,112,219];break;case"mediumseagreen":e=[60,179,113];break;case"mediumslateblue":e=[123,104,238];break;case"mediumspringgreen":e=[0,250,154];break;case"mediumturquoise":e=[72,209,204];break;case"mediumvioletred":e=[199,21,133];break;case"midnightblue":e=[25,25,112];break;case"mintcream":e=[245,255,250];break;case"mistyrose":e=[255,228,225];break;case"moccasin":e=[255,228,181];break;case"navajowhite":e=[255,222,173];break;case"navy":e=[0,0,128];break;case"oldLace":e=[253,245,230];break;case"olive":e=[128,128,0];break;case"olivedrab":e=[107,142,35];break;case"orange":e=[255,165,0];break;case"orangered":e=[255,69,0];break;case"orchid":e=[218,112,214];break;case"palegoldenrod":e=[238,232,170];break;case"palegreen":e=[152,251,152];break;case"paleturquoise":e=[175,238,238];break;case"palebioletred":e=[219,112,147];break;case"papayawhip":e=[255,239,213];break;case"peachpuff":e=[255,218,185];break;case"peru":e=[205,133,63];break;case"pink":e=[255,192,203];break;case"plum":e=[221,160,221];break;case"powderblue":e=[176,224,230];break;case"purple":e=[128,0,128];break;case"red":e=[255,0,0];break;case"rosybrown":e=[188,143,143];break;case"royalblue":e=[65,105,225];break;case"saddlebrown":e=[139,69,19];break;case"salmon":e=[250,128,114];break;case"sandybrown":e=[244,164,96];break;case"seagreen":e=[46,139,87];break;case"seashell":e=[255,245,238];break;case"sienna":e=[160,82,45];break;case"silver":e=[192,192,192];break;case"skyblue":e=[135,206,235];break;case"slateblue":e=[106,90,205];break;case"slategray":e=[112,128,144];break;case"snow":e=[255,250,250];break;case"springgreen":e=[0,255,127];break;case"steelblue":e=[70,130,180];break;case"tan":e=[210,180,140];break;case"teal":e=[0,128,128];break;case"thistle":e=[216,191,216];break;case"tomato":e=[255,99,71];break;case"turquoise":e=[64,224,208];break;case"violet":e=[238,130,238];break;case"wheat":e=[245,222,179];break;case"white":e=[255,255,255];break;case"whitesmoke":e=[245,245,245];break;case"yellow":e=[255,255,0];break;case"yellowgreen":e=[154,205,50]}return e}function et(t,e){var i=t._content.dictionary.getArray("BBox");if(i&&void 0!==e&&null!==e)if(0===e)t._content.dictionary.set("Matrix",[1,0,0,1,-i[0],-i[1]]);else{var r=new vr;90===e?r._translate(i[3],-i[0]):180===e?r._translate(i[2],i[3]):270===e&&r._translate(-i[1],i[2]),r._rotate(e),t._content.dictionary.set("Matrix",r._matrix._elements)}}function it(e){var i="4";switch(e){case t.PdfCheckBoxStyle.circle:i="l";break;case t.PdfCheckBoxStyle.cross:i="8";break;case t.PdfCheckBoxStyle.diamond:i="u";break;case t.PdfCheckBoxStyle.square:i="n";break;case t.PdfCheckBoxStyle.star:i="H"}return i}function rt(e){var i=t.PdfCheckBoxStyle.check;switch(e){case"l":i=t.PdfCheckBoxStyle.circle;break;case"8":i=t.PdfCheckBoxStyle.cross;break;case"u":i=t.PdfCheckBoxStyle.diamond;break;case"n":i=t.PdfCheckBoxStyle.square;break;case"H":i=t.PdfCheckBoxStyle.star}return i}function nt(e){var i;switch(e){case"cm":i=t.PdfMeasurementUnit.centimeter;break;case"in":i=t.PdfMeasurementUnit.inch;break;case"mm":i=t.PdfMeasurementUnit.millimeter;break;case"p":i=t.PdfMeasurementUnit.pica;break;case"pt":i=t.PdfMeasurementUnit.point;break;default:i=t.PdfMeasurementUnit.centimeter}return i}function st(e){var i;switch(e){case"Highlight":i=t.PdfTextMarkupAnnotationType.highlight;break;case"Squiggly":i=t.PdfTextMarkupAnnotationType.squiggly;break;case"StrikeOut":i=t.PdfTextMarkupAnnotationType.strikeOut;break;case"Underline":i=t.PdfTextMarkupAnnotationType.underline;break;default:i=t.PdfTextMarkupAnnotationType.highlight}return i}function at(e){var i="Highlight";switch(e){case t.PdfTextMarkupAnnotationType.highlight:i="Highlight";break;case t.PdfTextMarkupAnnotationType.squiggly:i="Squiggly";break;case t.PdfTextMarkupAnnotationType.strikeOut:i="StrikeOut";break;case t.PdfTextMarkupAnnotationType.underline:i="Underline";break;default:i="Highlight"}return i}function ot(e){var i;switch(e){case"cm":i=t._PdfGraphicsUnit.centimeter;break;case"in":i=t._PdfGraphicsUnit.inch;break;case"mm":i=t._PdfGraphicsUnit.millimeter;break;case"p":i=t._PdfGraphicsUnit.pica;break;case"pt":i=t._PdfGraphicsUnit.point;break;default:i=t._PdfGraphicsUnit.centimeter}return i}function ht(e){var i;switch(e){case"#Approved":case"SBApproved":i=t.PdfRubberStampAnnotationIcon.approved;break;case"#AsIs":case"SBAsIs":i=t.PdfRubberStampAnnotationIcon.asIs;break;case"#Completed":case"SBCompleted":i=t.PdfRubberStampAnnotationIcon.completed;break;case"#Confidential":case"SBConfidential":i=t.PdfRubberStampAnnotationIcon.confidential;break;case"#Departmental":case"SBDepartmental":i=t.PdfRubberStampAnnotationIcon.departmental;break;case"#Draft":case"SBDraft":i=t.PdfRubberStampAnnotationIcon.draft;break;case"#Experimental":case"SBExperimental":i=t.PdfRubberStampAnnotationIcon.experimental;break;case"#Expired":case"SBExpired":i=t.PdfRubberStampAnnotationIcon.expired;break;case"#Final":case"SBFinal":i=t.PdfRubberStampAnnotationIcon.final;break;case"#ForComment":case"SBForComment":i=t.PdfRubberStampAnnotationIcon.forComment;break;case"#ForPublicRelease":case"SBForPublicRelease":i=t.PdfRubberStampAnnotationIcon.forPublicRelease;break;case"#InformationOnly":case"SBInformationOnly":i=t.PdfRubberStampAnnotationIcon.informationOnly;break;case"#NotApproved":case"SBNotApproved":i=t.PdfRubberStampAnnotationIcon.notApproved;break;case"#NotForPublicRelease":case"SBNotForPublicRelease":i=t.PdfRubberStampAnnotationIcon.notForPublicRelease;break;case"#PreliminaryResults":case"SBPreliminaryResults":i=t.PdfRubberStampAnnotationIcon.preliminaryResults;break;case"#Sold":case"SBSold":i=t.PdfRubberStampAnnotationIcon.sold;break;case"#TopSecret":case"SBTopSecret":i=t.PdfRubberStampAnnotationIcon.topSecret;break;case"#Void":case"SBVoid":i=t.PdfRubberStampAnnotationIcon.void;break;default:i=t.PdfRubberStampAnnotationIcon.draft}return i}function ct(e){var i;switch(e){case"Note":i=t.PdfPopupIcon.note;break;case"Comment":i=t.PdfPopupIcon.comment;break;case"Help":i=t.PdfPopupIcon.help;break;case"Insert":i=t.PdfPopupIcon.insert;break;case"Key":i=t.PdfPopupIcon.key;break;case"NewParagraph":i=t.PdfPopupIcon.newParagraph;break;case"Paragraph":i=t.PdfPopupIcon.paragraph;break;default:i=t.PdfPopupIcon.note}return i}function _t(e){var i="None";switch(e){case t.PdfAnnotationState.none:i="None";break;case t.PdfAnnotationState.accepted:i="Accepted";break;case t.PdfAnnotationState.rejected:i="Rejected";break;case t.PdfAnnotationState.cancel:i="Cancelled";break;case t.PdfAnnotationState.completed:i="Completed";break;case t.PdfAnnotationState.marked:i="Marked";break;case t.PdfAnnotationState.unmarked:i="Unmarked";break;case t.PdfAnnotationState.unknown:i="Unknown";break;default:i="None"}return i}function dt(e){var i=t.PdfAnnotationState.none;switch(e){case"None":i=t.PdfAnnotationState.none;break;case"Accepted":i=t.PdfAnnotationState.accepted;break;case"Rejected":i=t.PdfAnnotationState.rejected;break;case"Cancelled":i=t.PdfAnnotationState.cancel;break;case"Completed":i=t.PdfAnnotationState.completed;break;case"Marked":i=t.PdfAnnotationState.marked;break;case"Unmarked":i=t.PdfAnnotationState.unmarked;break;case"Unknown":i=t.PdfAnnotationState.unknown}return i}function lt(e){var i="None";switch(e){case t.PdfAnnotationStateModel.none:i="None";break;case t.PdfAnnotationStateModel.marked:i="Marked";break;case t.PdfAnnotationStateModel.review:i="Review";break;default:i="None"}return i}function ft(e){var i=t.PdfAnnotationStateModel.none;switch(e){case"None":i=t.PdfAnnotationStateModel.none;break;case"Marked":i=t.PdfAnnotationStateModel.marked;break;case"Review":i=t.PdfAnnotationStateModel.review}return i}function pt(e){var i;switch(e){case"PushPin":i=t.PdfAttachmentIcon.pushPin;break;case"Tag":i=t.PdfAttachmentIcon.tag;break;case"Graph":i=t.PdfAttachmentIcon.graph;break;case"Paperclip":i=t.PdfAttachmentIcon.paperClip;break;default:i=t.PdfAttachmentIcon.pushPin}return i}function ut(e){var i;switch(e){case"None":i=t.PdfAnnotationIntent.none;break;case"FreeTextCallout":i=t.PdfAnnotationIntent.freeTextCallout;break;case"FreeTextTypeWriter":i=t.PdfAnnotationIntent.freeTextTypeWriter;break;default:i=t.PdfAnnotationIntent.none}return i}function gt(e){var i=[];return(e&t.PdfFontStyle.bold)>0&&i.push("Bold"),(e&t.PdfFontStyle.italic)>0&&i.push("Italic"),(e&t.PdfFontStyle.underline)>0&&i.push("Underline"),(e&t.PdfFontStyle.strikeout)>0&&i.push("Strikeout"),0===i.length?"Regular":i.join(", ")}function yt(t){var e;switch(t){case"head2right":e="➢";break;case"aacute":e="á";break;case"eacute":e="é";break;case"iacute":e="í";break;case"oacute":e="ó";break;case"uacute":e="ú";break;case"circleright":e="➲";break;case"bleft":e="⇦";break;case"bright":e="⇨";break;case"bup":e="⇧";break;case"bdown":e="⇩";break;case"barb4right":e="➔";break;case"bleftright":e="⬄";break;case"bupdown":e="⇳";break;case"bnw":e="⬀";break;case"bne":e="⬁";break;case"bsw":e="⬃";break;case"bse":e="⬂";break;case"bdash1":e="▭";break;case"bdash2":e="▫";break;case"xmarkbld":e="✗";break;case"checkbld":e="✓";break;case"boxxmarkbld":e="☒";break;case"boxcheckbld":e="☑";break;case"space":e=" ";break;case"pencil":e="✏";break;case"scissors":e="✂";break;case"scissorscutting":case"readingglasses":case"bell":case"book":case"telephonesolid":case"telhandsetcirc":case"envelopeback":e="✁";break;case"hourglass":e="⌛";break;case"keyboard":e="⌨";break;case"tapereel":e="✇";break;case"handwrite":e="✍";break;case"handv":e="✌";break;case"handptleft":e="☜";break;case"handptright":e="☞";break;case"handptup":e="☝";break;case"handptdown":e="☟";break;case"smileface":e="☺";break;case"frownface":e="☹";break;case"skullcrossbones":e="☠";break;case"flag":e="⚐";break;case"pennant":e="Ὢ9";break;case"airplane":e="✈";break;case"sunshine":e="☼";break;case"droplet":e="Ὂ7";break;case"snowflake":e="❄";break;case"crossshadow":e="✞";break;case"crossmaltese":e="✠";break;case"starofdavid":e="✡";break;case"crescentstar":e="☪";break;case"yinyang":e="☯";break;case"om":e="ॐ";break;case"wheel":e="☸";break;case"aries":e="♈";break;case"taurus":e="♉";break;case"gemini":e="♊";break;case"cancer":e="♋";break;case"leo":e="♌";break;case"virgo":e="♍";break;case"libra":e="♎";break;case"scorpio":e="♏";break;case"saggitarius":e="♐";break;case"capricorn":e="♑";break;case"aquarius":e="♒";break;case"pisces":e="♓";break;case"ampersanditlc":case"ampersandit":e="&";break;case"circle6":e="●";break;case"circleshadowdwn":e="❍";break;case"square6":e="■";break;case"box3":e="□";break;case"boxshadowdwn":e="❑";break;case"boxshadowup":e="❒";break;case"lozenge4":e="⬧";break;case"lozenge6":e="⧫";break;case"rhombus6":e="◆";break;case"xrhombus":e="❖";break;case"rhombus4":e="⬥";break;case"clear":e="⌧";break;case"escape":e="⍓";break;case"command":e="⌘";break;case"rosette":e="❀";break;case"rosettesolid":e="✿";break;case"quotedbllftbld":e="❝";break;case"quotedblrtbld":e="❞";break;case".notdef":e="▯";break;case"zerosans":e="⓪";break;case"onesans":e="①";break;case"twosans":e="②";break;case"threesans":e="③";break;case"foursans":e="④";break;case"fivesans":e="⑤";break;case"sixsans":e="⑥";break;case"sevensans":e="⑦";break;case"eightsans":e="⑧";break;case"ninesans":e="⑨";break;case"tensans":e="⑩";break;case"zerosansinv":e="⓿";break;case"onesansinv":e="❶";break;case"twosansinv":e="❷";break;case"threesansinv":e="❸";break;case"foursansinv":e="❹";break;case"circle2":e="·";break;case"circle4":e="•";break;case"square2":e="▪";break;case"ring2":e="○";break;case"ringbutton2":e="◉";break;case"target":e="◎";break;case"square4":e="▪";break;case"box2":e="◻";break;case"crosstar2":e="✦";break;case"pentastar2":e="★";break;case"hexstar2":e="✶";break;case"octastar2":e="✴";break;case"dodecastar3":e="✹";break;case"octastar4":e="✵";break;case"registercircle":e="⌖";break;case"cuspopen":e="⟡";break;case"cuspopen1":e="⌑";break;case"circlestar":e="★";break;case"starshadow":e="✰";break;case"deleteleft":e="⌫";break;case"deleteright":e="⌦";break;case"scissorsoutline":e="✄";break;case"telephone":e="☏";break;case"telhandset":e="ὍE";break;case"handptlft1":e="☜";break;case"handptrt1":e="☞";break;case"handptlftsld1":e="☚";break;case"handptrtsld1":e="☛";break;case"handptup1":e="☝";break;case"handptdwn1":e="☟";break;case"xmark":e="✗";break;case"check":e="✓";break;case"boxcheck":e="☑";break;case"boxx":case"boxxbld":e="☒";break;case"circlex":e="=⌔";break;case"circlexbld":e="⌔";break;case"prohibit":case"prohibitbld":e="⦸";break;case"ampersanditaldm":case"ampersandbld":case"ampersandsans":case"ampersandsandm":e="&";break;case"interrobang":case"interrobangdm":case"interrobangsans":case"interrobngsandm":e="‽";break;case"sacute":e="ś";break;case"Sacute":e="Ś";break;case"eogonek":e="ę";break;case"cacute":e="ć";break;case"aogonek":e="ą";break;default:e=t}return e}function mt(t){var e;switch(t){case"zero":e="0";break;case"one":e="1";break;case"two":e="2";break;case"three":e="3";break;case"four":e="4";break;case"five":e="5";break;case"six":e="6";break;case"seven":e="7";break;case"eight":e="8";break;case"nine":e="9";break;case"aacute":e="á";break;case"asciicircum":e="^";break;case"asciitilde":e="~";break;case"asterisk":e="*";break;case"at":e="@";break;case"atilde":e="ã";break;case"backslash":e="\\";break;case"bar":e="|";break;case"braceleft":e="{";break;case"braceright":e="}";break;case"bracketleft":e="[";break;case"bracketright":e="]";break;case"breve":e="˘";break;case"brokenbar":e="|";break;case"bullet3":case"bullet":e="•";break;case"caron":e="ˇ";break;case"ccedilla":e="ç";break;case"cedilla":e="¸";break;case"cent":e="¢";break;case"circumflex":e="ˆ";break;case"colon":e=":";break;case"comma":e=",";break;case"copyright":e="©";break;case"currency1":e="¤";break;case"dagger":e="†";break;case"daggerdbl":e="‡";break;case"degree":e="°";break;case"dieresis":e="¨";break;case"divide":e="÷";break;case"dollar":e="$";break;case"dotaccent":e="˙";break;case"dotlessi":e="ı";break;case"eacute":e="é";break;case"middot":e="˙";break;case"edieresis":e="ë";break;case"egrave":e="è";break;case"ellipsis":e="...";break;case"emdash":e="—";break;case"endash":e="–";break;case"equal":e="=";break;case"eth":e="ð";break;case"exclam":e="!";break;case"exclamdown":e="¡";break;case"florin":e="ƒ";break;case"fraction":e="⁄";break;case"germandbls":e="ß";break;case"grave":e="`";break;case"greater":e=">";break;case"guillemotleft4":e="«";break;case"guillemotright4":e="»";break;case"guilsinglleft":e="‹";break;case"guilsinglright":e="›";break;case"hungarumlaut":e="˝";break;case"hyphen5":e="-";break;case"iacute":e="í";break;case"icircumflex":e="î";break;case"idieresis":e="ï";break;case"igrave":e="ì";break;case"less":e="<";break;case"logicalnot":e="¬";break;case"lslash":e="ł";break;case"Lslash":e="Ł";break;case"macron":e="¯";break;case"minus":e="−";break;case"mu":e="μ";break;case"multiply":e="×";break;case"ntilde":e="ñ";break;case"numbersign":e="#";break;case"oacute":e="ó";break;case"ocircumflex":e="ô";break;case"odieresis":e="ö";break;case"oe":e="oe";break;case"ogonek":e="˛";break;case"ograve":e="ò";break;case"onehalf":e="1/2";break;case"onequarter":e="1/4";break;case"onesuperior":e="¹";break;case"ordfeminine":e="ª";break;case"ordmasculine":e="º";break;case"otilde":e="õ";break;case"paragraph":e="¶";break;case"parenleft":e="(";break;case"parenright":e=")";break;case"percent":e="%";break;case"period":e=".";break;case"periodcentered":e="·";break;case"perthousand":e="‰";break;case"plus":e="+";break;case"plusminus":e="±";break;case"question":e="?";break;case"questiondown":e="¿";break;case"quotedbl":e="'";break;case"quotedblbase":e="„";break;case"quotedblleft":e="“";break;case"quotedblright":e="”";break;case"quoteleft":e="‘";break;case"quoteright":e="’";break;case"quotesinglbase":e="‚";break;case"quotesingle":e="'";break;case"registered":e="®";break;case"ring":e="˚";break;case"scaron":e="š";break;case"section":e="§";break;case"semicolon":e=";";break;case"slash":e="/";break;case"space6":case"space":e=" ";break;case"udieresis":e="ü";break;case"uacute":e="ú";break;case"Ecircumflex":e="Ê";break;case"hyphen":e="-";break;case"underscore":e="_";break;case"adieresis":e="ä";break;case"ampersand":e="&";break;case"Adieresis":e="Ä";break;case"Udieresis":e="Ü";break;case"ccaron":e="č";break;case"Scaron":e="Š";break;case"zcaron":e="ž";break;case"sterling":e="£";break;case"agrave":e="à";break;case"ecircumflex":e="ê";break;case"acircumflex":e="â";break;case"Oacute":e="Ó";break;default:e=t}return e}function bt(t){for(var e="",i=0;i<t.length;i++){var r=255&t.charCodeAt(i),n=String.fromCharCode(r),s="";switch(n){case" ":case"%":case"(":case")":case"<":case">":case"[":case"]":case"{":case"}":case"/":case"#":e+="#",e+=1===(s=r.toString(16).toUpperCase()).length?"0"+s:s;break;default:r>126||r<37?(e+="#",e+=1===(s=r.toString(16).toUpperCase()).length?"0"+s:s):e+=n}}return e}function vt(t,e){return e?t.reviewHistory:t.comments}function wt(t){var e=t.get("F");return(t.has("State")||t.has("StateModel"))&&(30===e||128===e)}function St(t){var e=t.get("F");return!(t.has("State")||t.has("StateModel")||28!==e&&128!==e)}function Pt(e,i){switch(e.has("F")&&(delete e._map.F,e._updated=!0),i){case t.PdfFormFieldVisibility.hidden:e.update("F",t.PdfAnnotationFlag.hidden);break;case t.PdfFormFieldVisibility.hiddenPrintable:e.update("F",t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print);break;case t.PdfFormFieldVisibility.visible:if(e.has("DV")&&(delete e._map.DV,e._updated=!0),e.has("MK")){var r=e.get("MK");r&&r.has("BG")&&(delete r._map.BG,r._updated=!0)}}}function At(t,e,i){if(t&&t.has(i)){var r=t.getRaw(i);if(r&&r instanceof Qr&&r._isNew){var n=t.get(i);if(n){n instanceof Qr&&(n=e._fetch(n));var s=void 0;n instanceof $r?s=n:n instanceof rn&&(s=n.dictionary),s&&s.has("Resources")&&xt(s.get("Resources"),e)}e._cacheMap.delete(r)}}}function xt(t,e){t&&t.size>0&&t.forEach(function(i,r){if(void 0!==i&&void 0!==r)if(r instanceof Qr){var n=r;if(n._isNew){var s=t.get(i);s&&s instanceof $r&&("XObject"===i&&s.has("Resources")&&xt(s.get("Resources"),e),e._cacheMap.delete(n))}}else r instanceof $r&&(r.has("Resources")&&xt(r.get("Resources"),e),"Font"!==i&&"XObject"!==i&&"ExtGState"!==i||xt(r,e))})}function kt(t,e,i,r){var n;t&&(t instanceof $r?n=t:t instanceof nn&&(n=t.dictionary)),n&&(At(n,e,i),At(n,e,r))}function Ct(t){return"[object String]"===Object.prototype.toString.call(t)?"$s"+t:"$o"+t.toString()}function Tt(e,i,r){var n,s,a,o="";if((i&&i._dictionary.has("DA")||r._dictionary.has("DA"))&&(a=i&&i._dictionary.has("DA")?i._dictionary.get("DA"):r._dictionary.get("DA")),a&&a.includes("Tf")){var h=a.trim().split(/\s+/),c=h.indexOf("Tf");c>=2&&((o=h[c-2]).startsWith("/")&&(o=o.slice(1)),o&&(o=Zt(o)),n=parseFloat(h[c-1]))}if(o&&(o=o.trim()),e&&e._dictionary.has("DR")){var _=e._dictionary.get("DR");if(_.has("Font")&&(p=_.get("Font")).has(o)&&(u=p.get(o))&&o&&u.has("BaseFont")){var d=u.get("BaseFont"),l=t.PdfFontStyle.regular;d&&(a=d.name,"Helvetica"===d.name&&(d.name="Helv"),l=Rt(d.name),a.includes("-")&&(a=a.substring(0,a.indexOf("-"))),i&&i._dictionary.has("DA")?s=i._dictionary.has("AP")?Ft(a,n,l,i):Ft(a,n,l,i,u):r&&r._dictionary.has("DA")&&(s=r._dictionary.has("AP")?Ft(a,n,l,r):Ft(a,n,l,r,u)))}if(s&&s._dictionary&&s._dictionary.has("BaseFont")){var f=s._dictionary.get("BaseFont").name;if(f&&f!==o){var p=_.get("Font");if(p&&p.has(o)){var u=p.get(o),g=u.get("Subtype").name;if(u&&o&&u.has("BaseFont")){l=(d=u.get("BaseFont"))?Rt(d.name):t.PdfFontStyle.regular;if("TrueType"===g){var y=Qt(e,u);if(y&&y.length>0){var m=T(y);if(m&&m.length>0){var b=!0;if(i||r){var v=i?i._dictionary:r._dictionary;if(v&&v.has("V")){var w=v.get("V");if(null!==w&&void 0!==w&&(b=Jt(w),v.has("FT")&&"Ch"===v.get("FT").name&&v.has("Opt"))){var S=v.get("Opt");if(S&&S.length>0)for(var P=0,A=S.filter(function(t){return t.length>1});P<A.length;P++){var x=A[P],k=x[0],C=x[1];if(k===w){b=Jt(C);break}}}}}(s=new ii(m,n,l))._isUnicode=b}}}}}}}}return null!==s&&void 0!==s||!n||(s=new ti(t.PdfFontFamily.helvetica,n,t.PdfFontStyle.regular)),(null===s||void 0===s||s&&1===s.size)&&(!i||i._field instanceof bi?!r||r instanceof bi||(s=r._circleCaptionFont):s=i._circleCaptionFont),s}function Rt(e){var i=e.indexOf("-");i<0&&(i=e.indexOf(","));var r=t.PdfFontStyle.regular;if(i>=0)switch(e.substring(i+1,e.length)){case"Bold":case"BoldMT":r=t.PdfFontStyle.bold;break;case"Italic":case"ItalicMT":case"Oblique":case"It":r=t.PdfFontStyle.italic;break;case"BoldItalic":case"BoldItalicMT":case"BoldOblique":r=t.PdfFontStyle.bold|t.PdfFontStyle.italic}return r}function Ft(e,i,r,n,s){var a,o,h=e||"";h.includes("-")&&(h=h.substring(0,h.indexOf("-"))),void 0===i&&n instanceof Ci&&n._isLoaded&&(i=10);var c=void 0!==i?i:1;if(n._dictionary.has("DS")||n._dictionary.has("DA"))switch(h){case"Helv":case"Helvetica":a=new ti(t.PdfFontFamily.helvetica,c,r);break;case"Cour":case"Courier":a=new ti(t.PdfFontFamily.courier,c,r);break;case"Symb":case"Symbol":a=new ti(t.PdfFontFamily.symbol,c,r);break;case"Times":case"TiRo":case"TimesRoman":a=new ti(t.PdfFontFamily.timesRoman,c,r);break;case"ZaDb":case"ZapfDingbats":a=new ti(t.PdfFontFamily.zapfDingbats,c,r);break;case"MonotypeSungLight":a=new ei(t.PdfCjkFontFamily.monotypeSungLight,c,r);break;case"SinoTypeSongLight":a=new ei(t.PdfCjkFontFamily.sinoTypeSongLight,c,r);break;case"MonotypeHeiMedium":a=new ei(t.PdfCjkFontFamily.monotypeHeiMedium,c,r);break;case"HanyangSystemsGothicMedium":a=new ei(t.PdfCjkFontFamily.hanyangSystemsGothicMedium,c,r);break;case"HanyangSystemsShinMyeongJoMedium":a=new ei(t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium,c,r);break;case"HeiseiKakuGothicW5":a=new ei(t.PdfCjkFontFamily.heiseiKakuGothicW5,c,r);break;case"HeiseiMinchoW3":a=new ei(t.PdfCjkFontFamily.heiseiMinchoW3,c,r);break;default:if(n._dictionary.has("AP")?o=Lt(n._dictionary,n._crossReference,n,e):s&&(o=Dt(s)),o&&o.length>0){var _=!0;if(n._dictionary&&n._dictionary.has("V")){var d=n._dictionary.get("V");if(null!==d&&void 0!==d&&(_=Jt(d),n._dictionary.has("FT")&&"Ch"===n._dictionary.get("FT").name&&n._dictionary.has("Opt"))){var l=n._dictionary.get("Opt");if(l&&l.length>0)for(var f=0;f<l.length;f++){var p=l[f];if(p&&p.length>1){var u=p[0],g=p[1];if(u&&g&&u===d&&g){_=Jt(g);break}}}}}var y=new ii(o,c,r);y._isUnicode=_,a=y}}if(null===a||void 0===a){var m=n instanceof xi,b=n instanceof fi;if(m||b){var v=n._type,w=n._circleCaptionFont&&c>n._circleCaptionFont.size,S=m&&v!==t._PdfAnnotationType.widgetAnnotation,P=n instanceof pi&&w,A=n instanceof bi&&w;a=S||P||A?new ti(t.PdfFontFamily.helvetica,c,r):n._circleCaptionFont,v===t._PdfAnnotationType.widgetAnnotation&&w&&(a=new ti(t.PdfFontFamily.helvetica,c,r))}}return a}function Lt(t,e,i,r){var n,s=t.get("AP");if(s&&s instanceof $r&&s.has("N")){var a=s.get("N"),o=void 0;if(a&&(a instanceof nn?o=a:(i instanceof fi||i instanceof Ji)&&a.stream&&a.stream instanceof nn?o=a.stream:a.stream&&a.stream instanceof nn&&(o=a.stream)),o&&o instanceof nn&&o.dictionary.has("Resources")){var h=o.dictionary.get("Resources");h&&h.has("Font")&&(d=h.get("Font"))&&d instanceof $r&&d.forEach(function(t,i){if(i instanceof Qr){var r=e._fetch(i);n=Dt(r)}})}}if(!n&&i&&i instanceof fi&&i._form&&i._form._dictionary.has("DR")&&null!==r&&void 0!==r){var c=i._form._dictionary.get("DR");if(c&&c.has("Font")){var _=c.get("Font");if(_&&_.has(r)){var d=_.get(r);d&&d.has("FontDescriptor")&&(n=Dt(d))}}}return n}function Dt(t){var e,i;if(t&&t.has("DescendantFonts")){var r=t.getArray("DescendantFonts");r&&r.length>0&&r.forEach(function(t){t&&t instanceof $r&&t.has("FontDescriptor")&&(i=t.get("FontDescriptor"))})}else t&&t.has("FontDescriptor")&&(i=t.get("FontDescriptor"));if(i&&i.has("FontFile2")){var n=i.get("FontFile2");if(n instanceof nn&&n.length>0)e=n.getByteRange(n.start,n.end);else if(n.stream instanceof nn&&n.stream.length>0&&n.dictionary&&(n.dictionary.has("Length1")||n.dictionary.has("Length"))){var s=n.dictionary.get(n.dictionary.has("Length1")?"Length1":"Length");n.getBytes(s),e=n.buffer.subarray(0,s)}}return e}function Bt(t,e){return t.length===e.length&&t.every(function(t,i){return u(t,e[i])})}function Ot(t,e){e&&(t._bounds={x:e[0],y:e[1],width:e[2],height:e[3]});var i;if(t._page&&t.bounds){if(i=[t.bounds.x,t.bounds.y+t.bounds.height,t.bounds.width,t.bounds.height],t._page._isNew&&t._page._pageSettings){var r=t._page._pageSettings,n=[r.margins.left,r.margins.top,r.size[0]-(r.margins.left+r.margins.right),r.size[1]-(r.margins.top+r.margins.bottom)];i[0]+=n[0],i[1]=r.size[1]-(n[1]+i[1])}else{var s=t._page.size;i[1]=s[1]-(t.bounds.y+t.bounds.height);var a=t._getCropOrMediaBox();a&&a.length>2&&(0!==a[0]||0!==a[1])&&(i[0]+=a[0],i[1]+=a[1])}return[i[0],i[1],i[0]+i[2],i[1]+i[3]]}return i}function It(t,e,i){if(t&&"string"==typeof t&&!e&&!i&&t.startsWith("þÿ")){(t=t.substring(2)).endsWith("ÿý")&&(t=t.substring(0,t.length-2));for(var r=p(t,!1,!0),n=[],s=0;s<r.length;s+=2)n.push(r[s]<<8|r[s+1]);t=String.fromCharCode.apply(String,n)}return t}function Mt(t){return t<=4294967295?t<=65535?t<=255?1:2:t<=16777215?3:4:8}function Nt(t){for(var e=[],i=0;i<t.length;i++){var r=t.charCodeAt(i);r<=65535&&(e.push(r>>8&255),e.push(255&r))}return e}function Et(e,i){switch(i){case t.PdfNumberStyle.none:return"";case t.PdfNumberStyle.numeric:return e.toString();case t.PdfNumberStyle.lowerLatin:return Vt(e).toLowerCase();case t.PdfNumberStyle.lowerRoman:return jt(e).toLowerCase();case t.PdfNumberStyle.upperLatin:return Vt(e);case t.PdfNumberStyle.upperRoman:return jt(e)}}function jt(t){for(var e="",i=0,r=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];i<r.length;i++)for(var n=r[i],s=n[0],a=n[1];t>=s;)e+=a,t-=s;return e}function Vt(t){for(var e="";t>0;){var i=t%26;t=Math.floor(t/26),0===i&&(t--,i=26),e=zt(i)+e}return e}function zt(t){if(t<=0||t>26)throw new Error("Value can not be less 0 and greater 26");return String.fromCharCode(64+t)}function Ut(t){return null!==t&&void 0!==t}function Wt(t,e,i,r){return void 0===r&&(r=!1),Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}function Ht(t,i){void 0===i&&(i=!1);for(var r=t.getString(),n=[],s=0;s<r.length;s++)n.push(r.charCodeAt(s));var a=new Uint8Array(n),o=new e.CompressedStreamWriter;if(o.write(a,0,a.length),o.close(),r=o.getCompressedString,t.dictionary.update("Filter",Xr.get("FlateDecode")),i){for(var h=[],s=0;s<r.length;s++)h.push(255&r.charCodeAt(s));return w(new Uint8Array(h))}return r}function Gt(t){return/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/.test(t)}function Kt(t,e){if(t.update("Count",t.get("Count")+e),t.has("Parent")){var i=t.get("Parent");i&&"Pages"===i.get("Type").name&&Kt(i,e)}}function Xt(t,e){var i=[0,0,e.size[0],e.size[1]];t.update("MediaBox",i),t.update("CropBox",i);var r=90*Math.floor(e.rotation);r>=360&&(r%=360),t.update("Rotate",r)}function qt(t){var e=/[^\x00-\x7F]/;return t.split("").some(function(t){return null!==e.exec(t)})}function Qt(t,e){var i;return e&&e.forEach(function(e,r){if(r&&r.objectNumber){var n=t._crossReference._fetch(r);n&&n.forEach(function(t,e){if(e&&e instanceof Xr&&"FontDescriptor"===e.name){var r=void 0;n&&n.has("FontFile2")?(r=n.get("FontFile2"))&&r instanceof rn&&(i=r.getBytes()):n&&n.has("FontFile3")&&(r=n.get("FontFile3"))&&r instanceof rn&&(i=r.getBytes())}})}}),i}function Jt(t){if(null===t||void 0===t)throw new Error("ArgumentNullException: value");for(var e=0;e<t.length;e++)if(t.charCodeAt(e)>127)return!0;return!1}function Yt(t){if(t>="0"&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);if(t>="A"&&t<="F")return t.charCodeAt(0)-"A".charCodeAt(0)+10;if(t>="a"&&t<="f")return t.charCodeAt(0)-"a".charCodeAt(0)+10;throw new Error("Invalid hex character: "+t)}function Zt(t){for(var e=[],i=t.length,r=0;r<i;++r){var n=t[r];if("#"===n){var s=Yt(t[r+1]),a=Yt(t[r+2]);n=String.fromCharCode((s<<4)+a),r+=2}e.push(n)}return e.join("")}function $t(e,i){e.style===t.PdfBorderStyle.dashed&&(i.borderPen._dashStyle=t.PdfDashStyle.dash,i.borderPen._dashPattern=[3])}function te(){Hr=Object.create(null),Gr=Object.create(null),Kr=Object.create(null)}function ee(t,e){return t instanceof Xr&&(void 0===e||t.name===e)}function ie(t,e){return t instanceof qr&&(void 0===e||t.command===e)}!function(t){t[t.default=0]="default",t[t.invisible=1]="invisible",t[t.hidden=2]="hidden",t[t.print=4]="print",t[t.noZoom=8]="noZoom",t[t.noRotate=16]="noRotate",t[t.noView=32]="noView",t[t.readOnly=64]="readOnly",t[t.locked=128]="locked",t[t.toggleNoView=256]="toggleNoView"}(t.PdfAnnotationFlag||(t.PdfAnnotationFlag={})),function(t){t[t.none=0]="none",t[t.openArrow=1]="openArrow",t[t.closedArrow=2]="closedArrow",t[t.rOpenArrow=3]="rOpenArrow",t[t.rClosedArrow=4]="rClosedArrow",t[t.butt=5]="butt",t[t.diamond=6]="diamond",t[t.circle=7]="circle",t[t.square=8]="square",t[t.slash=9]="slash"}(t.PdfLineEndingStyle||(t.PdfLineEndingStyle={})),function(t){t[t.lineArrow=0]="lineArrow",t[t.lineDimension=1]="lineDimension"}(t.PdfLineIntent||(t.PdfLineIntent={})),function(t){t[t.start=0]="start",t[t.line=1]="line",t[t.bezier=3]="bezier",t[t.pathTypeMask=7]="pathTypeMask",t[t.dashMode=16]="dashMode",t[t.pathMarker=32]="pathMarker",t[t.closePath=128]="closePath"}(t.PathPointType||(t.PathPointType={})),function(t){t[t.inline=0]="inline",t[t.top=1]="top"}(t.PdfLineCaptionType||(t.PdfLineCaptionType={})),function(t){t[t.solid=0]="solid",t[t.dashed=1]="dashed",t[t.beveled=2]="beveled",t[t.inset=3]="inset",t[t.underline=4]="underline",t[t.dot=5]="dot"}(t.PdfBorderStyle||(t.PdfBorderStyle={})),function(t){t[t.solid=0]="solid",t[t.cloudy=1]="cloudy"}(t.PdfBorderEffectStyle||(t.PdfBorderEffectStyle={})),function(t){t[t.angle0=0]="angle0",t[t.angle90=1]="angle90",t[t.angle180=2]="angle180",t[t.angle270=3]="angle270"}(t.PdfRotationAngle||(t.PdfRotationAngle={})),function(t){t[t.table=0]="table",t[t.stream=1]="stream"}(t.PdfCrossReferenceType||(t.PdfCrossReferenceType={})),function(t){t[t.noHighlighting=0]="noHighlighting",t[t.invert=1]="invert",t[t.outline=2]="outline",t[t.push=3]="push"}(t.PdfHighlightMode||(t.PdfHighlightMode={})),function(t){t[t.left=0]="left",t[t.center=1]="center",t[t.right=2]="right",t[t.justify=3]="justify"}(t.PdfTextAlignment||(t.PdfTextAlignment={})),function(t){t[t.visible=0]="visible",t[t.hidden=1]="hidden",t[t.visibleNotPrintable=2]="visibleNotPrintable",t[t.hiddenPrintable=3]="hiddenPrintable"}(t.PdfFormFieldVisibility||(t.PdfFormFieldVisibility={})),function(t){t[t.inch=0]="inch",t[t.pica=1]="pica",t[t.point=3]="point",t[t.centimeter=4]="centimeter",t[t.millimeter=6]="millimeter"}(t.PdfMeasurementUnit||(t.PdfMeasurementUnit={})),function(t){t[t.diameter=0]="diameter",t[t.radius=1]="radius"}(t.PdfCircleMeasurementType||(t.PdfCircleMeasurementType={})),function(t){t[t.approved=0]="approved",t[t.asIs=1]="asIs",t[t.confidential=2]="confidential",t[t.departmental=3]="departmental",t[t.draft=4]="draft",t[t.experimental=5]="experimental",t[t.expired=6]="expired",t[t.final=7]="final",t[t.forComment=8]="forComment",t[t.forPublicRelease=9]="forPublicRelease",t[t.notApproved=10]="notApproved",t[t.notForPublicRelease=11]="notForPublicRelease",t[t.sold=12]="sold",t[t.topSecret=13]="topSecret",t[t.completed=14]="completed",t[t.void=15]="void",t[t.informationOnly=16]="informationOnly",t[t.preliminaryResults=17]="preliminaryResults"}(t.PdfRubberStampAnnotationIcon||(t.PdfRubberStampAnnotationIcon={})),function(t){t[t.check=0]="check",t[t.circle=1]="circle",t[t.cross=2]="cross",t[t.diamond=3]="diamond",t[t.square=4]="square",t[t.star=5]="star"}(t.PdfCheckBoxStyle||(t.PdfCheckBoxStyle={})),function(t){t[t.highlight=0]="highlight",t[t.underline=1]="underline",t[t.squiggly=2]="squiggly",t[t.strikeOut=3]="strikeOut"}(t.PdfTextMarkupAnnotationType||(t.PdfTextMarkupAnnotationType={})),function(t){t[t.note=0]="note",t[t.comment=1]="comment",t[t.help=2]="help",t[t.insert=3]="insert",t[t.key=4]="key",t[t.newParagraph=5]="newParagraph",t[t.paragraph=6]="paragraph"}(t.PdfPopupIcon||(t.PdfPopupIcon={})),function(t){t[t.none=0]="none",t[t.accepted=1]="accepted",t[t.rejected=2]="rejected",t[t.cancel=3]="cancel",t[t.completed=4]="completed",t[t.marked=5]="marked",t[t.unmarked=6]="unmarked",t[t.unknown=7]="unknown"}(t.PdfAnnotationState||(t.PdfAnnotationState={})),function(t){t[t.none=0]="none",t[t.marked=1]="marked",t[t.review=2]="review"}(t.PdfAnnotationStateModel||(t.PdfAnnotationStateModel={})),function(t){t[t.pushPin=0]="pushPin",t[t.tag=1]="tag",t[t.graph=2]="graph",t[t.paperClip=3]="paperClip"}(t.PdfAttachmentIcon||(t.PdfAttachmentIcon={})),function(t){t[t.none=0]="none",t[t.freeTextCallout=1]="freeTextCallout",t[t.freeTextTypeWriter=2]="freeTextTypeWriter"}(t.PdfAnnotationIntent||(t.PdfAnnotationIntent={})),function(t){t[t.location=0]="location",t[t.fitToPage=1]="fitToPage",t[t.fitR=2]="fitR",t[t.fitH=3]="fitH"}(t.PdfDestinationMode||(t.PdfDestinationMode={})),function(t){t[t.fdf=0]="fdf",t[t.xfdf=1]="xfdf",t[t.json=2]="json",t[t.xml=3]="xml"}(t.DataFormat||(t.DataFormat={})),function(t){t[t.none=0]="none",t[t.row=1]="row",t[t.column=2]="column",t[t.structure=3]="structure",t[t.manual=4]="manual",t[t.widget=5]="widget"}(t.PdfFormFieldsTabOrder||(t.PdfFormFieldsTabOrder={})),function(t){t[t.highlight=0]="highlight",t[t.underline=1]="underline",t[t.strikeOut=2]="strikeOut",t[t.squiggly=3]="squiggly",t[t.redactionAnnotation=4]="redactionAnnotation",t[t.textAnnotation=5]="textAnnotation",t[t.linkAnnotation=6]="linkAnnotation",t[t.documentLinkAnnotation=7]="documentLinkAnnotation",t[t.uriAnnotation=8]="uriAnnotation",t[t.fileLinkAnnotation=9]="fileLinkAnnotation",t[t.freeTextAnnotation=10]="freeTextAnnotation",t[t.lineAnnotation=11]="lineAnnotation",t[t.circleAnnotation=12]="circleAnnotation",t[t.ellipseAnnotation=13]="ellipseAnnotation",t[t.squareAnnotation=14]="squareAnnotation",t[t.rectangleAnnotation=15]="rectangleAnnotation",t[t.polygonAnnotation=16]="polygonAnnotation",t[t.polyLineAnnotation=17]="polyLineAnnotation",t[t.textMarkupAnnotation=18]="textMarkupAnnotation",t[t.caretAnnotation=19]="caretAnnotation",t[t.rubberStampAnnotation=20]="rubberStampAnnotation",t[t.popupAnnotation=21]="popupAnnotation",t[t.fileAttachmentAnnotation=22]="fileAttachmentAnnotation",t[t.soundAnnotation=23]="soundAnnotation",t[t.movieAnnotation=24]="movieAnnotation",t[t.screenAnnotation=25]="screenAnnotation",t[t.widgetAnnotation=26]="widgetAnnotation",t[t.printerMarkAnnotation=27]="printerMarkAnnotation",t[t.trapNetworkAnnotation=28]="trapNetworkAnnotation",t[t.watermarkAnnotation=29]="watermarkAnnotation",t[t.textWebLinkAnnotation=30]="textWebLinkAnnotation",t[t.inkAnnotation=31]="inkAnnotation",t[t.richMediaAnnotation=32]="richMediaAnnotation",t[t.angleMeasurementAnnotation=33]="angleMeasurementAnnotation",t[t.null=34]="null"}(t._PdfAnnotationType||(t._PdfAnnotationType={})),function(t){t[t.centimeter=0]="centimeter",t[t.pica=1]="pica",t[t.pixel=2]="pixel",t[t.point=3]="point",t[t.inch=4]="inch",t[t.document=5]="document",t[t.millimeter=6]="millimeter"}(t._PdfGraphicsUnit||(t._PdfGraphicsUnit={})),function(t){t[t.default=0]="default",t[t.readOnly=1]="readOnly",t[t.required=2]="required",t[t.noExport=4]="noExport",t[t.multiLine=4096]="multiLine",t[t.password=8192]="password",t[t.fileSelect=1048576]="fileSelect",t[t.doNotSpellCheck=4194304]="doNotSpellCheck",t[t.doNotScroll=8388608]="doNotScroll",t[t.comb=16777216]="comb",t[t.richText=33554432]="richText",t[t.noToggleToOff=16384]="noToggleToOff",t[t.radio=32768]="radio",t[t.pushButton=65536]="pushButton",t[t.radiosInUnison=33554432]="radiosInUnison",t[t.combo=131072]="combo",t[t.edit=262144]="edit",t[t.sort=524288]="sort",t[t.multiSelect=2097152]="multiSelect",t[t.commitOnSelectChange=67108864]="commitOnSelectChange"}(t._FieldFlag||(t._FieldFlag={})),function(t){t[t.none=0]="none",t[t.signatureExists=1]="signatureExists",t[t.appendOnly=2]="appendOnly"}(t._SignatureFlag||(t._SignatureFlag={})),function(t){t[t.unchecked=0]="unchecked",t[t.checked=1]="checked",t[t.pressedUnchecked=2]="pressedUnchecked",t[t.pressedChecked=3]="pressedChecked"}(t._PdfCheckFieldState||(t._PdfCheckFieldState={})),function(t){t[t.default=0]="default",t[t.print=4]="print",t[t.editContent=8]="editContent",t[t.copyContent=16]="copyContent",t[t.editAnnotations=32]="editAnnotations",t[t.fillFields=256]="fillFields",t[t.accessibilityCopyContent=512]="accessibilityCopyContent",t[t.assembleDocument=1024]="assembleDocument",t[t.fullQualityPrint=2048]="fullQualityPrint"}(t.PdfPermissionFlag||(t.PdfPermissionFlag={})),function(t){t[t.portrait=0]="portrait",t[t.landscape=1]="landscape"}(t.PdfPageOrientation||(t.PdfPageOrientation={})),function(t){t[t.none=0]="none",t[t.leftToRight=1]="leftToRight",t[t.rightToLeft=2]="rightToLeft"}(t.PdfTextDirection||(t.PdfTextDirection={})),function(t){t[t.none=0]="none",t[t.superScript=1]="superScript",t[t.subScript=2]="subScript"}(t.PdfSubSuperScript||(t.PdfSubSuperScript={})),function(t){t[t.normal=0]="normal",t[t.multiply=1]="multiply",t[t.screen=2]="screen",t[t.overlay=3]="overlay",t[t.darken=4]="darken",t[t.lighten=5]="lighten",t[t.colorDodge=6]="colorDodge",t[t.colorBurn=7]="colorBurn",t[t.hardLight=8]="hardLight",t[t.softLight=9]="softLight",t[t.difference=10]="difference",t[t.exclusion=11]="exclusion",t[t.hue=12]="hue",t[t.saturation=13]="saturation",t[t.color=14]="color",t[t.luminosity=15]="luminosity"}(t.PdfBlendMode||(t.PdfBlendMode={})),function(t){t[t.winding=0]="winding",t[t.alternate=1]="alternate"}(t.PdfFillMode||(t.PdfFillMode={})),function(t){t[t.solid=0]="solid",t[t.dash=1]="dash",t[t.dot=2]="dot",t[t.dashDot=3]="dashDot",t[t.dashDotDot=4]="dashDotDot",t[t.custom=5]="custom"}(t.PdfDashStyle||(t.PdfDashStyle={})),function(t){t[t.flat=0]="flat",t[t.round=1]="round",t[t.square=2]="square"}(t.PdfLineCap||(t.PdfLineCap={})),function(t){t[t.miter=0]="miter",t[t.round=1]="round",t[t.bevel=2]="bevel"}(t.PdfLineJoin||(t.PdfLineJoin={})),function(t){t[t.none=0]="none",t[t.word=1]="word",t[t.wordOnly=2]="wordOnly",t[t.character=3]="character"}(t._PdfWordWrapType||(t._PdfWordWrapType={})),function(t){t[t.fixedPitch=1]="fixedPitch",t[t.serif=2]="serif",t[t.symbolic=4]="symbolic",t[t.script=8]="script",t[t.nonSymbolic=32]="nonSymbolic",t[t.italic=64]="italic",t[t.forceBold=262144]="forceBold"}(t._FontDescriptorFlag||(t._FontDescriptorFlag={})),function(t){t[t.apple=0]="apple",t[t.microsoft=4]="microsoft",t[t.trimmed=6]="trimmed"}(t._TrueTypeCmapFormat||(t._TrueTypeCmapFormat={})),function(t){t[t.unknown=0]="unknown",t[t.symbol=1]="symbol",t[t.unicode=2]="unicode",t[t.macintosh=3]="macintosh"}(t._TrueTypeCmapEncoding||(t._TrueTypeCmapEncoding={})),function(t){t[t.appleUnicode=0]="appleUnicode",t[t.macintosh=1]="macintosh",t[t.iSO=2]="iSO",t[t.microsoft=3]="microsoft"}(t._TrueTypePlatformID||(t._TrueTypePlatformID={})),function(t){t[t.undefined=0]="undefined",t[t.unicode=1]="unicode"}(t._TrueTypeMicrosoftEncodingID||(t._TrueTypeMicrosoftEncodingID={})),function(t){t[t.roman=0]="roman",t[t.japanese=1]="japanese",t[t.chinese=2]="chinese"}(t._TrueTypeMacintoshEncodingID||(t._TrueTypeMacintoshEncodingID={})),function(t){t[t.Arg1And2AreWords=1]="Arg1And2AreWords",t[t.ArgsAreXyValues=2]="ArgsAreXyValues",t[t.RoundXyToGrid=4]="RoundXyToGrid",t[t.WeHaveScale=8]="WeHaveScale",t[t.Reserved=16]="Reserved",t[t.MoreComponents=32]="MoreComponents",t[t.WeHaveAnXyScale=64]="WeHaveAnXyScale",t[t.WeHaveTwoByTwo=128]="WeHaveTwoByTwo",t[t.WeHaveInstructions=256]="WeHaveInstructions",t[t.UseMyMetrics=512]="UseMyMetrics"}(t._TrueTypeCompositeGlyphFlag||(t._TrueTypeCompositeGlyphFlag={})),function(t){t[t.unknown=0]="unknown",t[t.bmp=1]="bmp",t[t.emf=2]="emf",t[t.gif=3]="gif",t[t.jpeg=4]="jpeg",t[t.png=5]="png",t[t.wmf=6]="wmf",t[t.icon=7]="icon"}(t._ImageFormat||(t._ImageFormat={})),function(t){t[t.none=0]="none",t[t.comment=1]="comment",t[t.number=2]="number",t[t.real=3]="real",t[t.string=4]="string",t[t.hexString=5]="hexString",t[t.unicodeString=6]="unicodeString",t[t.unicodeHexString=7]="unicodeHexString",t[t.name=8]="name",t[t.operator=9]="operator",t[t.beginArray=10]="beginArray",t[t.endArray=11]="endArray",t[t.eof=12]="eof"}(t._TokenType||(t._TokenType={})),function(t){t[t.regular=0]="regular",t[t.italic=1]="italic",t[t.bold=2]="bold"}(t.PdfTextStyle||(t.PdfTextStyle={})),function(t){t[t.rgb=0]="rgb",t[t.cmyk=1]="cmyk",t[t.grayScale=2]="grayScale",t[t.indexed=3]="indexed"}(t._PdfColorSpace||(t._PdfColorSpace={})),function(t){t[t.none=0]="none",t[t.numeric=1]="numeric",t[t.lowerLatin=2]="lowerLatin",t[t.lowerRoman=3]="lowerRoman",t[t.upperLatin=4]="upperLatin",t[t.upperRoman=5]="upperRoman"}(t.PdfNumberStyle||(t.PdfNumberStyle={})),function(t){t[t.none=0]="none",t[t.disk=1]="disk",t[t.square=2]="square",t[t.asterisk=3]="asterisk",t[t.circle=4]="circle"}(t.PdfUnorderedListStyle||(t.PdfUnorderedListStyle={})),function(t){t[t.paginate=0]="paginate",t[t.onePage=1]="onePage"}(t.PdfLayoutType||(t.PdfLayoutType={})),function(t){t[t.fitPage=0]="fitPage",t[t.fitElement=1]="fitElement"}(t.PdfLayoutBreakType||(t.PdfLayoutBreakType={})),function(t){t[t.left=0]="left",t[t.right=1]="right"}(t.PdfListMarkerAlignment||(t.PdfListMarkerAlignment={})),function(t){t[t.alwaysPrint=0]="alwaysPrint",t[t.neverPrint=1]="neverPrint",t[t.printWhenVisible=2]="printWhenVisible"}(t.PdfPrintState||(t.PdfPrintState={}));var re=function(){function t(t){void 0===t&&(t=!1),this._position=0,this._bufferText="",this._buffer=new Uint8Array(0),this._namespaceStack=[],this._elementStack=[],t?(this._currentState="StartDocument",this._skipNamespace=!0):(this._currentState="Initial",this._namespaceStack.push(new ne),this._elementStack.push(new se),this._namespaceStack[0]._set("xmlns","http://www.w3.org/2000/xmlns/","Special"),this._namespaceStack.push(new ne),this._namespaceStack[1]._set("xml","http://www.w3.org/XML/1998/namespace","Special"),this._namespaceStack.push(new ne),this._namespaceStack[2]._set("","","Implied"),this._elementStack[0]._set("","","",this._namespaceStack.length-1)),this._attributeStack=[]}return Object.defineProperty(t.prototype,"buffer",{get:function(){return this._flush(),this._buffer},enumerable:!0,configurable:!0}),t.prototype._writeStartDocument=function(t){if("Initial"!==this._currentState||void 0===this._buffer)throw new Error("InvalidOperationException: Wrong Token");this._currentState="StartDocument",this._rawText('<?xml version="1.0" encoding="utf-8'),void 0!==t&&null!==t&&(this._rawText('" standalone="'),this._rawText(t?"yes":"no")),this._rawText('"?>')},t.prototype._writeStartElement=function(t,e,i){if(void 0===this._buffer)throw new Error("InvalidOperationException: Wrong Token");if(void 0===t||null===t||0===t.length)throw new Error("ArgumentException: localName cannot be undefined, null or empty");if(this._checkName(t),"Initial"===this._currentState&&this._writeStartDocument(),"StartElement"===this._currentState&&this._startElementContent(),this._currentState="StartElement",void 0===e||null===e)void 0!==i&&null!==i&&(e=this._lookupPrefix(i)),void 0!==e&&null!==e||(e="");else if(e.length>0&&(void 0!==i&&null!==i||(i=this._lookupNamespace(e)),void 0===i||null===i||void 0!==i&&0===i.length))throw new Error("ArgumentException: Cannot use a prefix with an empty namespace");void 0!==i&&null!==i||(i=this._lookupNamespace(e)),this._writeStartElementInternal(e,t,i)},t.prototype._writeEndElement=function(){"StartElement"===this._currentState?(this._startElementContent(),this._currentState="ElementContent"):"ElementContent"===this._currentState&&(this._currentState="ElementContent"),this._currentState="EndElement";var t=this._elementStack.length-1;this._writeEndElementInternal(this._elementStack[t]._prefix,this._elementStack[t]._localName),this._namespaceStack.splice(this._elementStack[t]._previousTop+1),this._elementStack.splice(t)},t.prototype._writeElementString=function(t,e,i,r){this._writeStartElement(t,i,r),void 0!==e&&null!==e&&0!==e.length&&this._writeString(e),this._writeEndElement()},t.prototype._writeAttributeString=function(t,e,i,r){this._writeStartAttribute(t,e,i,r),this._writeStringInternal(e,!0),this._writeEndAttribute()},t.prototype._writeString=function(t){this._writeInternal(t,!1)},t.prototype._writeRaw=function(t){this._writeInternal(t,!0)},t.prototype._writeInternal=function(t,e){if(null!==t&&void 0!==t){if("StartElement"!==this._currentState&&"ElementContent"!==this._currentState)throw new Error("InvalidOperationException: Wrong Token");"StartElement"===this._currentState&&this._startElementContent(),this._currentState="ElementContent",e?this._rawText(t):this._writeStringInternal(t,!1)}},t.prototype._save=function(){for(;this._elementStack.length-1>0;)this._writeEndElement();return""!==this._bufferText&&this._flush(),this._buffer},t.prototype._destroy=function(){this._buffer=void 0;for(t=0;t<this._namespaceStack.length;t++)this._namespaceStack[t]._destroy();this._namespaceStack=[];for(var t=0;t<this._elementStack.length;t++)this._elementStack[t]._destroy();this._elementStack=[],this._bufferText="",this._position=0},t.prototype._flush=function(){if(this._buffer&&this._bufferText&&""!==this._bufferText){if(this._buffer.length>0){for(var t=new Array(this._bufferText.length),e=0;e<this._bufferText.length;e++)t[e]=255&this._bufferText.charCodeAt(e);var i=new Uint8Array(this._buffer.length+t.length);i.set(this._buffer),i.set(t,this._buffer.length),this._buffer=i}else this._buffer=p(this._bufferText);this._bufferText=""}},t.prototype._writeStartAttribute=function(t,e,i,r){if(void 0===t||null===t||0===t.length){if("xmlns"!==i)throw new Error("ArgumentException: localName cannot be undefined, null or empty");t="xmlns",i=""}if("StartElement"!==this._currentState)throw new Error("InvalidOperationException: Wrong Token");this._checkName(t),this._writeStartAttributePrefixAndNameSpace(t,e,i,r)},t.prototype._writeStartAttributePrefixAndNameSpace=function(t,e,i,r){void 0!==i&&null!==i||(void 0!==r&&null!==r&&("xmlns"===t&&"http://www.w3.org/2000/xmlns/"===r||(i=this._lookupPrefix(r))),void 0!==i&&null!==i||(i="")),void 0!==r&&null!==r||(void 0!==i&&null!==i&&i.length>0&&(r=this._lookupNamespace(i)),void 0!==r&&null!==r||(r="")),this._writeStartAttributeSpecialAttribute(i,t,r,e)},t.prototype._writeStartAttributeSpecialAttribute=function(t,e,i,r){if(0===t.length){if("x"===e[0]&&"xmlns"===e)return this._skipPushAndWrite(t,e,i),void this._pushNamespaceExplicit("",r);i.length>0&&(t=this._lookupPrefix(i))}else{if("x"===t[0]){if("xmlns"===t)return this._skipPushAndWrite(t,e,i),void this._pushNamespaceExplicit(e,r);if("xml"===t&&("space"===e||"lang"===e))return void this._skipPushAndWrite(t,e,i)}0===i.length&&(t="")}void 0!==t&&null!==t&&0!==t.length&&this._pushNamespaceImplicit(t,i),this._skipPushAndWrite(t,e,i)},t.prototype._writeEndAttribute=function(){this._currentState="StartElement",this._bufferText+='"'},t.prototype._writeStartElementInternal=function(t,e,i){this._bufferText+="<",t.length>0&&(this._rawText(t),this._bufferText+=":"),this._rawText(e);var r=this._elementStack.length;this._elementStack.push(new se),this._elementStack[r]._set(t,e,i,this._namespaceStack.length-1),this._pushNamespaceImplicit(t,i);for(var n=0;n<this._attributeStack.length;n++)this._attributeStack[n]._destroy();this._attributeStack=[]},t.prototype._writeEndElementInternal=function(t,e){this._position!==this._bufferText.length+1?(this._bufferText+="</",void 0!==t&&null!==t&&0!==t.length&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+=">"):(this._bufferText=this._bufferText.substring(0,this._bufferText.length-1),this._bufferText+=" />")},t.prototype._writeStartAttributeInternal=function(t,e){this._bufferText+=" ",void 0!==t&&null!==t&&t.length>0&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+='="'},t.prototype._writeNamespaceDeclaration=function(t,e){this._skipNamespace||(this._writeStartNamespaceDeclaration(t),this._writeStringInternal(e,!0),this._bufferText+='"')},t.prototype._writeStartNamespaceDeclaration=function(t){void 0===t||null===t||0===t.length?this._rawText(' xmlns="'):(this._rawText(" xmlns:"),this._rawText(t),this._bufferText+="=",this._bufferText+='"')},t.prototype._writeStringInternal=function(t,e){void 0!==t&&null!==t||(t=""),t=(t=(t=(t=t.replace(/\&/g,"&")).replace(/\</g,"<")).replace(/\>/g,">")).replace(/\u0000/g,""),e&&(t=t.replace(/\"/g,""")),this._bufferText+=t,e||(this._position=0)},t.prototype._startElementContent=function(){for(var t=this._elementStack[this._elementStack.length-1]._previousTop,e=this._namespaceStack.length-1;e>t;e--)"NeedToWrite"===this._namespaceStack[e]._kind&&this._writeNamespaceDeclaration(this._namespaceStack[e]._prefix,this._namespaceStack[e]._namespaceUri);this._bufferText+=">",this._position=this._bufferText.length+1},t.prototype._rawText=function(t){this._bufferText+=t},t.prototype._addNamespace=function(t,e,i){var r=this._namespaceStack.length;this._namespaceStack.push(new ne),this._namespaceStack[r]._set(t,e,i)},t.prototype._lookupPrefix=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[e]._namespaceUri===t)return this._namespaceStack[e]._prefix},t.prototype._lookupNamespace=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[e]._prefix===t)return this._namespaceStack[e]._namespaceUri},t.prototype._lookupNamespaceIndex=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[e]._prefix===t)return e;return-1},t.prototype._pushNamespaceImplicit=function(t,e){var i,r=this._lookupNamespaceIndex(t),n=!0;if(-1!==r)if(r>this._elementStack[this._elementStack.length-1]._previousTop){if(this._namespaceStack[r]._namespaceUri!==e)throw new Error("XmlException namespace Uri needs to be the same as the one that is already declared");n=!1}else if("Special"===this._namespaceStack[r]._kind){if("xml"!==t)throw new Error('InvalidArgumentException: Prefix "xmlns" is reserved for use by XML.');if(e!==this._namespaceStack[r]._namespaceUri)throw new Error("InvalidArgumentException: Xml String");i="Implied"}else i=this._namespaceStack[r]._namespaceUri===e?"Implied":"NeedToWrite";else{if("http://www.w3.org/XML/1998/namespace"===e&&"xml"!==t||"http://www.w3.org/2000/xmlns/"===e&&"xmlns"!==t)throw new Error("InvalidArgumentException");i="NeedToWrite"}n&&this._addNamespace(t,e,i)},t.prototype._pushNamespaceExplicit=function(t,e){var i=this._lookupNamespaceIndex(t);if(-1!==i&&i>this._elementStack[this._elementStack.length-1]._previousTop)return void(this._namespaceStack[i]._kind="Written");this._addNamespace(t,e,"Written")},t.prototype._addAttribute=function(t,e,i){var r=this._attributeStack.length;this._attributeStack.push(new ae),this._attributeStack[r]._set(t,e,i);for(var n=0;n<r;n++)if(this._attributeStack[n]._isDuplicate(t,e,i))throw new Error("XmlException: duplicate attribute name")},t.prototype._skipPushAndWrite=function(t,e,i){this._addAttribute(t,e,i),this._writeStartAttributeInternal(t,e)},t.prototype._checkName=function(t){if(/[ !@#$%^&*()+\=\[\]{};':"\\|,<>\/?]/.test(t))throw new Error("InvalidArgumentException: invalid name character")},t}(),ne=function(){function t(){}return t.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=e,this._kind=i},t.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._kind=void 0},t}(),se=function(){function t(){}return t.prototype._set=function(t,e,i,r){this._previousTop=r,this._prefix=t,this._namespaceUri=i,this._localName=e},t.prototype._destroy=function(){this._previousTop=void 0,this._prefix=void 0,this._localName=void 0,this._namespaceUri=void 0},t}(),ae=function(){function t(){}return t.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=i,this._localName=e},t.prototype._isDuplicate=function(t,e,i){return this._localName===e&&(this._prefix===t||this._namespaceUri===i)},t.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._localName=void 0},t}(),oe=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),he=function(){function t(){this._asPerSpecification=!1,this._fileName="",this._formKey="",this._exportEmptyFields=!1,this._groupReferences=new Map,this._groupHolders=[],this._richTextPrefix='<?xml version="1.0"?>',this._table=new Map,this._fields=new Map,this._richTextValues=new Map,this._jsonData=[],this._openingBrace=123,this._openingBracket=91,this._closingBrace=125,this._closingBracket=93,this._colon=58,this._doubleQuotes=34,this._comma=44,this._space=32,this.fdfString="",this._xmlImport=!1}return t.prototype._exportFormFieldsData=function(t){var e="";if(null!==t&&void 0!==t&&t.export){var i=R(t._dictionary,"FT",!1,!0);if(i&&null!==i.name&&void 0!==i.name){var r=this._getEncodedFontDictionary(t._dictionary),n=t.name;null!==r&&void 0!==r&&(n=this._getEncodedValue(n,r));var s=void 0,a=void 0;switch(i.name){case"Tx":null!==(e=R(t._dictionary,"V",!1,!0))&&void 0!==e?(e=this._getEncodedValue(e,r),this._table.set(n,e)):this._exportEmptyFields&&(e="",this._table.set(n,e));break;case"Ch":if(null!==(s=R(t._dictionary,"V",!0,!0))&&void 0!==s&&(a=this._getExportValue(s)),!s&&t._dictionary.has("I")&&(t instanceof vi||t instanceof bi)&&(a=t._obtainSelectedValue()),null!==a&&void 0!==a){if("string"==typeof a&&""!==a)e=a=this._getEncodedValue(a,r),this._table.set(n,e);else if(a instanceof Array&&a.length>0){for(var o=[],h=0;h<a.length;h++)o.push(this._getEncodedValue(a[h],r));return this._table.set(n,o),o}}else this._exportEmptyFields&&(e="",this._table.set(n,e));break;case"Btn":if(null!==(s=R(t._dictionary,"V",!1,!0))&&void 0!==s){var c=this._getExportValue(s,t);if(null!==c&&void 0!==c&&""!==c){var _=void 0;if(t instanceof yi&&(_=t),!t._dictionary.has("Opt")||null!==_&&void 0!==_&&-1===_.selectedIndex)e=c=this._getEncodedValue(c,r),this._table.set(n,e);else if(t._dictionary.has("Opt")){var d=t._dictionary.getArray("Opt"),l=Number(c);if((null===l||void 0===l||Number.isNaN(l))&&(l=0),null!==d&&void 0!==d){var f=void 0;null!==(f=_?d[_.selectedIndex]:d[l])&&void 0!==f&&(c=f),null!==c&&void 0!==c&&""!==c&&(e=c=this._getEncodedValue(c,r),this._table.set(n,e))}}}else(t instanceof yi||t instanceof gi)&&(e=this._exportEmptyFields?c:"Off",this._table.set(n,e))}else if(t instanceof yi)(e=t._getAppearanceStateValue())||(e=this._exportEmptyFields?"":"Off"),this._table.set(n,e);else{var p=t.itemAt(t._defaultIndex),u=void 0;(u=p?p._dictionary:t._dictionary)&&u.has("AS")?(e=u.get("AS").name,this._table.set(n,e)):this._exportEmptyFields&&(e="",this._table.set(n,e))}}}}return e},t.prototype._exportFormFieldData=function(t){var e=R(t._dictionary,"FT",!1,!0);if(e&&null!==e.name&&void 0!==e.name){var i=this._getEncodedFontDictionary(t._dictionary),r=t.name;null!==i&&void 0!==i&&(r=this._getEncodedValue(r,i));var n=void 0,s=void 0;switch(e.name){case"Tx":if(n=R(t._dictionary,"V",!1,!0),this._asPerSpecification){if(t._dictionary.has("RV"))null!==(n=R(t._dictionary,"RV",!1,!0))&&void 0!==n&&(n+=this._key,this._formKey=this._key,this._table.set(r,n));else if(null!==n&&void 0!==n){var a=n=this._getEncodedValue(n,i);t instanceof pi&&t.multiLine&&(n=a=(a=a.replace("\n","")).replace("\r","\r\n")),this._table.set(r,n)}}else null!==n&&void 0!==n?(n=this._getEncodedValue(n,i),this._table.set(r,n)):this._exportEmptyFields&&this._table.set(r,"");break;case"Ch":if(s=R(t._dictionary,"V",!0,!0),this._asPerSpecification){if(t instanceof mi)if(Array.isArray(s))this._table.set(r,s);else if("string"==typeof s)s=this._getEncodedValue(s,i),this._table.set(r,s);else if((null===s||void 0===s)&&t._dictionary.has("I")&&null!==(c=t._obtainSelectedValue())&&void 0!==c)if("string"==typeof c&&""!==c)c=this._getEncodedValue(c,i),this._table.set(r,n);else if(c instanceof Array&&c.length>0){for(var o=[],h=0;h<c.length;h++)o.push(this._getEncodedValue(c[h],i));this._table.set(r,o)}}else{var c=void 0;if(null!==s&&void 0!==s&&(c=this._getExportValue(s)),!s&&t._dictionary.has("I")&&(t instanceof vi||t instanceof bi)&&(c=t._obtainSelectedValue()),null!==c&&void 0!==c)if("string"==typeof c&&""!==c)c=this._getEncodedValue(c,i),this._table.set(r,c);else if(c instanceof Array&&c.length>0){for(var o=[],h=0;h<c.length;h++)o.push(this._getEncodedValue(c[h],i));this._table.set(r,o)}else this._exportEmptyFields&&this._table.set(r,"");else this._exportEmptyFields&&this._table.set(r,"")}break;case"Btn":if(null!==(s=R(t._dictionary,"V",!1,!0))&&void 0!==s)if(null!==(p=this._getExportValue(s,t))&&void 0!==p&&""!==p){this._asPerSpecification&&"XML"!==this._format&&(p=P(p));var _=void 0;if(t instanceof yi&&(_=t),!t._dictionary.has("Opt")||null!==_&&void 0!==_&&-1===_.selectedIndex)p=this._getEncodedValue(p,i),this._table.set(r,p);else if(t._dictionary.has("Opt")){var d=t._dictionary.getArray("Opt"),l=Number(p);if((null===l||void 0===l||Number.isNaN(l))&&(l=0),null!==d&&void 0!==d){var f=void 0;null!==(f=_?d[_.selectedIndex]:d[l])&&void 0!==f&&(p=f),null!==p&&void 0!==p&&""!==p&&(p=this._getEncodedValue(p,i),this._table.set(r,p))}}}else(t instanceof yi||t instanceof gi)&&(this._exportEmptyFields?this._table.set(r,p):this._table.set(r,"Off"));else if(t instanceof yi){var p=t._getAppearanceStateValue();p||(p=this._exportEmptyFields?"":"Off"),this._table.set(r,p)}else{var u=t.itemAt(t._defaultIndex),g=void 0;(g=u?u._dictionary:t._dictionary)&&g.has("AS")?this._table.set(r,g.get("AS").name):this._exportEmptyFields&&this._table.set(r,"")}}}},t.prototype._getAnnotationType=function(t){var e="";if(t&&t.has("Subtype")){var i=t.get("Subtype");i&&(e=i.name)}return e},t.prototype._getValue=function(t,e){void 0===e&&(e=!1);var i="";if(void 0!==t&&null!==t)if(t instanceof Xr)i=t.name;else if("boolean"==typeof t)i=t?e?"true":"yes":e?"false":"no";else if("string"==typeof t)i=this._getValidString(t);else if(Array.isArray(t)){var r=t;r.length>0&&(i=this._getValue(r[0],e));for(var n=1;n<r.length;n++)i+=","+this._getValue(r[n],e)}else"number"==typeof t?i=t.toString():t instanceof Qr&&(i=this._getValue(this._crossReference._fetch(t),e));return i},t.prototype._getColor=function(t){var e="";if(t&&Array.isArray(t)&&t.length>=3){var i=Math.round(255*t[0]).toString(16).toUpperCase(),r=Math.round(255*t[1]).toString(16).toUpperCase(),n=Math.round(255*t[2]).toString(16).toUpperCase();e="#"+(1===i.length?"0"+i:i)+(1===r.length?"0"+r:r)+(1===n.length?"0"+n:n)}return e},t.prototype._getValidString=function(t){return-1!==t.indexOf("\n")&&(t=t.replace(/\n/g,"\\n")),-1!==t.indexOf("\r")&&(t=t.replace(/\r/g,"\\r")),t},t.prototype._getEncodedFontDictionary=function(t){var e,i;if(t.has("Kids")&&!t.has("AP")&&(i=t.getArray("Kids")),t.has("AP")||null!==i&&void 0!==i&&Array.isArray(i)){var r=void 0;if(null!==i&&void 0!==i&&i.length>0){var n=i[0];null!==n&&void 0!==n&&n.has("AP")&&(r=n.get("AP"))}else r=t.get("AP");if(null!==r&&void 0!==r&&r.has("N")){var s=r.get("N");if(null!==s&&void 0!==s&&s instanceof rn&&s.dictionary.has("Resources")){var a=s.dictionary.get("Resources");null!==a&&void 0!==a&&a.has("Font")&&(e=a.get("Font"))}}}return e},t.prototype._getEncodedValue=function(t,e){var i,r=this,n=t;if(null!==this._encodeDictionary&&void 0!==this._encodeDictionary)return i=new _e(this._encodeDictionary),this._replaceNotUsedCharacters(n,i);var s=this._document.form._dictionary;if(null!==s&&void 0!==s&&s.has("DR")){var a=s.get("DR");if(null!==a&&void 0!==a&&a.has("Encoding")){var o=a.get("Encoding");if(null!==o&&void 0!==o&&o.has("PDFDocEncoding")){var h=o.get("PDFDocEncoding");if(null!==h&&void 0!==h&&h.has("Differences")){var c=new $r(this._crossReference);c.set("Differences",h.get("Differences"));var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,c);var d=new $r(this._crossReference);if(d.set("Subtype",Xr.get("Type1")),d.set("Encoding",_),null!==(i=new _e(d))&&void 0!==i&&null!==i.differencesDictionary&&void 0!==i.differencesDictionary&&i.differencesDictionary.size>0)return this._encodeDictionary=d,this._replaceNotUsedCharacters(n,i)}}}}if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e.size>0){var l,f=!1;if(e.forEach(function(t,e){if(!f&&null!==e&&void 0!==e){var s=void 0;if(e instanceof $r)s=e;else if(e instanceof Qr){var a=r._crossReference._fetch(e);null!==a&&void 0!==a&&a instanceof $r&&(s=a)}s&&(i=new _e(s),l=r._replaceNotUsedCharacters(n,i),f=!0)}}),!f)return l}return n},t.prototype._replaceNotUsedCharacters=function(t,e){for(var i="",r=e.differencesDictionary,n=0;n<t.length;n++){var s=t[n],a=t.charCodeAt(n);if(r.has(s)){var o=r.get(s);o.length>1&&"Type3"!==e._fontType||a>127&&a<=255&&"Type1"===e._fontType&&"WinAnsiEncoding"!==e._baseFontEncoding&&"Encoding"===e._fontEncoding&&"ZapfDingbats"===e._fontName?i+=s:i+=o}else i+=s}return i},t.prototype._getExportValue=function(t,e){var i;if(null!==t&&void 0!==t)if(null!==e&&void 0!==e){if(t instanceof Xr?i=t.name:"string"==typeof t&&(i=t),null!==i&&void 0!==i&&""!==i&&e instanceof yi&&-1!==e.selectedIndex){var r=e.itemAt(e.selectedIndex);null!==r&&void 0!==r&&r.value===i&&(i=r.value)}}else if(t instanceof Xr)i=t.name;else if("string"==typeof t)i=t;else if(Array.isArray(t)){var n=[];return t.forEach(function(t){t instanceof Xr?n.push(t.name):"string"==typeof t&&n.push(t)}),n}return i},t.prototype._addReferenceToGroup=function(t,e){var i=e.get("NM");i&&""!==i?(this._groupReferences.set(i,t),e.has("IRT")&&this._groupHolders.push(e)):!i&&e.has("IRT")&&(i=e.get("IRT"))&&""!==i&&this._groupReferences.has(i)&&e.update("IRT",this._groupReferences.get(i))},t.prototype._handlePopup=function(t,e,i,r){if(i&&i.has("Popup")){var n=i.getRaw("Popup"),s=i.get("Popup");if(s&&s instanceof $r){n&&s&&s.update("Parent",e);var a=t._parseAnnotation(s),o=t._annotations.length;r.set("Annots",t._annotations),r._updated=!0,t._parsedAnnotations.set(o,a)}}},t.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._fields.forEach(function(r,n){var s;t._richTextValues.size>0&&t._richTextValues.has(n)&&(s=t._richTextValues.get(n));var a=e._getFieldIndex(n);if(-1!==a&&a<i){var o=e.fieldAt(a);o&&null!==o&&void 0!==o&&(s&&""!==s&&o._dictionary.update("RV",s),t._importFieldData(o,r))}})},t.prototype._importFieldData=function(t,e){if(null!==e&&void 0!==e&&e.length>0&&null!==t&&void 0!==t&&!t.readOnly){var i=e[0];if(t instanceof pi)null!==i&&void 0!==i&&(t instanceof pi&&t.multiLine&&(i=(i=i.replace("\r\n","\r")).replace("\n","\r")),t.text=i);else if(t instanceof vi||t instanceof bi){var r;r=e.length>1?e:this._xmlImport?-1!==i.indexOf(",")?i.split(","):[i]:[-1!==i.indexOf(",")?i.split(",")[0]:i];var n=[],s=t._options;s&&s.length>0&&s.forEach(function(t){-1===r.indexOf(t[0])&&-1===r.indexOf(t[1])||n.push(s.indexOf(t))}),n.length>0&&(t.selectedIndex=n,t instanceof bi&&this._asPerSpecification&&t._dictionary.has("AP")&&(delete t._dictionary._map.AP,t._dictionary._updated=!0))}else if(t instanceof gi){var a=i.toLowerCase();this._containsExportValue(i,t)||"on"===a||"yes"===a?t.checked=!0:t.checked=!1}else if(t instanceof yi){for(var o=-1,h=0;h<t._kidsCount;h++){var c=t.itemAt(h);if(c&&c.value&&c.value===i){o=h;break}}-1!==o&&t.selectedIndex!==o&&(t.selectedIndex=o)}}},t.prototype._containsExportValue=function(t,e){var i=!1;if(e._kidsCount>0)for(var r=0;r<e._kidsCount;r++){var n=e.itemAt(r);if(n&&this._checkSelected(n._dictionary,t))return!0}else if(!(i=this._checkSelected(e._dictionary,t))&&this._asPerSpecification&&e._dictionary.has("AS")){var s=e._dictionary.get("AS");if(!s||"Off"!==s.name&&"No"!==s.name)i=!0;else if(e._dictionary.has("Opt")){var a=e._dictionary.getArray("Opt");a&&a.length>0&&a.forEach(function(e){e===t&&(i=!0)})}}return i},t.prototype._checkSelected=function(t,e){if(t&&t.has("AP")){var i=t.get("AP");if(i&&i instanceof $r&&i.has("N")){var r=i.get("N");if(r&&r instanceof $r&&r.has(e)&&"off"!==e.toLocaleLowerCase()&&"no"!==e.toLocaleLowerCase())return!0}}return!1},t.prototype._dispose=function(){this.exportAppearance=void 0,this._asPerSpecification=void 0,this._skipBorderStyle=void 0,this._fileName=void 0,this._document=void 0,this._crossReference=void 0,this._isAnnotationExport=void 0,this._isAnnotationImport=void 0,this._key=void 0,this._formKey=void 0,this._exportEmptyFields=void 0,this._groupReferences=void 0,this._groupHolders=void 0,this._encodeDictionary=void 0,this._annotationTypes=void 0,this._annotationAttributes=void 0,this._xmlDocument=void 0,this._parser=void 0,this._table=void 0,this._fields=void 0,this._richTextValues=void 0,this._jsonData=void 0},t}(),ce=function(e){function i(t){var i=e.call(this)||this;return null!==t&&void 0!==t&&(i._fileName=t),i}return oe(i,e),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._save()},i.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=X(),this._save()},i.prototype._save=function(){var t=new re;if(t._writeStartDocument(),t._writeStartElement("xfdf"),t._writeAttributeString(null,"http://ns.adobe.com/xfdf/","xmlns",null),t._writeAttributeString("space","preserve","xml",null),this._isAnnotationExport){if(t._writeStartElement("annots"),this._document)for(a=0;a<this._document.pageCount;a++)for(var e=this._document.getPage(a).annotations,i=0;i<e.count;i++){var r=e.at(i);r instanceof Mi&&r._dictionary.has("Parent")||r&&(!this._annotationTypes||0===this._annotationTypes.length||this._annotationTypes&&this._annotationTypes.length>0&&this._checkAnnotationType(r))&&this._exportAnnotationData(r,t,a)}t._writeEndElement()}else{var n=this._document.form;if(null!==n&&void 0!==n){this._exportEmptyFields=n.exportEmptyFields;for(var s=this._document.form.count,a=0;a<s;a++){var o=this._document.form.fieldAt(a);null!==o&&void 0!==o&&o.export&&this._exportFormFieldData(o)}this._writeFormFieldData(t,this._asPerSpecification)}}this._asPerSpecification||(t._writeStartElement("f"),t._writeAttributeString("href",this._fileName));var h=t._save();return t._destroy(),h},i.prototype._writeFormFieldData=function(t,e){var i=this;if(void 0===e&&(e=!1),e){t._writeStartElement("f"),t._writeAttributeString("href",this._fileName),t._writeEndElement();var r=this._getElements(this._table);if(r&&r.size>0){t._writeStartElement("fields");var n=!1;r.forEach(function(e,r){if(t._writeStartElement("field"),t._writeAttributeString("name",r.toString()),Array.isArray(e)&&e.forEach(function(e){t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement(),n=!0}),e instanceof Map)i._writeFieldName(e,t);else if(!n&&!e.toString().endsWith(i._formKey)||!n&&""===i._formKey)t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement();else if(""!==i._formKey&&e.toString().endsWith(i._formKey)){t._writeStartElement("value-richtext");var s=e.toString();s.startsWith('<?xml version="1.0"?>')&&(s=s.substring(21));var a=s.length-i._formKey.length;s=s.substring(0,a)+s.substring(a+i._formKey.length),t._writeRaw(s),t._writeEndElement()}t._writeEndElement(),n=!1}),t._writeEndElement()}t._writeStartElement("ids");var s=!1;if(this._crossReference._root.has("ID")){var a=this._crossReference._root.getArray("ID");a&&a.length>=1&&(t._writeAttributeString("original",a[0]),t._writeAttributeString("modified",a[1]),s=!0)}s||(t._writeAttributeString("original",""),t._writeAttributeString("modified","")),t._writeEndElement()}else t._writeStartElement("fields"),this._table.forEach(function(e,i){t._writeStartElement("field"),t._writeAttributeString("name",i.toString()),Array.isArray(e)?e.forEach(function(e){t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement()}):(t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement()),t._writeEndElement()}),t._writeEndElement()},i.prototype._writeFieldName=function(t,e){var i=this;t.forEach(function(t,r){if(t instanceof Map)e._writeStartElement("field"),e._writeAttributeString("name",r.toString()),i._writeFieldName(t,e),e._writeEndElement();else{if(e._writeStartElement("field"),e._writeAttributeString("name",r.toString()),Array.isArray(t))t.forEach(function(t){e._writeStartElement("value"),e._writeString(t.toString()),e._writeEndElement()});else{if(t.toString().endsWith(i._formKey)&&""!==i._formKey){e._writeStartElement("value-richtext");var n=t.toString();n.startsWith('<?xml version="1.0"?>')&&(n=n.substring(21));var s=n.length-i._formKey.length;n=n.substring(0,s)+n.substring(s+i._formKey.length),e._writeRaw(n)}else e._writeStartElement("value"),e._writeString(t.toString());e._writeEndElement()}e._writeEndElement()}})},i.prototype._getElements=function(t){var e=this,i=new Map;return t.forEach(function(t,r){var n=i;if(-1!==r.toString().indexOf(".")){var s=r.toString().split(".");s.forEach(function(i,r){if(n.has(i))e._getElements(n[i]),n=n[i];else if(r===s.length-1)n.set(i,t);else{var a=new Map;n.set(i,a),n=a}})}else n.set(r,t)}),i},i.prototype._checkAnnotationType=function(t){return void 0!==t._type&&-1!==this._annotationTypes.indexOf(t._type)},i.prototype._exportAnnotationData=function(t,e,i){t._dictionary&&!(t instanceof Ni||t instanceof Vi||t instanceof ji||t instanceof Ei||t instanceof Ui)&&this._writeAnnotationData(e,i,t)},i.prototype._writeAnnotationData=function(t,e,i){var r,n,s=!1;i instanceof xi?(r=i,n=i._dictionary):n=i;var a=this._getAnnotationType(n);if(this._skipBorderStyle=!1,a&&""!==a){this._annotationAttributes=[],t._writeStartElement(a.toLowerCase()),t._writeAttributeString("page",e.toString()),this._annotationAttributes.push("page");var o=void 0;switch(a){case"Line":o=r.linePoints,t._writeAttributeString("start",o[0].toString()+","+o[1].toString()),t._writeAttributeString("end",o[2].toString()+","+o[3].toString());break;case"Stamp":case"Square":s=!0}if(n&&n.has("BE")&&n.has("BS")){var h=n.get("BE");h&&h.has("S")&&(this._skipBorderStyle=!0)}this._writeDictionary(n,e,t,s),t._writeEndElement(),this._annotationAttributes=[]}},i.prototype._writeDictionary=function(t,e,i,r){var n=this,s=!1;if(t.has("Type")){var a=t.get("Type");s=a&&"Border"===a.name&&this._skipBorderStyle}if(t.forEach(function(a,o){if((r||"AP"!==a)&&"P"!==a&&"Parent"!==a&&"Measure"!==a&&"Popup"!==a&&-1===a.indexOf(":")){var h=void 0;if((h=o instanceof Qr?t.get(a):o)&&h instanceof $r)switch(a){case"BS":case"BE":n._writeDictionary(h,e,i,!1);break;case"IRT":h.has("NM")&&i._writeAttributeString("inreplyto",n._getValue(h.get("NM")));break;default:n._writeDictionary(h,e,i,!1)}else(!s||s&&"S"!==a)&&n._writeAttribute(i,a,h)}}),(this.exportAppearance||r)&&t.has("AP")){var o=this._getAppearanceString(t.get("AP"));o&&o.length>0&&(i._writeStartElement("appearance"),i._writeRaw(T(o)),i._writeEndElement())}if(t.has("Measure")&&this._exportMeasureDictionary(t.get("Measure"),i),t.has("Sound")){var h=t.get("Sound");if(h&&h.dictionary){var c=h.dictionary;c.has("B")&&i._writeAttributeString("bits",this._getValue(c.get("B"))),c.has("C")&&i._writeAttributeString("channels",this._getValue(c.get("C"))),c.has("E")&&i._writeAttributeString("encoding",this._getValue(c.get("E"))),c.has("R")&&i._writeAttributeString("rate",this._getValue(c.get("R"))),c.has("Length")&&c.get("Length")>0&&(y=w(h.getBytes()))&&""!==y&&(i._writeStartElement("data"),i._writeAttributeString("MODE","raw"),i._writeAttributeString("encoding","hex"),c.has("Length")&&i._writeAttributeString("length",this._getValue(c.get("Length"))),c.has("Filter")&&i._writeAttributeString("filter",this._getValue(c.get("Filter"))),i._writeRaw(y),i._writeEndElement())}}else if(t.has("FS")){i._writeStartElement("data");var _=t.get("FS");if(_&&(_.has("F")&&i._writeAttributeString("file",this._getValue(_.get("F"))),_.has("EF"))){var d=_.get("EF");if(d&&d.has("F")){var l=d.get("F");if(l&&l.dictionary){var f=l.dictionary;if(f.has("Params")){var u=f.get("Params");if(u){if(u.has("CreationDate")){v=this._getValue(u.get("CreationDate"));i._writeAttributeString("creation",v)}if(u.has("ModificationDate")){v=this._getValue(u.get("ModificationDate"));i._writeAttributeString("modification",v)}if(u.has("Size")&&i._writeAttributeString("size",this._getValue(u.get("Size"))),u.has("CheckSum")){var g=w(p(v=this._getValue(u.get("CheckSum"))));i._writeAttributeString("checksum",g)}}}var y=w(l.getBytes());y&&""!==y&&(i._writeStartElement("data"),i._writeAttributeString("MODE","raw"),i._writeAttributeString("encoding","hex"),f.has("Length")&&i._writeAttributeString("length",this._getValue(f.get("Length"))),f.has("Filter")&&i._writeAttributeString("filter",this._getValue(f.get("Filter"))),i._writeRaw(y),i._writeEndElement())}}}i._writeEndElement()}if(t.has("Vertices")){i._writeStartElement("vertices");var m=t.getArray("Vertices");if(m&&m.length>0){var b=m.length;if(b%2==0){for(var v="",S=0;S<b-1;S++)v+=this._getValue(m[S])+(S%2!=0?";":",");(v+=this._getValue(m[b-1]))&&""!==v&&i._writeRaw(v)}}i._writeEndElement()}if(t.has("Popup")){var P=t.get("Popup");P&&this._writeAnnotationData(i,e,P)}if(t.has("DA")){var A=t.get("DA");A&&this._writeRawData(i,"defaultappearance",A)}if(t.has("DS")){var x=t.get("DS");x&&this._writeRawData(i,"defaultstyle",x)}if(t.has("InkList")){var k=t.getArray("InkList");if(k&&k.length>0){i._writeStartElement("inklist");for(var C=0;C<k.length;C++)i._writeElementString("gesture",this._getValue(k[C]));i._writeEndElement()}}if(t.has("RC")&&(v=t.get("RC"))&&""!==v){var R=v.indexOf("<body");R>0&&(v=v.substring(R)),this._writeRawData(i,"contents-richtext",v)}t.has("Contents")&&(v=t.get("Contents"))&&v.length>0&&(i._writeStartElement("contents"),i._writeString(v),i._writeEndElement())},i.prototype._getAppearanceString=function(t){var e=new re(!0);e._writeStartElement("DICT"),e._writeAttributeString("KEY","AP"),this._writeAppearanceDictionary(e,t),e._writeEndElement();var i=e.buffer;return e._destroy(),i},i.prototype._writeAppearanceDictionary=function(t,e){var i=this;e&&e.size>0&&e.forEach(function(r,n){i._writeObject(t,n instanceof Qr?e.get(r):n,e,r)})},i.prototype._writeObject=function(t,e,i,r,n){if(null!==e&&void 0!==e)if(e instanceof Xr)this._writePrefix(t,"NAME",r),t._writeAttributeString("VAL",e.name),t._writeEndElement();else if(Array.isArray(e))this._writePrefix(t,"ARRAY",r),i.has(r)?this._writeArray(t,i.getArray(r),i):this._writeArray(t,e,i),t._writeEndElement();else if("string"==typeof e)this._writePrefix(t,"STRING",r),t._writeAttributeString("VAL",e),t._writeEndElement();else if("number"==typeof e)Number.isInteger(e)?(this._writePrefix(t,"INT",r),t._writeAttributeString("VAL",e.toString())):(this._writePrefix(t,"FIXED",r),t._writeAttributeString("VAL",e.toFixed(6))),t._writeEndElement();else if("boolean"==typeof e)this._writePrefix(t,"BOOL",r),t._writeAttributeString("VAL",e?"true":"false"),t._writeEndElement();else if(e instanceof $r)this._writePrefix(t,"DICT",r),this._writeAppearanceDictionary(t,e),t._writeEndElement();else if(null===e)this._writePrefix(t,"NULL",r),t._writeEndElement();else if(e instanceof rn&&e.dictionary){var s=e.dictionary;if(this._writePrefix(t,"STREAM",r),t._writeAttributeString("DEFINE",""),s.has("Subtype")&&("Image"===this._getValue(s.get("Subtype"))||"Form"===this._getValue(s.get("Subtype")))||!s.has("Type")&&!s.has("Subtype")&&"ToUnicode"!==r){a=void 0;a=n?s.has("Filter")&&"DCTDecode"===s.get("Filter").name||s.has("Subtype")&&"Form"===s.get("Subtype").name?e.getString(!0):Ht(e,!0):e.getString(!0),!s.has("Length")&&a&&""!==a&&s.update("Length",e.length),this._writeAppearanceDictionary(t,s),t._writeStartElement("DATA"),t._writeAttributeString("MODE","RAW"),t._writeAttributeString("ENCODING","HEX"),a&&""!==a&&t._writeRaw(a)}else{var a=e.getString();!s.has("Length")&&a&&""!==a&&s.update("Length",e.length),a=(a=a.replace(/</g,"<")).replace(/>/g,">"),this._writeAppearanceDictionary(t,s),t._writeStartElement("DATA"),t._writeAttributeString("MODE","FILTERED"),t._writeAttributeString("ENCODING","ASCII"),a&&""!==a&&t._writeRaw(a)}t._writeEndElement(),t._writeEndElement()}else e instanceof Qr&&this._crossReference&&this._writeObject(t,this._crossReference._fetch(e),i,r,e._isNew)},i.prototype._writePrefix=function(t,e,i){t._writeStartElement(e),i&&t._writeAttributeString("KEY",i)},i.prototype._writeArray=function(t,e,i){var r=this;e.forEach(function(e){r._writeObject(t,e,i)})},i.prototype._getFormatedString=function(t,e){return void 0===e&&(e=!1),t=e?(t=(t=t.replace("&","&")).replace("<","<")).replace(">",">"):(t=(t=t.replace("&","&")).replace("<","<")).replace(">",">")},i.prototype._writeAttribute=function(t,e,i){var r;if(this._annotationAttributes&&-1===this._annotationAttributes.indexOf(e))switch(e){case"C":this._writeColor(t,i,"color","c");break;case"IC":this._writeColor(t,i,"interior-color");break;case"M":this._writeAttributeString(t,"date",i);break;case"NM":this._writeAttributeString(t,"name",i);break;case"Name":this._writeAttributeString(t,"icon",i);break;case"Subj":this._writeAttributeString(t,"subject",i);break;case"T":this._writeAttributeString(t,"title",i);break;case"Rotate":this._writeAttributeString(t,"rotation",i);break;case"W":this._writeAttributeString(t,"width",i);break;case"LE":i&&Array.isArray(i)?2===i.length&&(t._writeAttributeString("head",this._getValue(i[0])),t._writeAttributeString("tail",this._getValue(i[1]))):i instanceof Xr&&this._writeAttributeString(t,"head",i);break;case"S":if(-1===this._annotationAttributes.indexOf("style")){switch(this._getValue(i)){case"D":t._writeAttributeString("style","dash");break;case"C":t._writeAttributeString("style","cloudy");break;case"S":t._writeAttributeString("style","solid");break;case"B":t._writeAttributeString("style","bevelled");break;case"I":t._writeAttributeString("style","inset");break;case"U":t._writeAttributeString("style","underline")}this._annotationAttributes.push("style")}break;case"D":this._writeAttributeString(t,"dashes",i);break;case"I":this._writeAttributeString(t,"intensity",i);break;case"RD":this._writeAttributeString(t,"fringe",i);break;case"IT":this._writeAttributeString(t,"IT",i);break;case"RT":this._writeAttributeString(t,"replyType",i,!0);break;case"LL":this._writeAttributeString(t,"leaderLength",i);break;case"LLE":this._writeAttributeString(t,"leaderExtend",i);break;case"Cap":this._writeAttributeString(t,"caption",i);break;case"Q":this._writeAttributeString(t,"justification",i);break;case"CP":this._writeAttributeString(t,"caption-style",i);break;case"CL":this._writeAttributeString(t,"callout",i);break;case"QuadPoints":this._writeAttributeString(t,"coords",i);break;case"CA":this._writeAttributeString(t,"opacity",i);break;case"F":if("number"==typeof i&&-1===this._annotationAttributes.indexOf("flags")){var n=d(i);t._writeAttributeString("flags",n),this._annotationAttributes.push("flags")}break;case"InkList":case"Type":case"Subtype":case"P":case"Parent":case"L":case"Contents":case"RC":case"DA":case"DS":case"FS":case"MeasurementTypes":case"Vertices":case"GroupNesting":case"ITEx":break;case"TextMarkupContent":r=p(i),this._writeAttributeString(t,e.toLowerCase(),w(r));break;default:this._writeAttributeString(t,e.toLowerCase(),i)}},i.prototype._writeAttributeString=function(t,e,i,r){if(void 0===r&&(r=!1),-1===this._annotationAttributes.indexOf(e)){var n=this._getValue(i);t._writeAttributeString(e,r?n.toLowerCase():n),this._annotationAttributes.push(e)}},i.prototype._writeRawData=function(t,e,i){i&&""!==i&&(t._writeStartElement(e),t._writeRaw(i),t._writeEndElement())},i.prototype._writeColor=function(t,e,i,r){var n=this._getColor(e);if("number"==typeof e&&r){var s=this._getValue(e);s&&""!==s&&-1===this._annotationAttributes.indexOf(r)&&(t._writeAttributeString(r,s),this._annotationAttributes.push(r))}n&&""!==n&&-1===this._annotationAttributes.indexOf(i)&&(t._writeAttributeString(i,n),this._annotationAttributes.push(i))},i.prototype._exportMeasureDictionary=function(t,e){if(e._writeStartElement("measure"),t){if(t.has("R")&&e._writeAttributeString("rateValue",this._getValue(t.get("R"))),t.has("A")){i=t.getArray("A");e._writeStartElement("area"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}if(t.has("D")){i=t.getArray("D");e._writeStartElement("distance"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}if(t.has("X")){var i=t.getArray("X");e._writeStartElement("xformat"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}}e._writeEndElement()},i.prototype._exportMeasureFormatDetails=function(t,e){t.has("C")&&e._writeAttributeString("c",this._getValue(t.get("C"))),t.has("F")&&e._writeAttributeString("f",this._getValue(t.get("F"))),t.has("D")&&e._writeAttributeString("d",this._getValue(t.get("D"))),t.has("RD")&&e._writeAttributeString("rd",this._getValue(t.get("RD"))),t.has("U")&&e._writeAttributeString("u",this._getValue(t.get("U"))),t.has("RT")&&e._writeAttributeString("rt",this._getValue(t.get("RT"))),t.has("SS")&&e._writeAttributeString("ss",this._getValue(t.get("SS"))),t.has("FD")&&e._writeAttributeString("fd",this._getValue(t.get("FD")))},i.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var i=m(e,!0);this._xmlDocument=(new DOMParser).parseFromString(i,"text/xml"),this._isAnnotationImport=!0,this._readXmlData(this._xmlDocument.documentElement)},i.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._xmlDocument=(new DOMParser).parseFromString(m(e,!0),"text/xml"),this._readXmlData(this._xmlDocument.documentElement)},i.prototype._readXmlData=function(t){var e=this;if(t&&1===t.nodeType)if(this._checkXfdf(t),this._isAnnotationImport){var i=t.getElementsByTagName("annots");if(i&&i.length>0)for(var r=0;r<i.length;r++){var n=i.item(r);if(n&&"annots"===n.localName&&n.hasChildNodes())for(var s=n.childNodes,a=0;a<s.length;a++){var o=s.item(a);if(o&&1===o.nodeType){var h=o;h&&1===h.nodeType&&this._parseAnnotationData(h)}}}this._groupHolders.length>0&&this._groupHolders.forEach(function(t){var i=t.get("IRT");i&&""!==i&&(e._groupReferences.has(i)?t.update("IRT",e._groupReferences.get(i)):delete t._map.IRT)}),this._groupHolders=[],this._groupReferences=new Map}else this._parseFormData(t);this._dispose()},i.prototype._checkXfdf=function(t){if("xfdf"!==t.nodeName)throw new Error("Invalid XFDF file.")},i.prototype._parseFormData=function(t){var e=t.getElementsByTagName("f");if(e&&e.length>0){var i=e.item(0);if(i&&"f"===i.localName&&i.hasAttribute("href")){var r=i.getAttribute("href");r&&""!==r&&(this._fileName=r)}}(e=t.getElementsByTagName("ids"))&&e.length>0&&(this._asPerSpecification=!0);var n=t.childNodes;if(n&&n.length>0)for(var s=0;s<n.length;s++){var a=n.item(s);if(a&&1===a.nodeType){var o=a;if(o&&"fields"===o.localName&&o.hasChildNodes()){for(var h=o.childNodes,c=[],_=0;_<h.length;_++){var d=h.item(_);if(d&&1===d.nodeType){var l=d;l&&"field"===l.localName&&c.push(l)}}this._importFormNodes(c)}}}this._importField()},i.prototype._importFormNodes=function(t){var e=this;t.forEach(function(t){var i="";if(t&&(t.hasAttribute("name")&&(i=t.getAttribute("name")),i&&""!==i)){var r=t.getElementsByTagName("value");if(r&&r.length>0){for(var n=t,s="";"fields"!==n.localName;){s.length>0&&(s="."+s);h=!1;if(n.hasAttribute("name")){var a=n.getAttribute("name");a&&""!==a&&(s=a+s,h=!0)}h||(s+=n.localName),n=n.parentElement}i=s;p=void 0;p=e._fields.has(i)?e._fields.get(i):[];for(f=0;f<r.length;f++)p.push(r.item(f).textContent);e._fields.set(i,p)}else if((r=t.getElementsByTagName("value-richtext"))&&r.length>0){var o=r.item(0);if(o){for(var n=t,s="";"fields"!==n.localName;){s.length>0&&(s="."+s);var h=!1;if(n.hasAttribute("name")){var c=n.getAttribute("name");c&&""!==c&&(s=c+s,h=!0)}h||(s+=n.localName),n=n.parentElement}i=s;var _=o.textContent;if(o.childNodes&&o.childNodes.length>0){var d=o.childNodes[0];if(d&&d.hasChildNodes()){_="";for(var l=d.childNodes,f=void 0;f<l.length;f++)_+=l.item(f).textContent+"\r";_=_.length>0?_.substring(0,_.length-1):o.textContent}}var p=void 0;p=e._fields.has(i)?e._fields.get(i):[];for(f=0;f<r.length;f++)p.push(_);e._fields.set(i,p),e._richTextValues.has(i)||e._richTextValues.set(i,o.innerHTML)}}}})},i.prototype._parseAnnotationData=function(t){if(t){var e=-1;if(t.hasAttributes&&t.hasAttribute("page")&&(e=Number(t.getAttribute("page")))>=0&&e<this._document.pageCount){var i=this._document.getPage(e),r=this._getAnnotationDictionary(i,t);if(r&&r.size>0){var n=i._pageDictionary;if(n){var s=i.annotations,a=s._parseAnnotation(r);if(a){a._isImported=!0;var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,r),(r.has("NM")||r.has("IRT"))&&this._addReferenceToGroup(o,r),a._ref=o;var h=s._annotations.length;s._annotations.push(o),r.has("Popup")&&s._annotations.push(r.getRaw("Popup")),s._comments&&s._comments.length>0&&(s._comments=[]),n.set("Annots",s._annotations),n._updated=!0,s._parsedAnnotations.set(h,a),this._handlePopup(s,o,r,n)}}}}}},i.prototype._getAnnotationDictionary=function(t,e){var i=new $r(this._crossReference);i.update("Type",Xr.get("Annot"));var r=!0;switch(e.localName.toLowerCase()){case"line":if(i.update("Subtype",Xr.get("Line")),e.hasAttribute("start")&&e.hasAttribute("end")){var n=e.getAttribute("start").split(",").map(function(t){return Number.parseFloat(t)}).concat(e.getAttribute("end").split(",").map(function(t){return Number.parseFloat(t)}));4===n.length&&i.update("L",n)}this._addLineEndStyle(i,e);break;case"circle":i.update("Subtype",Xr.get("Circle"));break;case"square":i.update("Subtype",Xr.get("Square"));break;case"polyline":i.update("Subtype",Xr.get("PolyLine")),this._addLineEndStyle(i,e);break;case"polygon":i.update("Subtype",Xr.get("Polygon")),this._addLineEndStyle(i,e);break;case"ink":i.update("Subtype",Xr.get("Ink"));break;case"popup":i.update("Subtype",Xr.get("Popup"));break;case"text":i.update("Subtype",Xr.get("Text"));break;case"freetext":i.update("Subtype",Xr.get("FreeText")),this._addLineEndStyle(i,e);break;case"stamp":i.update("Subtype",Xr.get("Stamp"));break;case"highlight":i.update("Subtype",Xr.get("Highlight"));break;case"squiggly":i.update("Subtype",Xr.get("Squiggly"));break;case"underline":i.update("Subtype",Xr.get("Underline"));break;case"strikeout":i.update("Subtype",Xr.get("StrikeOut"));break;case"fileattachment":i.update("Subtype",Xr.get("FileAttachment"));break;case"sound":i.update("Subtype",Xr.get("Sound"));break;case"caret":i.update("Subtype",Xr.get("Caret"));break;case"redact":i.update("Subtype",Xr.get("Redact"));break;default:r=!1}return r&&this._addAnnotationData(i,e,t),i},i.prototype._addAnnotationData=function(t,e,i){this._addBorderStyle(t,e),this._applyAttributeValues(t,e.attributes),this._parseInnerElements(t,e,i),this._addMeasureDictionary(t,e)},i.prototype._addBorderStyle=function(t,e){var i=new $r(this._crossReference),r=new $r(this._crossReference);e.hasAttribute("width")&&r.update("W",Number.parseFloat(e.getAttribute("width")));var n=!0;if(e.hasAttribute("style")){var s="";switch(e.getAttribute("style")){case"dash":s="D";break;case"solid":s="S";break;case"bevelled":s="B";break;case"inset":s="I";break;case"underline":s="U";break;case"cloudy":s="C",n=!1}if(""!==s)if((n?r:i).update("S",Xr.get(s)),!n&&e.hasAttribute("intensity"))i.update("I",Number.parseFloat(e.getAttribute("intensity")));else if(e.hasAttribute("dashes")){var a=e.getAttribute("dashes").split(",").map(function(t){return Number.parseFloat(t)});r.update("D",a)}}i.size>0&&t.update("BE",i),r.size>0&&(r.update("Type","Border"),t.update("BS",r))},i.prototype._applyAttributeValues=function(e,i){var r=this;Array.from(i).forEach(function(i){var n,s,a=i.value;switch(i.name.toLowerCase()){case"page":case"start":case"end":case"width":case"head":case"tail":case"style":case"intensity":case"itex":break;case"state":r._addString(e,"State",a);break;case"statemodel":r._addString(e,"StateModel",a);break;case"replytype":"group"===a&&e.update("RT",Xr.get("Group"));break;case"inreplyto":r._addString(e,"IRT",a);break;case"rect":(n=r._obtainPoints(a))&&4===n.length&&e.update("Rect",n);break;case"color":(n=I(a))&&3===n.length&&e.update("C",[n[0]/255,n[1]/255,n[2]/255]);break;case"interior-color":(n=I(a))&&3===n.length&&e.update("IC",[n[0]/255,n[1]/255,n[2]/255]);break;case"date":r._addString(e,"M",a);break;case"creationdate":r._addString(e,"CreationDate",a);break;case"name":r._addString(e,"NM",a);break;case"icon":a&&""!==a&&e.update("Name",Xr.get(a));break;case"subject":r._addString(e,"Subj",r._getFormatedString(a,!0));break;case"title":r._addString(e,"T",r._getFormatedString(a,!0));break;case"rotation":r._addInt(e,"Rotate",a);break;case"justification":r._addInt(e,"Q",a);break;case"fringe":r._addFloatPoints(e,r._obtainPoints(a),"RD");break;case"it":a&&""!==a&&e.update("IT",Xr.get(a));break;case"leaderlength":r._addFloat(e,"LL",a);break;case"leaderextend":void 0!==(s=Number.parseFloat(a))&&e.update("LLE",s);break;case"caption":a&&""!==a&&e.update("Cap","yes"===a.toLowerCase());break;case"caption-style":a&&""!==a&&e.update("CP",Xr.get(a));break;case"callout":r._addFloatPoints(e,r._obtainPoints(a),"CL");break;case"coords":r._addFloatPoints(e,r._obtainPoints(a),"QuadPoints");break;case"border":r._addFloatPoints(e,r._obtainPoints(a),"Border");break;case"opacity":r._addFloat(e,"CA",a);break;case"flags":if(a&&""!==a){var o=t.PdfAnnotationFlag.default;a.split(",").forEach(function(t,e){var i=l(t);0===e?o=i:o|=i}),e.update("F",o)}break;case"open":a&&""!==a&&e.update("Open","true"===a||"yes"===a);break;case"calibrate":r._addString(e,"Calibrate",a);break;case"customdata":r._addString(e,"CustomData",a);break;case"overlaytext":e.update("OverlayText",a);break;case"repeat":e.update("Repeat","true"===a||"yes"===a);break;default:r._document._allowImportCustomData&&r._addString(e,i.name,a)}})},i.prototype._obtainPoints=function(t){return t.split(",").map(function(t){return Number.parseFloat(t)})},i.prototype._parseInnerElements=function(t,e,i){var r=this;if(e.hasChildNodes){var n=e.childNodes;Array.from(n).forEach(function(n){if(1===n.nodeType){var s=n,a=n.textContent,o=s.innerHTML;switch(n.nodeName.toLowerCase()){case"popup":if(s&&s.hasAttributes){var h=r._getAnnotationDictionary(i,s);if(h.size>0){var c=r._crossReference._getNextReference();r._crossReference._cacheMap.set(c,h),t.update("Popup",c),h.has("NM")&&r._addReferenceToGroup(c,h)}}break;case"contents":a&&""!==a&&t.update("Contents",r._getFormatedString(a,!0));break;case"contents-richtext":o&&""!==o&&t.update("RC",r._richTextPrefix+o);break;case"defaultstyle":r._addString(t,"DS",a);break;case"defaultappearance":r._addString(t,"DA",a);break;case"vertices":if(a&&""!==a){var _=[];if(a.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){_.push(t)}):_.push(t)}),_.length>0){var d=_.map(function(t){return Number.parseFloat(t)});t.update("Vertices",d)}}break;case"appearance":r._addAppearanceData(n,t);break;case"inklist":if(n.hasChildNodes){var l=[],f=n.childNodes;Array.from(f).forEach(function(t){if(t&&1===t.nodeType){var e=t;if("gesture"===e.nodeName.toLowerCase()&&e.textContent&&""!==e.textContent){var i=[];if(e.textContent.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){i.push(t)}):i.push(t)}),i.length>0){var r=i.map(function(t){return Number.parseFloat(t)});l.push(r)}}}}),t.update("InkList",l)}break;case"data":r._addStreamData(n,t,e)}}})}},i.prototype._addStreamData=function(t,e,i){if(t&&t.textContent&&""!==t.textContent){var r=S(t.textContent,!0);if(r&&r.length>0&&e.has("Subtype")){var n=e.get("Subtype");n&&"FileAttachment"===n.name?this._addFileAttachment(e,i,r):n&&"Sound"===n.name&&this._addSound(e,i,r)}}},i.prototype._addSound=function(t,e,i){var r=new sn(i);if(r.dictionary._crossReference=this._crossReference,r.dictionary.update("Type",Xr.get("Sound")),e.hasAttribute("bits")&&this._addInt(r.dictionary,"B",e.getAttribute("bits")),e.hasAttribute("rate")&&this._addInt(r.dictionary,"R",e.getAttribute("rate")),e.hasAttribute("channels")&&this._addInt(r.dictionary,"C",e.getAttribute("channels")),e.hasAttribute("encoding")){var n=e.getAttribute("encoding");n&&""!==n&&r.dictionary.update("E",Xr.get(n))}e.hasAttribute("filter")&&r.dictionary.update("Filter",Xr.get("FlateDecode"));var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,r),t.update("Sound",s)},i.prototype._addFileAttachment=function(t,e,i){var r=new $r(this._crossReference);if(r.update("Type",Xr.get("Filespec")),e.hasAttribute("file")){var n=e.getAttribute("file");this._addString(r,"F",n),this._addString(r,"UF",n)}var s=new sn(i);s.dictionary._crossReference=this._crossReference;var a=new $r(this._crossReference);if(e.hasAttribute("size")){var o=Number(e.getAttribute("size"));void 0!==o&&(a.update("Size",o),s.dictionary.update("DL",o))}e.hasAttribute("modification")&&this._addString(a,"ModDate",e.getAttribute("modification")),e.hasAttribute("creation")&&this._addString(a,"CreationDate",e.getAttribute("creation")),s.dictionary.update("Params",a),e.hasAttribute("mimetype")&&this._addString(s.dictionary,"Subtype",e.getAttribute("mimetype")),s.dictionary.update("Filter",Xr.get("FlateDecode"));var h=new $r(this._crossReference),c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,s),h.update("F",c),r.update("EF",h);var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,r),t.update("FS",_)},i.prototype._addAppearanceData=function(t,e){var i=this,r=t.textContent;if(r&&""!==r){var n=(new DOMParser).parseFromString(atob(r),"text/xml");if(n&&n.hasChildNodes){var s=n.childNodes;if(s&&1===s.length){var a=s[0];if(a&&1===a.nodeType){var o=a;if("DICT"===o.nodeName.toUpperCase()&&o.hasAttribute("KEY")){var h=o.getAttribute("KEY");if(h&&"AP"===h&&o.hasChildNodes){var c=new $r(this._crossReference);s=o.childNodes,Array.from(s).forEach(function(t){i._getAppearance(c,t)}),c.size>0&&e.update("AP",c)}}}}}}},i.prototype._getAppearance=function(t,e){var i=t instanceof $r?t:t.dictionary;if(e&&1===e.nodeType){var r=e;if(r&&r.localName){var n=void 0,s=void 0,a=void 0;switch(r.localName){case"STREAM":if(n=this._getStream(r)){o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,n),this._addKey(o,i,r)}break;case"DICT":if(s=this._getDictionary(r)){var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,s),this._addKey(o,i,r)}break;case"ARRAY":this._addKey(this._getArray(r),i,r);break;case"FIXED":this._addKey(this._getFixed(r),i,r);break;case"INT":this._addKey(this._getInt(r),i,r);break;case"STRING":this._addKey(this._getString(r),i,r);break;case"NAME":this._addKey(this._getName(r),i,r);break;case"BOOL":this._addKey(this._getBoolean(r),i,r);break;case"DATA":if((a=this._getData(r))&&a.length>0&&t instanceof sn){t._bytes=a;var h=!1;if(i&&i.has("Subtype")){var c=i.get("Subtype");h=c&&"Image"===c.name}h?t._isCompress=!1:(t.dictionary.has("Length")&&delete t.dictionary._map.Length,t.dictionary.has("Filter")&&delete t.dictionary._map.Filter)}}}}},i.prototype._getStream=function(t){var e=this,i=new sn([]);if(i.dictionary._crossReference=this._crossReference,t.hasChildNodes){var r=t.childNodes;Array.from(r).forEach(function(t){1===t.nodeType&&e._getAppearance(i,t)})}return i},i.prototype._getDictionary=function(t){var e=this,i=new $r(this._crossReference);if(t.hasChildNodes){var r=t.childNodes;Array.from(r).forEach(function(t){1===t.nodeType&&e._getAppearance(i,t)})}return i},i.prototype._getArray=function(t){var e=this,i=[];if(t.hasChildNodes){var r=t.childNodes;Array.from(r).forEach(function(t){1===t.nodeType&&e._addArrayElements(i,t)})}return i},i.prototype._getData=function(t){var e=[];if(t&&t.textContent&&""!==t.textContent&&t.hasAttribute("MODE")&&t.hasAttribute("ENCODING")){var i=t.getAttribute("MODE"),r=t.getAttribute("ENCODING");if(i&&r){var n=this._getFormatedString(t.textContent,!0);"FILTERED"===i&&"ASCII"===r?e=p(n,!0):"RAW"===i&&"HEX"===r&&(e=S(n,!0))}}return e},i.prototype._addArrayElements=function(t,e){if(e&&1===e.nodeType){var i,r=e,n=void 0,s=void 0,a=void 0,o=void 0,h=void 0,c=void 0;switch(r.localName){case"STREAM":if(n=this._getStream(r)){_=this._crossReference._getNextReference();n.reference=_,this._crossReference._cacheMap.set(_,n),t.push(_)}break;case"DICT":if(s=this._getDictionary(r)){var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,s),t.push(_)}break;case"ARRAY":(a=this._getArray(r))&&t.push(a);break;case"FIXED":void 0===(o=this._getFixed(r))||isNaN(o)||t.push(o);break;case"INT":void 0===(h=this._getInt(r))||isNaN(h)||t.push(h);break;case"NAME":(i=this._getName(r))&&t.push(i);break;case"BOOL":void 0!==(c=this._getBoolean(r))&&null!==c&&t.push(c)}}},i.prototype._getFixed=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=Number.parseFloat(t.getAttribute("VAL"))),e},i.prototype._getInt=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=Number(t.getAttribute("VAL"))),e},i.prototype._getString=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=t.getAttribute("VAL")),e},i.prototype._getName=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=Xr.get(t.getAttribute("VAL"))),e},i.prototype._getBoolean=function(t){var e;return t&&t.hasAttribute("VAL")&&(e="true"===t.getAttribute("VAL")),e},i.prototype._addMeasureDictionary=function(t,e){var i,r,n,s;if(e.hasChildNodes)for(var a=e.childNodes,o=0;o<a.length;o++){var h=a[o];if(h&&"measure"===h.localName){i=h;break}}var c=new $r(this._crossReference),_=new $r(this._crossReference),d=new $r(this._crossReference),l=new $r(this._crossReference),f=[],p=[],u=[];if(i){if(c.update("Type",Xr.get("Measure")),i.hasAttribute("rateValue")){var g=i.getAttribute("rateValue");g&&""!==g&&c.update("R",g)}if(i.hasChildNodes){a=i.childNodes;Array.from(a).forEach(function(t){if(t&&1===t.nodeType){var e=t;switch(e.nodeName.toLowerCase()){case"distance":n=e;break;case"area":r=e;break;case"xformat":s=e}}})}}if(s&&(this._addElements(s,l),u.push(l)),n&&(this._addElements(n,_),f.push(_)),r&&(this._addElements(r,d),p.push(d)),c.set("A",p),c.set("D",f),c.set("X",u),c.size>0&&c.has("Type")){var y=this._crossReference._getNextReference();this._crossReference._cacheMap.set(y,c),t.update("Measure",y)}},i.prototype._addElements=function(t,e){t.hasAttribute("d")&&this._addFloat(e,"D",t.getAttribute("d")),t.hasAttribute("c")&&this._addFloat(e,"C",t.getAttribute("c")),t.hasAttribute("rt")&&e.update("RT",t.getAttribute("rt")),t.hasAttribute("rd")&&e.update("RD",t.getAttribute("rt")),t.hasAttribute("ss")&&e.update("SS",t.getAttribute("ss")),t.hasAttribute("u")&&e.update("U",t.getAttribute("u")),t.hasAttribute("f")&&e.update("F",Xr.get(t.getAttribute("f"))),t.hasAttribute("fd")&&e.update("FD","yes"===t.getAttribute("fd"))},i.prototype._addString=function(t,e,i){i&&""!==i&&t.update(e,i)},i.prototype._addInt=function(t,e,i){var r=Number(i);void 0!==r&&t.update(e,r)},i.prototype._addFloat=function(t,e,i){var r=Number.parseFloat(i);void 0!==r&&t.update(e,r)},i.prototype._addFloatPoints=function(t,e,i){e&&e.length>0&&t.update(i,e)},i.prototype._addKey=function(t,e,i){void 0!==t&&null!==t&&i.hasAttribute("KEY")&&e.update(i.getAttribute("KEY"),t)},i.prototype._addLineEndStyle=function(t,e){var i="";e.hasAttribute("head")&&(i=e.getAttribute("head"));var r="";if(e.hasAttribute("tail")&&(r=e.getAttribute("tail")),i&&""!==i)if(r&&""!==r){var n=[];n.push(Xr.get(i)),n.push(Xr.get(r)),t.update("LE",n)}else t.update("LE",Xr.get(i));else r&&""!==r&&t.update("LE",Xr.get(r))},i}(he),_e=function(){function t(t){this._baseFontEncoding="",this._dictionary=t,this._fontType=this._dictionary.get("Subtype").name}return Object.defineProperty(t.prototype,"differencesDictionary",{get:function(){return this._differencesDictionary||(this._differencesDictionary=this._getDifferencesDictionary()),this._differencesDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseFontEncoding",{get:function(){return this._baseFontEncoding},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontEncoding",{get:function(){return this._fontEncoding||(this._fontEncoding=this._getFontEncoding()),this._fontEncoding},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontName",{get:function(){return this._fontName||(this._fontName=this._getFontName()),this._fontName},enumerable:!0,configurable:!0}),t.prototype._getFontEncoding=function(){var t="";if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")){var e=this._dictionary.get("Encoding");if(e instanceof Xr)t=e.name;else if(e instanceof $r){if(e.has("BaseEncoding")){var i=e.get("BaseEncoding");i&&i instanceof Xr&&(this._baseFontEncoding=i.name)}if(e.has("Type")){var r=e.get("Type");null!==r&&void 0!==r&&(t=r.name)}}}return"identity#2dh"!==t.toString()&&"CMap"!==t||(t="Identity-H"),t},t.prototype._getDifferencesDictionary=function(){var t=this,e=new Map;if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")){var i=this._dictionary.get("Encoding");if(null!==i&&void 0!==i&&i instanceof $r&&i.has("Differences")){var r=i.getArray("Differences"),n=0;null!==r&&void 0!==r&&r.forEach(function(i){var r="";"number"==typeof i?(r=i.toString(),n=Number(r)):i instanceof Xr&&(r=i.name,"Type1"===t._fontType&&".notdef"===r?(r=" ",e.set(n.toString(),mt(r))):(r=yt(r=mt(r)),e.has(n.toString())||e.set(n.toString(),mt(r)),n++))})}}return e},t.prototype._getFontName=function(){var t="";if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("BaseFont")){var e=this._dictionary.get("BaseFont"),i=e.name;if(-1!==i.indexOf("#20")&&-1===i.indexOf("+")){var r=i.lastIndexOf("#20");i=i.substring(0,r),i+="+"}-1!==(t=-1!==e.name.indexOf("+")?e.name.split("+")[1]:e.name).indexOf("-")?t=t.split("-")[0]:-1!==t.indexOf(",")&&(t=t.split(",")[0]),-1!==t.indexOf("MT")&&(t=t.replace("MT","")),-1!==t.indexOf("#20")&&(t=t.replace("#20"," ")),-1!==t.indexOf("#")&&(t=this._decodeHexFontName(t))}return t},t.prototype._decodeHexFontName=function(t){for(var e=t,i=0;i<t.length;i++)if("#"===t[i]){var r=t[i+1]+t[i+2],n=Number.parseInt(r,16);if(0!==n&&(e=e.replace("#"+r,String.fromCharCode(n)),i+=2),-1===e.indexOf("#"))break}return e},t}(),de=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),le=function(e){function i(t){var i=e.call(this)||this;return i._isImport=!1,i._isColorSpace=!1,i._isDuplicate=!1,i._isGroupingSupport=!1,null!==t&&void 0!==t&&(i._fileName=t),i}return de(i,e),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},i.prototype._exportFormFields=function(t){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var e=this._document.form;if(null!==e&&void 0!==e){this._exportEmptyFields=e.exportEmptyFields;for(var i=this._document.form.count,r=0;r<i;r++){var n=this._document.form.fieldAt(r);this._exportFormFieldsData(n)}this._writeFormFieldData()}return this._save()},i.prototype._save=function(){var t=new Uint8Array(this._jsonData);return this._jsonData=[],t},i.prototype._writeFormFieldData=function(){var t=this;this._jsonData.push(this._openingBrace);var e=0;this._table.forEach(function(i,r){if(r=t._getValidString(r),t._jsonData.push(t._doubleQuotes),t._jsonData=p(r,!0,!1,t._jsonData),"string"==typeof i||Array.isArray(i)&&1===i.length)i=t._getValidString("string"==typeof i?i:i[0]),t._jsonData.push(t._doubleQuotes,t._colon,t._doubleQuotes),t._jsonData=p(i,!0,!1,t._jsonData),t._jsonData.push(t._doubleQuotes);else{t._jsonData.push(t._doubleQuotes,t._colon,t._openingBracket);for(var n=0;n<i.length;n++){t._jsonData.push(t._doubleQuotes);for(var s=i[n],a=0;a<s.length;a++)t._jsonData.push(s.charCodeAt(a));t._jsonData.push(t._doubleQuotes),n<i.length-1&&t._jsonData.push(t._comma)}t._jsonData.push(t._closingBracket)}e<t._table.size-1&&t._jsonData.push(t._comma),e++}),this._jsonData.push(this._closingBrace)},i.prototype._exportAnnotationData=function(t,e){var i=this,r=!1;this._jsonData.push(this._openingBrace,this._doubleQuotes,112,100,102,65,110,110,111,116,97,116,105,111,110,this._doubleQuotes,this._colon,this._openingBrace);for(var n=0;n<e;n++){var s=t.getPage(n);s&&s.annotations.count>0&&(this._jsonData.push(0!==n&&r?this._comma:this._space,this._doubleQuotes),p(n.toString(),!0,!1,[]).forEach(function(t){i._jsonData.push(t)}),this._jsonData.push(this._doubleQuotes,this._colon,this._openingBrace,this._doubleQuotes,115,104,97,112,101,65,110,110,111,116,97,116,105,111,110,this._doubleQuotes,this._colon,this._openingBracket),r=!0);for(var a=0,o=0;o<s.annotations.count;o++){var h=s.annotations.at(o);h&&(0!==a&&this._jsonData.push(this._comma),a++,this._exportAnnotation(h,n),this._jsonData=p(this._convertToJson(this._table),!0,!1,this._jsonData),this._table.clear())}s&&s.annotations.count>0&&this._jsonData.push(this._closingBracket,this._closingBrace)}this._jsonData.push(this._closingBrace,this._closingBrace)},i.prototype._exportAnnotation=function(t,e){var i=!1,r=t._dictionary,n=this._getAnnotationType(t._dictionary);if(this._skipBorderStyle=!1,n&&""!==n){this._table.set("type",n),this._table.set("page",e.toString());var s=void 0;switch(n){case"Line":s=t.linePoints,this._table.set("start",s[0].toString()+","+s[1].toString()),this._table.set("end",s[2].toString()+","+s[3].toString());break;case"Stamp":case"Square":i=!0}if(r&&r.has("BE")&&r.has("BS")){var a=r.get("BE");a&&a.has("S")&&(this._skipBorderStyle=!0)}this._writeDictionary(r,e,i)}},i.prototype._writeDictionary=function(t,e,i){var r=this,n=!1;if(t&&t.has("Type")){var s=t.get("Type");n=s&&"Border"===s.name&&this._skipBorderStyle}if(t.forEach(function(s,a){if((i||"AP"!==s)&&"P"!==s&&"Parent"!==s&&"Measure"!==s){var o=void 0;if((o=a instanceof Qr?t.get(s):a)&&o instanceof $r)switch(s){case"BS":case"BE":r._writeDictionary(o,e,!1);break;case"IRT":o.has("NM")&&r._table.set("inreplyto",r._getValue(o.get("NM"),!0));break;default:r._writeDictionary(o,e,!1)}else(!n||n&&"S"!==s)&&r._writeAttribute(s,o,t)}}),t.has("Measure")&&this._exportMeasureDictionary(t.get("Measure")),(this.exportAppearance||i)&&t.has("AP")){var a=this._getAppearanceString(t.get("AP"));a&&a.length>0&&this._table.set("appearance",T(a))}if(t.has("Sound")){var o=t.get("Sound");if(o&&o.dictionary){var h=o.dictionary;h.has("B")&&this._table.set("bits",this._getValue(h.get("B"),!0)),h.has("C")&&this._table.set("channels",this._getValue(h.get("C"),!0)),h.has("E")&&this._table.set("encoding",this._getValue(h.get("E"),!0)),h.has("R")&&this._table.set("rate",this._getValue(h.get("R"),!0)),h.has("Length")&&h.get("Length")>0&&(y=w(o.getBytes()))&&""!==y&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),h.has("Length")&&this._table.set("length",this._getValue(h.get("Length"),!0)),h.has("Filter")&&this._table.set("filter",this._getValue(h.get("Filter"),!0)),this._table.set("data",y))}}else if(t.has("FS")){var c=t.get("FS");if(c&&(c.has("F")&&this._table.set("file",this._getValue(c.get("F"),!0)),c.has("EF"))){var _=c.get("EF");if(_&&_.has("F")){var d=_.get("F");if(d&&d.dictionary){var l=d.dictionary;if(l.has("Params")){var f=l.get("Params");if(f){if(f.has("CreationDate")){u=this._getValue(f.get("CreationDate"),!0);this._table.set("creation",u)}if(f.has("ModificationDate")){var u=this._getValue(f.get("ModificationDate"),!0);this._table.set("modification",u)}if(f.has("Size")&&this._table.set("size",this._getValue(f.get("Size"),!0)),f.has("CheckSum")){var g=w(p(u=this._getValue(f.get("CheckSum"),!0)));this._table.set("checksum",g)}}}var y=w(d.getBytes());y&&""!==y&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),l.has("Length")&&this._table.set("length",this._getValue(l.get("Length"),!0)),l.has("Filter")&&this._table.set("filter",this._getValue(l.get("Filter"),!0)),this._table.set("data",y))}}}}},i.prototype._writeColor=function(t,e,i){var r=this._getColor(t);if("number"==typeof t&&i){var n=this._getValue(t,!0);n&&""!==n&&this._table.set(i,n)}r&&""!==r&&this._table.set(e,r)},i.prototype._writeAttributeString=function(t,e,i){void 0===i&&(i=!1);var r=this._getValue(e,!0);this._table.set(t,i?r.toLowerCase():r)},i.prototype._writeAttribute=function(t,e,i){var r,n,s;switch(t){case"C":this._writeColor(e,"color","c");break;case"IC":this._writeColor(e,"interior-color");break;case"DA":(r=i.get("DA"))&&this._table.set("defaultappearance",r);break;case"M":this._writeAttributeString("date",e);break;case"NM":this._table.set("name",e);break;case"Name":this._writeAttributeString("icon",e);break;case"Subj":this._writeAttributeString("subject",e);break;case"T":this._table.has("title")||this._writeAttributeString("title",e);break;case"Rect":if(r=this._getValue(e,!0)){var a=r.split(","),o=new Map;o.set("x",a[0]),o.set("y",a[1]),o.set("width",a[2]),o.set("height",a[3]),this._table.set(t.toLowerCase(),this._convertToJson(o))}break;case"CreationDate":this._writeAttributeString("creationdate",e);break;case"Rotate":this._writeAttributeString("rotation",e);break;case"W":this._writeAttributeString("width",e);break;case"LE":e&&Array.isArray(e)?2===e.length&&(this._table.set("head",this._getValue(e[0],!0)),this._table.set("tail",this._getValue(e[1],!0))):e instanceof Xr&&this._writeAttributeString("head",e);break;case"S":switch(this._getValue(e,!0)){case"D":this._table.set("style","dash");break;case"C":this._table.set("style","cloudy");break;case"S":this._table.set("style","solid");break;case"B":this._table.set("style","bevelled");break;case"I":this._table.set("style","inset");break;case"U":this._table.set("style","underline")}break;case"D":this._writeAttributeString("dashes",e);break;case"I":this._writeAttributeString("intensity",e);break;case"RD":this._writeAttributeString("fringe",e);break;case"IT":this._writeAttributeString("IT",e);break;case"RT":this._writeAttributeString("replyType",e,!0);break;case"LL":this._writeAttributeString("leaderLength",e);break;case"LLE":this._writeAttributeString("leaderExtend",e);break;case"Cap":this._writeAttributeString("caption",e);break;case"CP":this._writeAttributeString("caption-style",e);break;case"CL":this._writeAttributeString("callout",e);break;case"QuadPoints":this._writeAttributeString("coords",e);break;case"CA":this._writeAttributeString("opacity",e);break;case"F":if("number"==typeof e){var h=d(e);this._table.set("flags",h)}break;case"Contents":(r=i.get("Contents"))&&r.length>0&&this._table.set("contents",this._getValidString(r));break;case"InkList":this._writeInkList(i);break;case"Vertices":this._writeVertices(i);break;case"DS":if(r=i.get("DS"),Ut(r)){var c=new Map;r.split(";").forEach(function(t){var e=t.split(":");e&&e.length>0&&e[0]&&e[0].length>1&&e[0].startsWith(" ")&&(e[0]=e[0].substring(1)),c.set(e[0],e[1])}),this._table.set("defaultStyle",this._convertToJson(c))}break;case"AllowedInteractions":if(e){var _=p(e),l=new Map;l.set("unicodeData",w(_)),this._table.set(t,this._convertToJson(l))}break;case"RC":if("string"==typeof(n=i.get("RC"))&&n.includes("<body")){var f=n.indexOf("<body");f>0&&(n=n.substring(f)),this._writeAttributeString("contents-richtext",n)}break;case"Type":case"Subtype":case"P":case"Parent":case"L":case"FS":case"MeasurementTypes":case"GroupNesting":case"ITEx":break;case"TextMarkupContent":s=p(e),this._writeAttributeString(t,w(s));break;case"Border":case"A":case"R":case"X":case"ca":this._writeAttributeString(t.toLowerCase(),e);break;default:"string"==typeof e&&e.startsWith("{")&&e.endsWith("}")?this._table.set(t,e):this._writeAttributeString(t,e)}},i.prototype._writeVertices=function(t){var e=t.getArray("Vertices");if(Ut(e)&&e.length>0){var i=e.length;if(i%2==0){for(var r="",n=0;n<i-1;n++)r+=this._getValue(e[n],!0)+(n%2!=0?";":",");(r+=this._getValue(e[i-1],!0))&&""!==r&&this._table.set("vertices",r)}}},i.prototype._writeInkList=function(t){var e=t.getArray("InkList");if(e&&e.length>0){for(var i=new Map,r="[",n=0;n<e.length;n++)r+="["+this._getValue(e[n],!0)+"]",n<e.length-1&&(r+=",");r+="]",i.set("gesture",r),this._table.set("inklist",this._convertToJson(i))}},i.prototype._exportMeasureDictionary=function(t){if(t&&(t.has("Type")&&this._table.set("type1","Measure"),t.has("R")&&this._table.set("ratevalue",this._getValue(t.get("R"),!0)),t.has("SubType")&&this._table.set("SubType",this._getValue(t.get("SubType"),!0)),t.has("TargetUnitConversion")&&this._table.set("TargetUnitConversion",this._getValue(t.get("TargetUnitConversion"),!0)),t.has("A")&&(e=t.getArray("A"))&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("area",e[0]),t.has("D")&&(e=t.getArray("D"))&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("distance",e[0]),t.has("X")&&(e=t.getArray("X"))&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("xformat",e[0]),t.has("T")&&(e=t.getArray("T"))&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("tformat",e[0]),t.has("V"))){var e=t.getArray("V");e&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("vformat",e[0])}},i.prototype._exportMeasureFormatDetails=function(t,e){var i=new Map;e&&(e.has("C")&&i.set("c",this._getValue(e.get("C"),!0)),e.has("F")&&i.set("f",this._getValue(e.get("F"),!0)),e.has("D")&&i.set("d",this._getValue(e.get("D"),!0)),e.has("RD")&&i.set("rd",this._getValue(e.get("RD"),!0)),e.has("U")&&i.set("u",this._getValue(e.get("U"),!0)),e.has("RT")&&i.set("rt",this._getValue(e.get("RT"),!0)),e.has("SS")&&i.set("ss",this._getValue(e.get("SS"),!0)),e.has("FD")&&i.set("fd",this._getValue(e.get("FD"),!0))),this._table.set(t,this._convertToJson(i))},i.prototype._getAppearanceString=function(t){var e=new Map,i=new Map;return this._writeAppearanceDictionary(i,t),e.set("ap",this._convertToJson(i)),p(this._convertToJson(e))},i.prototype._writeAppearanceDictionary=function(t,e){var i=this;e&&e.size>0&&e.forEach(function(r,n){("OC"===r&&n instanceof Array||"P"!==r&&"Parent"!==r&&"Dest"!==r&&"OC"!==r&&("AP"!==r||!i._isGroupingSupport))&&i._writeObject(t,n instanceof Qr?e.get(r):n,e,r)})},i.prototype._writeObject=function(t,e,i,r,n,s,a){if(void 0===s&&(s=!1),void 0===a&&(a=!1),e instanceof Xr)e.name=this._getValidString(e.name),this._writeTable("name",e.name,t,r,n);else if(Array.isArray(e)){var o=[];"ColorSpace"===r||s?this._writeArray(o,e,i,!0):this._writeArray(o,e,i),this._isColorSpace=!1,this._writeTable("array",this._convertToJsonArray(o),t,r,n)}else if("string"==typeof e){var h=!1;if(-1!==e.indexOf("\t")&&(h=!0),"AllowedInteractions"!==r&&(e=this._getValidString(e)),this._isColorSpace||"AllowedInteractions"===r||qt(e)||h){b=p(e);this._writeTable("unicodeData",w(b),t,r,n),h=!1}else this._writeTable("string",e,t,r,n)}else if("number"==typeof e)this._writeTable(Number.isInteger(e)?"int":"fixed",e.toString(),t,r,n);else if("boolean"==typeof e)this._writeTable("boolean",e?"true":"false",t,r,n);else if(e instanceof $r){var c=new Map;this._writeAppearanceDictionary(c,e),this._writeTable("dict",this._convertToJson(c),t,r,n)}else if(e instanceof rn&&e.dictionary){var _=new Map,d=new Map,l=e.dictionary,f=void 0,u=e,g=!1;if(l.has("Subtype")&&"Image"===l.get("Subtype").name&&(g=!0),a&&g)f=e.dictionary.has("Filter")&&"DCTDecode"===e.dictionary.get("Filter").name?e.getString(!0):Ht(e,!0);else if(g&&u.stream)if(u.stream instanceof nn)if("boolean"==typeof u._initialized&&u._cipher){m=u.stream.end-u.stream.start;u.getBytes(m);b=u.buffer.subarray(0,u.bufferLength);f=u.getString(!0,b)}else{v=u.stream;f=u.getString(!0,v.getByteRange(v.start,v.end))}else if(u.stream.stream){var y=u.stream;if(y.stream instanceof nn&&"boolean"==typeof y._initialized&&y._cipher){var m=y.stream.end-y.stream.start;y.getBytes(m);var b=y.buffer.subarray(0,y.bufferLength);f=y.getString(!0,b)}else if(y.stream instanceof nn){var v=y.stream;f=y.getString(!0,v.getByteRange(v.start,v.end))}}else f=e.getString(!0);else f=e.getString(!0);!l.has("Length")&&f&&""!==f&&l.update("Length",e.length),this._writeAppearanceDictionary(d,l);var S=void 0;l.has("Subtype")&&(S=this._getValue(l.get("Subtype"))),!l.has("Type")&&!l.has("Subtype")||l.has("Subtype")&&("Image"===S||"Form"===S||"CIDFontType0C"===S||"OpenType"===S)?(_.set("mode","raw"),_.set("encoding","hex")):(_.set("mode","filtered"),_.set("encoding","ascii")),f&&""!==f&&_.set("bytes",f),d.set("data",this._convertToJson(_)),this._writeTable("stream",this._convertToJson(d),t,r,n)}else e instanceof Qr&&this._crossReference?this._writeObject(t,this._crossReference._fetch(e),i,r,n,s,e._isNew):null!==e&&void 0!==e||this._writeTable("null","null",t,r,n)},i.prototype._writeTable=function(t,e,i,r,n){var s=new Map;s.set(t,e),r?i.set(r,this._convertToJson(s)):n&&n.push(s)},i.prototype._writeArray=function(t,e,i,r){var n=this;void 0===r&&(r=!1),e.forEach(function(e){r&&"string"==typeof e&&(n._isColorSpace=!0),n._writeObject(null,e,i,null,t,r)})},i.prototype._convertToJson=function(t){var e=0,i="{";return t.forEach(function(r,n){r.startsWith("{")||r.startsWith("[")?i+='"'+n+'":'+r:(r.startsWith(" ")&&r.length>1&&("["===r[1]||"{"===r[1])&&(r=r.substring(1)),i+='"'+n+'":"'+r+'"'),e<t.size-1&&(i+=","),e++}),i+"}"},i.prototype._convertToJsonArray=function(t){for(var e="[",i=0;i<t.length;i++)e+=this._convertToJson(t[i]),i<t.length-1&&(e+=",");return e+"]"},i.prototype._parseJson=function(t,e){this._document=t,this._crossReference=t._crossReference;var i=m(e,!0);if(i.startsWith("{")&&!i.endsWith("}"))for(;i.length>0&&!i.endsWith("}");)i=i.substring(0,i.length-1);return JSON.parse(i)},i.prototype._importFormData=function(t,e){var i=this,r=this._parseJson(t,e);if(r){var n=Object.keys(r);if(n&&n.length>0){for(var s=this,a=0;a<n.length;a++)!function(t){var e=n[t],a=r[e];Array.isArray(a)?s._fields.has("key")?a.forEach(function(t){i._fields.get(e).push(t)}):s._fields.set(e,a):s._fields.has("key")?s._fields.get(e).push(a):s._fields.set(e,[a])}(a);this._importField()}}},i.prototype._importAnnotations=function(t,e){var i=this;this._isImport=!0;var r=this._parseJson(t,e);if(r&&-1!==Object.keys(r).indexOf("pdfAnnotation")){var n=r.pdfAnnotation,s=t.pageCount,a=Object.keys(n);a&&a.length>0&&a.forEach(function(e){var r=Number(e);if(void 0!==r&&r<s){var a=t.getPage(r),o=n[e];if(o){var h=Object.keys(o);if(h&&h.length>0&&-1!==h.indexOf("shapeAnnotation")){var c=o.shapeAnnotation;c&&c.length>0&&c.forEach(function(t){var e=Object.keys(t);if(e&&e.length>0&&-1!==e.indexOf("type")){var r=new $r(i._crossReference);r.update("Type",Xr.get("Annot"));var n=!0;switch(t.type.toLowerCase()){case"line":r.update("Subtype",Xr.get("Line"));break;case"circle":r.update("Subtype",Xr.get("Circle"));break;case"square":r.update("Subtype",Xr.get("Square"));break;case"polyline":r.update("Subtype",Xr.get("PolyLine"));break;case"polygon":r.update("Subtype",Xr.get("Polygon"));break;case"ink":r.update("Subtype",Xr.get("Ink"));break;case"popup":r.update("Subtype",Xr.get("Popup"));break;case"text":r.update("Subtype",Xr.get("Text"));break;case"freetext":r.update("Subtype",Xr.get("FreeText"));break;case"stamp":r.update("Subtype",Xr.get("Stamp"));break;case"highlight":r.update("Subtype",Xr.get("Highlight"));break;case"squiggly":r.update("Subtype",Xr.get("Squiggly"));break;case"underline":r.update("Subtype",Xr.get("Underline"));break;case"strikeout":r.update("Subtype",Xr.get("StrikeOut"));break;case"fileattachment":r.update("Subtype",Xr.get("FileAttachment"));break;case"sound":r.update("Subtype",Xr.get("Sound"));break;case"redact":r.update("Subtype",Xr.get("Redact"));break;case"caret":r.update("Subtype",Xr.get("Caret"));break;default:n=!1}if(n){i._addAnnotationData(r,t,e);var s=a._pageDictionary;if(s){var o=a.annotations,h=o._parseAnnotation(r);if(h){h._isImported=!0;var c=i._crossReference._getNextReference();i._crossReference._cacheMap.set(c,r),(r.has("NM")||r.has("IRT"))&&i._addReferenceToGroup(c,r),h._ref=c;var _=o._annotations.length;o._annotations.push(c),o._comments&&o._comments.length>0&&(o._comments=[]),s.set("Annots",o._annotations),s._updated=!0,o._parsedAnnotations.set(_,h),i._handlePopup(o,c,r,s)}}}}})}}}}),this._groupHolders.length>0&&this._groupHolders.forEach(function(t){var e=t.get("IRT");e&&""!==e&&(i._groupReferences.has(e)?t.update("IRT",i._groupReferences.get(e)):delete t._map.IRT)}),this._groupHolders=[],this._groupReferences=new Map}},i.prototype._addAnnotationData=function(e,i,r){var n,s,a,o,h=this,c=new $r(this._crossReference),_=new $r(this._crossReference),d=new Map,f=[],p="";if(r.forEach(function(r){var u=i[r];switch(r.toLowerCase()){case"start":case"end":h._addLinePoints(u,f),4===f.length&&(e.update("L",f),f=[]);break;case"itex":break;case"state":h._addString(e,"State",u);break;case"statemodel":h._addString(e,"StateModel",u);break;case"replytype":"group"===u.toLowerCase()&&e.update("RT",Xr.get("Group"));break;case"inreplyto":h._addString(e,"IRT",u);break;case"dashes":case"width":case"intensity":case"style":h._addBorderStyle(r,u,c,_);break;case"rect":if(a=u){var g=[];g.push(Number.parseFloat(a.x)),g.push(Number.parseFloat(a.y)),g.push(Number.parseFloat(a.width)),g.push(Number.parseFloat(a.height)),g&&4===g.length&&e.update("Rect",g)}break;case"color":(u=I(u))&&3===u.length&&e.update("C",[u[0]/255,u[1]/255,u[2]/255]);break;case"oc":if(u&&"Redact"===e.get("Subtype").name){var y=(o=u.split(",")).map(function(t){return Number.parseFloat(t)});y&&y.length>0&&e.update("OC",y)}break;case"interior-color":(u=I(u))&&3===u.length&&e.update("IC",[u[0]/255,u[1]/255,u[2]/255]);break;case"date":h._addString(e,"M",u);break;case"creationdate":h._addString(e,"CreationDate",u);break;case"name":h._addString(e,"NM",u);break;case"icon":u&&e.update("Name",Xr.get(u));break;case"subject":h._addString(e,"Subj",u);break;case"title":h._addString(e,"T",u);break;case"rotation":e.update("Rotate",Number.parseFloat(u));break;case"fringe":h._addFloatPoints(e,"RD",h._parseFloatPoints(u));break;case"it":u&&e.update("IT",Xr.get(u));break;case"leaderlength":e.update("LL",Number.parseFloat(u));break;case"leaderextend":e.update("LLE",Number.parseFloat(u));break;case"caption":h._addBoolean(e,"Cap",u.toLowerCase());break;case"caption-style":u&&e.update("CP",Xr.get(u));break;case"callout":h._addFloatPoints(e,"CL",h._parseFloatPoints(u));break;case"coords":h._addFloatPoints(e,"QuadPoints",h._parseFloatPoints(u));break;case"border":h._addFloatPoints(e,"Border",h._parseFloatPoints(u));break;case"opacity":e.update("CA",Number.parseFloat(u));break;case"defaultstyle":if(u){var b=Object.keys(u);if(b&&b.length>0){var v="",w=0;b.forEach(function(t){var e=u[t];v+=t+":"+e,w<b.length-1&&(v+=";"),w++}),h._addString(e,"DS",v)}}break;case"defaultappearance":h._addString(e,"DA",u);break;case"contents-richtext":"string"==typeof u&&h._addString(e,"RC",u);break;case"flags":if(u&&"string"==typeof u){var P=t.PdfAnnotationFlag.default;u.split(",").forEach(function(t,e){var i=l(t);0===e?P=i:P|=i}),e.update("F",P)}break;case"open":h._addBoolean(e,"Open",u.toLowerCase());break;case"repeat":h._addBoolean(e,"Repeat",u.toLowerCase());break;case"overlaytext":h._addString(e,"OverlayText",u);break;case"contents":"string"==typeof u&&(-1!==u.indexOf("\\r")&&(u=u.replace("\\r","\r")),u&&h._addString(e,"Contents",u));break;case"q":e.update("Q",Number(u));break;case"inklist":if(u){var A=Object.keys(u);if(A&&A.length>0&&-1!==A.indexOf("gesture")){var x=u.gesture;x&&x.length>0&&e.update("InkList",x)}}break;case"head":n=u;break;case"tail":s=u;break;case"creation":case"modification":case"file":case"bits":case"channels":case"encoding":case"rate":case"length":case"filter":case"mode":case"size":d.set(r,u);break;case"data":p=u;break;case"vertices":if(u&&"string"==typeof u){var k=u.split(/[,;]/);if(k&&k.length>0){var C=k.map(function(t){return Number(t)});C.length>0&&C.length%2==0&&e.update("Vertices",C)}}break;case"appearance":h._addAppearanceData(e,u);break;case"allowedinteractions":if(u)if(u&&"string"==typeof u)h._addString(e,"AllowedInteractions",u);else{var T=Object.keys(u);if(T&&T.length>0&&-1!==T.indexOf("unicodeData")){var R=JSON.stringify(u.unicodeData);R=R.substring(1,R.length-1),u=m(S(R,!1),!0),h._addString(e,"AllowedInteractions",u)}}break;default:h._document._allowImportCustomData&&"type"!==r&&"page"!==r&&h._addString(e,r,"string"==typeof u?u:JSON.stringify(u))}}),this._addMeasureDictionary(e,i,r),n?s?e.update("LE",[Xr.get(n),Xr.get(s)]):e.update("LE",n):s&&e.update("LE",s),_.size>0){_.update("Type",Xr.get("Border"));u=this._crossReference._getNextReference();_.objId=u.objectNumber+" "+u.generationNumber,this._crossReference._cacheMap.set(u,_),e.update("BS",u)}if(c.size>0){var u=this._crossReference._getNextReference();_.objId=u.objectNumber+" "+u.generationNumber,this._crossReference._cacheMap.set(u,c),e.update("BE",u)}this._addStreamData(e,d,p)},i.prototype._addLinePoints=function(t,e){t&&-1!==t.indexOf(",")&&t.split(",").forEach(function(t){e.push(Number.parseFloat(t))})},i.prototype._addString=function(t,e,i){i&&t.update(e,i)},i.prototype._addBoolean=function(t,e,i){i&&t.update(e,"yes"===i||"true"===i)},i.prototype._addBorderStyle=function(t,e,i,r){var n="",s=!0;switch(e){case"dash":n="D";break;case"solid":n="S";break;case"bevelled":n="B";break;case"inset":n="I";break;case"underline":n="U";break;case"cloudy":n="C",s=!1}switch(t.toLowerCase()){case"width":r.update("W",Number.parseFloat(e));break;case"intensity":i.update("I",Number.parseFloat(e));break;case"dashes":e&&-1!==e.indexOf(",")&&r.update("D",this._parseFloatPoints(e))}n&&(s?r.update("S",Xr.get(n)):i.update("S",Xr.get(n)))},i.prototype._parseFloatPoints=function(t){return t.split(",").map(function(t){return Number.parseFloat(t)})},i.prototype._addFloatPoints=function(t,e,i){i&&i.length>0&&t.update(e,i)},i.prototype._addMeasureDictionary=function(t,e,i){var r=new $r(this._crossReference),n=[],s=[],a=[],o=[],h=[];if(r.set("A",n),r.set("D",s),r.set("X",a),r.set("T",o),r.set("V",h),-1!==i.indexOf("ratevalue")&&this._addString(r,"R",e.ratevalue),-1!==i.indexOf("subtype")&&this._addString(r,"Subtype",e.subtype),-1!==i.indexOf("targetunitconversion")&&this._addString(r,"TargetUnitConversion",e.targetunitconversion),-1!==i.indexOf("area")&&n.push(this._readDictionaryElements(e.area)),-1!==i.indexOf("distance")&&s.push(this._readDictionaryElements(e.distance)),-1!==i.indexOf("xformat")&&a.push(this._readDictionaryElements(e.xformat)),-1!==i.indexOf("tformat")&&o.push(this._readDictionaryElements(e.tformat)),-1!==i.indexOf("vformat")&&h.push(this._readDictionaryElements(e.vformat)),-1!==i.indexOf("type1")){r.set("Type",Xr.get("Measure"));var c=this._crossReference._getNextReference();r.objId=c.objectNumber+" "+c.generationNumber,this._crossReference._cacheMap.set(c,r),t.update("Measure",c)}},i.prototype._readDictionaryElements=function(t){var e=Object.keys(t),i=new $r(this._crossReference);return e&&e.length>0&&e.forEach(function(e){var r=t[e];if(e&&r)switch(e){case"d":i.set("D",Number.parseFloat(r));break;case"c":i.set("C",Number.parseFloat(r));break;case"rt":i.set("RT",r);break;case"rd":i.set("RD",r);break;case"ss":i.set("SS",r);break;case"u":i.set("U",r);break;case"f":i.set("F",Xr.get(r));break;case"fd":i.set("FD",r);break;case"type":i.set("Type",Xr.get(r))}}),i},i.prototype._addStreamData=function(t,e,i){var r=this,n=t.get("Subtype").name,s=S(i,!0);if("Sound"===n){var a=new sn(s);a.dictionary._crossReference=this._crossReference,a.dictionary.update("Type",Xr.get("Sound")),e.forEach(function(t,e){if(e&&t)switch(e){case"bits":case"rate":case"channels":a.dictionary.set(e,Number(t));break;case"encoding":a.dictionary.set("E",Xr.get(t));break;case"filter":a.dictionary.set("Filter",Xr.get("FlateDecode"))}}),a.reference=this._crossReference._getNextReference(),a.dictionary.objId=a.reference.objectNumber+" "+a.reference.generationNumber,this._crossReference._cacheMap.set(a.reference,a),t.update("Sound",a.reference)}else if("FileAttachment"===n){var o=new $r(this._crossReference);o.update("Type",Xr.get("Filespec"));var h=new sn(s);h.dictionary._crossReference=this._crossReference;var c=new $r(this._crossReference);e.forEach(function(t,e){if(e&&t){var i=void 0;switch(e){case"file":r._addString(o,"F",t),r._addString(o,"UF",t);break;case"size":void 0!==(i=Number(t))&&(c.update("Size",i),h.dictionary.update("DL",i));break;case"creation":r._addString(c,"CreationDate",t);break;case"modification":r._addString(c,"ModificationDate",t)}}}),h.dictionary.update("Params",c),h.dictionary.update("Filter",Xr.get("FlateDecode")),h.reference=this._crossReference._getNextReference(),h.dictionary.objId=h.reference.objectNumber+" "+h.reference.generationNumber,this._crossReference._cacheMap.set(h.reference,h);var _=new $r(this._crossReference);_.update("F",h.reference),o.update("EF",_);var d=this._crossReference._getNextReference();o.objId=d.objectNumber+" "+d.generationNumber,this._crossReference._cacheMap.set(d,o),t.update("FS",d)}},i.prototype._addAppearanceData=function(t,e){if(e){var i=m(k(e,!1));if(i.startsWith("{")&&!i.endsWith("}"))for(;i.length>0&&!i.endsWith("}");)i=i.substring(0,i.length-1);var r=JSON.parse(i);if(r){var n=Object.keys(r);n&&n.length>0&&-1!==n.indexOf("ap")&&t.update("AP",this._parseDictionary(r.ap))}}},i.prototype._parseAppearance=function(t){var e,i=this,r=Object.keys(t);if(-1!==r.indexOf("name"))e=Xr.get(t.name);else if(-1!==r.indexOf("int"))e=Number(t.int);else if(-1!==r.indexOf("fixed"))e=Number.parseFloat(t.fixed);else if(-1!==r.indexOf("string"))e=t.string;else if(-1!==r.indexOf("boolean"))e="true"===t.boolean;else if(-1!==r.indexOf("array")){var n=t.array;e=[],n.forEach(function(t){e.push(i._parseAppearance(t))})}else if(-1!==r.indexOf("dict")){var s=this._parseDictionary(t.dict);s.size>0?(e=this._crossReference._getNextReference(),s.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,s)):e=new $r(this._crossReference)}else if(-1!==r.indexOf("stream")){var a=this._parseStream(t.stream);e=this._crossReference._getNextReference(),a.reference=e,a.dictionary.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,a)}else e=-1!==r.indexOf("unicodeData")?m(S(t.unicodeData,!1),!0):null;return e},i.prototype._parseDictionary=function(t){var e=this,i=new $r(this._crossReference);if(t){var r=Object.keys(t);r&&r.length>0&&r.forEach(function(r){var n=t[r];if("data"!==r){var s=e._parseAppearance(n);i.update(r,s)}})}return i},i.prototype._parseStream=function(t){var e,i=Object.keys(t);if(t&&i.indexOf("data")){var r=t.data,n=void 0;if(r){var s=Object.keys(r);if(s&&-1!==s.indexOf("bytes")){var a=r.bytes;a&&(n=S(a,!0))}}n||(n=[]);var o=new sn(n);this._crossReference?this._parseStreamElements(o,t):o._pendingResources=JSON.stringify(t),e=o}return e},i.prototype._parseStreamElements=function(t,e){if(void 0===e&&t._pendingResources&&(e=JSON.parse(t._pendingResources)),e){var i=this._parseDictionary(e),r=!1;if(i&&i.has("Subtype")){var n=i.get("Subtype");r=n&&"Image"===n.name}r||this._isImport&&t._isCompress?(t._isCompress=!1,r||delete i._map.Filter):(i.has("Length")&&delete i._map.Length,i.has("Filter")&&delete i._map.Filter),t.dictionary=i}},i.prototype._getValidString=function(t){return-1!==t.indexOf("\\")&&(t=t.replace(/\\/g,"\\\\")),-1!==t.indexOf('"')&&(t=t.replace(/"/g,'\\"')),-1!==t.indexOf("[")&&(t=t.replace(/\[/g,"\\[")),-1!==t.indexOf("]")&&(t=t.replace(/\[/g,"\\]")),-1!==t.indexOf("{")&&(t=t.replace(/\[/g,"\\{")),-1!==t.indexOf("}")&&(t=t.replace(/\}/g,"\\}")),-1!==t.indexOf("\n")&&(t=t.replace(/\n/g,"\\n")),-1!==t.indexOf("\r")&&(t=t.replace(/\r/g,"\\r")),-1!==t.indexOf("\0")&&(t=t.replace(/\u0000/g,"")),t},i}(he),fe=function(){function t(t,e){if(this._isExported=!1,this._isResourceExport=!1,this._isSignature=!1,this._isNew=!1,e&&(this._crossReference=e),null===t||void 0===t)this._isReadOnly=!0;else if(t instanceof rn){if(this._content=t,this._content.dictionary.has("Type")&&this._content.dictionary.has("Subtype")||this._initialize(),(r=this._content.dictionary.getArray("BBox"))&&r.length>3){var i=D(r);this._size=[i.width,i.height],this._templateOriginalSize=this._size}this._isReadOnly=!0}else if(Array.isArray(t))this._size=[t[2],t[3]],this._content=new sn([]),this._content.dictionary._crossReference=this._crossReference,this._initialize(),this._content.dictionary.set("BBox",[t[0],t[1],t[0]+t[2],t[1]+t[3]]);else if(null!==t.width&&null!==t.height&&void 0!==t.width&&void 0!==t.height){var r=void 0,n=t;r=null!==n.x&&void 0!==n.x&&null!==n.y&&void 0!==n.y?{x:n.x,y:n.y,width:n.width,height:n.height}:{x:0,y:0,width:n.width,height:n.height},this._size=[r.width,r.height],this._content=new sn([]),this._crossReference?this._content.dictionary._crossReference=this._crossReference:this._isNew=!0,this._initialize(),this._content.dictionary.set("BBox",[r.x,r.y,r.x+r.width,r.y+r.height])}this._writeTransformation=!0}return Object.defineProperty(t.prototype,"graphics",{get:function(){return this._isReadOnly?null:(void 0===this._g&&(this._g=new br(this._size,this._content,this._crossReference,this),this._writeTransformation&&this._g._initializeCoordinates(),this._g._isTemplateGraphics=!0),this._g)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_originalSize",{get:function(){return this._templateOriginalSize},enumerable:!0,configurable:!0}),t.prototype._initialize=function(){this._content.dictionary.set("Type",Xr.get("XObject")),this._content.dictionary.set("Subtype",Xr.get("Form"))},t.prototype._exportStream=function(t,e){var i=new le;i._crossReference=e,i._isAnnotationExport=!0;var r=new Map;i._writeObject(r,t.get("N"),t,"normal"),this._appearance=i._convertToJson(r),i._dispose()},t.prototype._importStream=function(t,e){var i=new le;t&&(i._crossReference=this._crossReference);var r=JSON.parse(this._appearance);if(r){var n=r[e?"resources":"normal"];if(n)if(e){var s=i._parseDictionary(n.dict);t&&this._content.dictionary.update("Resources",s)}else this._content=i._parseStream(n.stream),t&&(this._content.dictionary._crossReference=this._crossReference,this._content.dictionary._updated=!0)}i._dispose()},t.prototype._updatePendingResource=function(t){if(this._content._pendingResources&&""!==this._content._pendingResources){var e=new le;e._crossReference=t,e._parseStreamElements(this._content),this._content._pendingResources="",e._dispose()}},t}(),pe=function(){function e(e,i){this.horizontalScalingFactor=100,this.rightToLeft=!1,this._wordWrapType=t._PdfWordWrapType.word,this._isList=!1,this.lineLimit=!0,void 0!==e&&(this.alignment=e),this.lineAlignment=void 0!==i?i:t.PdfVerticalAlignment.top,this.characterSpacing=0,this.wordSpacing=0,this.lineSpacing=0,this.clipPath=!1,this.firstLineIndent=0,this._internalParagraphIndent=0,this.measureTrailingSpaces=!1,this.noClip=!1}return Object.defineProperty(e.prototype,"paragraphIndent",{get:function(){return this._internalParagraphIndent},set:function(t){this._internalParagraphIndent=t,this.firstLineIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subSuperScript",{get:function(){return void 0===this._pdfSubSuperScript||null===this._pdfSubSuperScript?t.PdfSubSuperScript.none:this._pdfSubSuperScript},set:function(t){this._pdfSubSuperScript=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_wordWrap",{get:function(){return this._wordWrapType},set:function(t){this._wordWrapType=t},enumerable:!0,configurable:!0}),e}();!function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(t.PdfVerticalAlignment||(t.PdfVerticalAlignment={}));var ue=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ge=function(){function e(){this._lineGap=0}return e.prototype._getAscent=function(t){return.001*this._ascent*this._getSize(t)},e.prototype._getDescent=function(t){return.001*this._descent*this._getSize(t)},e.prototype._getLineGap=function(t){return.001*this._lineGap*this._getSize(t)},e.prototype._getHeight=function(t){var e=["cambria","candara","constantia","corbel","cariadings"],i=[];return i.push.apply(i,e),this._getDescent(t)<0?this._getAscent(t)-this._getDescent(t)+this._getLineGap(t):this._getAscent(t)+this._getDescent(t)+this._getLineGap(t)},e.prototype._getSize=function(e){var i=this._size;if(null!==e&&void 0!==e)switch(e.subSuperScript){case t.PdfSubSuperScript.subScript:i/=this._subScriptSizeFactor;break;case t.PdfSubSuperScript.superScript:i/=this._superscriptSizeFactor}return i},e}(),ye=function(){function t(){}return t}(),me=function(t){function e(e){var i=t.call(this)||this;return i.widths=e,i}return ue(e,t),e.prototype._itemAt=function(t){if(t<0||t>=this.widths.length)throw new Error("The character is not supported by the font.");return this.widths[t]},e.prototype._toArray=function(){return this.widths},e}(ye),be=function(t){function e(e){var i=t.call(this)||this;return i._defaultWidth=e,i.widths=[],i}return ue(e,t),e.prototype._itemAt=function(t){var e=this._defaultWidth;return this.widths.forEach(function(i){t>=i._from&&t<=i._to&&(e=i._itemAt(t))}),e},e.prototype._toArray=function(){var t=[];return this.widths.forEach(function(e){e._appendToArray(t)}),t},e.prototype._add=function(t){this.widths.push(t)},e}(ye),ve=function(){function t(){}return t}(),we=function(t){function e(e,i,r){var n=t.call(this)||this;return n._widthFrom=e,n._widthTo=i,n._width=r,n}return ue(e,t),Object.defineProperty(e.prototype,"_from",{get:function(){return this._widthFrom},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_to",{get:function(){return this._widthTo},enumerable:!0,configurable:!0}),e.prototype._itemAt=function(t){if(t<this._from||t>this._to)throw new Error("Index is out of range.");return this._width},e.prototype._appendToArray=function(t){t.push(this._from,this._to,this._width)},e}(ve),Se=function(t){function e(e,i){var r=t.call(this)||this;return r._widthFrom=e,r._widths=i,r}return ue(e,t),Object.defineProperty(e.prototype,"_from",{get:function(){return this._widthFrom},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_to",{get:function(){return this._widthFrom+this._widths.length-1},enumerable:!0,configurable:!0}),e.prototype._itemAt=function(t){if(t<this._widthFrom||t>this._to)throw new Error("Index is out of range.");return this._widths[t]},e.prototype._appendToArray=function(t){t.push(this._from),t.forEach(function(e){t.push(e)})},e}(ve),Pe=function(){function e(){}return e.prototype._layout=function(t,e,i,r){this._initialize(t,e,i,r);var n=this._doLayout();return this._clear(),n},e.prototype._initialize=function(t,e,i,r){this._font=e,this._format=i,this._size=r,this._rectangle=[0,0,r[0],r[1]],this._reader=new ke(t),this._pageHeight=0},e.prototype._clear=function(){this._font=null,this._format=null,this._reader._close(),this._reader=null},e.prototype._doLayout=function(){for(var t=new Ae,e=new Ae,i=[],r=this._reader._peekLine(),n=this._getLineIndent(!0);null!==r;){if(void 0!==(e=this._layoutLine(r,n))&&null!==e){var s=0,a=this._copyToResult(t,e,i,s),o=a.success;if(s=a.flag,!o){this._reader._read(s);break}}this._reader._readLine(),r=this._reader._peekLine(),n=this._getLineIndent(!1)}return this._finalizeResult(t,i),t},e.prototype._getLineIndent=function(t){var e=0;return this._format&&(e=t?this._format.firstLineIndent:this._format.paragraphIndent,e=this._size[0]>0?Math.min(this._size[0],e):e),e},e.prototype._getLineHeight=function(){var t=this._font._metrics._getHeight();return this._format&&0!==this._format.lineSpacing&&(t=this._format.lineSpacing+this._font._metrics._getHeight()),t},e.prototype._getLineWidth=function(t){return this._font.getLineWidth(t,this._format)},e.prototype._layoutLine=function(e,i){var r=new Ae;r._lineHeight=this._getLineHeight();var n=[],s=this._size[0],a=this._getLineWidth(e)+i,o=t._LineType.firstParagraphLine,h=!0;if(s<=0||Math.round(a)<=Math.round(s))this._addToLineResult(r,n,e,a,t._LineType.newLineBreak|o);else{var c="",_="";a=i;var d=i,l=new ke(e),f=l._peekWord();for(f.length!==l._length&&" "===f&&(_+=f,c+=f,l._position+=1,f=l._peekWord());null!==f;){_+=f;var p=this._getLineWidth(_.toString())+d;if(" "===_.toString()&&(_="",p=0),p>s){if(this._getWrapType()===t._PdfWordWrapType.none)break;if(_.length===f.length){if(this._getWrapType()===t._PdfWordWrapType.wordOnly){r._remainder=e.substring(l._position);break}if(1===_.length){c+=f;break}h=!1,_="",f=l._peek().toString();continue}if(this._getLineWidth(f.toString())>s?void 0!==this._format&&null!==this._format&&(this._format._wordWrap=t._PdfWordWrapType.character):void 0!==this._format&&null!==this._format&&(this._format._wordWrap=t._PdfWordWrapType.word),this._getWrapType()===t._PdfWordWrapType.character&&h)h=!1,_="",_+=c.toString(),f=l._peek().toString();else{var u=c.toString();" "!==u&&this._addToLineResult(r,n,u,a,t._LineType.layoutBreak|o),_="",c="",a=0,d=0,p=0,o=t._LineType.none,f=h?f:l._peekWord(),h=!0}}else c+=f,a=p,h?(l._readWord(),f=l._peekWord()):(l._read(),f=l._peek().toString())}c.length>0&&this._addToLineResult(r,n,c.toString(),a,t._LineType.newLineBreak|t._LineType.lastParagraphLine),l._close()}r._layoutLines=[];for(var g=0;g<n.length;g++)r._layoutLines.push(n[g]);return n=[],r},e.prototype._addToLineResult=function(t,e,i,r,n){var s=new xe;s._text=i,s._width=r,s._lineType=n,e.push(s);var a=t._actualSize;a[1]=a[1]+this._getLineHeight(),a[0]=Math.max(a[0],r),t._size=a},e.prototype._copyToResult=function(t,e,i,r){var n=!0,s=this._format&&!this._format.lineLimit,a=t._actualSize[1],o=this._size[1];if(this._pageHeight>0&&o+this._rectangle[1]>this._pageHeight&&(o=this._rectangle[1]-this._pageHeight,o=Math.max(o,-o)),r=0,null!==e._lines)for(var h=0,c=e._lines.length;h<c;h++){var _=a+e._lineHeight;if(!(Math.floor(_)<=o||o<=0||s)){n=!1;break}var d=e._lines[h];r+=d._text.length,d=this._trimLine(d,0===i.length),i.push(d);var l=t._actualSize;l[0]=Math.max(l[0],d._width),t._size=l,a=_}return a!==t._size[1]&&(t._size=[t._actualSize[0],a]),{success:n,flag:r}},e.prototype._finalizeResult=function(t,e){t._layoutLines=[];for(var i=0;i<e.length;i++)t._layoutLines.push(e[i]);t._lineHeight=this._getLineHeight(),this._reader._end||(t._remainder=this._reader._readToEnd()),e=[]},e.prototype._trimLine=function(e,i){var r=e._text.trim(),n=e._width;return r.length!==e._text.length&&(n=this._getLineWidth(r),(e._lineType&t._LineType.firstParagraphLine)>0&&(n+=this._getLineIndent(i))),e._text=r,e._width=n,e},e.prototype._getWrapType=function(){return null!==this._format&&void 0!==this._format?this._format._wordWrap:t._PdfWordWrapType.word},e}(),Ae=function(){function t(){}return Object.defineProperty(t.prototype,"_actualSize",{get:function(){return void 0===this._size&&(this._size=[0,0]),this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lines",{get:function(){return this._layoutLines},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_empty",{get:function(){return null===this._layoutLines||0===this._layoutLines.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lineCount",{get:function(){return this._empty?0:this._layoutLines.length},enumerable:!0,configurable:!0}),t}(),xe=function(){function t(){}return t}();!function(t){t[t.none=0]="none",t[t.newLineBreak=1]="newLineBreak",t[t.layoutBreak=2]="layoutBreak",t[t.firstParagraphLine=4]="firstParagraphLine",t[t.lastParagraphLine=8]="lastParagraphLine"}(t._LineType||(t._LineType={}));var ke=function(){function t(t){if(this._position=0,void 0===t||null===t)throw new Error("ArgumentNullException:text");this._text=t}return Object.defineProperty(t.prototype,"_length",{get:function(){return this._text.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_end",{get:function(){return this._position===this._text.length},enumerable:!0,configurable:!0}),t.prototype._readLine=function(){for(var t=this._position;t<this._length;){var e=this._text[t],i=void 0;switch(e){case"\r":case"\n":return i=this._text.substring(this._position,t),this._position=t+1,"\r"===e&&this._position<this._length&&"\n"===this._text[this._position]&&this._position++,i}t++}if(t>this._position){var r=this._text.substring(this._position,t);return this._position=t,r}return null},t.prototype._peekLine=function(){var t=this._position,e=this._readLine();return this._position=t,e},t.prototype._readWord=function(){for(var t=this._position;t<this._length;){var e=this._text[t],i=void 0;switch(e){case"\r":case"\n":return i=this._text.substring(this._position,t-this._position),this._position=t+1,"\r"===e&&this._position<this._length&&"\n"===this._text[this._position]&&this._position++,i;case" ":case"\t":return t===this._position&&t++,i=this._text.substring(this._position,t),this._position=t,i}t++}if(t>this._position){var r=this._text.substring(this._position,t);return this._position=t,r}return null},t.prototype._peekWord=function(){var t=this._position,e=this._readWord();return this._position=t,e},t.prototype._read=function(t){if(void 0===t){var e="0";return this._end||(e=this._text[this._position],this._position++),e}for(var i=0,r="";!this._end&&i<t;)r+=this._read(),i++;return r},t.prototype._peek=function(){return this._end?"0":this._text[this._position]},t.prototype._close=function(){this._text=null},t.prototype._readToEnd=function(){var t;return t=0===this._position?this._text:this._text.substring(this._position),this._position=this._length,t},t._whiteSpace=" ",t._tab="\t",t._spaces=[t._whiteSpace,t._tab],t}(),Ce=function(){function t(){}return Object.defineProperty(t.prototype,"_empty",{get:function(){return this._offset===this._length&&this._length===this._checksum&&0===this._checksum},enumerable:!0,configurable:!0}),t}(),Te=function(){function t(){}return t}(),Re=function(){function t(){}return t}(),Fe=function(){function t(){}return t}(),Le=function(){function t(){}return t}(),De=function(){function t(){}return t}(),Be=function(){function t(){}return t}(),Oe=function(){function t(){}return t}(),Ie=function(){function t(){}return t}(),Me=function(){function t(){}return t}(),Ne=function(){function t(){}return t}(),Ee=function(){function e(t){this._int32Size=4,this._isFont=!1,this._isMacTtf=!1,this._isMacFont=!1,this._missedGlyphs=0,this._tableNames=["cvt ","fpgm","glyf","head","hhea","hmtx","loca","maxp","prep"],this._entrySelectors=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4],this._fontData=t,this._initialize()}return Object.defineProperty(e.prototype,"macintosh",{get:function(){return null!==this._macintoshDictionary&&void 0!==this._macintoshDictionary||(this._macintoshDictionary=new Zr),this._macintoshDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_microsoft",{get:function(){return null!==this._microsoftDictionary&&void 0!==this._microsoftDictionary||(this._microsoftDictionary=new Zr),this._microsoftDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_macintoshGlyphs",{get:function(){return null!==this._internalMacintoshGlyphs&&void 0!==this._internalMacintoshGlyphs||(this._internalMacintoshGlyphs=new Zr),this._internalMacintoshGlyphs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_microsoftGlyphs",{get:function(){return null!==this._internalMicrosoftGlyphs&&void 0!==this._internalMicrosoftGlyphs||(this._internalMicrosoftGlyphs=new Zr),this._internalMicrosoftGlyphs},enumerable:!0,configurable:!0}),e.prototype._initialize=function(){void 0!==this._metrics&&null!==this._metrics||(this._metrics=new Ve),this._readFontDictionary();var t=this._readNameTable(),e=this._readHeadTable();this._initializeFontName(t),this._metrics._macStyle=e._macStyle},e.prototype._readFontDictionary=function(){this._offset=0,this._check();var t=this._readInt16(this._offset);this._readInt16(this._offset),this._readInt16(this._offset),this._readInt16(this._offset),void 0!==this._tableDirectory&&null!==this._tableDirectory||(this._tableDirectory=new Zr);for(var e=0;e<t;++e){var i=new Ce,r=this._readString(this._int32Size);i._checksum=this._readInt32(this._offset),i._offset=this._readInt32(this._offset),i._length=this._readInt32(this._offset),this._tableDirectory.setValue(r,i)}this._lowestPosition=this._offset,this._isFont||this._fixOffsets()},e.prototype._fixOffsets=function(){for(var t=this,e=Number.MAX_VALUE,i=this._tableDirectory.keys(),r=0;r<i.length;r++){var n=this._tableDirectory.getValue(i[r])._offset;if(e>n&&(e=n)<=this._lowestPosition)break}var s=e-this._lowestPosition;if(0!==s){var a=new Zr;i.forEach(function(e){var i=t._tableDirectory.getValue(e);i._offset-=s,a.setValue(e,i)}),this._tableDirectory=a}},e.prototype._check=function(){var t=this._readInt32(this._offset);if(this._isMacTtf=1953658213===t,65536!==t&&1953658213!==t&&1330926671!==t){if(this._isFont=!0,this._offset=0,"ttcf"!==this._readString(4))throw new Error("Can not read TTF font data");if(this._offset+=4,this._readInt32(this._offset)<0)throw new Error("Can not read TTF font data");this._offset=this._readInt32(this._offset),t=this._readInt32(this._offset)}return t},e.prototype._readNameTable=function(){var t=this._getTable("name");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new Fe;e._formatSelector=this._readUInt16(this._offset),e._recordsCount=this._readUInt16(this._offset),e._offset=this._readUInt16(this._offset),e._nameRecords=[];for(var i=this._offset,r=0;r<e._recordsCount;r++){this._offset=i;var n=new je;n._platformID=this._readUInt16(this._offset),n._encodingID=this._readUInt16(this._offset),n._languageID=this._readUInt16(this._offset),n._nameID=this._readUInt16(this._offset),n._length=this._readUInt16(this._offset),n._offset=this._readUInt16(this._offset),this._offset=t._offset+e._offset+n._offset;var s=0===n._platformID||3===n._platformID;n._name=this._readString(n._length,s),e._nameRecords[r]=n,i+=12}return e},e.prototype._readHeadTable=function(){var t=this._getTable("head");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new Be;return e._version=this._readFixed(this._offset),e._fontRevision=this._readFixed(this._offset),e._checkSumAdjustment=this._readUInt32(this._offset),e._magicNumber=this._readUInt32(this._offset),e._flags=this._readUInt16(this._offset),e._unitsPerEm=this._readUInt16(this._offset),e._created=this._readInt64(this._offset),e._modified=this._readInt64(this._offset),e._xMin=this._readInt16(this._offset),e._yMin=this._readInt16(this._offset),e._xMax=this._readInt16(this._offset),e._yMax=this._readInt16(this._offset),e._macStyle=this._readUInt16(this._offset),e._lowestReadableSize=this._readUInt16(this._offset),e._fontDirectionHint=this._readInt16(this._offset),e._indexToLocalFormat=this._readInt16(this._offset),e._glyphDataFormat=this._readInt16(this._offset),e},e.prototype._readHorizontalHeaderTable=function(){var t=this._getTable("hhea");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new De;return e._version=this._readFixed(this._offset),e._ascender=this._readInt16(this._offset),e._descender=this._readInt16(this._offset),e._lineGap=this._readInt16(this._offset),e._advanceWidthMax=this._readUInt16(this._offset),e._minLeftSideBearing=this._readInt16(this._offset),e._minRightSideBearing=this._readInt16(this._offset),e._xMaxExtent=this._readInt16(this._offset),e._caretSlopeRise=this._readInt16(this._offset),e._caretSlopeRun=this._readInt16(this._offset),this._offset+=10,e._metricDataFormat=this._readInt16(this._offset),e._numberOfHMetrics=this._readUInt16(this._offset),e},e.prototype._readOS2Table=function(){var t=this._getTable("OS/2");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new Te;return e._version=this._readUInt16(this._offset),e._xAvgCharWidth=this._readInt16(this._offset),e._usWeightClass=this._readUInt16(this._offset),e._usWidthClass=this._readUInt16(this._offset),e._fsType=this._readInt16(this._offset),e._ySubscriptXSize=this._readInt16(this._offset),e._ySubscriptYSize=this._readInt16(this._offset),e._ySubscriptXOffset=this._readInt16(this._offset),e._ySubscriptYOffset=this._readInt16(this._offset),e._ySuperscriptXSize=this._readInt16(this._offset),e._ySuperscriptYSize=this._readInt16(this._offset),e._ySuperscriptXOffset=this._readInt16(this._offset),e._ySuperscriptYOffset=this._readInt16(this._offset),e._yStrikeoutSize=this._readInt16(this._offset),e._yStrikeoutPosition=this._readInt16(this._offset),e._sFamilyClass=this._readInt16(this._offset),e._panose=this._readBytes(10),e._ulUnicodeRange1=this._readUInt32(this._offset),e._ulUnicodeRange2=this._readUInt32(this._offset),e._ulUnicodeRange3=this._readUInt32(this._offset),e._ulUnicodeRange4=this._readUInt32(this._offset),e._vendorIdentifier=this._readBytes(4),e._fsSelection=this._readUInt16(this._offset),e._usFirstCharIndex=this._readUInt16(this._offset),e._usLastCharIndex=this._readUInt16(this._offset),e._sTypoAscender=this._readInt16(this._offset),e._sTypoDescender=this._readInt16(this._offset),e._sTypoLineGap=this._readInt16(this._offset),e._usWinAscent=this._readUInt16(this._offset),e._usWinDescent=this._readUInt16(this._offset),e._ulCodePageRange1=this._readUInt32(this._offset),e._ulCodePageRange2=this._readUInt32(this._offset),e._version>1?(e._sxHeight=this._readInt16(this._offset),e._sCapHeight=this._readInt16(this._offset),e._usDefaultChar=this._readUInt16(this._offset),e._usBreakChar=this._readUInt16(this._offset),e._usMaxContext=this._readUInt16(this._offset)):(e._sxHeight=0,e._sCapHeight=0,e._usDefaultChar=0,e._usBreakChar=0,e._usMaxContext=0),e},e.prototype._readPostTable=function(){var t=this._getTable("post");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new Re;return e._formatType=this._readFixed(this._offset),e._italicAngle=this._readFixed(this._offset),e._underlinePosition=this._readInt16(this._offset),e._underlineThickness=this._readInt16(this._offset),e._isFixedPitch=this._readUInt32(this._offset),e._minType42=this._readUInt32(this._offset),e._maxType42=this._readUInt32(this._offset),e._minType1=this._readUInt32(this._offset),e._maxType1=this._readUInt32(this._offset),e},e.prototype._readWidthTable=function(t,e){var i=this._getTable("hmtx");void 0!==i._offset&&null!==i._offset&&(this._offset=i._offset);for(var r=[],n=0;n<t;n++){var s=new ze;s._advanceWidth=this._readUInt16(this._offset),s._lsb=this._readInt16(this._offset);var a=1e3*s._advanceWidth/e;r.push(Math.floor(a))}return r},e.prototype._readCmapTable=function(){var t=this._getTable("cmap");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new Oe;e._version=this._readUInt16(this._offset),e._tablesCount=this._readUInt16(this._offset);for(var i=this._offset,r=[],n=0;n<e._tablesCount;n++){this._offset=i;var s=new Ie;s._platformID=this._readUInt16(this._offset),s._encodingID=this._readUInt16(this._offset),s._offset=this._readUInt32(this._offset),i=this._offset,this._readCmapSubTable(s),r[n]=s}return r},e.prototype._readCmapSubTable=function(e){var i=this._getTable("cmap");this._offset=i._offset+e._offset;var r=this._readUInt16(this._offset),n=this._getCmapEncoding(e._platformID,e._encodingID);if(n!==t._TrueTypeCmapEncoding.unknown)switch(r){case t._TrueTypeCmapFormat.apple:this._readAppleCmapTable(e,n);break;case t._TrueTypeCmapFormat.microsoft:this._readMicrosoftCmapTable(e,n);break;case t._TrueTypeCmapFormat.trimmed:this._readTrimmedCmapTable(e,n)}},e.prototype._readAppleCmapTable=function(t,e){var i=this._getTable("cmap");this._offset=i._offset+t._offset;var r=new Me;r._format=this._readUInt16(this._offset),r._length=this._readUInt16(this._offset),r._version=this._readUInt16(this._offset),null!==this._maxMacIndex&&void 0!==this._maxMacIndex||(this._maxMacIndex=0);for(var n=0;n<256;++n){var s=new Ue;s._index=this._readByte(this._offset),s._width=this._getWidth(s._index),s._charCode=n,this.macintosh.setValue(n,s),this._addGlyph(s,e),this._maxMacIndex=Math.max(n,this._maxMacIndex)}},e.prototype._readMicrosoftCmapTable=function(e,i){var r=this._getTable("cmap");this._offset=r._offset+e._offset;var n=i===t._TrueTypeCmapEncoding.unicode?this._microsoft:this.macintosh,s=new Le;s._format=this._readUInt16(this._offset),s._length=this._readUInt16(this._offset),s._version=this._readUInt16(this._offset),s._segCountX2=this._readUInt16(this._offset),s._searchRange=this._readUInt16(this._offset),s._entrySelector=this._readUInt16(this._offset),s._rangeShift=this._readUInt16(this._offset);var a=s._segCountX2/2;s._endCount=this._readUShortArray(a),s._reservedPad=this._readUInt16(this._offset),s._startCount=this._readUShortArray(a),s._idDelta=this._readUShortArray(a),s._idRangeOffset=this._readUShortArray(a);var o=s._length/2-8-4*a;s._glyphID=this._readUShortArray(o);for(var h=0,c=0,_=0;_<a;_++)for(var d=s._startCount[_];d<=s._endCount[_]&&65535!==d;d++){if(0===s._idRangeOffset[_])h=d+s._idDelta[_]&65535;else{if((c=_+s._idRangeOffset[_]/2-a+d-s._startCount[_])>=s._glyphID.length)continue;h=s._glyphID[c]+s._idDelta[_]&65535}var l=new Ue;l._index=h,l._width=this._getWidth(l._index);var f=i===t._TrueTypeCmapEncoding.symbol&&61440==(65280&d)?255&d:d;l._charCode=f,n.setValue(f,l),this._addGlyph(l,i)}},e.prototype._readTrimmedCmapTable=function(t,e){var i=this._getTable("cmap");this._offset=i._offset+t._offset;var r=new Ne;r._format=this._readUInt16(this._offset),r._length=this._readUInt16(this._offset),r._version=this._readUInt16(this._offset),r._firstCode=this._readUInt16(this._offset),r._entryCount=this._readUInt16(this._offset);for(var n=0;n<r._entryCount;++n){var s=new Ue;s._index=this._readUInt16(this._offset),s._width=this._getWidth(s._index),s._charCode=n+r._firstCode,this.macintosh.setValue(n,s),this._addGlyph(s,e),this._maxMacIndex=Math.max(n,this._maxMacIndex)}},e.prototype._initializeFontName=function(t){for(var e=0;e<t._recordsCount;e++){var i=t._nameRecords[e];if(1===i._nameID?this._metrics._fontFamily=i._name:6===i._nameID&&(this._metrics._postScriptName=i._name),null!==this._metrics._fontFamily&&void 0!==this._metrics._fontFamily&&null!==this._metrics._postScriptName&&void 0!==this._metrics._postScriptName)break}},e.prototype._getTable=function(t){var e,i=new Ce;return this._tableDirectory.containsKey(t)&&(e=this._tableDirectory.getValue(t)),null!==e&&void 0!==e&&(i=e),i},e.prototype._getWidth=function(t){return t=t<this._width.length?t:this._width.length-1,this._width[t]},e.prototype._getCmapEncoding=function(e,i){var r=t._TrueTypeCmapEncoding.unknown;return e===t._TrueTypePlatformID.microsoft&&i===t._TrueTypeMicrosoftEncodingID.undefined?r=t._TrueTypeCmapEncoding.symbol:e===t._TrueTypePlatformID.microsoft&&i===t._TrueTypeMicrosoftEncodingID.unicode?r=t._TrueTypeCmapEncoding.unicode:e===t._TrueTypePlatformID.macintosh&&i===t._TrueTypeMacintoshEncodingID.roman&&(r=t._TrueTypeCmapEncoding.macintosh),r},e.prototype._addGlyph=function(e,i){var r=null;switch(i){case t._TrueTypeCmapEncoding.unicode:r=this._microsoftGlyphs;break;case t._TrueTypeCmapEncoding.macintosh:case t._TrueTypeCmapEncoding.symbol:r=this._macintoshGlyphs}e&&void 0!==e._index&&r.setValue(e._index,e)},e.prototype._initializeMetrics=function(e,i,r,n,s,a){var o=this;this._initializeFontName(e);var h=!1;h=a.some(function(e){return o._getCmapEncoding(e._platformID,e._encodingID)===t._TrueTypeCmapEncoding.symbol}),this._metrics._isSymbol=h,this._metrics._macStyle=i._macStyle,this._metrics._isFixedPitch=0!==s._isFixedPitch,this._metrics._italicAngle=s._italicAngle;var c=1e3/i._unitsPerEm;this._metrics._winAscent=n._sTypoAscender*c,this._metrics._macAscent=r._ascender*c,this._metrics._capHeight=0!==n._sCapHeight?n._sCapHeight:.7*i._unitsPerEm*c,this._metrics._winDescent=n._sTypoDescender*c,this._metrics._macDescent=r._descender*c,this._metrics._leading=(n._sTypoAscender-n._sTypoDescender+n._sTypoLineGap)*c,this._metrics._lineGap=Math.ceil(r._lineGap*c);var _=i._xMin*c,d=Math.ceil(this._metrics._macAscent+this._metrics._lineGap),l=i._xMax*c,f=this._metrics._macDescent;this._metrics._fontBox=[_,d,l,f],this._metrics._stemV=80,this._metrics._widthTable=this._updateWidth(),this._metrics._contains=this._tableDirectory.containsKey("CFF"),this._metrics._subScriptSizeFactor=i._unitsPerEm/n._ySubscriptYSize,this._metrics._superscriptSizeFactor=i._unitsPerEm/n._ySuperscriptYSize},e.prototype._updateWidth=function(){var t=[];if(this._metrics._isSymbol)for(n=0;n<256;n++){var e=this._getGlyph(String.fromCharCode(n));t[n]=e._empty?0:e._width}else for(var i=[],r=String.fromCharCode(32),n=0;n<256;n++){i[0]=n;var s=this._getString(i,0,i.length),a=s.length>0?s[0]:"?";(e=this._getGlyph(a))._empty?(e=this._getGlyph(r),t[n]=e._empty?0:e._width):t[n]=e._width}return t},e.prototype._getDefaultGlyph=function(){return this._getGlyph(ke._whiteSpace)},e.prototype._getString=function(t,e,i){for(var r="",n=0;n<i;n++)r+=String.fromCharCode(t[n+e]);return r},e.prototype._setOffset=function(t){this._offset=t},e.prototype._readFontProgram=function(t){var e=this._getGlyphChars(t),i=this._readLocaTable(this._bIsLocaShort);e&&e._size()<t._size()&&(this._missedGlyphs=t._size()-e._size()),this._updateGlyphChars(e,i);var r=this._generateGlyphTable(e,i,null,null),n=r.glyphTableSize,s=r.newLocaTable,a=r.newGlyphTable,o=this._updateLocaTable(s,this._bIsLocaShort),h=o.newLocaSize,c=o.newLocaUpdated;return this._getFontProgram(c,a,n,h)},e.prototype._generateGlyphTable=function(t,e,i,r){i=[];var n=t.keys();n.sort(function(t,e){return t-e});var s=0;n.forEach(function(t){e._offsets.length>0&&(s+=e._offsets[t+1]-e._offsets[t])});var a=this._align(s);r=[];for(_=0;_<a;_++)r.push(0);for(var o=0,h=0,c=this._getTable("glyf"),_=0;_<e._offsets.length;_++)if(i.push(o),h<n.length&&n[h]===_){++h,i[_]=o;var d=e._offsets[_],l=e._offsets[_+1]-d;l>0&&(this._offset=c._offset+d,r=this._read(r,o,l).buffer,o+=l)}return{glyphTableSize:s,newLocaTable:i,newGlyphTable:r}},e.prototype._readLocaTable=function(t){var e=this._getTable("loca");this._offset=e._offset;var i=new We,r=[];if(t){n=e._length/2;r=[];for(s=0;s<n;s++)r[s]=2*this._readUInt16(this._offset)}else{var n=e._length/4;r=[];for(var s=0;s<n;s++)r[s]=this._readUInt32(this._offset)}return i._offsets=r,i},e.prototype._updateGlyphChars=function(t,e){var i=this;t.containsKey(0)||t.setValue(0,0);var r=new Zr,n=t.keys();n.forEach(function(e){r.setValue(e,t.getValue(e))}),n.forEach(function(r){i._processCompositeGlyph(t,r,e)})},e.prototype._processCompositeGlyph=function(e,i,r){if(i<r._offsets.length-1){var n=r._offsets[i];if(n!==r._offsets[i+1]){var s=this._getTable("glyf");this._offset=s._offset+n;var a=new He;if(a.numberOfContours=this._readInt16(this._offset),a.xMin=this._readInt16(this._offset),a.yMin=this._readInt16(this._offset),a.xMax=this._readInt16(this._offset),a.yMax=this._readInt16(this._offset),a.numberOfContours<0)for(var o=0;;){var h=this._readUInt16(this._offset),c=this._readUInt16(this._offset);if(e.containsKey(c)||e.setValue(c,0),0==(h&t._TrueTypeCompositeGlyphFlag.MoreComponents))break;o=0!=(h&t._TrueTypeCompositeGlyphFlag.Arg1And2AreWords)?4:2,0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveScale)?o+=2:0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveAnXyScale)?o+=4:0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveTwoByTwo)&&(o+=8),this._offset+=o}}}},e.prototype._updateLocaTable=function(t,e){var i=e?2*t.length:4*t.length,r=this._align(i),n=new Ge(r);return t.forEach(function(t){e?(t/=2,n._writeShort(t)):n._writeInt(t)}),{newLocaUpdated:n._data,newLocaSize:i}},e.prototype._align=function(t){return t+3&-4},e.prototype._getFontProgram=function(t,e,i,r){var n=this._getFontProgramLength(t,e,0),s=n.fontProgramLength,a=n.table,o=new Ge(s);o._writeInt(65536),o._writeShort(a);var h=this._entrySelectors[a];return o._writeShort(16*(1<<(31&h))),o._writeShort(h),o._writeShort(16*(a-(1<<(31&h)))),this._writeCheckSums(o,a,t,e,i,r),this._writeGlyphs(o,t,e),o._data},e.prototype._getFontProgramLength=function(t,e,i){var r=this,n=0;return null!==t&&void 0!==t&&t.length>0&&null!==e&&void 0!==e&&e.length>0&&(i=2,this._tableNames.forEach(function(t){if("glyf"!==t&&"loca"!==t){var e=r._getTable(t);e._empty||(++i,n+=r._align(e._length))}}),n+=t.length,n+=e.length,n+=16*i+12),{fontProgramLength:n,table:i}},e.prototype._getGlyphChars=function(t){var e=this,i=new Zr;return null!==t&&void 0!==t&&t.keys().forEach(function(t){var r=e._getGlyph(t);r._empty||i.setValue(r._index,t.charCodeAt(0))}),i},e.prototype._writeCheckSums=function(t,e,i,r,n,s){var a=this;if(null!==t&&void 0!==t&&null!==i&&void 0!==i&&i.length>0&&null!==r&&void 0!==r&&r.length>0){var o=16*e+12,h=0;this._tableNames.forEach(function(e){var c=a._getTable(e);if(!c._empty){if(t._writeString(e),"glyf"===e){_=a._calculateCheckSum(r);t._writeInt(_),h=n}else if("loca"===e){var _=a._calculateCheckSum(i);t._writeInt(_),h=s}else t._writeInt(c._checksum),h=c._length;t._writeUInt(o),t._writeUInt(h),o+=a._align(h)}})}},e.prototype._calculateCheckSum=function(t){var e=0,i=0,r=0,n=0,s=0,a=0;if(null!==t&&void 0!==t&&t.length>0){for(var o=0;o<(t.length+1)/4;o++)s+=255&t[e++],n+=255&t[e++],r+=255&t[e++],i+=255&t[e++];a=i,a+=r<<8,a+=n<<16,a+=s<<24}return a},e.prototype._writeGlyphs=function(t,e,i){var r=this;null!==t&&void 0!==t&&null!==e&&void 0!==e&&e.length>0&&null!==i&&void 0!==i&&i.length>0&&this._tableNames.forEach(function(n){var s=r._getTable(n);if(!s._empty)if("glyf"===n)t._writeBytes(i);else if("loca"===n)t._writeBytes(e);else{for(var a=r._align(s._length),o=[],h=0;h<a;h++)o.push(0);r._offset=s._offset;var c=r._read(o,0,s._length);t._writeBytes(c.buffer)}})},e.prototype._read=function(t,e,i){var r=0;if(null!==t&&void 0!==t&&t.length>0){var n=0;do{for(var s=0;s<i-r&&this._offset+s<this._fontData.length;s++)t[e+s]=this._fontData[this._offset+s];n=i-r,this._offset+=n,r+=n}while(r<i)}return{buffer:t,written:r}},e.prototype._createInternals=function(){this._metrics=new Ve;var t=this._readNameTable(),e=this._readHeadTable();this._bIsLocaShort=0===e._indexToLocalFormat;var i=this._readHorizontalHeaderTable(),r=this._readOS2Table(),n=this._readPostTable();this._width=this._readWidthTable(i._numberOfHMetrics,e._unitsPerEm);var s=this._readCmapTable();this._initializeMetrics(t,e,i,r,n,s)},e.prototype._getGlyph=function(t){if("number"==typeof t){var e=null;return this._metrics._isSymbol||null===this._microsoftGlyphs?this._metrics._isSymbol&&null!==this._macintoshGlyphs&&this._macintoshGlyphs.containsKey(t)&&(e=this._macintoshGlyphs.getValue(t)):this._microsoftGlyphs.containsKey(t)&&(e=this._microsoftGlyphs.getValue(t)),n=null!==e?e:this._getDefaultGlyph()}var i=null,r=t.charCodeAt(0);this._metrics._isSymbol||null===this._microsoft?(this._metrics._isSymbol&&null!==this.macintosh||this._isMacFont)&&(0!==this._maxMacIndex?r%=this._maxMacIndex+1:r=61440==(65280&r)?255&r:r,this.macintosh.containsKey(r)&&(i=this.macintosh.getValue(r),this._isFontPresent=!0)):this._microsoft.containsKey(r)?(i=this._microsoft.getValue(r),r!==ke._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!0)):r!==ke._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!1),t===ke._whiteSpace&&null===i&&(i=new Ue);var n=null!==i?i:this._getDefaultGlyph();return n},e.prototype._readString=function(t,e){if(void 0===e||null===e)return this._readString(t,!1);var i="";if(e)for(r=0;r<t;r++)r%2!=0&&(i+=String.fromCharCode(this._fontData[this._offset])),this._offset+=1;else for(var r=0;r<t;r++)i+=String.fromCharCode(this._fontData[this._offset]),this._offset+=1;return i},e.prototype._readFixed=function(t){return this._readInt16(t)+this._readInt16(t+2)/16384},e.prototype._readInt32=function(t){var e=this._fontData[t+3],i=this._fontData[t+2],r=this._fontData[t+1],n=this._fontData[t];return this._offset+=4,e+(i<<8)+(r<<16)+(n<<24)},e.prototype._readUInt32=function(t){var e=this._fontData[t+3],i=this._fontData[t+2],r=this._fontData[t+1],n=this._fontData[t];return this._offset+=4,e|i<<8|r<<16|n<<24},e.prototype._readInt16=function(t){var e=(this._fontData[t]<<8)+this._fontData[t+1];return e=32768&e?e-65536:e,this._offset+=2,e},e.prototype._readInt64=function(t){var e=this._readInt32(t+4),i=4294967296*this._readInt32(t)+e;return e<0&&(i+=4294967296),i},e.prototype._readUInt16=function(t){var e=this._fontData[t]<<8|this._fontData[t+1];return this._offset+=2,e},e.prototype._readUShortArray=function(t){for(var e=[],i=0;i<t;i++)e[i]=this._readUInt16(this._offset);return e},e.prototype._readBytes=function(t){for(var e=[],i=0;i<t;i++)e.push(this._fontData[this._offset]),this._offset+=1;return e},e.prototype._readByte=function(t){var e=this._fontData[t];return this._offset+=1,e},e.prototype._getCharacterWidth=function(t){var e=this._getGlyph(t);return(e=e._empty?this._getDefaultGlyph():e)._empty?0:e._width},e.prototype._convertString=function(t){var e="";if(null!==t&&void 0!==t&&t.length>0)for(var i=0;i<t.length;i++){var r=t[i],n=this._getGlyph(r);n._empty||(e+=String.fromCharCode(n._index))}return e},e}(),je=function(){function t(){}return t}(),Ve=function(){function t(){}return Object.defineProperty(t.prototype,"_isItalic",{get:function(){return 0!=(2&this._macStyle)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_isBold",{get:function(){return 0!=(1&this._macStyle)},enumerable:!0,configurable:!0}),t}(),ze=function(){function t(){}return t}(),Ue=function(){function t(){}return Object.defineProperty(t.prototype,"_empty",{get:function(){return this._index===this._width&&this._width===this._charCode&&0===this._charCode},enumerable:!0,configurable:!0}),t}(),We=function(){function t(){}return t}(),He=function(){function t(){}return t}(),Ge=function(){function t(t){this.int32Size=4,this.int16Size=2,this.int64Size=8,this._bufferLength=t,this._buffer=[]}return Object.defineProperty(t.prototype,"_data",{get:function(){if(this._buffer.length<this._bufferLength)for(var t=this._bufferLength-this._buffer.length,e=0;e<t;e++)this._buffer.push(0);return this._buffer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_position",{get:function(){return void 0!==this._internalPosition&&null!==this._internalPosition||(this._internalPosition=0),this._internalPosition},enumerable:!0,configurable:!0}),t.prototype._writeShort=function(t){var e=[(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeInt=function(t){var e=[(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeUInt=function(t){var e=[(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeString=function(t){if(null!==t&&void 0!==t){for(var e=[],i=0;i<t.length;i++)e.push(t.charCodeAt(i));this._flush(e)}},t.prototype._writeBytes=function(t){this._flush(t)},t.prototype._flush=function(t){if(null!==t&&void 0!==t){for(var e=this._position,i=0;i<t.length;i++)this._buffer[e]=t[i],e++;this._internalPosition+=t.length}},t}(),Ke=function(){function e(t,e){if(this._nameString="ABCDEFGHIJKLMNOPQRSTUVWXYZ",this._isEmbedFont=!1,this._cmapPrefix="/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\r\n/CIDSystemInfo << /Registry (Adobe)/Ordering (UCS)/Supplement 0>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 beginCodeSpacerange\r\n",this._cmapEndCodeSpaceRange="endCodeSpacerange\r\n",this._cmapBeginRange="beginbfrange\r\n",this._cmapEndRange="endbfrange\r\n",this._cmapSuffix="endbfrange\nendcmap\nCMapName currentdict /CMap defineresource pop\nend end\r\n",null===t||void 0===t)throw new Error("ArgumentNullException:base64String");this._fontSize=e,this._fontData="string"==typeof t?k(t):t,this._ttfReader=new Ee(this._fontData),this._ttfMetrics=this._ttfReader._metrics}return e.prototype._beginSave=function(){this._descendantFontBeginSave(),this._cmapBeginSave(),this._fontDictionaryBeginSave(),this._fontProgramBeginSave(),this._fontDescriptor&&(this._fontDescriptor.update("FontFile2",this._fontProgram),this._fontDescriptor._updated=!0,this._fontDescriptor._isFont=!0)},e.prototype._descendantFontBeginSave=function(){if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var t=this._getDescendantWidth();null!==t&&this._descendantFont.set("W",t)}},e.prototype._fontDictionaryBeginSave=function(){null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0&&this._fontDictionary&&!this._fontDictionary.has("ToUnicode")&&this._fontDictionary.update("ToUnicode",this._cmap)},e.prototype._createInternals=function(){this._fontDictionary=new $r,this._descendantFont=new $r,this._metrics=new ge,this._ttfReader._createInternals(),this._usedChars=null;var t=[];this._fontProgram=new nn(t,new $r),this._cmap=new nn(t,new $r),this._ttfMetrics=this._ttfReader._metrics,this._initializeMetrics(),this._subsetName=this._getFontName(),this._createDescendantFont(),this._createFontDictionary()},e.prototype._getInternals=function(){return this._fontDictionary},e.prototype._initializeMetrics=function(){var t=this._ttfReader._metrics;this._metrics._ascent=t._macAscent,this._metrics._descent=t._macDescent,this._metrics._height=t._macAscent-t._macDescent+t._lineGap,this._metrics._name=t._fontFamily,this._metrics._postScriptName=t._postScriptName,this._metrics._size=this._fontSize,this._metrics._widthTable=new me(t._widthTable),this._metrics._lineGap=t._lineGap,this._metrics._subScriptSizeFactor=t._subScriptSizeFactor,this._metrics._superscriptSizeFactor=t._superscriptSizeFactor,this._metrics._isBold=t._isBold},e.prototype._getFontName=function(){for(var t="",e=0;e<6;e++){var i=Math.floor(26*Math.random())+0;t+=this._nameString[i]}return t+="+",(t+=this._ttfReader._metrics._postScriptName).toString()},e.prototype._createDescendantFont=function(){this._descendantFont=new $r,this._descendantFont._updated=!0,this._descendantFont.set("Type",new Xr("Font")),this._descendantFont.set("Subtype",new Xr("CIDFontType2")),this._descendantFont.set("BaseFont",new Xr(this._subsetName)),this._descendantFont.set("CIDToGIDMap",new Xr("Identity")),this._descendantFont.set("DW",1e3),this._fontDescriptor=this._createFontDescriptor(),this._descendantFont.set("FontDescriptor",this._fontDescriptor);var t=this._createSystemInfo();this._descendantFont.set("CIDSystemInfo",t),this._descendantFont._isFont=!0},e.prototype._createFontDescriptor=function(){var t=new $r,e=this._ttfReader._metrics;return t.set("Type",new Xr("FontDescriptor")),t.set("FontName",new Xr(this._subsetName)),t.set("Flags",this._getDescriptorFlags()),t.set("FontBBox",this._getBoundBox()),t.set("MissingWidth",e._widthTable[32]),t.set("StemV",e._stemV),t.set("ItalicAngle",e._italicAngle),t.set("CapHeight",e._capHeight),t.set("Ascent",e._winAscent),t.set("Descent",e._winDescent),t.set("Leading",e._leading),t.set("AvgWidth",e._widthTable[32]),t.set("MaxWidth",e._widthTable[32]),t.set("XHeight",0),t.set("StemH",0),t._updated=!0,t},e.prototype._generateFontProgram=function(){var t=[];this._usedChars=null===this._usedChars||void 0===this._usedChars?new Zr:this._usedChars,this._ttfReader._setOffset(0),t=this._ttfReader._readFontProgram(this._usedChars),this._fontProgram._clearStream(),this._fontProgram._writeBytes(t)},e.prototype._getBoundBox=function(){var t=this._ttfReader._metrics._fontBox,e=Math.abs(t[2]-t[0]),i=Math.abs(t[1]-t[3]);return[t[0],t[3],e,i]},e.prototype._cmapBeginSave=function(){this._generateCmap()},e.prototype._fontProgramBeginSave=function(){this._generateFontProgram()},e.prototype._toHexString=function(t,e){var i=t.toString(16);return e&&(i=i.toUpperCase()),"<0000".substring(0,5-i.length)+i+">"},e.prototype._generateCmap=function(){var t=this;if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var e=this._ttfReader._getGlyphChars(this._usedChars);if(e._size()>0){var i=e.keys().sort(),r=i[0],n=i[i.length-1],s=this._toHexString(r,!1)+this._toHexString(n,!1)+"\r\n",a="";a+=this._cmapPrefix,a+=s,a+=this._cmapEndCodeSpaceRange;var o=0;i.forEach(function(r,n){0===o&&(0!==n&&(a+=t._cmapEndRange),o=Math.min(100,i.length-n),a+=o,a+=" ",a+=t._cmapBeginRange),o-=1,a+=t._toHexString(r,!0)+t._toHexString(r,!0),a+=t._toHexString(e.getValue(r),!0)+"\n"}),a+=this._cmapSuffix,this._cmap._clearStream(),this._cmap._write(a)}}},e.prototype._createFontDictionary=function(){this._fontDictionary._updated=!0,this._fontDictionary.set("Type",Xr.get("Font")),this._fontDictionary.set("Subtype",Xr.get("Type0")),this._fontDictionary.set("BaseFont",new Xr(this._subsetName)),this._fontDictionary.set("Encoding",Xr.get("Identity-H")),this._fontDictionary.set("DescendantFonts",this._descendantFont),this._fontDictionary._isFont=!0,this._fontDictionary._currentObj=this},e.prototype._createSystemInfo=function(){var t=new $r;return t._updated=!0,t.set("Registry","Adobe"),t.set("Ordering","Identity"),t.set("Supplement",0),t},e.prototype._getDescriptorFlags=function(){var e=0,i=this._ttfReader._metrics;return i._isFixedPitch&&(e|=t._FontDescriptorFlag.fixedPitch),i._isSymbol?e|=t._FontDescriptorFlag.symbolic:e|=t._FontDescriptorFlag.nonSymbolic,i._isItalic&&(e|=t._FontDescriptorFlag.italic),i._isBold&&(e|=t._FontDescriptorFlag.forceBold),e},e.prototype._getCharacterWidth=function(t){return this._ttfReader._getCharacterWidth(t)},e.prototype._setSymbols=function(t){var e=this;null!==t&&void 0!==t&&(null!==this._usedChars&&void 0!==this._usedChars||(this._usedChars=new Zr),t.split("").forEach(function(t){e._usedChars.setValue(t,String.fromCharCode(0))}))},e.prototype._getDescendantWidth=function(){var t=this,e=new Array;if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var i=[];this._usedChars.keys().forEach(function(e){var r=t._ttfReader._getGlyph(e);i.push(r)}),i.sort(function(t,e){return t._index-e._index});var r=0,n=0,s=!1,a=new Array;i.forEach(function(t,o){s||(s=!0,r=t._index,n=t._index-1),(n+1!==t._index||o+1===i.length)&&i.length>1&&(e.push(Number(r)),0!==o&&e.push(a),r=t._index,a=new Array),a.push(Number(t._width)),o+1===i.length&&(e.push(Number(r)),e.push(a)),n=t._index})}return e},e}(),Xe=function(){function t(){var t=this;this._arabicCharTable=[["ء","ﺀ"],["آ","ﺁ","ﺂ"],["أ","ﺃ","ﺄ"],["ؤ","ﺅ","ﺆ"],["إ","ﺇ","ﺈ"],["ئ","ﺉ","ﺊ","ﺋ","ﺌ"],["ا","ﺍ","ﺎ"],["ب","ﺏ","ﺐ","ﺑ","ﺒ"],["ة","ﺓ","ﺔ"],["ت","ﺕ","ﺖ","ﺗ","ﺘ"],["ث","ﺙ","ﺚ","ﺛ","ﺜ"],["ج","ﺝ","ﺞ","ﺟ","ﺠ"],["ح","ﺡ","ﺢ","ﺣ","ﺤ"],["خ","ﺥ","ﺦ","ﺧ","ﺨ"],["د","ﺩ","ﺪ"],["ذ","ﺫ","ﺬ"],["ر","ﺭ","ﺮ"],["ز","ﺯ","ﺰ"],["س","ﺱ","ﺲ","ﺳ","ﺴ"],["ش","ﺵ","ﺶ","ﺷ","ﺸ"],["ص","ﺹ","ﺺ","ﺻ","ﺼ"],["ض","ﺽ","ﺾ","ﺿ","ﻀ"],["ط","ﻁ","ﻂ","ﻃ","ﻄ"],["ظ","ﻅ","ﻆ","ﻇ","ﻈ"],["ع","ﻉ","ﻊ","ﻋ","ﻌ"],["غ","ﻍ","ﻎ","ﻏ","ﻐ"],["ـ","ـ","ـ","ـ","ـ"],["ف","ﻑ","ﻒ","ﻓ","ﻔ"],["ق","ﻕ","ﻖ","ﻗ","ﻘ"],["ك","ﻙ","ﻚ","ﻛ","ﻜ"],["ل","ﻝ","ﻞ","ﻟ","ﻠ"],["م","ﻡ","ﻢ","ﻣ","ﻤ"],["ن","ﻥ","ﻦ","ﻧ","ﻨ"],["ه","ﻩ","ﻪ","ﻫ","ﻬ"],["و","ﻭ","ﻮ"],["ى","ﻯ","ﻰ","ﯨ","ﯩ"],["ي","ﻱ","ﻲ","ﻳ","ﻴ"],["ٱ","ﭐ","ﭑ"],["ٹ","ﭦ","ﭧ","ﭨ","ﭩ"],["ٺ","ﭞ","ﭟ","ﭠ","ﭡ"],["ٻ","ﭒ","ﭓ","ﭔ","ﭕ"],["پ","ﭖ","ﭗ","ﭘ","ﭙ"],["ٿ","ﭢ","ﭣ","ﭤ","ﭥ"],["ڀ","ﭚ","ﭛ","ﭜ","ﭝ"],["ڃ","ﭶ","ﭷ","ﭸ","ﭹ"],["ڄ","ﭲ","ﭳ","ﭴ","ﭵ"],["چ","ﭺ","ﭻ","ﭼ","ﭽ"],["ڇ","ﭾ","ﭿ","ﮀ","ﮁ"],["ڈ","ﮈ","ﮉ"],["ڌ","ﮄ","ﮅ"],["ڍ","ﮂ","ﮃ"],["ڎ","ﮆ","ﮇ"],["ڑ","ﮌ","ﮍ"],["ژ","ﮊ","ﮋ"],["ڤ","ﭪ","ﭫ","ﭬ","ﭭ"],["ڦ","ﭮ","ﭯ","ﭰ","ﭱ"],["ک","ﮎ","ﮏ","ﮐ","ﮑ"],["ڭ","ﯓ","ﯔ","ﯕ","ﯖ"],["گ","ﮒ","ﮓ","ﮔ","ﮕ"],["ڱ","ﮚ","ﮛ","ﮜ","ﮝ"],["ڳ","ﮖ","ﮗ","ﮘ","ﮙ"],["ں","ﮞ","ﮟ"],["ڻ","ﮠ","ﮡ","ﮢ","ﮣ"],["ھ","ﮪ","ﮫ","ﮬ","ﮭ"],["ۀ","ﮤ","ﮥ"],["ہ","ﮦ","ﮧ","ﮨ","ﮩ"],["ۅ","ﯠ","ﯡ"],["ۆ","ﯙ","ﯚ"],["ۇ","ﯗ","ﯘ"],["ۈ","ﯛ","ﯜ"],["ۉ","ﯢ","ﯣ"],["ۋ","ﯞ","ﯟ"],["ی","ﯼ","ﯽ","ﯾ","ﯿ"],["ې","ﯤ","ﯥ","ﯦ","ﯧ"],["ے","ﮮ","ﮯ"],["ۓ","ﮰ","ﮱ"]],this._alef="ا",this._alefHamza="أ",this._alefHamzaBelow="إ",this._alefMadda="آ",this._lam="ل",this._hamza="ء",this._zeroWidthJoiner="",this._hamzaAbove="ٔ",this._hamzaBelow="ٕ",this._wawHamza="ؤ",this._yehHamza="ئ",this._waw="و",this._alefsura="ى",this._yeh="ي",this._farsiYeh="ی",this._shadda="ّ",this._madda="ٓ",this._lwa="ﻻ",this._lwawh="ﻷ",this._lwawhb="ﻹ",this._lwawm="ﻵ",this._bwhb="ۓ",this._fathatan="ً",this._superalef="ٰ",this._vowel=1,this._arabicMapTable=new Map,this._arabicCharTable.forEach(function(e){t._arabicMapTable.set(e[0],e)})}return t.prototype._getCharacterShape=function(t,e){if(t>=this._hamza&&t<=this._bwhb){if(this._arabicMapTable.get(t))return this._arabicMapTable.get(t)[e+1]}else if(t>=this._lwawm&&t<=this._lwa)return t;return t},t.prototype._shape=function(t){for(var e="",i="",r=0;r<t.length;r++){var n=t[r];n>=""&&n<="ۿ"?i+=n:(i.length>0&&(e+=s=this._doShape(i.toString(),0),i=""),e+=n)}if(i.length>0){var s=this._doShape(i.toString(),0);e+=s}return e.toString()},t.prototype._doShape=function(t,e){for(var i="",r=0,n=0,s="",a=new qe,o=new qe;n<t.length;)if(s=t[n++],0===this._ligature(s,o)){var h=this._getShapeCount(s);r=1===h?0:2,a._shapes>2&&(r+=1),r%=o._shapes,o._shapeValue=this._getCharacterShape(o._shapeValue,r),i=this._append(i,a,e),a=o,(o=new qe)._shapeValue=s,o._shapes=h,o._shapeLigature++}return r=a._shapes>2?1:0,r%=o._shapes,o._shapeValue=this._getCharacterShape(o._shapeValue,r),i=this._append(i,a,e),(i=this._append(i,o,e)).toString()},t.prototype._append=function(t,e,i){return""!==e._shapeValue&&(t+=e._shapeValue,e._shapeLigature-=1,""!==e._shapeType&&(0==(i&this._vowel)?(t+=e._shapeType,e._shapeLigature-=1):e._shapeLigature-=1),""!==e._shapeVowel&&(0==(i&this._vowel)?(t+=e._shapeVowel,e._shapeLigature-=1):e._shapeLigature-=1)),t},t.prototype._ligature=function(t,e){if(""!==e._shapeValue){var i=0;if(t>=this._fathatan&&t<=this._hamzaBelow||t===this._superalef){if(i=1,""!==e._shapeVowel&&t!==this._shadda&&(i=2),t===this._shadda){if(""!==e._shapeType)return 0;e._shapeType=this._shadda}else t===this._hamzaBelow?e._shapeValue===this._alef?(e._shapeValue=this._alefHamzaBelow,i=2):e._shapeValue===this._lwa?(e._shapeValue=this._lwawhb,i=2):e._shapeType=this._hamzaBelow:t===this._hamzaAbove?e._shapeValue===this._alef?(e._shapeValue=this._alefHamza,i=2):e._shapeValue===this._lwa?(e._shapeValue=this._lwawh,i=2):e._shapeValue===this._waw?(e._shapeValue=this._wawHamza,i=2):e._shapeValue===this._yeh||e._shapeValue===this._alefsura||e._shapeValue===this._farsiYeh?(e._shapeValue=this._yehHamza,i=2):e._shapeType=this._hamzaAbove:t===this._madda?e._shapeValue===this._alef&&(e._shapeValue=this._alefMadda,i=2):e._shapeVowel=t;return 1===i&&e._shapeLigature++,i}return""!==e._shapeVowel?0:(e._shapeValue===this._lam&&(t===this._alef?(e._shapeValue=this._lwa,e._shapes=2,i=3):t===this._alefHamza?(e._shapeValue=this._lwawh,e._shapes=2,i=3):t===this._alefHamzaBelow?(e._shapeValue=this._lwawhb,e._shapes=2,i=3):t===this._alefMadda&&(e._shapeValue=this._lwawm,e._shapes=2,i=3)),i)}return 0},t.prototype._getShapeCount=function(t){if(t>=this._hamza&&t<=this._bwhb&&!(t>=this._fathatan&&t<=this._hamzaBelow||t===this._superalef)){if(this._arabicMapTable.get(t))return this._arabicMapTable.get(t).length-1}else if(t===this._zeroWidthJoiner)return 4;return 1},t}(),qe=function(){function t(){this._shapeValue="",this._shapeType="",this._shapeVowel="",this._shapeLigature=0,this._shapes=1}return t}(),Qe=function(){function t(){this._indexes=[],this._indexLevels=[],this._mirroringShape=new Zr,this._update()}return t.prototype._doMirrorShaping=function(t){for(var e=[],i=0;i<t.length;i++)if(1==(1&this._indexLevels[i])&&this._mirroringShape.containsKey(t[i].charCodeAt(0))){var r=t[i].charCodeAt(0);e[i]=String.fromCharCode(this._mirroringShape.getValue(r))}else e[i]=t[i].toString();return e.join("")},t.prototype._getLogicalToVisualString=function(t,e){var i=new Je;this._indexLevels=i._getVisualOrder(t,e),this._setDefaultIndexLevel(),this._doOrder(0,this._indexLevels.length-1);var r=this._doMirrorShaping(t);return this._indexes.map(function(t){return r[t]}).join("").toString()},t.prototype._setDefaultIndexLevel=function(){for(var t=0;t<this._indexLevels.length;t++)this._indexes[t]=t},t.prototype._doOrder=function(t,e){for(var i=this._indexLevels[t],r=i,n=i,s=i,a=t+1;a<=e;++a){var o=this._indexLevels[a];o>i?i=o:o<r&&(r=o),n&=o,s|=o}if(0!=(1&s)){if(1==(1&n))return void this._reArrange(t,e+1);for(r|=1;i>=r;){for(var h=t;;){for(;h<=e&&!(this._indexLevels[h]>=i);)h+=1;if(h>e)break;for(var c=h+1;c<=e&&!(this._indexLevels[c]<i);)c+=1;this._reArrange(h,c),h=c+1}i-=1}}},t.prototype._reArrange=function(t,e){var i=(t+e)/2;for(--e;t<i;++t,--e){var r=this._indexes[t];this._indexes[t]=this._indexes[e],this._indexes[e]=r}},t.prototype._update=function(){this._mirroringShape.setValue(40,41),this._mirroringShape.setValue(41,40),this._mirroringShape.setValue(60,62),this._mirroringShape.setValue(62,60),this._mirroringShape.setValue(91,93),this._mirroringShape.setValue(93,91),this._mirroringShape.setValue(123,125),this._mirroringShape.setValue(125,123),this._mirroringShape.setValue(171,187),this._mirroringShape.setValue(187,171),this._mirroringShape.setValue(8249,8250),this._mirroringShape.setValue(8250,8249),this._mirroringShape.setValue(8261,8262),this._mirroringShape.setValue(8262,8261),this._mirroringShape.setValue(8317,8318),this._mirroringShape.setValue(8318,8317),this._mirroringShape.setValue(8333,8334),this._mirroringShape.setValue(8334,8333),this._mirroringShape.setValue(8712,8715),this._mirroringShape.setValue(8713,8716),this._mirroringShape.setValue(8714,8717),this._mirroringShape.setValue(8715,8712),this._mirroringShape.setValue(8716,8713),this._mirroringShape.setValue(8717,8714),this._mirroringShape.setValue(8725,10741),this._mirroringShape.setValue(8764,8765),this._mirroringShape.setValue(8765,8764),this._mirroringShape.setValue(8771,8909),this._mirroringShape.setValue(8786,8787),this._mirroringShape.setValue(8787,8786),this._mirroringShape.setValue(8788,8789),this._mirroringShape.setValue(8789,8788),this._mirroringShape.setValue(8804,8805),this._mirroringShape.setValue(8805,8804),this._mirroringShape.setValue(8806,8807),this._mirroringShape.setValue(8807,8806),this._mirroringShape.setValue(8808,8809),this._mirroringShape.setValue(8809,8808),this._mirroringShape.setValue(8810,8811),this._mirroringShape.setValue(8811,8810),this._mirroringShape.setValue(8814,8815),this._mirroringShape.setValue(8815,8814),this._mirroringShape.setValue(8816,8817),this._mirroringShape.setValue(8817,8816),this._mirroringShape.setValue(8818,8819),this._mirroringShape.setValue(8819,8818),this._mirroringShape.setValue(8820,8821),this._mirroringShape.setValue(8821,8820),this._mirroringShape.setValue(8822,8823),this._mirroringShape.setValue(8823,8822),this._mirroringShape.setValue(8824,8825),this._mirroringShape.setValue(8825,8824),this._mirroringShape.setValue(8826,8827),this._mirroringShape.setValue(8827,8826),this._mirroringShape.setValue(8828,8829),this._mirroringShape.setValue(8829,8828),this._mirroringShape.setValue(8830,8831),this._mirroringShape.setValue(8831,8830),this._mirroringShape.setValue(8832,8833),this._mirroringShape.setValue(8833,8832),this._mirroringShape.setValue(8834,8835),this._mirroringShape.setValue(8835,8834),this._mirroringShape.setValue(8836,8837),this._mirroringShape.setValue(8837,8836),this._mirroringShape.setValue(8838,8839),this._mirroringShape.setValue(8839,8838),this._mirroringShape.setValue(8840,8841),this._mirroringShape.setValue(8841,8840),this._mirroringShape.setValue(8842,8843),this._mirroringShape.setValue(8843,8842),this._mirroringShape.setValue(8847,8848),this._mirroringShape.setValue(8848,8847),this._mirroringShape.setValue(8849,8850),this._mirroringShape.setValue(8850,8849),this._mirroringShape.setValue(8856,10680),this._mirroringShape.setValue(8866,8867),this._mirroringShape.setValue(8867,8866),this._mirroringShape.setValue(8870,10974),this._mirroringShape.setValue(8872,10980),this._mirroringShape.setValue(8873,10979),this._mirroringShape.setValue(8875,10981),this._mirroringShape.setValue(8880,8881),this._mirroringShape.setValue(8881,8880),this._mirroringShape.setValue(8882,8883),this._mirroringShape.setValue(8883,8882),this._mirroringShape.setValue(8884,8885),this._mirroringShape.setValue(8885,8884),this._mirroringShape.setValue(8886,8887),this._mirroringShape.setValue(8887,8886),this._mirroringShape.setValue(8905,8906),this._mirroringShape.setValue(8906,8905),this._mirroringShape.setValue(8907,8908),this._mirroringShape.setValue(8908,8907),this._mirroringShape.setValue(8909,8771),this._mirroringShape.setValue(8912,8913),this._mirroringShape.setValue(8913,8912),this._mirroringShape.setValue(8918,8919),this._mirroringShape.setValue(8919,8918),this._mirroringShape.setValue(8920,8921),this._mirroringShape.setValue(8921,8920),this._mirroringShape.setValue(8922,8923),this._mirroringShape.setValue(8923,8922),this._mirroringShape.setValue(8924,8925),this._mirroringShape.setValue(8925,8924),this._mirroringShape.setValue(8926,8927),this._mirroringShape.setValue(8927,8926),this._mirroringShape.setValue(8928,8929),this._mirroringShape.setValue(8929,8928),this._mirroringShape.setValue(8930,8931),this._mirroringShape.setValue(8931,8930),this._mirroringShape.setValue(8932,8933),this._mirroringShape.setValue(8933,8932),this._mirroringShape.setValue(8934,8935),this._mirroringShape.setValue(8935,8934),this._mirroringShape.setValue(8936,8937),this._mirroringShape.setValue(8937,8936),this._mirroringShape.setValue(8938,8939),this._mirroringShape.setValue(8939,8938),this._mirroringShape.setValue(8940,8941),this._mirroringShape.setValue(8941,8940),this._mirroringShape.setValue(8944,8945),this._mirroringShape.setValue(8945,8944),this._mirroringShape.setValue(8946,8954),this._mirroringShape.setValue(8947,8955),this._mirroringShape.setValue(8948,8956),this._mirroringShape.setValue(8950,8957),this._mirroringShape.setValue(8951,8958),this._mirroringShape.setValue(8954,8946),this._mirroringShape.setValue(8955,8947),this._mirroringShape.setValue(8956,8948),this._mirroringShape.setValue(8957,8950),this._mirroringShape.setValue(8958,8951),this._mirroringShape.setValue(8968,8969),this._mirroringShape.setValue(8969,8968),this._mirroringShape.setValue(8970,8971),this._mirroringShape.setValue(8971,8970),this._mirroringShape.setValue(9001,9002),this._mirroringShape.setValue(9002,9001),this._mirroringShape.setValue(10088,10089),this._mirroringShape.setValue(10089,10088),this._mirroringShape.setValue(10090,10091),this._mirroringShape.setValue(10091,10090),this._mirroringShape.setValue(10092,10093),this._mirroringShape.setValue(10093,10092),this._mirroringShape.setValue(10094,10095),this._mirroringShape.setValue(10095,10094),this._mirroringShape.setValue(10096,10097),this._mirroringShape.setValue(10097,10096),this._mirroringShape.setValue(10098,10099),this._mirroringShape.setValue(10099,10098),this._mirroringShape.setValue(10100,10101),this._mirroringShape.setValue(10101,10100),this._mirroringShape.setValue(10197,10198),this._mirroringShape.setValue(10198,10197),this._mirroringShape.setValue(10205,10206),this._mirroringShape.setValue(10206,10205),this._mirroringShape.setValue(10210,10211),this._mirroringShape.setValue(10211,10210),this._mirroringShape.setValue(10212,10213),this._mirroringShape.setValue(10213,10212),this._mirroringShape.setValue(10214,10215),this._mirroringShape.setValue(10215,10214),this._mirroringShape.setValue(10216,10217),this._mirroringShape.setValue(10217,10216),this._mirroringShape.setValue(10218,10219),this._mirroringShape.setValue(10219,10218),this._mirroringShape.setValue(10627,10628),this._mirroringShape.setValue(10628,10627),this._mirroringShape.setValue(10629,10630),this._mirroringShape.setValue(10630,10629),this._mirroringShape.setValue(10631,10632),this._mirroringShape.setValue(10632,10631),this._mirroringShape.setValue(10633,10634),this._mirroringShape.setValue(10634,10633),this._mirroringShape.setValue(10635,10636),this._mirroringShape.setValue(10636,10635),this._mirroringShape.setValue(10637,10640),this._mirroringShape.setValue(10638,10639),this._mirroringShape.setValue(10639,10638),this._mirroringShape.setValue(10640,10637),this._mirroringShape.setValue(10641,10642),this._mirroringShape.setValue(10642,10641),this._mirroringShape.setValue(10643,10644),this._mirroringShape.setValue(10644,10643),this._mirroringShape.setValue(10645,10646),this._mirroringShape.setValue(10646,10645),this._mirroringShape.setValue(10647,10648),this._mirroringShape.setValue(10648,10647),this._mirroringShape.setValue(10680,8856),this._mirroringShape.setValue(10688,10689),this._mirroringShape.setValue(10689,10688),this._mirroringShape.setValue(10692,10693),this._mirroringShape.setValue(10693,10692),this._mirroringShape.setValue(10703,10704),this._mirroringShape.setValue(10704,10703),this._mirroringShape.setValue(10705,10706),this._mirroringShape.setValue(10706,10705),this._mirroringShape.setValue(10708,10709),this._mirroringShape.setValue(10709,10708),this._mirroringShape.setValue(10712,10713),this._mirroringShape.setValue(10713,10712),this._mirroringShape.setValue(10714,10715),this._mirroringShape.setValue(10715,10714),this._mirroringShape.setValue(10741,8725),this._mirroringShape.setValue(10744,10745),this._mirroringShape.setValue(10745,10744),this._mirroringShape.setValue(10748,10749),this._mirroringShape.setValue(10749,10748),this._mirroringShape.setValue(10795,10796),this._mirroringShape.setValue(10796,10795),this._mirroringShape.setValue(10797,10796),this._mirroringShape.setValue(10798,10797),this._mirroringShape.setValue(10804,10805),this._mirroringShape.setValue(10805,10804),this._mirroringShape.setValue(10812,10813),this._mirroringShape.setValue(10813,10812),this._mirroringShape.setValue(10852,10853),this._mirroringShape.setValue(10853,10852),this._mirroringShape.setValue(10873,10874),this._mirroringShape.setValue(10874,10873),this._mirroringShape.setValue(10877,10878),this._mirroringShape.setValue(10878,10877),this._mirroringShape.setValue(10879,10880),this._mirroringShape.setValue(10880,10879),this._mirroringShape.setValue(10881,10882),this._mirroringShape.setValue(10882,10881),this._mirroringShape.setValue(10883,10884),this._mirroringShape.setValue(10884,10883),this._mirroringShape.setValue(10891,10892),this._mirroringShape.setValue(10892,10891),this._mirroringShape.setValue(10897,10898),this._mirroringShape.setValue(10898,10897),this._mirroringShape.setValue(10899,10900),this._mirroringShape.setValue(10900,10899),this._mirroringShape.setValue(10901,10902),this._mirroringShape.setValue(10902,10901),this._mirroringShape.setValue(10903,10904),this._mirroringShape.setValue(10904,10903),this._mirroringShape.setValue(10905,10906),this._mirroringShape.setValue(10906,10905),this._mirroringShape.setValue(10907,10908),this._mirroringShape.setValue(10908,10907),this._mirroringShape.setValue(10913,10914),this._mirroringShape.setValue(10914,10913),this._mirroringShape.setValue(10918,10919),this._mirroringShape.setValue(10919,10918),this._mirroringShape.setValue(10920,10921),this._mirroringShape.setValue(10921,10920),this._mirroringShape.setValue(10922,10923),this._mirroringShape.setValue(10923,10922),this._mirroringShape.setValue(10924,10925),this._mirroringShape.setValue(10925,10924),this._mirroringShape.setValue(10927,10928),this._mirroringShape.setValue(10928,10927),this._mirroringShape.setValue(10931,10932),this._mirroringShape.setValue(10932,10931),this._mirroringShape.setValue(10939,10940),this._mirroringShape.setValue(10940,10939),this._mirroringShape.setValue(10941,10942),this._mirroringShape.setValue(10942,10941),this._mirroringShape.setValue(10943,10944),this._mirroringShape.setValue(10944,10943),this._mirroringShape.setValue(10945,10946),this._mirroringShape.setValue(10946,10945),this._mirroringShape.setValue(10947,10948),this._mirroringShape.setValue(10948,10947),this._mirroringShape.setValue(10949,10950),this._mirroringShape.setValue(10950,10949),this._mirroringShape.setValue(10957,10958),this._mirroringShape.setValue(10958,10957),this._mirroringShape.setValue(10959,10960),this._mirroringShape.setValue(10960,10959),this._mirroringShape.setValue(10961,10962),this._mirroringShape.setValue(10962,10961),this._mirroringShape.setValue(10963,10964),this._mirroringShape.setValue(10964,10963),this._mirroringShape.setValue(10965,10966),this._mirroringShape.setValue(10966,10965),this._mirroringShape.setValue(10974,8870),this._mirroringShape.setValue(10979,8873),this._mirroringShape.setValue(10980,8872),this._mirroringShape.setValue(10981,8875),this._mirroringShape.setValue(10988,10989),this._mirroringShape.setValue(10989,10988),this._mirroringShape.setValue(10999,11e3),this._mirroringShape.setValue(11e3,10999),this._mirroringShape.setValue(11001,11002),this._mirroringShape.setValue(11002,11001),this._mirroringShape.setValue(12296,12297),this._mirroringShape.setValue(12297,12296),this._mirroringShape.setValue(12298,12299),this._mirroringShape.setValue(12299,12298),this._mirroringShape.setValue(12300,12301),this._mirroringShape.setValue(12301,12300),this._mirroringShape.setValue(12302,12303),this._mirroringShape.setValue(12303,12302),this._mirroringShape.setValue(12304,12305),this._mirroringShape.setValue(12305,12304),this._mirroringShape.setValue(12308,12309),this._mirroringShape.setValue(12309,12308),this._mirroringShape.setValue(12310,12311),this._mirroringShape.setValue(12311,12310),this._mirroringShape.setValue(12312,12313),this._mirroringShape.setValue(12313,12312),this._mirroringShape.setValue(12314,12315),this._mirroringShape.setValue(12315,12314),this._mirroringShape.setValue(65288,65289),this._mirroringShape.setValue(65289,65288),this._mirroringShape.setValue(65308,65310),this._mirroringShape.setValue(65310,65308),this._mirroringShape.setValue(65339,65341),this._mirroringShape.setValue(65341,65339),this._mirroringShape.setValue(65371,65373),this._mirroringShape.setValue(65373,65371),this._mirroringShape.setValue(65375,65376),this._mirroringShape.setValue(65376,65375),this._mirroringShape.setValue(65378,65379),this._mirroringShape.setValue(65379,65378)},t}(),Je=function(){function t(){this._type=[],this._textOrder=-1,this._rtlCharacterTypes=new Array(65536),this.L=0,this.lre=1,this.lro=2,this.R=3,this.AL=4,this.rle=5,this.rlo=6,this.pdf=7,this.EN=8,this.ES=9,this.ET=10,this.AN=11,this.CS=12,this.nsm=13,this.BN=14,this.B=15,this.S=16,this.WS=17,this.ON=18,this._charTypes=[this.L,this.EN,this.BN,this.ES,this.ES,this.S,this.ET,this.ET,this.B,this.AN,this.AN,this.S,this.CS,this.CS,this.WS,this.nsm,this.nsm,this.B,this.BN,27,this.BN,28,30,this.B,31,31,this.S,32,32,this.WS,33,34,this.ON,35,37,this.ET,38,42,this.ON,43,43,this.ET,44,44,this.CS,45,45,this.ET,46,46,this.CS,47,47,this.CS,48,57,this.EN,58,58,this.CS,59,64,this.ON,65,90,this.L,91,96,this.ON,97,122,this.L,123,126,this.ON,127,132,this.BN,133,133,this.B,134,159,this.BN,160,160,this.CS,161,161,this.ON,162,165,this.ET,166,169,this.ON,170,170,this.L,171,175,this.ON,176,177,this.ET,178,179,this.EN,180,180,this.ON,181,181,this.L,182,184,this.ON,185,185,this.EN,186,186,this.L,187,191,this.ON,192,214,this.L,215,215,this.ON,216,246,this.L,247,247,this.ON,248,696,this.L,697,698,this.ON,699,705,this.L,706,719,this.ON,720,721,this.L,722,735,this.ON,736,740,this.L,741,749,this.ON,750,750,this.L,751,767,this.ON,768,855,this.nsm,856,860,this.L,861,879,this.nsm,880,883,this.L,884,885,this.ON,886,893,this.L,894,894,this.ON,895,899,this.L,900,901,this.ON,902,902,this.L,903,903,this.ON,904,1013,this.L,1014,1014,this.ON,1015,1154,this.L,1155,1158,this.nsm,1159,1159,this.L,1160,1161,this.nsm,1162,1417,this.L,1418,1418,this.ON,1419,1424,this.L,1425,1441,this.nsm,1442,1442,this.L,1443,1465,this.nsm,1466,1466,this.L,1467,1469,this.nsm,1470,1470,this.R,1471,1471,this.nsm,1472,1472,this.R,1473,1474,this.nsm,1475,1475,this.R,1476,1476,this.nsm,1477,1487,this.L,1488,1514,this.R,1515,1519,this.L,1520,1524,this.R,1525,1535,this.L,1536,1539,this.AL,1540,1547,this.L,1548,1548,this.CS,1549,1549,this.AL,1550,1551,this.ON,1552,1557,this.nsm,1558,1562,this.L,1563,1563,this.AL,1564,1566,this.L,1567,1567,this.AL,1568,1568,this.L,1569,1594,this.AL,1595,1599,this.L,1600,1610,this.AL,1611,1624,this.nsm,1625,1631,this.L,1632,1641,this.AN,1642,1642,this.ET,1643,1644,this.AN,1645,1647,this.AL,1648,1648,this.nsm,1649,1749,this.AL,1750,1756,this.nsm,1757,1757,this.AL,1758,1764,this.nsm,1765,1766,this.AL,1767,1768,this.nsm,1769,1769,this.ON,1770,1773,this.nsm,1774,1775,this.AL,1776,1785,this.EN,1786,1805,this.AL,1806,1806,this.L,1807,1807,this.BN,1808,1808,this.AL,1809,1809,this.nsm,1810,1839,this.AL,1840,1866,this.nsm,1867,1868,this.L,1869,1871,this.AL,1872,1919,this.L,1920,1957,this.AL,1958,1968,this.nsm,1969,1969,this.AL,1970,2304,this.L,2305,2306,this.nsm,2307,2363,this.L,2364,2364,this.nsm,2365,2368,this.L,2369,2376,this.nsm,2377,2380,this.L,2381,2381,this.nsm,2382,2384,this.L,2385,2388,this.nsm,2389,2401,this.L,2402,2403,this.nsm,2404,2432,this.L,2433,2433,this.nsm,2434,2491,this.L,2492,2492,this.nsm,2493,2496,this.L,2497,2500,this.nsm,2501,2508,this.L,2509,2509,this.nsm,2510,2529,this.L,2530,2531,this.nsm,2532,2545,this.L,2546,2547,this.ET,2548,2560,this.L,2561,2562,this.nsm,2563,2619,this.L,2620,2620,this.nsm,2621,2624,this.L,2625,2626,this.nsm,2627,2630,this.L,2631,2632,this.nsm,2633,2634,this.L,2635,2637,this.nsm,2638,2671,this.L,2672,2673,this.nsm,2674,2688,this.L,2689,2690,this.nsm,2691,2747,this.L,2748,2748,this.nsm,2749,2752,this.L,2753,2757,this.nsm,2758,2758,this.L,2759,2760,this.nsm,2761,2764,this.L,2765,2765,this.nsm,2766,2785,this.L,2786,2787,this.nsm,2788,2800,this.L,2801,2801,this.ET,2802,2816,this.L,2817,2817,this.nsm,2818,2875,this.L,2876,2876,this.nsm,2877,2878,this.L,2879,2879,this.nsm,2880,2880,this.L,2881,2883,this.nsm,2884,2892,this.L,2893,2893,this.nsm,2894,2901,this.L,2902,2902,this.nsm,2903,2945,this.L,2946,2946,this.nsm,2947,3007,this.L,3008,3008,this.nsm,3009,3020,this.L,3021,3021,this.nsm,3022,3058,this.L,3059,3064,this.ON,3065,3065,this.ET,3066,3066,this.ON,3067,3133,this.L,3134,3136,this.nsm,3137,3141,this.L,3142,3144,this.nsm,3145,3145,this.L,3146,3149,this.nsm,3150,3156,this.L,3157,3158,this.nsm,3159,3259,this.L,3260,3260,this.nsm,3261,3275,this.L,3276,3277,this.nsm,3278,3392,this.L,3393,3395,this.nsm,3396,3404,this.L,3405,3405,this.nsm,3406,3529,this.L,3530,3530,this.nsm,3531,3537,this.L,3538,3540,this.nsm,3541,3541,this.L,3542,3542,this.nsm,3543,3632,this.L,3633,3633,this.nsm,3634,3635,this.L,3636,3642,this.nsm,3643,3646,this.L,3647,3647,this.ET,3648,3654,this.L,3655,3662,this.nsm,3663,3760,this.L,3761,3761,this.nsm,3762,3763,this.L,3764,3769,this.nsm,3770,3770,this.L,3771,3772,this.nsm,3773,3783,this.L,3784,3789,this.nsm,3790,3863,this.L,3864,3865,this.nsm,3866,3892,this.L,3893,3893,this.nsm,3894,3894,this.L,3895,3895,this.nsm,3896,3896,this.L,3897,3897,this.nsm,3898,3901,this.ON,3902,3952,this.L,3953,3966,this.nsm,3967,3967,this.L,3968,3972,this.nsm,3973,3973,this.L,3974,3975,this.nsm,3976,3983,this.L,3984,3991,this.nsm,3992,3992,this.L,3993,4028,this.nsm,4029,4037,this.L,4038,4038,this.nsm,4039,4140,this.L,4141,4144,this.nsm,4145,4145,this.L,4146,4146,this.nsm,4147,4149,this.L,4150,4151,this.nsm,4152,4152,this.L,4153,4153,this.nsm,4154,4183,this.L,4184,4185,this.nsm,4186,5759,this.L,5760,5760,this.WS,5761,5786,this.L,5787,5788,this.ON,5789,5905,this.L,5906,5908,this.nsm,5909,5937,this.L,5938,5940,this.nsm,5941,5969,this.L,5970,5971,this.nsm,5972,6001,this.L,6002,6003,this.nsm,6004,6070,this.L,6071,6077,this.nsm,6078,6085,this.L,6086,6086,this.nsm,6087,6088,this.L,6089,6099,this.nsm,6100,6106,this.L,6107,6107,this.ET,6108,6108,this.L,6109,6109,this.nsm,6110,6127,this.L,6128,6137,this.ON,6138,6143,this.L,6144,6154,this.ON,6155,6157,this.nsm,6158,6158,this.WS,6159,6312,this.L,6313,6313,this.nsm,6314,6431,this.L,6432,6434,this.nsm,6435,6438,this.L,6439,6443,this.nsm,6444,6449,this.L,6450,6450,this.nsm,6451,6456,this.L,6457,6459,this.nsm,6460,6463,this.L,6464,6464,this.ON,6465,6467,this.L,6468,6469,this.ON,6470,6623,this.L,6624,6655,this.ON,6656,8124,this.L,8125,8125,this.ON,8126,8126,this.L,8127,8129,this.ON,8130,8140,this.L,8141,8143,this.ON,8144,8156,this.L,8157,8159,this.ON,8160,8172,this.L,8173,8175,this.ON,8176,8188,this.L,8189,8190,this.ON,8191,8191,this.L,8192,8202,this.WS,8203,8205,this.BN,8206,8206,this.L,8207,8207,this.R,8208,8231,this.ON,8232,8232,this.WS,8233,8233,this.B,8234,8234,this.lre,8235,8235,this.rle,8236,8236,this.pdf,8237,8237,this.lro,8238,8238,this.rlo,8239,8239,this.WS,8240,8244,this.ET,8245,8276,this.ON,8277,8278,this.L,8279,8279,this.ON,8280,8286,this.L,8287,8287,this.WS,8288,8291,this.BN,8292,8297,this.L,8298,8303,this.BN,8304,8304,this.EN,8305,8307,this.L,8308,8313,this.EN,8314,8315,this.ET,8316,8318,this.ON,8319,8319,this.L,8320,8329,this.EN,8330,8331,this.ET,8332,8334,this.ON,8335,8351,this.L,8352,8369,this.ET,8370,8399,this.L,8400,8426,this.nsm,8427,8447,this.L,8448,8449,this.ON,8450,8450,this.L,8451,8454,this.ON,8455,8455,this.L,8456,8457,this.ON,8458,8467,this.L,8468,8468,this.ON,8469,8469,this.L,8470,8472,this.ON,8473,8477,this.L,8478,8483,this.ON,8484,8484,this.L,8485,8485,this.ON,8486,8486,this.L,8487,8487,this.ON,8488,8488,this.L,8489,8489,this.ON,8490,8493,this.L,8494,8494,this.ET,8495,8497,this.L,8498,8498,this.ON,8499,8505,this.L,8506,8507,this.ON,8508,8511,this.L,8512,8516,this.ON,8517,8521,this.L,8522,8523,this.ON,8524,8530,this.L,8531,8543,this.ON,8544,8591,this.L,8592,8721,this.ON,8722,8723,this.ET,8724,9013,this.ON,9014,9082,this.L,9083,9108,this.ON,9109,9109,this.L,9110,9168,this.ON,9169,9215,this.L,9216,9254,this.ON,9255,9279,this.L,9280,9290,this.ON,9291,9311,this.L,9312,9371,this.EN,9372,9449,this.L,9450,9450,this.EN,9451,9751,this.ON,9752,9752,this.L,9753,9853,this.ON,9854,9855,this.L,9856,9873,this.ON,9874,9887,this.L,9888,9889,this.ON,9890,9984,this.L,9985,9988,this.ON,9989,9989,this.L,9990,9993,this.ON,9994,9995,this.L,9996,10023,this.ON,10024,10024,this.L,10025,10059,this.ON,10060,10060,this.L,10061,10061,this.ON,10062,10062,this.L,10063,10066,this.ON,10067,10069,this.L,10070,10070,this.ON,10071,10071,this.L,10072,10078,this.ON,10079,10080,this.L,10081,10132,this.ON,10133,10135,this.L,10136,10159,this.ON,10160,10160,this.L,10161,10174,this.ON,10175,10191,this.L,10192,10219,this.ON,10220,10223,this.L,10224,11021,this.ON,11022,11903,this.L,11904,11929,this.ON,11930,11930,this.L,11931,12019,this.ON,12020,12031,this.L,12032,12245,this.ON,12246,12271,this.L,12272,12283,this.ON,12284,12287,this.L,12288,12288,this.WS,12289,12292,this.ON,12293,12295,this.L,12296,12320,this.ON,12321,12329,this.L,12330,12335,this.nsm,12336,12336,this.ON,12337,12341,this.L,12342,12343,this.ON,12344,12348,this.L,12349,12351,this.ON,12352,12440,this.L,12441,12442,this.nsm,12443,12444,this.ON,12445,12447,this.L,12448,12448,this.ON,12449,12538,this.L,12539,12539,this.ON,12540,12828,this.L,12829,12830,this.ON,12831,12879,this.L,12880,12895,this.ON,12896,12923,this.L,12924,12925,this.ON,12926,12976,this.L,12977,12991,this.ON,12992,13003,this.L,13004,13007,this.ON,13008,13174,this.L,13175,13178,this.ON,13179,13277,this.L,13278,13279,this.ON,13280,13310,this.L,13311,13311,this.ON,13312,19903,this.L,19904,19967,this.ON,19968,42127,this.L,42128,42182,this.ON,42183,64284,this.L,64285,64285,this.R,64286,64286,this.nsm,64287,64296,this.R,64297,64297,this.ET,64298,64310,this.R,64311,64311,this.L,64312,64316,this.R,64317,64317,this.L,64318,64318,this.R,64319,64319,this.L,64320,64321,this.R,64322,64322,this.L,64323,64324,this.R,64325,64325,this.L,64326,64335,this.R,64336,64433,this.AL,64434,64466,this.L,64467,64829,this.AL,64830,64831,this.ON,64832,64847,this.L,64848,64911,this.AL,64912,64913,this.L,64914,64967,this.AL,64968,65007,this.L,65008,65020,this.AL,65021,65021,this.ON,65022,65023,this.L,65024,65039,this.nsm,65040,65055,this.L,65056,65059,this.nsm,65060,65071,this.L,65072,65103,this.ON,65104,65104,this.CS,65105,65105,this.ON,65106,65106,this.CS,65107,65107,this.L,65108,65108,this.ON,65109,65109,this.CS,65110,65118,this.ON,65119,65119,this.ET,65120,65121,this.ON,65122,65123,this.ET,65124,65126,this.ON,65127,65127,this.L,65128,65128,this.ON,65129,65130,this.ET,65131,65131,this.ON,65132,65135,this.L,65136,65140,this.AL,65141,65141,this.L,65142,65276,this.AL,65277,65278,this.L,65279,65279,this.BN,65280,65280,this.L,65281,65282,this.ON,65283,65285,this.ET,65286,65290,this.ON,65291,65291,this.ET,65292,65292,this.CS,65293,65293,this.ET,65294,65294,this.CS,65295,65295,this.ES,65296,65305,this.EN,65306,65306,this.CS,65307,65312,this.ON,65313,65338,this.L,65339,65344,this.ON,65345,65370,this.L,65371,65381,this.ON,65382,65503,this.L,65504,65505,this.ET,65506,65508,this.ON,65509,65510,this.ET,65511,65511,this.L,65512,65518,this.ON,65519,65528,this.L,65529,65531,this.BN,65532,65533,this.ON,65534,65535,this.L];for(var t=0;t<this._charTypes.length;++t)for(var e=this._charTypes[t],i=this._charTypes[++t],r=this._charTypes[++t];e<=i;)this._rtlCharacterTypes[e++]=r}return t.prototype._getVisualOrder=function(t,e){return this._type=this._getCharacterCode(t),this._textOrder=e?this.lre:this.L,this._doVisualOrder(),this._levels.slice()},t.prototype._getCharacterCode=function(t){for(var e=[],i=0;i<t.length;i++){var r=t[i].charCodeAt(0);e[i]=this._rtlCharacterTypes[r]}return e},t.prototype._setDefaultLevels=function(){for(var t=0;t<this._length;t++)this._levels[t]=this._textOrder},t.prototype._setLevels=function(){this._setDefaultLevels();for(var t=0;t<this._length;++t){var e=this._levels[t];this._levels[t]=e}},t.prototype._updateLevels=function(t,e,i){if(0==(1&e))for(r=t;r<i;++r)this._result[r]===this.R?this._levels[r]+=1:this._result[r]!==this.L&&(this._levels[r]+=2);else for(var r=t;r<i;++r)this._result[r]!==this.R&&(this._levels[r]+=1)},t.prototype._doVisualOrder=function(){this._length=this._type.length,this._result=this._type,this._levels=[],this._setLevels(),this._length=this._getEmbeddedCharactersLength();for(var t=this._textOrder,e=0;e<this._length;){for(var i=this._levels[e],r=0==(1&Math.max(t,i))?this.L:this.R,n=e+1;n<this._length&&this._levels[n]===i;)++n;var s=n<this._length?this._levels[n]:this._textOrder,a=0==(1&Math.max(s,i))?this.L:this.R;this._check(e,n,i,r,a),this._updateLevels(e,i,n),t=i,e=n}this._checkEmbeddedCharacters(this._length)},t.prototype._getEmbeddedCharactersLength=function(){for(var t=0,e=0;e<this._length;++e)this._type[e]!==this.lre&&this._type[e]!==this.rle&&this._type[e]!==this.lro&&this._type[e]!==this.rlo&&this._type[e]!==this.pdf&&this._type[e]!==this.BN&&(this._result[t]=this._result[e],this._levels[t]=this._levels[e],t++);return t},t.prototype._checkEmbeddedCharacters=function(t){for(e=this._type.length-1;e>=0;--e)this._type[e]===this.lre||this._type[e]===this.rle||this._type[e]===this.lro||this._type[e]===this.rlo||this._type[e]===this.pdf||this._type[e]===this.BN?(this._result[e]=this._type[e],this._levels[e]=-1):(t-=1,this._result[e]=this._result[t],this._levels[e]=this._levels[t]);for(var e=0;e<this._type.length;e++)-1===this._levels[e]&&(this._levels[e]=this._levels[e-1])},t.prototype._check=function(t,e,i,r,n){for(var s=r,a=t;a<e;++a)this._result[a]===this.nsm?this._result[a]=s:s=this._result[a];this._checkEuropeanDigits(t,e,i,r,n)},t.prototype._checkEuropeanDigits=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[s]===this.EN)for(var a=s-1;a>=t;--a)if(this._result[a]===this.L||this._result[a]===this.R||this._result[a]===this.AL){this._result[a]===this.AL&&(this._result[s]=this.AN);break}this._checkArabicCharacters(t,e,i,r,n)},t.prototype._checkArabicCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)this._result[s]===this.AL&&(this._result[s]=this.R);this._checkEuropeanNumberSeparator(t,e,i,r,n)},t.prototype._checkEuropeanNumberSeparator=function(t,e,i,r,n){for(var s=t+1;s<e-1;++s)if(this._result[s]===this.ES||this._result[s]===this.CS){var a=this._result[s-1],o=this._result[s+1];a===this.EN&&o===this.EN?this._result[s]=this.EN:this._result[s]===this.CS&&a===this.AN&&o===this.AN&&(this._result[s]=this.AN)}this._checkEuropeanNumberTerminator(t,e,i,r,n)},t.prototype._checkEuropeanNumberTerminator=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[s]===this.ET){var a=s,o=[];o.push(this.ET);var h=this._getLength(a,e,o),c=a===t?r:this._result[a-1];c!==this.EN&&(c=h===e?n:this._result[h]),s=h}this._checkOtherNeutrals(t,e,i,r,n)},t.prototype._checkOtherNeutrals=function(t,e,i,r,n){for(var s=t;s<e;++s)this._result[s]!==this.ES&&this._result[s]!==this.ET&&this._result[s]!==this.CS||(this._result[s]=this.ON);this._checkOtherCharacters(t,e,i,r,n)},t.prototype._checkOtherCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[s]===this.EN){for(var a=r,o=s-1;o>=t;--o)if(this._result[o]===this.L||this._result[o]===this.R){a=this._result[o];break}a===this.L&&(this._result[s]=this.L)}this._checkCharacters(t,e,i,r,n)},t.prototype._getLength=function(t,e,i){for(--t;++t<e;){for(var r=this._result[t],n=0;n<i.length;++n)r===i[n]&&(t=this._getLength(++t,e,i));return t}return e},t.prototype._checkCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[s]===this.WS||this._result[s]===this.ON||this._result[s]===this.B||this._result[s]===this.S){var a=s,o=[this.B,this.S,this.WS,this.ON],h=this._getLength(a,e,o),c=0,_=0,d=0;a===t?c=r:(c=this._result[a-1])===this.AN?c=this.R:c===this.EN&&(c=this.R),h===e?_=n:(_=this._result[h])===this.AN&&(_=this.R),d=c===_?c:0==(1&i)?this.L:this.R;for(var l=a;l<h;++l)this._result[l]=d;s=h}},t}(),Ye=function(){function e(){this._openBracket="(",this._closeBracket=")"}return e.prototype._layout=function(t,e,i,r,n){var s=[];return null!==e&&void 0!==e&&null!==t&&void 0!==t&&(e._isUnicode?s=this._customLayout(t,i,n,e,r):(s=[])[0]=t),s},e.prototype._splitLayout=function(t,e,i,r,n){var s=[];if(null!==e&&void 0!==e&&null!==t&&void 0!==t){s=this._customSplitLayout(t,e,i,r,n)}return s},e.prototype._getGlyphIndex=function(t,e,i){if(i=[],null!==e&&void 0!==e&&null!==t&&void 0!==t){if(0===t.length)return{_result:!1,_glyphIndex:i};var r=(new Xe)._shape(t),n=e._fontInternal._ttfReader;i=[r.length];for(var s=0,a=0,o=r.length;a<o;a++){var h=r[a],c=n._getGlyph(h);null!==c&&void 0!==c&&(i[s++]=c._index)}}var _=new ai;return _._result=!0,_._glyphIndex=i,_},e.prototype._customLayout=function(e,i,r,n,s){var a=this;if(null===s||void 0===s){h=null;return null!==e&&void 0!==e&&null!==r&&void 0!==r&&r.textDirection!==t.PdfTextDirection.none&&(h=(new Qe)._getLogicalToVisualString(e,i)),h}var o="",h=[];if(null!==e&&void 0!==e&&null!==n&&void 0!==n){if(null!==r&&void 0!==r&&r.textDirection!==t.PdfTextDirection.none){var c=(new Xe)._shape(e);o=this._customLayout(c,i,r)}if(s){var _=o.split("");h=_=_.map(function(t){return a._addCharacter(n,t)})}else(h=[])[0]=this._addCharacter(n,o)}return h},e.prototype._addCharacter=function(t,e){if(null!==t&&void 0!==t&&null!==e&&void 0!==e){var i=t._fontInternal._ttfReader;t._setSymbols(e),e=m(v(e=i._convertString(e)))}return e},e.prototype._customSplitLayout=function(t,e,i,r,n){var s=[];return null!==t&&void 0!==t&&(s=this._customLayout(t,i,n).split("")),s},e}(),Ze=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),$e=function(){function e(t,e){"number"==typeof t&&void 0===e?this._size=t:(this._size=t,this._style=e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUnderline",{get:function(){return(this.style&t.PdfFontStyle.underline)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isStrikeout",{get:function(){return(this.style&t.PdfFontStyle.strikeout)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_metrics",{get:function(){return this._fontMetrics},set:function(t){this._fontMetrics=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBold",{get:function(){return(this.style&t.PdfFontStyle.bold)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isItalic",{get:function(){return(this.style&t.PdfFontStyle.italic)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._metrics._getHeight()},enumerable:!0,configurable:!0}),e.prototype._setInternals=function(t){if(!t)throw new Error("ArgumentNullException:internals");this._pdfFontInternals=t},e.prototype._getCharacterCount=function(t,e){if("string"==typeof e){var i=0,r=0;for(r=t.indexOf(e,r);-1!==r;)i++,r++,r=t.indexOf(e,r);return i}for(var n=0,s=0;s<t.length;s++)-1!==e.indexOf(t[s])&&n++;return n},e.prototype.measureString=function(t,e,i,r,n){if("string"==typeof t&&void 0===e)return this.measureString(t,null);if("string"==typeof t&&(e instanceof pe||null===e)&&void 0===i&&void 0===r){o=e;return this.measureString(t,o,0,0)}if("string"==typeof t&&(e instanceof pe||null===e)&&"number"==typeof i&&"number"==typeof r){o=e;return this.measureString(t,0,o,i,r)}if("string"==typeof t&&"number"==typeof e&&(i instanceof pe||null===i)&&"number"==typeof r&&"number"==typeof n){var s=[e,0],a=i;return this.measureString(t,s,a,r,n)}var o=e,a=i,h=(new Pe)._layout(t,this,a,o);return r=t.length,n=h._empty?0:h._lines.length,h._actualSize},e.prototype._applyFormatSettings=function(t,e,i){var r=i;return void 0!==e&&null!==e&&i>0&&(0!==e.characterSpacing&&(r+=(t.length-1)*e.characterSpacing),0!==e.wordSpacing&&(r+=this._getCharacterCount(t,[" ","\t"])*e.wordSpacing)),r},e}(),ti=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._fontFamily=i,s._checkStyle(),s._initializeInternals(),s}return Ze(i,e),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),i.prototype._checkStyle=function(){this._fontFamily!==t.PdfFontFamily.symbol&&this._fontFamily!==t.PdfFontFamily.zapfDingbats||(this._style&=~(t.PdfFontStyle.bold|t.PdfFontStyle.italic))},i.prototype.getLineWidth=function(t,e){var i=this,r=0;return t.split("").forEach(function(t){r+=i._getCharacterWidthInternal(t)}),r*=.001*this._metrics._size,r=this._applyFormatSettings(t,e,r)},i.prototype._initializeInternals=function(){this._metrics=ri._getMetrics(this._fontFamily,this._style,this._size),this._dictionary=this._createInternals()},i.prototype._createInternals=function(){var e=new $r;return e._updated=!0,e.set("Type",Xr.get("Font")),e.set("Subtype",Xr.get("Type1")),e.set("BaseFont",new Xr(this._metrics._postScriptName)),this._fontFamily!==t.PdfFontFamily.symbol&&this._fontFamily!==t.PdfFontFamily.zapfDingbats&&e.set("Encoding",new Xr("WinAnsiEncoding")),e},i.prototype._getCharacterWidthInternal=function(t){var e=t.charCodeAt(0);return"Helvetica"!==this._metrics._name&&"Courier"!==this._metrics._name&&"TimesRoman"!==this._metrics._name&&"Symbol"!==this._metrics._name&&"ZapfDingbats"!==this._metrics._name||(e-=32),e=e>=0&&128!==e?e:0,this._metrics._widthTable._itemAt(e)},i}($e),ei=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._fontFamily=i,s._size=r,s._initializeInternals(),s}return Ze(i,e),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),i.prototype._initializeInternals=function(){this._metrics=ni._getMetrics(this._fontFamily,this._style,this._size),this._dictionary=this._createInternals()},i.prototype._createInternals=function(){var t=new $r;return t._updated=!0,t.set("Type",Xr.get("Font")),t.set("Subtype",Xr.get("Type0")),t.set("BaseFont",new Xr(this._metrics._postScriptName)),t.set("Encoding",this._getEncoding(this._fontFamily)),t.set("DescendantFonts",this._getDescendantFont()),t},i.prototype._getEncoding=function(e){var i="Unknown";switch(e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:i="UniKS-UCS2-H";break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:case t.PdfCjkFontFamily.heiseiMinchoW3:i="UniJIS-UCS2-H";break;case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.monotypeSungLight:i="UniCNS-UCS2-H";break;case t.PdfCjkFontFamily.sinoTypeSongLight:i="UniGB-UCS2-H"}return new Xr(i)},i.prototype._getDescendantFont=function(){var t=new $r;return t._updated=!0,t.set("Type",Xr.get("Font")),t.set("Subtype",Xr.get("CIDFontType2")),t.set("BaseFont",new Xr(this._metrics._postScriptName)),t.set("DW",this._metrics._widthTable._defaultWidth),t.set("W",this._metrics._widthTable._toArray()),t.set("FontDescriptor",si._getFontDescriptor(this._fontFamily,this._style,this._metrics)),t.set("CIDSystemInfo",this._getSystemInformation()),[t]},i.prototype._getSystemInformation=function(){var e=new $r;switch(e._updated=!0,e.set("Registry","Adobe"),this._fontFamily){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:e.set("Ordering","Korea1"),e.set("Supplement",1);break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:case t.PdfCjkFontFamily.heiseiMinchoW3:e.set("Ordering","Japan1"),e.set("Supplement",2);break;case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.monotypeSungLight:e.set("Ordering","CNS1"),e.set("Supplement","0");break;case t.PdfCjkFontFamily.sinoTypeSongLight:e.set("Ordering","GB1"),e.set("Supplement",2)}return e},i.prototype.getLineWidth=function(t,e){for(var i=0,r=0;r<t.length;r++)i+=this._getCharacterWidthInternal(t.charCodeAt(r));return i*=.001*this._metrics._size,i=this._applyFormatSettings(t,e,i)},i.prototype._getCharacterWidthInternal=function(t){return t=t>=0?t:0,this._metrics._widthTable._itemAt(t)},i}($e),ii=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._isEmbedFont=!1,s._isUnicode=!0,void 0!==n?s._createFontInternal(i,n):s._createFontInternal(i,t.PdfFontStyle.regular),s}return Ze(i,e),Object.defineProperty(i.prototype,"isUnicode",{get:function(){return this._isUnicode},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isEmbed",{get:function(){return this._isEmbedFont},enumerable:!0,configurable:!0}),i.prototype._createFontInternal=function(t,e){this._fontInternal=new Ke(t,this._size),this.style=e,this._initializeInternals()},i.prototype._initializeInternals=function(){var t=null;this._fontInternal instanceof Ke&&(this._fontInternal._isEmbed=this._isEmbedFont),this._fontInternal._createInternals(),t=this._fontInternal._getInternals(),this._metrics=this._fontInternal._metrics,this._metrics._isUnicodeFont=!0,this._setInternals(t)},i.prototype.getLineWidth=function(e,i){var r=0;if(null!==i&&void 0!==i&&i.textDirection!==t.PdfTextDirection.none)r=this._getUnicodeLineWidth(e,r);else for(var n=0,s=e.length;n<s;n++)r+=this._getCharacterWidthInternal(e[n]);return isNaN(r)&&(r=0),r*=.001*this._metrics._size,r=this._applyFormatSettings(e,i,r)},i.prototype._getUnicodeLineWidth=function(t,e){e=0;var i=[],r=!1,n=(new Ye)._getGlyphIndex(t,this,i);if(r=n._result,i=n._glyphIndex,r&&null!==i){var s=this._fontInternal._ttfReader;i.forEach(function(t){if(null!==t&&void 0!==t){var i=s._getGlyph(t);null!==i&&void 0!==i&&(e+=i._width)}})}return e},i.prototype._getCharacterWidth=function(t,e){var i=this._fontInternal._getCharacterWidth(t);return i*=.001*this._metrics._getSize(e)},i.prototype._setSymbols=function(t){var e=this._fontInternal;null!==e&&void 0!==e&&e._setSymbols(t)},i.prototype._getCharacterWidthInternal=function(t){var e=t.charCodeAt(0);return e=e>=0&&128!==e?e:0,this._metrics._widthTable._itemAt(e)},i}($e),ri=function(){function e(){}return e._getMetrics=function(e,i,r){var n=null;switch(e){case t.PdfFontFamily.helvetica:(n=this._getHelveticaMetrics(i,r))._name="Helvetica";break;case t.PdfFontFamily.courier:(n=this._getCourierMetrics(i,r))._name="Courier";break;case t.PdfFontFamily.timesRoman:(n=this._getTimesMetrics(i,r))._name="TimesRoman";break;case t.PdfFontFamily.symbol:(n=this._getSymbolMetrics(r))._name="Symbol";break;case t.PdfFontFamily.zapfDingbats:(n=this._getZapfDingbatsMetrics(r))._name="ZapfDingbats";break;default:(n=this._getHelveticaMetrics(i,r))._name="Helvetica"}return n._subScriptSizeFactor=this._subSuperScriptFactor,n._superscriptSizeFactor=this._subSuperScriptFactor,n},e._getHelveticaMetrics=function(e,i){var r=new ge;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._helveticaBoldItalicAscent,r._descent=this._helveticaBoldItalicDescent,r._postScriptName=this._helveticaBoldItalicName,r._size=i,r._widthTable=new me(this._arialBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._helveticaBoldAscent,r._descent=this._helveticaBoldDescent,r._postScriptName=this._helveticaBoldName,r._size=i,r._widthTable=new me(this._arialBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._helveticaItalicAscent,r._descent=this._helveticaItalicDescent,r._postScriptName=this._helveticaItalicName,r._size=i,r._widthTable=new me(this._arialWidth),r._height=r._ascent-r._descent):(r._ascent=this._helveticaAscent,r._descent=this._helveticaDescent,r._postScriptName=this._helveticaName,r._size=i,r._widthTable=new me(this._arialWidth),r._height=r._ascent-r._descent),r},e._getCourierMetrics=function(e,i){var r=new ge;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._courierBoldItalicAscent,r._descent=this._courierBoldItalicDescent,r._postScriptName=this._courierBoldItalicName,r._size=i,r._widthTable=new me(this._fixedWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._courierBoldAscent,r._descent=this._courierBoldDescent,r._postScriptName=this._courierBoldName,r._size=i,r._widthTable=new me(this._fixedWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._courierItalicAscent,r._descent=this._courierItalicDescent,r._postScriptName=this._courierItalicName,r._size=i,r._widthTable=new me(this._fixedWidth),r._height=r._ascent-r._descent):(r._ascent=this._courierAscent,r._descent=this._courierDescent,r._postScriptName=this._courierName,r._size=i,r._widthTable=new me(this._fixedWidth),r._height=r._ascent-r._descent),r},e._getTimesMetrics=function(e,i){var r=new ge;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._timesBoldItalicAscent,r._descent=this._timesBoldItalicDescent,r._postScriptName=this._timesBoldItalicName,r._size=i,r._widthTable=new me(this._timesRomanBoldItalicWidths),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._timesBoldAscent,r._descent=this._timesBoldDescent,r._postScriptName=this._timesBoldName,r._size=i,r._widthTable=new me(this._timesRomanBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._timesItalicAscent,r._descent=this._timesItalicDescent,r._postScriptName=this._timesItalicName,r._size=i,r._widthTable=new me(this._timesRomanItalicWidth),r._height=r._ascent-r._descent):(r._ascent=this._timesAscent,r._descent=this._timesDescent,r._postScriptName=this._timesName,r._size=i,r._widthTable=new me(this._timesRomanWidth),r._height=r._ascent-r._descent),r},e._getSymbolMetrics=function(t){var e=new ge;return e._ascent=this._symbolAscent,e._descent=this._symbolDescent,e._postScriptName=this._symbolName,e._size=t,e._widthTable=new me(this._symbolWidth),e._height=e._ascent-e._descent,e},e._getZapfDingbatsMetrics=function(t){var e=new ge;return e._ascent=this._zapfDingbatsAscent,e._descent=this._zapfDingbatsDescent,e._postScriptName=this._zapfDingbatsName,e._size=t,e._widthTable=new me(this._zapfDingbatsWidth),e._height=e._ascent-e._descent,e},e._subSuperScriptFactor=1.52,e._helveticaAscent=931,e._helveticaDescent=-225,e._helveticaName="Helvetica",e._helveticaBoldAscent=962,e._helveticaBoldDescent=-228,e._helveticaBoldName="Helvetica-Bold",e._helveticaItalicAscent=931,e._helveticaItalicDescent=-225,e._helveticaItalicName="Helvetica-Oblique",e._helveticaBoldItalicAscent=962,e._helveticaBoldItalicDescent=-228,e._helveticaBoldItalicName="Helvetica-BoldOblique",e._courierAscent=805,e._courierDescent=-250,e._courierName="Courier",e._courierBoldAscent=801,e._courierBoldDescent=-250,e._courierBoldName="Courier-Bold",e._courierItalicAscent=805,e._courierItalicDescent=-250,e._courierItalicName="Courier-Oblique",e._courierBoldItalicAscent=801,e._courierBoldItalicDescent=-250,e._courierBoldItalicName="Courier-BoldOblique",e._timesAscent=898,e._timesDescent=-218,e._timesName="Times-Roman",e._timesBoldAscent=935,e._timesBoldDescent=-218,e._timesBoldName="Times-Bold",e._timesItalicAscent=883,e._timesItalicDescent=-217,e._timesItalicName="Times-Italic",e._timesBoldItalicAscent=921,e._timesBoldItalicDescent=-218,e._timesBoldItalicName="Times-BoldItalic",e._symbolAscent=1010,e._symbolDescent=-293,e._symbolName="Symbol",e._zapfDingbatsAscent=820,e._zapfDingbatsDescent=-143,e._zapfDingbatsName="ZapfDingbats",e._arialWidth=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,0,556,0,222,556,333,1e3,556,556,333,1e3,667,333,1e3,0,611,0,0,222,222,333,333,350,556,1e3,333,1e3,500,333,944,0,500,667,0,333,556,556,556,556,260,556,333,737,370,556,584,0,737,333,400,584,333,333,333,556,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500],e._arialBoldWidth=[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,0,556,0,278,556,500,1e3,556,556,333,1e3,667,333,1e3,0,611,0,0,278,278,500,500,350,556,1e3,333,1e3,556,333,944,0,500,667,0,333,556,556,556,556,280,556,333,737,370,556,584,0,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,611,611,611,611,611,556,611,556],e._fixedWidth=[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600],e._timesRomanWidth=[250,333,408,500,500,833,778,180,333,333,500,564,250,333,250,278,500,500,500,500,500,500,500,500,500,500,278,278,564,564,564,444,921,722,667,667,722,611,556,722,722,333,389,722,611,889,722,722,556,722,667,556,611,722,722,944,722,722,611,333,278,333,469,500,333,444,500,444,500,444,333,500,500,278,278,500,278,778,500,500,500,500,333,389,278,500,500,722,500,500,444,480,200,480,541,0,500,0,333,500,444,1e3,500,500,333,1e3,556,333,889,0,611,0,0,333,333,444,444,350,500,1e3,333,980,389,333,722,0,444,722,0,333,500,500,500,500,200,500,333,760,276,500,564,0,760,333,400,564,300,300,333,500,453,250,333,300,310,500,750,750,750,444,722,722,722,722,722,722,889,667,611,611,611,611,333,333,333,333,722,722,722,722,722,722,722,564,722,722,722,722,722,722,556,500,444,444,444,444,444,444,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,564,500,500,500,500,500,500,500,500],e._timesRomanBoldWidth=[250,333,555,500,500,1e3,833,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,930,722,667,722,722,667,611,778,778,389,500,778,667,944,722,778,611,778,722,556,667,722,722,1e3,722,722,667,333,278,333,581,500,333,500,556,444,556,444,333,500,556,278,333,556,278,833,556,500,556,556,444,389,333,556,500,722,500,500,444,394,220,394,520,0,500,0,333,500,500,1e3,500,500,333,1e3,556,333,1e3,0,667,0,0,333,333,500,500,350,500,1e3,333,1e3,389,333,722,0,444,722,0,333,500,500,500,500,220,500,333,747,300,500,570,0,747,333,400,570,300,300,333,556,540,250,333,300,330,500,750,750,750,500,722,722,722,722,722,722,1e3,722,667,667,667,667,389,389,389,389,722,722,778,778,778,778,778,570,778,722,722,722,722,722,611,556,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,500,556,500],e._timesRomanItalicWidth=[250,333,420,500,500,833,778,214,333,333,500,675,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,675,675,675,500,920,611,611,667,722,611,611,722,722,333,444,667,556,833,667,722,611,722,611,500,556,722,611,833,611,556,556,389,278,389,422,500,333,500,500,444,500,444,278,500,500,278,278,444,278,722,500,500,500,500,389,389,278,500,444,667,444,444,389,400,275,400,541,0,500,0,333,500,556,889,500,500,333,1e3,500,333,944,0,556,0,0,333,333,556,556,350,500,889,333,980,389,333,667,0,389,556,0,389,500,500,500,500,275,500,333,760,276,500,675,0,760,333,400,675,300,300,333,500,523,250,333,300,310,500,750,750,750,500,611,611,611,611,611,611,889,667,611,611,611,611,333,333,333,333,722,667,722,722,722,722,722,675,722,722,722,722,722,556,611,500,500,500,500,500,500,500,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,675,500,500,500,500,500,444,500,444],e._timesRomanBoldItalicWidths=[250,389,555,500,500,833,778,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,832,667,667,667,722,667,667,722,778,389,500,667,611,889,722,722,611,722,667,556,611,722,667,889,667,611,611,333,278,333,570,500,333,500,500,444,500,444,333,500,556,278,278,500,278,778,556,500,500,500,389,389,278,556,444,667,500,444,389,348,220,348,570,0,500,0,333,500,500,1e3,500,500,333,1e3,556,333,944,0,611,0,0,333,333,500,500,350,500,1e3,333,1e3,389,333,722,0,389,611,0,389,500,500,500,500,220,500,333,747,266,500,606,0,747,333,400,570,300,300,333,576,500,250,333,300,300,500,750,750,750,500,667,667,667,667,667,667,944,667,667,667,667,667,389,389,389,389,722,722,722,722,722,722,722,570,722,722,722,722,722,611,611,500,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,444,500,444],e._symbolWidth=[250,333,713,500,549,833,778,439,333,333,500,549,250,549,250,278,500,500,500,500,500,500,500,500,500,500,278,278,549,549,549,444,549,722,667,722,612,611,763,603,722,333,631,722,686,889,722,722,768,741,556,592,611,690,439,768,645,795,611,333,863,333,658,500,500,631,549,549,494,439,521,411,603,329,603,549,549,576,521,549,549,521,549,603,439,576,713,686,493,686,494,480,200,480,549,750,620,247,549,167,713,500,753,753,753,753,1042,987,603,987,603,400,549,411,549,549,713,494,460,549,549,549,549,1e3,603,1e3,658,823,686,795,987,768,768,823,768,768,713,713,713,713,713,713,713,768,713,790,790,890,823,549,250,713,603,603,1042,987,603,987,603,494,329,790,790,786,713,384,384,384,384,384,384,494,494,494,494,329,274,686,686,686,384,384,384,384,384,384,494,494,494,-1],e._zapfDingbatsWidth=[278,974,961,974,980,719,789,790,791,690,960,939,549,855,911,933,911,945,974,755,846,762,761,571,677,763,760,759,754,494,552,537,577,692,786,788,788,790,793,794,816,823,789,841,823,833,816,831,923,744,723,749,790,792,695,776,768,792,759,707,708,682,701,826,815,789,789,707,687,696,689,786,787,713,791,785,791,873,761,762,762,759,759,892,892,788,784,438,138,277,415,392,392,668,668,390,390,317,317,276,276,509,509,410,410,234,234,334,334,732,544,544,910,667,760,760,776,595,694,626,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,894,838,1016,458,748,924,748,918,927,928,928,834,873,828,924,924,917,930,931,463,883,836,836,867,867,696,696,874,874,760,946,771,865,771,888,967,888,831,873,927,970,918],e}(),ni=function(){function e(){}return e._getHanyangSystemsGothicMedium=function(e,i){var r=new ge,n=new be(1e3);return n._add(new we(1,127,500)),n._add(new we(8094,8190,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYGoThic-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HYGoThic-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYGoThic-Medium,Italic":r._postScriptName="HYGoThic-Medium",r},e._getHanyangSystemsShinMyeongJoMedium=function(e,i){var r=new ge,n=new be(1e3);return n._add(new we(1,95,500)),n._add(new we(8094,8190,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYSMyeongJo-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HYSMyeongJo-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYSMyeongJo-Medium,Italic":r._postScriptName="HYSMyeongJo-Medium",r},e._getHeiseiKakuGothicW5=function(e,i){var r=new ge,n=new be(1e3);return n._add(new we(1,95,500)),n._add(new we(231,632,500)),r._widthTable=n,r._ascent=857,r._descent=-125,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiKakuGo-W5,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HeiseiKakuGo-W5,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiKakuGo-W5,Italic":r._postScriptName="HeiseiKakuGo-W5",r},e._getHeiseiMinchoW3=function(e,i){var r=new ge,n=new be(1e3);return n._add(new we(1,95,500)),n._add(new we(231,632,500)),r._widthTable=n,r._ascent=857,r._descent=-143,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiMin-W3,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HeiseiMin-W3,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiMin-W3,Italic":r._postScriptName="HeiseiMin-W3",r},e._getMonotypeHeiMedium=function(e,i){var r=new ge,n=new be(1e3);return n._add(new we(1,95,500)),n._add(new we(13648,13742,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MHei-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="MHei-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MHei-Medium,Italic":r._postScriptName="MHei-Medium",r},e._getMonotypeSungLight=function(e,i){var r=new ge,n=new be(1e3);return n._add(new we(1,95,500)),n._add(new we(13648,13742,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MSung-Light,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="MSung-Light,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MSung-Light,Italic":r._postScriptName="MSung-Light",r},e._getSinoTypeSongLight=function(e,i){var r=new ge,n=new be(1e3);return n._add(new we(1,95,500)),n._add(new we(814,939,500)),n._add(new Se(7712,[500])),n._add(new Se(7716,[500])),r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="STSong-Light,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="STSong-Light,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="STSong-Light,Italic":r._postScriptName="STSong-Light",r._widthTable=n,r},e._getMetrics=function(e,i,r){var n;switch(e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:(n=this._getHanyangSystemsGothicMedium(i,r))._name="HanyangSystemsGothicMedium";break;case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:(n=this._getHanyangSystemsShinMyeongJoMedium(i,r))._name="HanyangSystemsShinMyeongJoMedium";break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:(n=this._getHeiseiKakuGothicW5(i,r))._name="HeiseiKakuGothicW5";break;case t.PdfCjkFontFamily.heiseiMinchoW3:(n=this._getHeiseiMinchoW3(i,r))._name="HeiseiMinchoW3";break;case t.PdfCjkFontFamily.monotypeHeiMedium:(n=this._getMonotypeHeiMedium(i,r))._name="MonotypeHeiMedium";break;case t.PdfCjkFontFamily.monotypeSungLight:(n=this._getMonotypeSungLight(i,r))._name="MonotypeSungLight";break;case t.PdfCjkFontFamily.sinoTypeSongLight:(n=this._getSinoTypeSongLight(i,r))._name="SinoTypeSongLight"}return n._subScriptSizeFactor=this._subSuperScriptFactor,n._superscriptSizeFactor=this._subSuperScriptFactor,n},e._subSuperScriptFactor=1.52,e}(),si=function(){function e(){}return e._fillMonotypeSungLight=function(t,e,i){var r={x:-160,y:-249,width:1175,height:1137};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHeiseiKakuGothicW5=function(e,i,r,n){var s={x:-92,y:-250,width:1102,height:1172},a={x:-92,y:-250,width:1102,height:1932};(i&(t.PdfFontStyle.italic|t.PdfFontStyle.bold))!==t.PdfFontStyle.italic?this._fillFontBox(e,s):this._fillFontBox(e,a),this._fillKnownInformation(e,r,n),e.set("StemV",93),e.set("StemH",93),e.set("AvgWidth",689),e.set("MaxWidth",1e3),e.set("CapHeight",718),e.set("XHeight",500),e.set("Leading",250)},e._fillHanyangSystemsShinMyeongJoMedium=function(t,e,i){var r={x:0,y:-148,width:1001,height:1028};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHeiseiMinchoW3=function(t,e,i){var r={x:-123,y:-257,width:1124,height:1167};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",702),t.set("MaxWidth",1e3),t.set("CapHeight",718),t.set("XHeight",500),t.set("Leading",250)},e._fillSinoTypeSongLight=function(t,e,i){var r={x:-25,y:-254,width:1025,height:1134};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillMonotypeHeiMedium=function(t,e,i){var r={x:-45,y:-250,width:1060,height:1137};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHanyangSystemsGothicMedium=function(t,e,i){var r={x:-6,y:-145,width:1009,height:1025};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("Flags",4),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillFontBox=function(t,e){t.set("FontBBox",B(e))},e._fillKnownInformation=function(e,i,r){switch(e.set("FontName",Xr.get(r._postScriptName)),e.set("Type",Xr.get("FontDescriptor")),e.set("ItalicAngle",0),e.set("MissingWidth",r._widthTable._defaultWidth),e.set("Ascent",r._ascent),e.set("Descent",r._descent),i){case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.heiseiKakuGothicW5:e.set("Flags",4);break;case t.PdfCjkFontFamily.sinoTypeSongLight:case t.PdfCjkFontFamily.monotypeSungLight:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:case t.PdfCjkFontFamily.heiseiMinchoW3:e.set("Flags",6)}},e._getFontDescriptor=function(e,i,r){var n=new $r;switch(n._updated=!0,e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:this._fillHanyangSystemsGothicMedium(n,e,r);break;case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:this._fillHanyangSystemsShinMyeongJoMedium(n,e,r);break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:this._fillHeiseiKakuGothicW5(n,i,e,r);break;case t.PdfCjkFontFamily.heiseiMinchoW3:this._fillHeiseiMinchoW3(n,e,r);break;case t.PdfCjkFontFamily.monotypeHeiMedium:this._fillMonotypeHeiMedium(n,e,r);break;case t.PdfCjkFontFamily.monotypeSungLight:this._fillMonotypeSungLight(n,e,r);break;case t.PdfCjkFontFamily.sinoTypeSongLight:this._fillSinoTypeSongLight(n,e,r)}return n},e}();!function(t){t[t.regular=0]="regular",t[t.bold=1]="bold",t[t.italic=2]="italic",t[t.underline=4]="underline",t[t.strikeout=8]="strikeout"}(t.PdfFontStyle||(t.PdfFontStyle={})),function(t){t[t.helvetica=0]="helvetica",t[t.courier=1]="courier",t[t.timesRoman=2]="timesRoman",t[t.symbol=3]="symbol",t[t.zapfDingbats=4]="zapfDingbats"}(t.PdfFontFamily||(t.PdfFontFamily={})),function(t){t[t.heiseiKakuGothicW5=0]="heiseiKakuGothicW5",t[t.heiseiMinchoW3=1]="heiseiMinchoW3",t[t.hanyangSystemsGothicMedium=2]="hanyangSystemsGothicMedium",t[t.hanyangSystemsShinMyeongJoMedium=3]="hanyangSystemsShinMyeongJoMedium",t[t.monotypeHeiMedium=4]="monotypeHeiMedium",t[t.monotypeSungLight=5]="monotypeSungLight",t[t.sinoTypeSongLight=6]="sinoTypeSongLight"}(t.PdfCjkFontFamily||(t.PdfCjkFontFamily={}));var ai=function(){function t(){this._result=!1,this._glyphIndex=[]}return t}(),oi=function(){function e(e,i){if(this._points=[],this._pathTypes=[],this._isRoundedRectangle=!1,this._fillMode=t.PdfFillMode.winding,this._isStart=!0,this._isXps=!1,this._brush=void 0,this._pen=void 0,e&&i){if(!Array.isArray(e)||!Array.isArray(i))throw new Error("Invalid constructor arguments.");this._points=e,this._pathTypes=i}else this._points=[],this._pathTypes=[]}return Object.defineProperty(e.prototype,"lastPoint",{get:function(){var t=[0,0],e=this._points.length;return this._points.length>0&&(t[0]=this._points[e-1][0],t[1]=this._points[e-1][1]),t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pathPoints",{get:function(){return this._points},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pathTypes",{get:function(){return this._pathTypes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fillMode",{get:function(){return this._fillMode},set:function(t){this._fillMode=t},enumerable:!0,configurable:!0}),e.prototype.addPath=function(t,i){t instanceof e?this._addPath(t._points,t._pathTypes):Array.isArray(t)&&Array.isArray(i)&&this._addPath(t,i)},e.prototype._addPath=function(t,e){if(!t||0===t.length)throw new Error("Path points cannot be null or undefined.");if(!e||0===e.length)throw new Error("Path types cannot be null or undefined.");if(t.length!==e.length)throw new Error("The argument arrays should be of equal length.");for(var i=0;i<t.length;i++){if(i>=t.length||i<0)throw new Error("Index"+i+"is out of bounds.");this._points.push(t[i].slice()),this._pathTypes.push(e[i])}},e.prototype.addLine=function(e,i,r,n){this._addPoints([e,i,r,n],t.PathPointType.line)},e.prototype._addLines=function(e){var i=e[0];if(1===e.length)this._addPoint(e[0],t.PathPointType.line);else for(var r=1;r<e.length;r++){var n=e[r];this.addLine(i[0],i[1],n[0],n[1]),i=n}},e.prototype._addPoints=function(e,i,r,n){for(var s=void 0!==r?r:0,a=void 0!==n?n:e.length,o=s;o<a;o+=2){var h=[e[o],e[o+1]];o===s?0===this._points.length||this._isStart?(this._addPoint(h,t.PathPointType.start),this._isStart=!1):!this._isRoundedRectangle||h[0]===this.lastPoint[0]&&h[1]===this.lastPoint[1]?h[0]!==this.lastPoint[0]&&h[1]!==this.lastPoint[1]&&this._addPoint(h,t.PathPointType.line):this._addPoint(h,t.PathPointType.line):this._addPoint(h,i)}},e.prototype._addPoint=function(t,e){this._points.push(t),this._pathTypes.push(e)},e.prototype.addArc=function(e,i,r,n,s,a){for(var o=Q(e,i,e+r,i+n,s,a),h=0;h<o.length;++h){var c=[o[h],o[++h],o[++h],o[++h],o[++h],o[++h],o[++h],o[++h]];this._addPoints(c,t.PathPointType.bezier)}},e.prototype.addRectangle=function(e,i,r,n){this.startFigure(),this._addPoints([e,i,e+r,i,e+r,i+n,e,i+n],t.PathPointType.line),this.closeFigure()},e.prototype.addPolygon=function(e){for(var i=[],r=0;r<e.length;r++){var n=e[r];i.push(n[0],n[1])}this.startFigure(),this._addPoints(i,t.PathPointType.line),this.closeFigure()},e.prototype.addEllipse=function(t,e,i,r){this.startFigure(),this.addArc(t,e,i,r,0,360),this.closeFigure()},e.prototype.addBezier=function(e,i,r,n,s,a,o,h){var c=[e,i,r,n,s,a,o,h];this._addPoints(c,t.PathPointType.bezier)},e.prototype._addBezierPoints=function(t){if(t.length<4)throw Error("Incorrect size of array points");var e=0,i=t[e];for(e++;e+3<=t.length;){var r=t[e],n=t[++e],s=t[++e];e++,this.addBezier(i[0],i[1],r[0],r[1],n[0],n[1],s[0],s[1]),i=s}},e.prototype.addPie=function(e,i,r,n,s,a){this.startFigure(),this.addArc(e,i,r,n,s,a),this._addPoint([e+r/2,i+n/2],t.PathPointType.line),this.closeFigure()},e.prototype.startFigure=function(){this._isStart=!0},e.prototype.closeFigure=function(e){if(void 0!==e){var i=this._pathTypes[e];i|=t.PathPointType.closePath,this._pathTypes[e]=i}else this._points.length>0&&this.closeFigure(this._points.length-1),this.startFigure()},e.prototype.closeAllFigures=function(){for(var e=0;e<this._points.length;++e){var i=this._pathTypes[e],r=!1;0!==e&&i===t.PathPointType.start?(this.closeFigure(e-1),r=!0):e===this._pathTypes.length-1&&!r&&this._isXps&&this._points[0][0]===this._points[e][0]&&this._points[0][1]===this._points[e][1]&&this.closeFigure(e)}},e.prototype._getBounds=function(){var t=[0,0,0,0];if(this._points.length>0){for(var e=this._points[0][0],i=this._points[0][0],r=this._points[0][1],n=this._points[0][1],s=1;s<this._points.length;++s){var a=this._points[s];e=Math.min(a[0],e),i=Math.max(a[0],i),r=Math.min(a[1],r),n=Math.max(a[1],n)}t=[e,r,i-e,n-r]}return t},e}(),hi=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ci=function(){function t(){}return Object.defineProperty(t.prototype,"next",{get:function(){return this._next},set:function(t){this._next=t;var e=this._page._crossReference._getNextReference();this._page._crossReference._cacheMap.set(e,t._dictionary),t._dictionary.objId=e.toString(),this._dictionary.update("Next",e)},enumerable:!0,configurable:!0}),t}(),_i=function(t){function e(e){var i=t.call(this)||this;return e instanceof ur?(i._destination=e,i._page=e.page):(i._page=e,i._destination=new ur(e,[0,0])),i._dictionary=new $r,i._dictionary.update("Type",new Xr("Action")),i._dictionary.update("S",new Xr("GoTo")),i}return hi(e,t),Object.defineProperty(e.prototype,"destination",{get:function(){return this._destination},set:function(t){this._destination=t},enumerable:!0,configurable:!0}),e}(ci),di=function(){function e(t){this._field=t}return Object.defineProperty(e.prototype,"mouseEnter",{get:function(){return this._mouseEnter||(this._mouseEnter=this._getPdfAction("E")),this._mouseEnter},set:function(t){t&&(this._mouseEnter=t,this._updateAction(this._mouseEnter,"E"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseLeave",{get:function(){return this._mouseLeave||(this._mouseLeave=this._getPdfAction("X")),this._mouseLeave},set:function(t){t&&(this._mouseLeave=t,this._updateAction(this._mouseLeave,"X"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseUp",{get:function(){return this._mouseUp||(this._mouseUp=this._getPdfAction("U")),this._mouseUp},set:function(t){t&&(this._mouseUp=t,this._updateAction(this._mouseUp,"U"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseDown",{get:function(){return this._mouseDown||(this._mouseDown=this._getPdfAction("D")),this._mouseDown},set:function(t){t&&(this._mouseDown=t,this._updateAction(this._mouseDown,"D"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gotFocus",{get:function(){return this._gotFocus||(this._gotFocus=this._getPdfAction("Fo")),this._gotFocus},set:function(t){t&&(this._gotFocus=t,this._updateAction(this._gotFocus,"Fo"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lostFocus",{get:function(){return this._lostFocus||(this._lostFocus=this._getPdfAction("Bl")),this._lostFocus},set:function(t){t&&(this._lostFocus=t,this._updateAction(this._lostFocus,"Bl"))},enumerable:!0,configurable:!0}),e.prototype._updateAction=function(e,i){var r;if(this._field._kidsCount>0&&(r=this._field.itemAt(0))&&r._dictionary&&e instanceof _i){var n=new $r,s=e._page,a=e.destination;a._destinationMode===t.PdfDestinationMode.location?e._dictionary.update("D",[s._ref,new Xr("XYZ"),a.location[0],s.size[1],a.zoom]):a._destinationMode===t.PdfDestinationMode.fitR?e._dictionary.update("D",[s._ref,new Xr("FitR"),0,0,0,0]):a._destinationMode===t.PdfDestinationMode.fitH?e._dictionary.update("D",[s._ref,new Xr("FitH"),s.size[1]]):a._destinationMode===t.PdfDestinationMode.fitToPage&&e._dictionary.update("D",[s._ref,new Xr("Fit")]),n.set(i,e._dictionary),n._updated=!0,r._dictionary.update("AA",n)}},e.prototype._getPdfAction=function(t){var e,i=this._field.itemAt(0);if(i&&i._dictionary&&i._dictionary.has("AA")){var r=i._dictionary.get("AA");if(r&&r.has(t)){var n=r.get(t);if(n&&n.has("S")){var s=n.get("S");if(s&&"GoTo"===s.name&&n.has("D")){n._crossReference||(n._crossReference=i._crossReference);var a=new gr(n,"D");e=new _i(a._obtainDestination())}}}}return e},e}(),li=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),fi=function(){function e(){this._enableGrouping=!1,this._isDuplicatePage=!1,this._visible=!0,this._isTransparentBackColor=!1,this._isTransparentBorderColor=!1,this._defaultFont=new ti(t.PdfFontFamily.helvetica,8),this._appearanceFont=new ti(t.PdfFontFamily.helvetica,10,t.PdfFontStyle.regular),this._defaultItemFont=new ti(t.PdfFontFamily.timesRoman,12),this._flatten=!1,this._circleCaptionFont=new ti(t.PdfFontFamily.helvetica,8,t.PdfFontStyle.regular),this._isUpdating=!1,this._isImport=!1}return Object.defineProperty(e.prototype,"itemsCount",{get:function(){return this._kids?this._kids.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{get:function(){return this._form},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){if(void 0===this._name){var t=R(this._dictionary,"T",!1,!1);t&&t.length>0&&(1===t.length?this._name=t[0]:this._name=t.join("."))}return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"actualName",{get:function(){if(void 0===this._actualName&&this._dictionary&&this._dictionary.has("T")){var t=this._dictionary.get("T");t&&"string"==typeof t&&(this._actualName=t)}return this._actualName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mappingName",{get:function(){if(void 0===this._mappingName&&this._dictionary.has("TM")){var t=this._dictionary.get("TM");t&&"string"==typeof t&&(this._mappingName=t)}return this._mappingName},set:function(t){void 0!==this.mappingName&&this._mappingName===t||(this._mappingName=t,this._dictionary.update("TM",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"toolTip",{get:function(){if(void 0===this._alternateName&&this._dictionary&&this._dictionary.has("TU")){var t=this._dictionary.get("TU");t&&"string"==typeof t&&(this._alternateName=t)}return this._alternateName},set:function(t){void 0!==this.toolTip&&this._alternateName===t||(this._alternateName=t,this._dictionary.update("TU",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visibility",{get:function(){var e;if(this._isLoaded){e=t.PdfFormFieldVisibility.visible;var i=this.itemAt(this._defaultIndex),r=t.PdfAnnotationFlag.default;if(i&&i._hasFlags)r=i.flags;else{if(!this._dictionary.has("F"))return t.PdfFormFieldVisibility.visibleNotPrintable;r=this._dictionary.get("F")}var n=3;switch((r&t.PdfAnnotationFlag.hidden)===t.PdfAnnotationFlag.hidden&&(n=0),(r&t.PdfAnnotationFlag.noView)===t.PdfAnnotationFlag.noView&&(n=1),(r&t.PdfAnnotationFlag.print)!==t.PdfAnnotationFlag.print&&(n&=2),n){case 0:e=t.PdfFormFieldVisibility.hidden;break;case 1:e=t.PdfFormFieldVisibility.hiddenPrintable;break;case 2:e=t.PdfFormFieldVisibility.visibleNotPrintable;break;case 3:e=t.PdfFormFieldVisibility.visible}}else void 0===this._visibility&&(this._visibility=t.PdfFormFieldVisibility.visible),e=this._visibility;return e},set:function(e){var i=this.itemAt(this._defaultIndex);if(this._isLoaded)!i||i._hasFlags&&this.visibility===e?this._dictionary.has("F")&&this.visibility===e||(Pt(this._dictionary,e),this._dictionary._updated=!0):(Pt(i._dictionary,e),this._dictionary._updated=!0);else if(this.visibility!==e)switch(this._visibility=e,e){case t.PdfFormFieldVisibility.hidden:i.flags=t.PdfAnnotationFlag.hidden;break;case t.PdfFormFieldVisibility.hiddenPrintable:i.flags=t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visible:i.flags=t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visibleNotPrintable:i.flags=t.PdfAnnotationFlag.default}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&(e._page=this.page),e&&e.bounds?t=e.bounds:this._dictionary&&this._dictionary.has("Rect")&&(t=L(this._dictionary,this.page)),void 0!==t&&null!==t||(t={x:0,y:0,width:0,height:0}),t},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");var e=this.itemAt(this._defaultIndex);this._isLoaded&&(void 0===e||this._dictionary.has("Rect"))?this._dictionary.update("Rect",O([t.x,t.y,t.width,t.height],this.page)):(e._page=this.page,e.bounds=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){var t,e=this.itemAt(this._defaultIndex);if(e&&void 0!==e.rotate)t=e.rotate;else if(this._dictionary.has("R"))t=this._dictionary.get("R");else for(var i=0;i<this._kidsCount&&void 0===t;i++)i!==this._defaultIndex&&(e=this.itemAt(i))&&void 0!==e.rotate&&(t=e.rotate);return void 0===t&&(t=0),t},set:function(t){var e=this.itemAt(this._defaultIndex);e?e.rotate=t:this._dictionary.has("R")&&this._dictionary.get("R")===t||this._dictionary.update("R",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&e.color?t=e.color:this._defaultAppearance&&(t=this._da.color),t},set:function(t){var e=this.itemAt(this._defaultIndex);if(e&&e.color&&Ut(t))e.color=t;else{var i=!1;this._defaultAppearance||(this._da=new Si(""),i=!0),(i||this._da.color!==t)&&(this._da.color=t,this._dictionary.update("DA",this._da.toString()))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backColor",{get:function(){return this._parseBackColor(!1)},set:function(t){this._updateBackColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._parseBorderColor(!0)},set:function(t){this._updateBorderColor(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readOnly",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.readOnly)},set:function(e){e?this._fieldFlags|=t._FieldFlag.readOnly:(this._fieldFlags===t._FieldFlag.readOnly&&(this._fieldFlags|=t._FieldFlag.default),this._fieldFlags&=~t._FieldFlag.readOnly)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"required",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.required)},set:function(e){e?this._fieldFlags|=t._FieldFlag.required:this._fieldFlags&=~t._FieldFlag.required},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){if(this._isLoaded){var e=this.itemAt(this._defaultIndex),i=t.PdfAnnotationFlag.default;return e&&e._hasFlags?i=e.flags:this._dictionary.has("F")&&(i=this._dictionary.get("F")),i!==t.PdfAnnotationFlag.hidden}return this._visible},set:function(e){this._isLoaded||this._visible===e||e||(this._visible=e,this.itemAt(this._defaultIndex).flags=t.PdfAnnotationFlag.hidden)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){var e,i=this.itemAt(this._defaultIndex);if(i&&i._dictionary.has("BS"))e=i.border;else if(e=new ir,this instanceof ui||(e._width=0),e._dictionary=this._dictionary,null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("BS")){var r=this._dictionary.get("BS");if(r){if(r.has("W")&&(e._width=r.get("W")),r.has("S")){var n=r.get("S");if(n)switch(n.name){case"D":e._style=t.PdfBorderStyle.dashed;break;case"B":e._style=t.PdfBorderStyle.beveled;break;case"I":e._style=t.PdfBorderStyle.inset;break;case"U":e._style=t.PdfBorderStyle.underline;break;default:e._style=t.PdfBorderStyle.solid}}r.has("D")&&(e._dash=r.getArray("D"))}}return e},set:function(t){var e=this.itemAt(this._defaultIndex);e?this._updateBorder(e._dictionary,t):this._updateBorder(this._dictionary,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){var e=this.itemAt(this._defaultIndex);if(!e)return t.PdfRotationAngle.angle0;var i=e._dictionary.get("MK");if(i.has("R")){var r=i.get("R");if(void 0!==r)switch(r){case 90:return t.PdfRotationAngle.angle90;case 180:return t.PdfRotationAngle.angle180;case 270:return t.PdfRotationAngle.angle270;default:return t.PdfRotationAngle.angle0}}return e.rotationAngle},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"export",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.noExport))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.noExport:this._fieldFlags|=t._FieldFlag.noExport},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabIndex",{get:function(){if(this._isLoaded){var t=void 0;if(this.page._pageDictionary.has("Annots")&&(t=this.page._pageDictionary.get("Annots")),this._kids&&this._kids.length>0)for(var e=0,i=this._kids;e<i.length;e++){var r=i[e];if(r&&this.page._pageDictionary.has("Annots")&&t&&-1!==(n=t.indexOf(r)))return n}else if(this._dictionary&&this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._ref&&t){var n=t.indexOf(this._ref);if(-1!==n)return n}return-1}return this._tabIndex},set:function(e){if(this._tabIndex=e,this._isLoaded){var i=this.page;if(i&&(i.tabOrder===t.PdfFormFieldsTabOrder.manual||this.form&&this.form._tabOrder===t.PdfFormFieldsTabOrder.manual)&&i._pageDictionary.has("Annots")){var r=i._pageDictionary.get("Annots"),n=new or(r,this._crossReference,i);i._annotations=n;var s=r.indexOf(this._ref);s<0&&(s=this._annotationIndex);var a=i.annotations._reArrange(this._ref,this._tabIndex,s);i._pageDictionary.update("Annots",a),i._pageDictionary._updated=!0}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){if(!this._page){var t,e=this.itemAt(this._defaultIndex),i=void 0!==e?e._dictionary:this._dictionary;this._crossReference&&(t=this._crossReference._document);var r=void 0;if(i&&i.has("P")){var n=i.getRaw("P");if(n&&t)for(o=0;o<t.pageCount;o++){var s=t.getPage(o);if(s&&s._ref===n){r=s;break}}}if(!r&&t){var a=void 0!==e?e._ref:this._ref;if(!r&&a&&(r=J(t,a)),!r&&this._kids&&this._kids.length>0)for(var o=0;o<this._kids.length&&!(r=J(t,this._kids[o]));o++);}this._page=r}return this._page},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_grayBrush",{get:function(){return this._gray||(this._gray=new Ar([128,128,128])),this._gray},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_silverBrush",{get:function(){return this._silver||(this._silver=new Ar([198,198,198])),this._silver},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_whiteBrush",{get:function(){return this._white||(this._white=new Ar([255,255,255])),this._white},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_blackBrush",{get:function(){return this._black||(this._black=new Ar([0,0,0])),this._black},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_kidsCount",{get:function(){return this._kids?this._kids.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_hasBackColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;if(!t){var e=this.itemAt(this._defaultIndex);e&&e._dictionary.has("MK")&&(t=e._dictionary.get("MK"))}return t&&t.has("BG")}return!this._isTransparentBackColor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_hasBorderColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;if(!t){var e=this.itemAt(this._defaultIndex);e&&e._dictionary.has("MK")&&(t=e._dictionary.get("MK"))}return t&&t.has("BC")}return!this._isTransparentBorderColor},enumerable:!0,configurable:!0}),e.prototype._parseBackColor=function(t){var e;if(!t||this._isLoaded&&this._hasBackColor||!this._isLoaded&&!this._isTransparentBackColor){var i=this.itemAt(this._defaultIndex);if(i&&i.backColor)e=i.backColor;else if(this._mkDictionary){var r=this._mkDictionary;if(r&&r.has("BG")){var n=r.getArray("BG");n&&(e=M(n))}}void 0!==e&&null!==e||(e=[255,255,255])}return e},e.prototype._parseBorderColor=function(t){var e;if(!t||this._isLoaded&&this._hasBorderColor||!this._isLoaded&&!this._isTransparentBorderColor){var i=this.itemAt(this._defaultIndex);if(i&&i.borderColor)e=i.borderColor;else if(this._mkDictionary){var r=this._mkDictionary;if(r.has("BC")){var n=r.getArray("BC");n&&(e=M(n))}}void 0!==e&&null!==e||(e=[0,0,0])}return e},e.prototype._updateBackColor=function(t,e){if(void 0===e&&(e=!1),e&&Ut(t)&&4===t.length&&255!==t[3]){this._isTransparentBackColor=!0,this._dictionary&&this._dictionary.has("BG")&&delete this._dictionary._map.BG,(n=this._mkDictionary)&&n.has("BG")&&(delete n._map.BG,this._dictionary._updated=!0);var i=this.itemAt(this._defaultIndex);i&&(i.backColor=t)}else{this._isTransparentBackColor=!1;var r=this.itemAt(this._defaultIndex);if(r&&r.backColor!==t)r.backColor=t;else{var n=this._mkDictionary;if(void 0===n){var s=new $r(this._crossReference);s.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary.update("MK",s)}else n.has("BG")&&M(n.getArray("BG"))===t||(n.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary._updated=!0)}}},e.prototype._updateBorderColor=function(t,e){if(void 0===e&&(e=!1),e&&4===t.length&&255!==t[3]){if(this._isTransparentBorderColor=!0,this._dictionary.has("BC")&&delete this._dictionary._map.BC,(s=this._mkDictionary)&&s.has("BC")){if(delete s._map.BC,this._dictionary.has("BS")){var i=this._dictionary.get("BS");i&&i.has("W")&&delete i._map.W}this._dictionary._updated=!0}var r=this.itemAt(this._defaultIndex);r&&(r.borderColor=t)}else{this._isTransparentBorderColor=!1;var n=this.itemAt(this._defaultIndex);if(n&&n.borderColor!==t)n.borderColor=t;else{var s=this._mkDictionary;if(void 0===s){var a=new $r(this._crossReference);a.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary.update("MK",a)}else s.has("BC")&&M(s.getArray("BC"))===t||(s.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary._updated=!0)}}},e.prototype.itemAt=function(t){var e;if(t>=0&&t<this._kidsCount)if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0,r=this._kids[t];r&&r instanceof Qr&&(i=this._crossReference._fetch(r)),i&&((e=Ji._load(i,this._crossReference))._ref=r,this._parsedItems.set(t,e))}return e},e.prototype.setAppearance=function(t){this._setAppearance=t},e.prototype.getValue=function(t){var e;if(!this._dictionary||!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(null!==i&&void 0!==i&&i instanceof Xr)e=i.name;else{if("string"!=typeof i)throw new Error("PdfException: "+t+" is not found");e=i}return e},e.prototype.setValue=function(t,e){t&&""!==t&&e&&""!==e&&this._dictionary.update(t,e)},e.prototype.removeItemAt=function(t){if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Kids")&&this.itemsCount>0){var e=this.itemAt(t);if(e&&e._ref){var i=e._getPage();if(i&&i._removeAnnotation(e._ref),this._kids.splice(t,1),this._dictionary.set("Kids",this._kids),this._dictionary._updated=!0,this._parsedItems.delete(t),this._parsedItems.size>0){var r=new Map;this._parsedItems.forEach(function(e,i){i>t?r.set(i-1,e):r.set(i,e)}),this._parsedItems=r}}}},e.prototype.removeItem=function(t){if(t&&t._ref){var e=this._kids.indexOf(t._ref);-1!==e&&this.removeItemAt(e)}},Object.defineProperty(e.prototype,"_fieldFlags",{get:function(){return void 0===this._flags&&(this._flags=R(this._dictionary,"Ff",!1,!0),void 0===this._flags&&(this._flags=t._FieldFlag.default)),this._flags},set:function(t){this._fieldFlags!==t&&(this._flags=t,this._dictionary.update("Ff",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_defaultAppearance",{get:function(){if(void 0===this._da){var t=R(this._dictionary,"DA",!1,!0);t&&""!==t&&(this._da=new Si(t))}return this._da},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary&&this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),e.prototype._updateBorder=function(e,i){var r,n=!1;e&&e.has("BS")?r=e.get("BS"):(r=new $r(this._crossReference),e.update("BS",r),n=!0),void 0!==i.width?(r.update("W",i.width),e._updated=!0):n&&r.update("W",0),void 0!==i.style?(r.update("S",N(i.style)),e._updated=!0):n&&r.update("S",N(t.PdfBorderStyle.solid)),void 0!==i.dash&&(r.update("D",i.dash),e._updated=!0)},e.prototype._checkFieldFlag=function(t){var e=t.get("F");return void 0!==e&&6===e},e.prototype._initializeFont=function(t){var e=this;this._font=t;var i,r=this._crossReference._document;r&&(i=r.form._dictionary.has("DR")?r.form._dictionary.get("DR"):new $r(this._crossReference));var n,s=!1;if(i&&i.has("Font")){var a=i.getRaw("Font");a&&a instanceof Qr?(s=!0,n=this._crossReference._fetch(a)):a instanceof $r&&(n=a)}n||(n=new $r(this._crossReference),i.update("Font",n));var o,h,c=!1;this._font&&null!==this._font._key&&void 0!==this._font._key&&this._font._reference?(o=Xr.get(this._font._key),h=this._font._reference,c=!0):(o=Xr.get(X()),h=this._crossReference._getNextReference(),this._font&&(this._font._key=o.name,this._font._reference=h)),h&&!c&&(t instanceof ii?this._font._pdfFontInternals&&(this._crossReference._cacheMap.set(h,this._font._pdfFontInternals),this._font._reference=h):this._font._dictionary&&(this._crossReference._cacheMap.set(h,this._font._dictionary),n.update(o.name,h),i._updated=!0,r.form._dictionary.update("DR",i),r.form._dictionary._updated=!0)),n.update(o.name,h),i._updated=!0,r.form._dictionary.update("DR",i),r.form._dictionary._updated=!0,this._fontName=o.name;var _=new Si;_.fontName=this._fontName,_.fontSize=this._font._size,_.color=this.color?this.color:[0,0,0],this._dictionary.has("Kids")?this._dictionary.getArray("Kids").forEach(function(t,i){var r=e.itemAt(i);t.update("DA",_.toString()),r&&(r._da=_)}):this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._dictionary.update("DA",_.toString()),s&&(i._updated=!0)},e.prototype._drawRectangularControl=function(e,i){switch(e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush),this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth),i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._whiteBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}},e.prototype._drawBorder=function(e,i,r,n,s){r&&s>0&&(n===t.PdfBorderStyle.underline?e.drawLine(r,i[0],i[0]+i[3]-s/2,i[0]+i[2],i[1]+i[3]-s/2):e.drawRectangle(i[0]+s/2,i[1]+s/2,i[2]-s,i[3]-s,r))},e.prototype._drawLeftTopShadow=function(t,e,i,r){var n=new oi,s=[];s.push([e[0]+i,e[1]+i]),s.push([e[0]+i,e[1]+e[3]-i]),s.push([e[0]+2*i,e[1]+e[3]-2*i]),s.push([e[0]+2*i,e[1]+2*i]),s.push([e[0]+e[2]-2*i,e[1]+2*i]),s.push([e[0]+e[2]-i,e[1]+i]),n.addPolygon(s),t.drawPath(n,r)},e.prototype._drawRightBottomShadow=function(t,e,i,r){var n=new oi,s=[];s.push([e[0]+i,e[1]+e[3]-i]),s.push([e[0]+2*i,e[1]+e[3]-2*i]),s.push([e[0]+e[2]-2*i,e[1]+e[3]-2*i]),s.push([e[0]+e[2]-2*i,e[1]+2*i]),s.push([e[0]+e[2]-i,e[1]+i]),s.push([e[0]+e[2]-i,e[1]+e[3]-i]),n.addPolygon(s),t.drawPath(n,r)},e.prototype._drawRadioButton=function(e,i,r,n){if("l"===r){var s=i.bounds,a=s[2];switch(this._enableGrouping&&(a=Math.min(s[2],s[3])),n){case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:e.drawEllipse(s[0],s[1],a,s[3],i.backBrush);break;case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.underline?e.drawEllipse(s[0],s[1],s[2],s[3],i.backBrush):e.drawEllipse(s[0],s[1],a,s[3],i.shadowBrush)}if(this._drawRoundBorder(e,s,i.borderPen,i.borderWidth),this._drawRoundShadow(e,i,n),n===t._PdfCheckFieldState.checked||n===t._PdfCheckFieldState.pressedChecked){var o=[s[0]+i.borderWidth/2,s[1]+i.borderWidth/2,a-i.borderWidth,s[3]-i.borderWidth];e.drawEllipse(o[0]+o[2]/4,o[1]+o[2]/4,o[2]-o[2]/2,o[3]-o[2]/2,i.foreBrush)}}else this._drawCheckBox(e,i,r,n)},e.prototype._drawRoundBorder=function(t,e,i,r){0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||t.drawEllipse(e[0]+r/2,e[1]+r/2,(this._enableGrouping?Math.min(e[2],e[3]):e[2])-r,e[3]-r,i)},e.prototype._drawRoundShadow=function(e,i,r){var n=i.borderWidth,s=-1.5*n,a=i.bounds[0]+s,o=i.bounds[1]+s,h=i.bounds[2]+2*s,c=i.bounds[3]+2*s,_=i.shadowBrush;if(_){var d=_._color,l=void 0,f=void 0;switch(i.borderStyle){case t.PdfBorderStyle.beveled:switch(r){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:l=new xr(d,n),f=new xr([255,255,255],n);break;case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:l=new xr([255,255,255],n),f=new xr(d,n)}break;case t.PdfBorderStyle.inset:switch(r){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:l=new xr([0,0,0],n),f=new xr([0,0,0],n);break;case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:l=new xr([128,128,128],n),f=new xr([192,192,192],n)}}l&&f&&(e.drawArc(a,o,h,c,135,180,l),e.drawArc(a,o,h,c,-45,180,f))}},e.prototype._drawCheckBox=function(e,i,r,n,s){switch(n){case t._PdfCheckFieldState.unchecked:case t._PdfCheckFieldState.checked:(i.borderPen||i.backBrush)&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush);break;case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:i.borderStyle===t.PdfBorderStyle.beveled||i.backBrush||i.borderStyle===t.PdfBorderStyle.underline?(i.borderPen||i.backBrush)&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush):(i.borderPen||i.shadowBrush)&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.shadowBrush)}var a=i.bounds;if(this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth),n===t._PdfCheckFieldState.pressedChecked||n===t._PdfCheckFieldState.pressedUnchecked)switch(i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._blackBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush)}else switch(i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._whiteBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}var o=0,h=0;switch(n){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.checked:if(s)s=new ti(t.PdfFontFamily.zapfDingbats,s._size);else{var c=i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.inset,_=i.borderWidth;c&&(_*=2);var d=Math.max(c?2*i.borderWidth:i.borderWidth,1),l=Math.min(_,d),f=(h=i.bounds[2]>i.bounds[3]?i.bounds[3]:i.bounds[2])-2*l;s=new ti(t.PdfFontFamily.zapfDingbats,f),i.bounds[2]>i.bounds[3]&&(o=(i.bounds[3]-s._metrics._getHeight())/2)}if(0===h&&(h=i.bounds[3]),i.pageRotationAngle!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var p=e.save(),u=e._size;if(i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(u[1],0),e.rotateTransform(90);var g=u[1]-(a[0]+a[2]);a=[b=a[1],g,a[3],a[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(u[0],u[1]),e.rotateTransform(-180),a=[b=u[0]-(a[0]+a[2]),g=u[1]-(a[1]+a[3]),a[2],a[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,u[0]),e.rotateTransform(270),a=[b=u[0]-(a[1]+a[3]),g=a[0],a[3],a[2]]);if(i.rotationAngle>0){if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,u[1]),e.rotateTransform(-90),a=[b=u[1]-(a[1]+a[3]),g=a[0],a[3],a[2]];else if(a[2]>a[3])e.translateTransform(0,u[1]),e.rotateTransform(-90),a=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]];else{var y=a[0];a[0]=-(a[1]+a[3]),a[1]=y;var m=a[3];a[3]=a[2]>s._metrics._getHeight()?a[2]:s._metrics._getHeight(),a[2]=m,e.rotateTransform(-90),a=[a[0],a[1],a[2],a[3]]}else if(270===i.rotationAngle)e.translateTransform(u[0],0),e.rotateTransform(-270),a=[b=a[1],g=u[0]-(a[0]+a[2]),a[3],a[2]];else if(180===i.rotationAngle){e.translateTransform(u[0],u[1]),e.rotateTransform(-180);var b=u[0]-(a[0]+a[2]);a=[b,g=u[1]-(a[1]+a[3]),a[2],a[3]]}e.drawString(r,s,[a[0],a[1]-o,a[2],a[3]],null,i.foreBrush,new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle)),e.restore(p)}else e.drawString(r,s,[a[0],a[1]-o,a[2],a[3]],null,i.foreBrush,new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle));break}}},e.prototype._addToKid=function(t){if(this._dictionary&&this._dictionary.has("Kids")?this._kids=this._dictionary.get("Kids"):(this._kids=[],this._dictionary.update("Kids",this._kids),this._parsedItems=new Map),-1===this._kids.indexOf(t._ref)){var e=this._kidsCount;t._index=e,this._kids.push(t._ref),this._parsedItems.set(e,t)}},e.prototype._drawTemplate=function(e,i,r){if(e&&i){var n=i.graphics;n.save(),i.rotation===t.PdfRotationAngle.angle90?(n.translateTransform(n._size[1],0),n.rotateTransform(90)):i.rotation===t.PdfRotationAngle.angle180?(n.translateTransform(n._size[0],n._size[1]),n.rotateTransform(-180)):i.rotation===t.PdfRotationAngle.angle270&&(n.translateTransform(0,n._size[0]),n.rotateTransform(270)),n._sw._setTextRenderingMode(t._TextRenderingMode.fill),n.drawTemplate(e,r),n.restore()}},e.prototype._addToOptions=function(t,e){e instanceof vi&&e._listValues.push(t._text),e._options.push([t._value,t._text]),e._dictionary.set("Opt",e._options),e._dictionary._updated=!0,!t._isFont&&t._pdfFont&&this._initializeFont(t._pdfFont)},e.prototype._addAppearance=function(t,e,i){var r=new $r;t&&t.has("AP")?(r=t.get("AP"),At(t.get("AP"),this._crossReference,i)):(r=new $r(this._crossReference),t.update("AP",r));var n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,e._content),r.update(i,n)},e.prototype._rotateTextBox=function(e,i,r){var n=[0,0,0,0];return r===t.PdfRotationAngle.angle180?n=[i[0]-(e[0]+e[2]),i[1]-(e[1]+e[3]),e[2],e[3]]:r===t.PdfRotationAngle.angle270?n=[e[1],i[0]-(e[0]+e[2]),e[3],e[2]]:r===t.PdfRotationAngle.angle90&&(n=[i[1]-(e[1]+e[3]),e[0],e[3],e[2]]),n},e.prototype._checkIndex=function(t,e){if(t<0||0!==t&&t>=e)throw Error("Index out of range.")},e.prototype._getAppearanceStateValue=function(){var t;if(this._dictionary&&this._dictionary.has("Kids"))for(var e=0;e<this._kidsCount;e++){var i=this.itemAt(e);if(i&&i._dictionary&&i._dictionary.has("AS")&&(r=i._dictionary.get("AS"))&&"Off"!==r.name){t=r.name;break}}else if(this._dictionary&&this._dictionary.has("AS")){var r=this._dictionary.get("AS");r&&"Off"!==r.name&&(t=r.name)}return t},e.prototype._getTextAlignment=function(){if(null===this._textAlignment||void 0===this._textAlignment)if(this._isLoaded){var e=this.itemAt(this._defaultIndex);e&&e._dictionary&&e._dictionary.has("Q")?this._textAlignment=e._dictionary.get("Q"):this._dictionary.has("Q")?this._textAlignment=this._dictionary.get("Q"):this._textAlignment=t.PdfTextAlignment.left}else this._textAlignment=t.PdfTextAlignment.left;return this._textAlignment},e.prototype._setTextAlignment=function(e){var i=this.itemAt(this._defaultIndex);this._isLoaded&&!this.readOnly&&(i&&i._dictionary?i._dictionary.update("Q",e):this._dictionary.update("Q",e)),this._isLoaded||this._textAlignment===e||(i&&i._dictionary?i._dictionary.update("Q",e):this._dictionary&&this._dictionary.update("Q",e)),this._textAlignment=e,this._stringFormat=new pe(e,t.PdfVerticalAlignment.middle)},e.prototype._parseItems=function(){for(var t=[],e=0;e<this.itemsCount;e++)t.push(this.itemAt(e));return t},e}(),pi=function(e){function i(t,i,r){var n=e.call(this)||this;return n._autoResizeText=!1,t&&i&&r&&n._initialize(t,i,r),n}return li(i,e),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},Object.defineProperty(i.prototype,"text",{get:function(){if(void 0===this._text)if(this._isLoaded){var t=R(this._dictionary,"V",!1,!0);if(t)this._text=f(t);else{var e=this.itemAt(this._defaultIndex);e&&(t=e._dictionary.get("V"))&&(this._text=f(t))}}else this._text="";return this._text},set:function(t){if(this._isLoaded){if(!this.readOnly){this._dictionary.has("V")&&this._dictionary.get("V")===t||this._dictionary.update("V",t);var e=this.itemAt(this._defaultIndex);!e||e._dictionary.has("V")&&e._dictionary.get("V")===t||e._dictionary.update("V",t)}}else this._text!==t&&(this._dictionary.update("V",t),this._text=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"defaultValue",{get:function(){if(void 0===this._defaultValue){var t=R(this._dictionary,"DV",!1,!0);t&&(this._defaultValue=t)}return this._defaultValue},set:function(t){t!==this.defaultValue&&(this._dictionary.update("DV",t),this._defaultValue=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"multiLine",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.multiLine)},set:function(e){e?this._fieldFlags|=t._FieldFlag.multiLine:this._fieldFlags&=~t._FieldFlag.multiLine,this._stringFormat&&(this._stringFormat.lineAlignment=e?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"password",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.password)},set:function(e){e?this._fieldFlags|=t._FieldFlag.password:this._fieldFlags&=~t._FieldFlag.password},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollable",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.doNotScroll))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.doNotScroll:this._fieldFlags|=t._FieldFlag.doNotScroll},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"spellCheck",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.doNotSpellCheck))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.doNotSpellCheck:this._fieldFlags|=t._FieldFlag.doNotSpellCheck},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"insertSpaces",{get:function(){var e=this._fieldFlags;return 0!=(t._FieldFlag.comb&e)&&0==(e&t._FieldFlag.multiLine)&&0==(e&t._FieldFlag.password)&&0==(e&t._FieldFlag.fileSelect)},set:function(e){e?this._fieldFlags|=t._FieldFlag.comb:this._fieldFlags&=~t._FieldFlag.comb},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){var e,i=this.itemAt(this._defaultIndex);return i&&void 0!==i.highlightMode?e=i.highlightMode:this._dictionary&&this._dictionary.has("H")&&(e=z(this._dictionary.get("H").name)),void 0!==e?e:t.PdfHighlightMode.noHighlighting},set:function(t){var e=this.itemAt(this._defaultIndex);!e||void 0!==e.highlightMode&&e.highlightMode===t?this._dictionary.has("H")&&z(this._dictionary.get("H"))===t||this._dictionary.update("H",U(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxLength",{get:function(){if(void 0===this._maxLength){var t=R(this._dictionary,"MaxLen",!1,!0);this._maxLength=void 0!==t&&Number.isInteger(t)?t:0}return this._maxLength},set:function(t){this.maxLength!==t&&(this._dictionary.update("MaxLen",t),this._maxLength=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isAutoResizeText",{get:function(){return this._autoResizeText},set:function(t){this._autoResizeText=t;var e=this.itemAt(this._defaultIndex);e&&(e._isAutoResize=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=Tt(this._form,t,this),this._font},set:function(t){t&&t instanceof $e&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._initialize=function(e,i,r){this._crossReference=e._crossReference,this._page=e,this._name=i,this._text="",this._defaultValue="",this._defaultIndex=0,this._spellCheck=!1,this._insertSpaces=!1,this._multiline=!1,this._password=!1,this._scrollable=!1,this._dictionary=new $r(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Xr.get("Tx")),this._dictionary.update("T",i),this._fieldFlags|=t._FieldFlag.doNotSpellCheck,this._createItem(r),this._initializeFont(this._defaultFont)},i.prototype._createItem=function(e){var i=new Ji;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.left,this._stringFormat=new pe(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new $r(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[1,1,1]),i._mkDictionary.update("CA",this.actualName),this._addToKid(i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._isLoaded)if(e>0)for(i=0;i<e;i++)(r=this.itemAt(i))&&this._postProcess(t,r);else(t||this._form._setAppearance||this._setAppearance)&&!this._checkFieldFlag(this._dictionary)&&this._postProcess(t);else if(t||this._form._setAppearance||this._setAppearance)for(var i=0;i<e;i++){var r=this.itemAt(i);if(r&&!this._checkFieldFlag(r._dictionary)){var n=this._createAppearance(t,r);t?this._drawTemplate(n,r._page,{x:r.bounds.x,y:r.bounds.y,width:n._size[0],height:n._size[1]}):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}}t&&(this._dictionary._updated=!1)}},i.prototype._postProcess=function(e,i){var r,n,s=i||this;if(null!==i&&void 0!==i&&i._setAppearance&&i._enableGrouping||this._form._setAppearance||this._setAppearance||e&&!s._dictionary.has("AP"))r=this._createAppearance(e,s);else if(s._dictionary.has("AP")){var a=void 0,o=s._dictionary.get("AP");if(o&&o.has("N")){a=o.get("N");var h=o.getRaw("N");h&&(a.reference=h),a&&(r=new fe(a,this._crossReference))}}if(r)if(e){var c=s instanceof Ji?s._getPage():s.page;if(c){var _=c.graphics;_.save(),c.rotation===t.PdfRotationAngle.angle90?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(90)):c.rotation===t.PdfRotationAngle.angle180?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(-180)):c.rotation===t.PdfRotationAngle.angle270&&(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(270)),n={x:s.bounds.x,y:s.bounds.y,width:r._size[0],height:r._size[1]},_.drawTemplate(r,n),_.restore()}s._dictionary._updated=!1}else this._addAppearance(s._dictionary,r,"N")},i.prototype._createAppearance=function(e,i){var r=i.bounds,n=new fe([0,0,r.width,r.height],this._crossReference);et(n,null),n._writeTransformation=!1;var s=n.graphics,a=new sr;a.bounds=[0,0,r.width,r.height];var o=i.backColor;o&&(a.backBrush=new Ar(o)),a.foreBrush=new Ar(i.color);var h=i.border;if(i.borderColor&&(0===h.width&&(i.borderColor=[255,255,255]),a.borderPen=new xr(i.borderColor,h.width),$t(h,a)),a.borderWidth=h.width,a.borderStyle=h.style,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];a.shadowBrush=new Ar(_)}a.rotationAngle=i.rotate,a.insertSpaces=this.insertSpaces;var d,l,f=this.text,p=!1;if(null!==f&&void 0!==f||(f=""),this.password){for(var u="",g=0;g<f.length;g++)u+="*";f=u}return this.maxLength&&f.length>this.maxLength&&(f=f.substring(0,this.maxLength)),a.required=this.required,this.required||(s._sw._beginMarkupSequence("Tx"),s._initializeCoordinates()),null!==i&&void 0!==i&&i instanceof Ji&&i._enableGrouping&&(p=!0),p&&null!==i.font&&void 0!==i.font?0===(d=i.font).size&&(d._size=8,d._fontMetrics._size=0):void 0!==this._font&&null!==this._font||(this._font=this._defaultFont),p&&null!==i.textAlignment&&void 0!==i.textAlignment?l=l=new pe(i.textAlignment,t.PdfVerticalAlignment.middle):void 0!==this._stringFormat&&null!==this._stringFormat||(void 0===this.textAlignment||null===this.textAlignment?this._stringFormat=new pe(this.textAlignment,t.PdfVerticalAlignment.middle):this._stringFormat=new pe(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle)),Gt(f)&&(this._stringFormat.textDirection=t.PdfTextDirection.rightToLeft),p?this._drawTextBox(s,a,f,d,l,this.multiLine,this.scrollable,this.maxLength):this._drawTextBox(s,a,f,this._font,this._stringFormat,this.multiLine,this.scrollable,this.maxLength),this.required||s._sw._endMarkupSequence(),n},i.prototype._drawTextBox=function(e,i,r,n,s,a,o,h){if(void 0!==h)if(i.insertSpaces){var c=0;if(void 0!==h&&h>0&&this.borderColor){c=i.bounds[2]/h,e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.borderPen,i.backBrush);for(var _=r,d=0;d<h;d++){if(s.alignment===t.PdfTextAlignment.right)r=h-_.length<=d?_[d-(h-_.length)]:"";else if(s.alignment===t.PdfTextAlignment.center&&_.length<h){var l=Math.floor(h/2-Math.ceil(_.length/2));r=d>=l&&d<l+_.length?_[d-l]:""}else r=_.length>d?_[d]:"";i.bounds[2]=c;var f=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle);this._drawTextBox(e,i,r,n,f,a,o),i.bounds[0]=i.bounds[0]+c,i.borderWidth&&e.drawLine(i.borderPen,i.bounds[0],i.bounds[1],i.bounds[0],i.bounds[1]+i.bounds[3])}}else this._drawTextBox(e,i,r,n,s,a,o)}else this._drawTextBox(e,i,r,n,s,a,o);else{e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),i.insertSpaces||this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());var p=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]],u=this.rotate;if(null!==u&&void 0!==u&&90===u&&(p[1]=p[2]/2),i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.inset?(p[0]=p[0]+4*i.borderWidth,p[2]=p[2]-8*i.borderWidth):(p[0]=p[0]+2*i.borderWidth,p[2]=p[2]-4*i.borderWidth),a){var g=(void 0===s||null===s||0===s.lineSpacing?n._metrics._getHeight():s.lineSpacing)-n._metrics._getAscent(s);r.indexOf("\n"),0===p[0]&&1===p[1]&&(p[1]=-(p[1]-g)),i.isAutoFontSize&&0!==i.borderWidth&&(p[1]=p[1]+2.5*i.borderWidth)}if(e._page&&void 0!==e._page.rotation&&e._page.rotation!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var y=e.save();if(void 0!==i.pageRotationAngle&&i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(e._size[1],0),e.rotateTransform(90);var m=e._size[1]-(p[0]+p[2]);p=[w=p[1],m,p[3],p[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180),p=[w=e._size[0]-(p[0]+p[2]),m=e._size[1]-(p[1]+p[3]),p[2],p[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,e._size[0]),e.rotateTransform(270),p=[w=e._size[0]-(p[1]+p[3]),m=p[0],p[3],p[2]]);if(i.rotationAngle)if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),p=[w=e._size[1]-(p[1]+p[3]),m=p[0],p[3],p[2]],i.stringFormat=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle);else if(p[2]>p[3])e.translateTransform(0,e._size[1]),e.rotateTransform(-90),(p=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]])[1]=p[2]/2-8*i.borderWidth;else{var b=p[0];p[0]=-(p[1]+p[3]),p[1]=b;var v=p[3];p[3]=p[2]>n._metrics._getHeight()?p[2]:n._metrics._getHeight(),p[2]=v,e.rotateTransform(-90)}else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),(p=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]])[1]=p[2]/2-8*i.borderWidth;else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var w=e._size[0]-(p[0]+p[2]);p=[w,m=e._size[1]-(p[1]+p[3]),p[2],p[3]]}e.drawString(r,n,p,null,i.foreBrush,s),e.restore(y)}else e.drawString(r,n,p,null,i.foreBrush,s);e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())}},i}(fi),ui=function(e){function i(t,i,r){var n=e.call(this)||this;return t&&i&&r&&n._initialize(t,i,r),n}return li(i,e),Object.defineProperty(i.prototype,"actions",{get:function(){return this._actions||(this._actions=new di(this)),this._actions},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){if(this._isLoaded){if(void 0===this._text){var t=this.itemAt(this._defaultIndex);t&&t._mkDictionary&&t._mkDictionary.has("CA")?this._text=t._mkDictionary.get("CA"):this._mkDictionary&&this._mkDictionary.has("CA")&&(this._text=this._mkDictionary.get("CA"))}if(void 0===this._text){var e=R(this._dictionary,"V",!1,!0);e&&(this._text=e)}}return void 0===this._text&&(this._text=""),this._text},set:function(t){if(this._isLoaded&&!this.readOnly&&((e=this.itemAt(this._defaultIndex))&&e._dictionary?this._assignText(e._dictionary,t):this._assignText(this._dictionary,t)),!this._isLoaded&&this._text!==t){var e=this.itemAt(this._defaultIndex);this._assignText(e._dictionary,t),this._text=t}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){var e,i=this.itemAt(this._defaultIndex);return i&&void 0!==i.highlightMode?e=i.highlightMode:this._dictionary&&this._dictionary.has("H")&&(e=z(this._dictionary.get("H").name)),void 0!==e?e:t.PdfHighlightMode.invert},set:function(t){var e=this.itemAt(this._defaultIndex);!e||void 0!==e.highlightMode&&e.highlightMode===t?this._dictionary.has("H")&&z(this._dictionary.get("H"))===t||this._dictionary.update("H",U(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=Tt(this._form,t,this),this._font},set:function(t){t&&t instanceof $e&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._assignText=function(t,e){var i;t&&t.has("MK")?i=t.get("MK"):(i=new $r(this._crossReference),t.set("MK",i)),i.update("CA",e),t._updated=!0},i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},i.prototype._initialize=function(e,i,r){this._crossReference=e._crossReference,this._page=e,this._name=i,this._defaultIndex=0,this._dictionary=new $r(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Xr.get("Btn")),this._dictionary.update("T",i),this._fieldFlags|=t._FieldFlag.pushButton,this._initializeFont(this._defaultFont),this._createItem(r)},i.prototype._createItem=function(e){var i=new Ji;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.center,this._stringFormat=new pe(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new $r(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[.827451,.827451,.827451]),i._mkDictionary.update("CA",void 0!==this._name&&null!==this._name?this._name:this._actualName),this._addToKid(i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._isLoaded)if(e>0)for(i=0;i<e;i++)(r=this.itemAt(i))&&this._postProcess(t,r);else(t||this._form._setAppearance||this._setAppearance)&&!this._checkFieldFlag(this._dictionary)&&this._postProcess(t);else if(t||this._form._setAppearance||this._setAppearance)for(var i=0;i<e;i++){var r=this.itemAt(i);if(r&&!this._checkFieldFlag(r._dictionary)){var n=this._createAppearance(r);if(t)this._drawTemplate(n,r._getPage(),{x:r.bounds.x,y:r.bounds.y,width:n._size[0],height:n._size[1]});else{this._addAppearance(r._dictionary,n,"N");var s=this._createAppearance(r,!0);s&&this._addAppearance(r._dictionary,s,"D")}r._dictionary._updated=!t}}t&&(this._dictionary._updated=!1)}},i.prototype._postProcess=function(e,i){var r,n,s=i||this;if(null!==i&&void 0!==i&&i._setAppearance&&i._enableGrouping||this._form._setAppearance||this._setAppearance||e&&!s._dictionary.has("AP"))r=this._createAppearance(s);else if(s._dictionary.has("AP")){var a=void 0,o=s._dictionary.get("AP");if(o&&o.has("N")){a=o.get("N");var h=o.getRaw("N");if(h&&(a.reference=h),a&&a instanceof $r&&s._dictionary.has("AS")){var c=s._dictionary.get("AS");if(c&&c instanceof Xr&&a.has(c.name)){var _=a.getRaw(c.name),d=a.get(c.name);_&&d&&d instanceof rn&&((a=d).reference=_)}}a&&(r=new fe(a,this._crossReference))}}if(r)if(e){var l=s instanceof Ji?s._getPage():s.page;if(l){var f=l.graphics;f.save(),l.rotation===t.PdfRotationAngle.angle90?(f.translateTransform(f._size[0],f._size[1]),f.rotateTransform(90)):l.rotation===t.PdfRotationAngle.angle180?(f.translateTransform(f._size[0],f._size[1]),f.rotateTransform(-180)):l.rotation===t.PdfRotationAngle.angle270&&(f.translateTransform(f._size[0],f._size[1]),f.rotateTransform(270)),n={x:s.bounds.x,y:s.bounds.y,width:r._size[0],height:r._size[1]},f.drawTemplate(r,n),f.restore()}s._dictionary._updated=!1}else this._addAppearance(s._dictionary,r,"N")},i.prototype._createAppearance=function(e,i){void 0===i&&(i=!1);var r=e.bounds,n=new fe([0,0,r.width,r.height],this._crossReference),s=new sr;s.bounds=[0,0,r.width,r.height];var a,o,h,c=!1,_=!1,d=e.backColor;d&&(s.backBrush=new Ar(d)),s.foreBrush=new Ar(e.color);var l=e.border;if(e.borderColor&&(s.borderPen=new xr(e.borderColor,l.width),$t(l,s)),s.borderWidth=l.width,s.borderStyle=l.style,d){var f=[d[0]-64,d[1]-64,d[2]-64],p=[f[0]>=0?f[0]:0,f[1]>=0?f[1]:0,f[2]>=0?f[2]:0];s.shadowBrush=new Ar(p)}if(s.rotationAngle=e.rotate,null!==e&&void 0!==e&&e instanceof Ji&&e._enableGrouping&&(c=!0),c?(a=e._mkDictionary&&e._mkDictionary&&e._mkDictionary.has("CA")?e._mkDictionary.get("CA"):"",void 0!==e.font&&null!==e.font.size&&0!==e.font.size&&(o=e.font),h=new pe(e.textAlignment,t.PdfVerticalAlignment.middle)):void 0!==this._font&&null!==this._font||(this._font=this._defaultFont),this._isLoaded&&e instanceof Ji&&null!==e&&void 0!==e&&e._defaultAppearance){var u=e._defaultAppearance.fontName;null!==u&&void 0!==u||(u="Helvetica");var g=e._defaultAppearance.fontSize;null===g||void 0===g?g=this._defaultFont.size:0===g&&(_=!0);var y,m=void 0,b=void 0;this._stringFormat=new pe,this._stringFormat.lineAlignment=t.PdfVerticalAlignment.middle,this._stringFormat.alignment=t.PdfTextAlignment.center,null!==g&&void 0!==g&&u&&(y=Ft(u,g,t.PdfFontStyle.regular,e));var v=(b=null!==y&&void 0!==y?y:this._defaultFont).measureString(this.text,this._stringFormat);if(_&&b&&b instanceof ti&&this._isLoaded&&!e._dictionary.has("AP")){for(var w=e.bounds.width-8*l.width,S=e.bounds.height-8*l.width;v[0]<w||v[1]<S;)if(m=b,b=new ti(b.fontFamily,b._size+1),(v=b.measureString(this.text,this._stringFormat))[0]>w||v[1]>S){b=m;break}this._font=b}}return c?i?this._drawPressedButton(n.graphics,s,a,o,h):this._drawButton(n.graphics,s,a,o,h):i?this._drawPressedButton(n.graphics,s,this.text,this._font,this._stringFormat):this._drawButton(n.graphics,s,this.text,this._font,this._stringFormat),n},i.prototype._drawButton=function(e,i,r,n,s){this._drawRectangularControl(e,i);var a=i.bounds;if(e._page&&void 0!==e._page.rotation&&e._page.rotation!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var o=e.save();if(void 0!==i.pageRotationAngle&&i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(e._size[1],0),e.rotateTransform(90);var h=e._size[1]-(a[0]+a[2]);a=[d=a[1],h,a[3],a[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180),a=[d=e._size[0]-(a[0]+a[2]),h=e._size[1]-(a[1]+a[3]),a[2],a[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,e._size[0]),e.rotateTransform(270),a=[d=e._size[0]-(a[1]+a[3]),h=a[0],a[3],a[2]]);if(i.rotationAngle)if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),a=[d=e._size[1]-(a[1]+a[3]),h=a[0],a[3],a[2]];else if(a[2]>a[3])e.translateTransform(0,e._size[1]),e.rotateTransform(-90),a=[d=e._size[1]-(a[1]+a[3]),h=a[0],a[3],a[2]],s._wordWrapType=t._PdfWordWrapType.none;else{var c=a[0];a[0]=-(a[1]+a[3]),a[1]=c;var _=a[3];a[3]=a[2]>n._metrics._getHeight()?a[2]:n._metrics._getHeight(),a[2]=_,e.rotateTransform(-90)}else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),a=[d=a[1],h=e._size[0]-(a[0]+a[2]),a[3],a[2]],s._wordWrapType=t._PdfWordWrapType.none;else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var d=e._size[0]-(a[0]+a[2]);a=[d,h=e._size[1]-(a[1]+a[3]),a[2],a[3]]}e.drawString(r,n,a,null,i.foreBrush,s),e.restore(o)}else e.drawString(r,n,a,null,i.foreBrush,s)},i.prototype._drawPressedButton=function(e,i,r,n,s){switch(i.borderStyle){case t.PdfBorderStyle.inset:e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.shadowBrush);break;default:e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush)}this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth);var a=[i.borderWidth,i.borderWidth,i.bounds[2]-i.borderWidth,i.bounds[3]-i.borderWidth];switch(e.drawString(r,n,a,null,i.foreBrush,s),i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush);break;default:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}},i}(fi),gi=function(e){function i(t,i,r){var n=e.call(this)||this;return r&&t&&i&&n._initialize(r,t,i),n}return li(i,e),i._load=function(t,e,r,n){var s=new i;if(s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._defaultIndex=0,s._parsedItems=new Map,s._dictionary.has("Kids"))s._kids=s._dictionary.get("Kids");else{var a=Yi._load(e,r,s);a._isLoaded=!0,a._ref=n,s._parsedItems.set(0,a)}return s},i.prototype.itemAt=function(t){if(t<0||0!==t&&t>=this._kidsCount)throw Error("Index out of range.");var e;if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0;if(t>=0&&this._kids&&this._kids.length>0&&t<this._kids.length){var r=this._kids[t];r&&r instanceof Qr&&(i=this._crossReference._fetch(r)),i&&((e=Yi._load(i,this._crossReference,this))._isLoaded=!0,e._ref=r,this._parsedItems.set(t,e))}}return e},Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=Tt(this._form,t,this),this._font},set:function(t){t&&t instanceof $e&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"checked",{get:function(){return this._kidsCount>0?this.itemAt(this._defaultIndex).checked:Y(this._dictionary)},set:function(t){if(this.checked!==t){if(this._kidsCount>0&&(this.itemAt(this._defaultIndex).checked=t),t)if(this._isLoaded){var e=Z(this._kidsCount>0?this.itemAt(this._defaultIndex)._dictionary:this._dictionary);this._dictionary.update("V",Xr.get(e)),this._dictionary.update("AS",Xr.get(e))}else this._dictionary.update("V",Xr.get("Yes")),this._dictionary.update("AS",Xr.get("Yes"));else this._dictionary.has("V")&&delete this._dictionary._map.V,this._dictionary.has("AS")&&delete this._dictionary._map.AS;this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return this._parseBorderColor(!0)},set:function(t){this._updateBorderColor(t,!0),this._isLoaded&&(this._setAppearance=!0)},enumerable:!0,configurable:!0}),i.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._defaultIndex=0,this._dictionary=new $r(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Xr.get("Btn")),this._dictionary.update("T",e),this._createItem(i)},i.prototype._createItem=function(e){var i=new Yi;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.center,this._stringFormat=new pe(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new $r(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[1,1,1]),i.style=t.PdfCheckBoxStyle.check,i._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg"),this._addToKid(i)},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1);var i=this._kidsCount;if(this._isLoaded){if(e||this._setAppearance||this._dictionary._updated||this._isImport)if(i>0)for(o=0;o<i;o++){var r=this.itemAt(o);if(r){if(!this._checkFieldFlag(r._dictionary))if(e){var n=void 0,s=r.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;n=this._setAppearance||this._form._setAppearance||!r._dictionary.has("AP")?this._createAppearance(r,s):$(s,r),this._drawTemplate(n,r._getPage(),r.bounds)}else(this._setAppearance||this._form._setAppearance||!r._isLoaded)&&(r._postProcess(r.checked?"Yes":"Off"),this._drawAppearance(r));r._dictionary._updated=!e}}else{var a=this.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;this._drawTemplate($(a,this),this.page,this.bounds)}}else for(var o=0;o<i;o++)if(r=this.itemAt(o)){s=r.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;if(r._postProcess(r.checked?"Yes":"Off"),e){n=this._createAppearance(r,s);this._drawTemplate(n,r._getPage(),r.bounds)}else this._drawAppearance(r);r._dictionary._updated=!e}this._dictionary._updated=!e},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new sr;r.bounds=[0,0,i.width,i.height];var n=t.backColor;n&&(r.backBrush=new Ar(n)),r.foreBrush=new Ar(t.color);var s=t.border;if(t.borderColor&&(r.borderPen=new xr(t.borderColor,s.width)),r.borderWidth=s.width,r.borderStyle=s.style,n){var a=[n[0]-64,n[1]-64,n[2]-64],o=[a[0]>=0?a[0]:0,a[1]>=0?a[1]:0,a[2]>=0?a[2]:0];r.shadowBrush=new Ar(o)}r.rotationAngle=t.rotate;var h=new fe(r.bounds,this._crossReference),c=h.graphics;return t._styleText?this._drawCheckBox(c,r,t._styleText,e):this._drawCheckBox(c,r,it(t._style),e),h},i.prototype._drawAppearance=function(e,i){var r=new $r;if(e._dictionary.has("AP"))(r=e._dictionary.get("AP"))&&(r.has("N")&&kt(r.get("N"),this._crossReference,"Yes","Off"),r.has("D")&&kt(r.get("D"),this._crossReference,"Yes","Off")),At(r,this._crossReference,"N"),At(r,this._crossReference,"D");else{var n=this._crossReference._getNextReference();r=new $r(this._crossReference),this._crossReference._cacheMap.set(n,r),e._dictionary.update("AP",n)}var s=this._createAppearance(e,t._PdfCheckFieldState.checked),a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,s._content);var o=this._createAppearance(e,t._PdfCheckFieldState.unchecked),h=this._crossReference._getNextReference();this._crossReference._cacheMap.set(h,o._content);var c=new $r(this._crossReference);null!==i&&void 0!==i?c.update(i,a):c.update("Yes",a),c.update("Off",h);var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,c),r.update("N",_);var d=this._createAppearance(e,t._PdfCheckFieldState.pressedChecked),l=this._crossReference._getNextReference();this._crossReference._cacheMap.set(l,d._content);var f=this._createAppearance(e,t._PdfCheckFieldState.pressedUnchecked),p=this._crossReference._getNextReference();this._crossReference._cacheMap.set(p,f._content);var u=new $r(this._crossReference);null!==i&&void 0!==i?u.update(i,l):u.update("Yes",l),u.update("Off",p);var g=this._crossReference._getNextReference();this._crossReference._cacheMap.set(g,u),r.update("D",g),e._dictionary._updated=!0},i}(fi),yi=function(e){function i(t,i){var r=e.call(this)||this;return r._selectedIndex=-1,t&&i&&r._initialize(t,i),r}return li(i,e),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},Object.defineProperty(i.prototype,"checked",{get:function(){var t=!1;return this._kidsCount>0&&(t=this.itemAt(this._defaultIndex).checked),t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedIndex",{get:function(){return this._isLoaded&&-1===this._selectedIndex&&(this._selectedIndex=this._obtainSelectedIndex()),this._selectedIndex},set:function(t){if(this.selectedIndex!==t){this._selectedIndex=t;for(var e=0;e<this._kidsCount;e++){var i=this.itemAt(e);if(e===t){i._dictionary.update("AS",Xr.get(i.value));var r=Xr.get(i.value);this._dictionary.update("V",r),this._dictionary.update("DV",r)}else i._dictionary.update("AS",Xr.get("Off"))}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return this._parseBorderColor(!this._isLoaded)},set:function(t){this._updateBorderColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype.itemAt=function(t){if(t<0||0!==t&&t>=this._kidsCount)throw Error("Index out of range.");var e;if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0;if(t>=0&&this._kids&&this._kids.length>0&&t<this._kids.length){var r=this._kids[t];r&&r instanceof Qr&&(i=this._crossReference._fetch(r)),i&&((e=Zi._load(i,this._crossReference,this))._ref=r,e._index=t,this._parsedItems.set(t,e))}}return e},i.prototype.add=function(t,e){return t instanceof Zi?(t._field=this,t._dictionary.update("Parent",this._ref),t._setField(this),this._kidsCount):new Zi(t,e,this)},i.prototype.removeItemAt=function(t){var e=this.itemAt(t);if(e&&e._ref){var i=e._getPage();if(i&&i._removeAnnotation(e._ref),this._kids.splice(t,1),this._dictionary.set("Kids",this._kids),this._dictionary._updated=!0,this._parsedItems.delete(t),this._parsedItems.size>0){var r=new Map;this._parsedItems.forEach(function(e,i){i>t?r.set(i-1,e):r.set(i,e)}),this._parsedItems=r}if(this._dictionary.has("Opt")){var n=this._dictionary.getArray("Opt");n&&n.length>0&&(n.splice(t,1),this._dictionary.set("Opt",n))}}},i.prototype.removeItem=function(t){if(t&&t._ref){var e=this._kids.indexOf(t._ref);-1!==e&&this.removeItemAt(e)}},i.prototype._initialize=function(e,i){this._defaultIndex=0,this._crossReference=e._crossReference,this._page=e,this._name=i,this._dictionary=new $r(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Xr.get("Btn")),this._dictionary.update("T",i),this._parsedItems=new Map,this._fieldFlags|=t._FieldFlag.radio},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&t.length>0)for(var e=this._kidsCount,i=t.length<=e?t.length:e,r=0;r<i;r++)t[r]&&(this.itemAt(r)._optionValue=t[r])}},i.prototype._obtainSelectedIndex=function(){for(var t=-1,e=0;e<this._kidsCount;++e){var i=this.itemAt(e);if(i){var r=R(i._dictionary,"V",!1,!0);if(r&&i._dictionary.has("AS")){var n=i._dictionary.get("AS");if(n&&"off"!==n.name.toLowerCase())if(r instanceof Xr&&"off"!==r.name.toLowerCase()){if(n.name===r.name||i._optionValue===r.name){t=e;break}}else if("string"==typeof r&&"off"!==r.toLowerCase()&&(n.name===r||i._optionValue===r)){t=e;break}}}}return t},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1);var i=this._kidsCount;if(this._isLoaded)if(i>0){for(a=0;a<i;a++)if((o=this.itemAt(a))&&!this._checkFieldFlag(o._dictionary)){if(e){var r=void 0,n=this.selectedIndex===a?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;r=this._setAppearance||this._form._setAppearance||!o._dictionary.has("AP")?this._createAppearance(o,n):$(n,o),this._drawTemplate(r,o._getPage(),o.bounds)}else(this._setAppearance||this._form._setAppearance||!o._isLoaded)&&(o._postProcess(this.selectedIndex===a?o.value:"Off"),this._drawAppearance(o));o._dictionary._updated=!e}}else{var s=-1!==this.selectedIndex?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;this._drawTemplate($(s,this),this.page,this.bounds)}else for(var a=0;a<i;a++){var o=this.itemAt(a),n=this.selectedIndex===a?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;if(this._isDuplicatePage||o._dictionary.update("AS",Xr.get(this.selectedIndex===a?o.value:"Off")),e){r=this._createAppearance(o,n);this._drawTemplate(r,o._getPage(),o.bounds)}else this._isDuplicatePage||(o._postProcess(this.selectedIndex===a?o.value:"Off"),this._drawAppearance(o));o._dictionary._updated=!e}this._dictionary._updated=!e},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new sr;r.bounds=[0,0,i.width,i.height];var n=t.backColor;n&&(r.backBrush=new Ar(n)),r.foreBrush=new Ar(t.color);var s=t.border;if(t.borderColor&&(r.borderPen=new xr(t.borderColor,s.width)),r.borderWidth=s.width,r.borderStyle=s.style,n){var a=[n[0]-64,n[1]-64,n[2]-64],o=[a[0]>=0?a[0]:0,a[1]>=0?a[1]:0,a[2]>=0?a[2]:0];r.shadowBrush=new Ar(o)}r.rotationAngle=t.rotate;var h=new fe(r.bounds,this._crossReference),c=h.graphics;return t._styleText?this._drawRadioButton(c,r,t._styleText,e):this._drawRadioButton(c,r,it(t.style),e),h},i.prototype._drawAppearance=function(e){var i=new $r;if(e._dictionary.has("AP"))(i=e._dictionary.get("AP"))&&(i.has("N")&&kt(i.get("N"),this._crossReference,e.value,"Off"),i.has("D")&&kt(i.get("D"),this._crossReference,e.value,"Off")),At(i,this._crossReference,"N"),At(i,this._crossReference,"D");else{var r=this._crossReference._getNextReference();i=new $r(this._crossReference),this._crossReference._cacheMap.set(r,i),e._dictionary.update("AP",r)}var n=this._createAppearance(e,t._PdfCheckFieldState.checked),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n._content);var a=this._createAppearance(e,t._PdfCheckFieldState.unchecked),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a._content);var h=new $r(this._crossReference),c=e.value;!c&&e._enableGrouping&&(c="check"+e._index),h.update(c,s),h.update("Off",o);var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,h),i.update("N",_);var d=this._createAppearance(e,t._PdfCheckFieldState.pressedChecked),l=this._crossReference._getNextReference();this._crossReference._cacheMap.set(l,d._content);var f=this._createAppearance(e,t._PdfCheckFieldState.pressedUnchecked),p=this._crossReference._getNextReference();this._crossReference._cacheMap.set(p,f._content);var u=new $r(this._crossReference);u.update(c,l),u.update("Off",p);var g=this._crossReference._getNextReference();this._crossReference._cacheMap.set(g,u),i.update("D",g),e._dictionary._updated=!0},i}(fi),mi=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return li(i,e),Object.defineProperty(i.prototype,"itemsCount",{get:function(){return this._options.length},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&(e._page=this.page),e&&e.bounds?t=e.bounds:this._dictionary.has("Rect")&&(t=L(this._dictionary,this.page)),t||(this._bounds?this._bounds:t)},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");var e=this.itemAt(this._defaultIndex);this._isLoaded?void 0===e||this._dictionary.has("Rect")?this._dictionary.update("Rect",O([t.x,t.y,t.width,t.height],this.page)):(e._page=this.page,e.bounds=t):e?(e._page=this.page,e.bounds=t):this._bounds=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedIndex",{get:function(){var t=this._dictionary.get("I");return void 0===t?[]:1===t.length?t[0]:t},set:function(t){var e=this,i=this._options.length;if("number"==typeof t)this._checkIndex(t,i),this._dictionary.update("I",[t]),this._dictionary.update("V",[this._options[t][0]]);else{var r=[];t.forEach(function(t){e._checkIndex(t,i),r.push(e._options[t][0])}),this._dictionary.update("I",t),this._dictionary.update("V",r)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedValue",{get:function(){var t=this,e=[];if(this._dictionary&&this._dictionary.has("V")&&void 0!==(i=this._dictionary.getArray("V"))&&(Array.isArray(i)?e.push.apply(e,i):"string"==typeof i&&e.push(i)),0===e.length&&this._dictionary&&this._dictionary.has("I")){var i=this._dictionary.get("I");i&&i.length>0&&e.push.apply(e,i.map(function(e){return t._options[e][0]}))}return 1===e.length?e[0]:e},set:function(t){var e=this;if("string"==typeof t){var i=this._tryGetIndex(t);-1!==i&&(this._dictionary.update("I",[i]),this._dictionary.update("V",[t]))}else{var r=[],n=[];t.forEach(function(t){var i=e._tryGetIndex(t);-1!==i&&(n.push(i),r.push(t))}),r.length>0&&(this._dictionary.update("I",n),this._dictionary.update("V",r))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"multiSelect",{get:function(){return this._isLoaded?0!=(this._fieldFlags&t._FieldFlag.multiSelect):this._multiSelect},set:function(e){this.multiSelect!==e&&(this._multiSelect=e,e?this._fieldFlags|=t._FieldFlag.multiSelect:this._fieldFlags&=~t._FieldFlag.multiSelect)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"editable",{get:function(){return this._isLoaded?0!=(this._fieldFlags&t._FieldFlag.edit):this._editable},set:function(e){this._editable!==e&&(this._editable=e,e?this._fieldFlags|=t._FieldFlag.edit:this._fieldFlags&=~t._FieldFlag.edit)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=Tt(this._form,t,this),this._font},set:function(t){t&&t instanceof $e&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_options",{get:function(){return this._optionArray||(this._dictionary&&this._dictionary.has("Opt")?this._optionArray=this._dictionary.getArray("Opt"):(this._optionArray=[],this._dictionary.update("Opt",this._optionArray))),this._optionArray},enumerable:!0,configurable:!0}),i.prototype.itemAt=function(t){var e;if(t<this._kidsCount)if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{i=void 0;(r=this._kids[t])&&r instanceof Qr&&(i=this._crossReference._fetch(r)),i&&((e=$i._load(i,this._crossReference,this))._index=t,e._ref=r,this._options&&this._options.length>0&&t<this._options.length?e._text=this._options[t][1]:e._text="",this._parsedItems.set(t,e))}else if(this._parsedItems.has(t))e=this._parsedItems.get(t);else if(this._kidsCount>0&&this._kids&&this._kids.length>0){var i=void 0,r=void 0;(r=1===this._kidsCount?this._kids[0]:this._kids[t])&&r instanceof Qr&&(i=this._crossReference._fetch(r)),i&&((e=$i._load(i,this._crossReference,this))._index=t,e._ref=r,this._options&&this._options.length>0&&t<this._options.length?e._text=this._options[t][1]:e._text="",this._parsedItems.set(t,e))}return e},i.prototype.addItem=function(t){return this._addToOptions(t,this),this._listValues.length-1},i.prototype.removeItemAt=function(t){var e=this.itemAt(t);if(e&&e._ref){if(this._parsedItems.delete(t),this._parsedItems.size>0){var i=new Map;this._parsedItems.forEach(function(e,r){r>t?i.set(r-1,e):i.set(r,e)}),this._parsedItems=i}if(this._dictionary&&this._dictionary.has("Opt")){var r=this._options;r&&r.length>0&&(r.splice(t,1),this._dictionary.set("Opt",r),this._optionArray=r,this._dictionary._updated=!0)}}},i.prototype.removeItem=function(t){if(t&&t.text){for(var e=void 0,i=0;i<this.itemsCount;i++){var r=this.itemAt(i);if(r&&t===r&&r.text===t.text){e=i;break}}-1!==e&&this.removeItemAt(e)}},i.prototype._initialize=function(t,e,i){this._defaultIndex=0,this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new $r(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Xr.get("Ch")),this._dictionary.update("T",e),this._parsedItems=new Map,this._listValues=[],this._kids=[],this.bounds=i,this._addEmptyWidget()},i.prototype._obtainFont=function(e){var i="",r=1;if(e&&(e._dictionary.has("DS")||e._dictionary.has("DA"))){if(e._dictionary.has("DS"))e._dictionary.get("DS").split(";").forEach(function(t){var e=t.split(":");if(-1!==t.indexOf("font-family"))i=e[1];else if(-1!==t.indexOf("font-size"))e[1].endsWith("pt")&&(r=Number.parseFloat(e[1].replace("pt","")));else if(-1===t.indexOf("font-style")&&-1!==t.indexOf("font")){for(e[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(i+=t+" "),t.endsWith("pt")&&(r=Number.parseFloat(t.replace("pt","")))});" "!==i&&i.endsWith(" ");)i=i.substring(0,i.length-2);-1!==i.indexOf(",")&&(i=i.split(",")[0])}});else{var n=e._dictionary.get("DA");if(n&&""!==n&&-1!==n.indexOf("Tf")){var s=n.split(" ");s.forEach(function(t,e){if(-1!==t.indexOf("Tf")){for(i=s[e-2];""!==i&&i.length>1&&"/"===i[0];)i=i.substring(1);r=Number.parseFloat(s[e-1])}});var a=0;if(0===r){var o=new ti(t.PdfFontFamily.helvetica,a);null!==o&&(a=this._getFontHeight(o._fontFamily),(Number.isNaN(a)||0===a)&&(a=12),o._size=a,r=a)}}}switch((i=i.trim())&&(i=Zt(i)),i){case"Helv":this._font=new ti(t.PdfFontFamily.helvetica,r,t.PdfFontStyle.regular);break;case"Courier":case"Cour":this._font=new ti(t.PdfFontFamily.courier,r,t.PdfFontStyle.regular);break;case"Symb":this._font=new ti(t.PdfFontFamily.symbol,r,t.PdfFontStyle.regular);break;case"TiRo":this._font=new ti(t.PdfFontFamily.timesRoman,r,t.PdfFontStyle.regular);break;case"ZaDb":this._font=new ti(t.PdfFontFamily.zapfDingbats,r,t.PdfFontStyle.regular);break;default:this._font=new ti(t.PdfFontFamily.helvetica,r,t.PdfFontStyle.regular)}if(this._font&&this._font._dictionary&&this._font._dictionary.has("BaseFont")){var h=this._font._dictionary.get("BaseFont").name;if(h&&h!==i&&this.form._dictionary.has("DR")){var c=this.form._dictionary.get("DR").get("Font");if(c&&c.has(i)){var _=c.get(i),d=_.get("Subtype").name;if(_&&i&&_.has("BaseFont")){var l=_.get("BaseFont"),f=t.PdfFontStyle.regular;if(l&&null!==l.name&&void 0!==l.name)if(f=Rt(l.name),d&&"TrueType"===d)(p=Qt(this.form,_))&&p.length>0&&(u=T(p))&&u.length>0&&(this._font=new ii(u,r,f));else if(d&&"Type0"===d){var p=Dt(_);if(p&&p.length>0){var u=T(p);u&&u.length>0&&(this._font=new ii(u,r,f))}}}}}}}return this._font},i.prototype._obtainSelectedValue=function(){var t=this,e=[];if(this._dictionary.has("V")){var i=this._dictionary.get("V"),r=this._dictionary.getArray("V");null!==i&&void 0!==i&&("string"==typeof i?e.push(i):Array.isArray(i)&&e.push.apply(e,r))}else{var n=this._dictionary.get("I");null!==n&&void 0!==n&&n.length>0&&n[0]>-1&&this._options&&this._options.length>0&&e.push.apply(e,n.map(function(e){return t._options[e][0]}))}return e},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._kids&&this._kids.length>0)if(e>1){for(var i=0;i<e;i++)if((r=this.itemAt(i))&&!this._checkFieldFlag(r._dictionary)){n=this._createAppearance(r);t?(s=r._getPage())&&this._drawTemplate(n,s,r.bounds):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}}else{var r=this.itemAt(0),n=this._createAppearance();t?(s=this.page)&&this._drawTemplate(n,s,this.bounds):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}else if(this._dictionary){n=this._createAppearance();if(t){var s=this.page;s&&this._drawTemplate(n,s,this.bounds)}else this._addAppearance(this._dictionary,n,"N")}this._dictionary._updated=!t}},i.prototype._tryGetIndex=function(t){var e=-1;if(this._options&&this._options.length>0)for(var i=0;i<this._options.length;i++)if(t===this._options[i][0]){e=i;break}return e},i.prototype._addEmptyWidget=function(){var t=new Ji;t._create(this._page,this.bounds,this),this._addToKid(t),t._dictionary.update("MK",new $r(this._crossReference)),t._mkDictionary.update("BC",[0,0,0]),t._mkDictionary.update("BG",[1,1,1]),t._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg")},i}(fi),bi=function(e){function i(i,r,n){var s=e.call(this)||this;return i&&r&&n&&(s._initialize(i,r,n),s._fieldFlags|=t._FieldFlag.combo),s}return li(i,e),Object.defineProperty(i.prototype,"_isAutoFontSize",{get:function(){var t=this,e=!1;if(this._isLoaded&&this._form){var i=this._form._dictionary;if(i&&i.has("DA")){var r=i.get("DA");if(r){var n=new Si(r);if(0===n.fontSize)if(this._kids&&this._kids.length>0){var s=!1;this._dictionary.has("DA")&&(r=this._dictionary.get("DA"))&&(n=new Si(r))&&n.fontSize>0&&(s=!0),s||this._kids.forEach(function(i){var s;if(i&&i instanceof Qr&&(s=t._crossReference._fetch(i)),s)if(s.has("DA")){var a=0;(r=s.get("DA"))&&(n=new Si(r))&&(a=n.fontSize),0===a&&(e=!0)}else e=!0})}else if(this._dictionary.has("DA")){var a=0;(r=this._dictionary.get("DA"))&&(n=new Si(r))&&(a=n.fontSize),0===a&&(e=!0)}else e=!0}}}return e},enumerable:!0,configurable:!0}),i._load=function(t,e,r,n){var s=new i;s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids"));var a=s._dictionary.getArray("Opt");return null!==a&&void 0!==a&&(s._listValues=new Array(a.length)),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&t.length>0)for(var e=this._kidsCount,i=t.length<=e?t.length:e,r=0;r<i;r++){var n=t[r][1];n&&(this.itemAt(r)._text=n||"")}}},i.prototype._createAppearance=function(e){var i=new sr;if(e){var r=e.bounds,n=e._getPage();e._isLoaded&&n&&void 0!==n.rotation&&n.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],n.size,n.rotation):i.bounds=[0,0,r.width,r.height],(o=e.backColor)&&(i.backBrush=new Ar(o)),i.foreBrush=new Ar(e.color);h=e.border;if(e.borderColor&&(i.borderPen=new xr(e.borderColor,h.width),$t(h,i)),i.borderStyle=h.style,i.borderWidth=h.width,o){_=[(c=[o[0]-64,o[1]-64,o[2]-64])[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ar(_)}var s=void 0!==e.textAlignment?e.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new pe(s,a)}else{(r=this.bounds)&&(this._isLoaded&&this.page&&void 0!==this.page.rotation&&this.page.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],this.page.size,this.page.rotation):i.bounds=[0,0,r.width,r.height]);var o=this.backColor;o&&(i.backBrush=new Ar(o)),i.foreBrush=new Ar(this.color);var h=this.border;if(this.borderColor&&(i.borderPen=new xr(this.borderColor,h.width),$t(h,i)),i.borderStyle=h.style,i.borderWidth=h.width,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ar(_)}i.rotationAngle=this.rotationAngle,null!==this.rotate&&void 0!==this.rotate&&(i.rotationAngle=this.rotate);var s=void 0!==this.textAlignment?this.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new pe(s,a)}i.required=this.required,null!==i.bounds&&void 0!==i.bounds||(i.bounds=[0,0,0,0]);var d=new fe(i.bounds,this._crossReference),l=d.graphics;if(l._sw._clear(),this.required||(l._sw._beginMarkupSequence("Tx"),l._initializeCoordinates()),this._isLoaded){var f=void 0;e&&(f=this._obtainFont(e)),void 0!==f&&null!==f||(f=this.font),f&&0!==f.size||(f=this._appearanceFont),this._drawComboBox(l,i,f,i.stringFormat)}else this._font||(this._font=new ti(t.PdfFontFamily.timesRoman,this._getFontHeight(t.PdfFontFamily.helvetica))),this._drawComboBox(l,i,this._font,i.stringFormat);return this.required||l._sw._endMarkupSequence(),d},i.prototype._drawComboBox=function(e,i,r,n){e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());var s=this._options,a=this._dictionary.get("I"),o=-1;if(a&&a.length>0&&(o=a[0]),o>=0&&o<s.length){var h=s[o],c=[0,0],_=i.borderWidth,d=2*_,l=i.borderStyle===t.PdfBorderStyle.inset||i.borderStyle===t.PdfBorderStyle.beveled;l?(c[0]=2*d,c[1]=2*_):(c[0]=d+2,c[1]=1*_+1);var f=i.foreBrush,p=i.bounds,u=p[2]-d,g=p;if(g[3]-=l?d:_,e.setClip(g,t.PdfFillMode.winding),0===i.rotationAngle){S=p[0]+_;l&&(S+=_,u-=d),f=new Ar([153,193,218]),e.drawRectangle(S,c[1],u,p[3],f),f=new Ar([0,0,0])}var y=void 0;if(y=h&&Array.isArray(h)?h[1]?h[1]:h[0]:h){var m=[c[0],c[1],u-c[0],p[3]];if(i.rotationAngle>0){var b=e.save();if(90===i.rotationAngle)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),g=[e._size[1]-(g[1]+g[3]),w=g[0],g[3]+g[2],g[2]];else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),g=[g[1],w=e._size[0]-(g[0]+g[2]),g[3]+g[2],g[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var v=e._size[0]-(g[0]+g[2]),w=e._size[1]-(g[1]+g[3]);g=[v,w,g[2],g[3]]}var S=p[0]+_;l&&(S+=_,u-=d),f=new Ar([153,193,218]),e.drawRectangle(S,c[1],u,p[3],f),f=new Ar([0,0,0]),e.drawString(y,r,m,null,f,n),e.restore(b)}else e.drawString(y,r,m,null,f,n)}}e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())},i.prototype._getFontHeight=function(e){var i,r,n,s,a,o=this._dictionary.get("I"),h=this.border.width;if(this._isLoaded){r=new ti(e,12),n=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),s=this._dictionary.getArray("Opt"),a=this.bounds;var c=[];if(o&&o.length>0)o.forEach(function(t){c.push(r.measureString(s[t][1],[0,0],n,0,0)[0])});else if(s.length>0)for(var _=r.measureString(s[0][1],[0,0],n,0,0)[0],d=1;d<s.length;++d){f=r.measureString(s[d][1],[0,0],n,0,0)[0];_=Math.max(_,f),c.push(_)}i=c.length>0?12*(a.width-4*h)/c.sort()[c.length-1]:12}else{if(i=0,!(o&&o.length>0))return i;r=new ti(e,12),n=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),s=this._dictionary.getArray("Opt");var l=this.selectedValue,f=r.measureString(null!==l&&"string"==typeof l?l:s[o[0]][1],[0,0],n,0,0)[0];a=this.bounds,i=f?12*(a.width-4*h)/f:12}var p=0;if(o&&o.length>0){if(12!==i){r=new ti(e,i);var u=null!==(l=this.selectedValue)&&"string"==typeof l?l:s[o[0]][1],g=r.measureString(u);if(g[0]>a.width||g[1]>a.height)for(var f=a.width-4*h,y=a.height-4*h,d=1;d<=a.height;d++){var m=(r=new ti(e,d)).measureString(u);if(m[0]>a.width||m[1]>y){p=d;do{var b=(r=new ti(e,p-=.001)).getLineWidth(u,n);if(p<.248){r._size=.248;break}if(m=r.measureString(u,[0,0],n,0,0),b<f&&m[1]<y){r._size=p;break}}while(p>.248);i=p;break}}}}else i>12&&(i=12);return i},i}(mi),vi=function(e){function i(t,i,r){var n=e.call(this)||this;return t&&i&&r&&n._initialize(t,i,r),n}return li(i,e),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt"),e=this._kidsCount,i=t.length<=e?t.length:e;if(this._listValues=new Array(i),t&&t.length>0){var r=this._dictionary.get("I");Array.isArray(r)&&r.length>0&&(r=r[0],this._selectedIndex=r);for(var n=0;n<i;n++){var s=this.itemAt(n);if(s)if(Ut(r)&&null!==this._listValues&&void 0!==this._listValues){var a=t[n];Array.isArray(a)?this._listValues[n]=a[1]:this._listValues[n]=a,n===r?(s._text=this._listValues[n],this._selectedIndex=n):s._text=this._listValues[n]}else s._text=""}}}},i.prototype._createAppearance=function(e){var i=new sr;if(e){var r=e.bounds,n=e._getPage();e._isLoaded&&n&&void 0!==n.rotation&&n.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],n.size,n.rotation):i.bounds=[0,0,r.width,r.height],(o=e.backColor)&&(i.backBrush=new Ar(o)),i.foreBrush=new Ar(e.color);h=e.border;if(e.borderColor&&(i.borderPen=new xr(e.borderColor,h.width),$t(h,i)),i.borderStyle=h.style,i.borderWidth=h.width,o){_=[(c=[o[0]-64,o[1]-64,o[2]-64])[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ar(_)}e._enableGrouping&&void 0===e.rotate?i.rotationAngle=0:i.rotationAngle=e.rotate;var s=void 0!==e.textAlignment?e.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new pe(s,a)}else{r=this.bounds;this._isLoaded&&this.page&&void 0!==this.page.rotation&&this.page.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],this.page.size,this.page.rotation):i.bounds=[0,0,r.width,r.height];var o=this.backColor;o&&(i.backBrush=new Ar(o)),i.foreBrush=new Ar(this.color);var h=this.border;if(this.borderColor&&(i.borderPen=new xr(this.borderColor,h.width),$t(h,i)),i.borderStyle=h.style,i.borderWidth=h.width,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ar(_)}i.rotationAngle=this.rotationAngle,null!==this.rotate&&void 0!==this.rotate&&(i.rotationAngle=this.rotate);var s=void 0!==this.textAlignment?this.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new pe(s,a)}i.required=this.required;var d=new fe(i.bounds,this._crossReference),l=d.graphics;if(l._sw._clear(),this.required||(l._sw._beginMarkupSequence("Tx"),l._initializeCoordinates()),this._isLoaded){var f=this._obtainFont(e);(void 0===f||null===f||!this._isLoaded&&1===f.size)&&(f=this._appearanceFont),this._drawListBox(l,i,f,i.stringFormat)}else this._font||(this._font=this._defaultItemFont),this._drawListBox(l,i,this._font,i.stringFormat);return this.required||l._sw._endMarkupSequence(),d},i.prototype._drawListBox=function(e,i,r,n){e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());for(var s=this._options,a=this,o=0;o<s.length;++o)!function(o){var h=s[o],c=[],_=i.borderWidth,d=2*_,l=i.borderStyle===t.PdfBorderStyle.inset||i.borderStyle===t.PdfBorderStyle.beveled;l?(c.push(2*d),c.push((o+2)*_+r._metrics._getHeight()*o)):(c.push(d+2),c.push((o+1)*_+r._metrics._getHeight()*o+1));var f=i.foreBrush,p=i.bounds,u=p[2]-d,g=p;g[3]-=l?d:_,e.setClip(g,t.PdfFillMode.winding);var y=!1,m=a._dictionary.get("I");if(null!==m&&void 0!==m&&m.length>0&&m.forEach(function(t){y=y||t===o}),0===i.rotationAngle&&y){S=p[0]+_;l&&(S+=_,u-=d),f=new Ar([153,193,218]),e.drawRectangle(S,c[1],u,r._metrics._getHeight(),f),f=new Ar([0,0,0])}var b=void 0;b=h&&"string"==typeof h?h:h[1]?h[1]:h[0];var v=[c[0],c[1],u-c[0],r._metrics._getHeight()];if(i.rotationAngle>0){var w=e.save();if(90===i.rotationAngle)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),g=[S=e._size[1]-(g[1]+g[3]),P=g[0],g[3]+g[2],g[2]];else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),g=[S=g[1],P=e._size[0]-(g[0]+g[2]),g[3]+g[2],g[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var S=e._size[0]-(g[0]+g[2]),P=e._size[1]-(g[1]+g[3]);g=[S,P,g[2],g[3]]}if(y){S=p[0]+_;l&&(S+=_,u-=d),f=new Ar([153,193,218]),e.drawRectangle(S,c[1],u,r._metrics._getHeight(),f),f=new Ar([0,0,0])}e.drawString(b,r,v,null,f,n),e.restore(w)}else e.drawString(b,r,v,null,f,n)}(o);e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())},i.prototype._getFontHeight=function(e){var i=new ti(e,12,t.PdfFontStyle.regular),r=new pe(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle),n=0;if(Ut(this._listValues)&&this._listValues.length>0){for(var s=i.measureString(this._listValues[0],[0,0],r,0,0)[0],a=1;a<this._listValues.length;++a){var o=i.measureString(this._listValues[a],[0,0],r,0,0)[0];s=s>o?s:o}n=(n=12*(this.bounds.width-4*this.border.width)/s)>12?12:n}return n},i}(mi),wi=function(e){function i(t,i,r){var n=e.call(this)||this;return n._isSigned=!1,t&&i&&r&&n._initialize(t,i,r),n}return li(i,e),Object.defineProperty(i.prototype,"isSigned",{get:function(){return this._isSigned||this._checkSigned(),this._isSigned},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},i.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new $r(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Xr.get("Sig")),this._dictionary.update("T",e),this._defaultIndex=0,this._initializeFont(this._defaultFont),this._createItem(i)},i.prototype._createItem=function(t){var e=new Ji;e._create(this._page,t,this),e._dictionary.update("MK",new $r(this._crossReference)),e._mkDictionary.update("BC",[0,0,0]),e._mkDictionary.update("BG",[1,1,1]),e._dictionary.update("DA",this._fontName+" 8 Tf 0 0 0 rg"),this._addToKid(e)},i.prototype._doPostProcess=function(t){void 0===t&&(t=!1);var e=this._setAppearance||this._form._setAppearance;if((t||e)&&(r=this._kidsCount)>0)for(s=0;s<r;s++)if((a=this.itemAt(s))&&a._dictionary&&(e||t&&!a._dictionary.has("AP"))){var i=this._createAppearance(a,t);this._addAppearance(a._dictionary,i,"N")}if(t){var r=this._kidsCount;if(r>0)for(var n=void 0,s=0;s<r;s++){var a=this.itemAt(s);if(a&&a._dictionary){var o=a.page;o&&(n||0!==s||(n=this._getItemTemplate(a._dictionary)),this._flattenSignature(a._dictionary,o,a.bounds,n))}}else this._flattenSignature(this._dictionary,this.page,this.bounds)}},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new fe([0,0,i.width,i.height],this._crossReference);et(r,null),r._writeTransformation=!1;var n=r.graphics,s=new sr;s.bounds=[0,0,i.width,i.height];var a=t.backColor;e&&a&&(s.backBrush=new Ar(a)),s.foreBrush=new Ar(t.color);var o=t.border;if(t.borderColor&&(s.borderPen=new xr(t.borderColor,o.width)),s.borderWidth=o.width,s.borderStyle=o.style,a){var h=[a[0]-64,a[1]-64,a[2]-64],c=[h[0]>=0?h[0]:0,h[1]>=0?h[1]:0,h[2]>=0?h[2]:0];s.shadowBrush=new Ar(c)}return s.rotationAngle=t.rotate,n.save(),n._initializeCoordinates(),this._drawRectangularControl(n,s),n.restore(),r},i.prototype._flattenSignature=function(e,i,r,n){var s;if(e.has("AP")){var a=e.get("AP");if(a&&a.has("N")){var o=a.get("N"),h=a.getRaw("N");if(h&&o&&(o.reference=h),o&&(s=n||new fe(o,this._crossReference))&&i){_=(c=i.graphics).save();this.isSigned&&(s._isSignature=!0),i.rotation!==t.PdfRotationAngle.angle0?(d=new br(c._size,c._sw._stream,c._crossReference,i)).drawTemplate(s,this._calculateTemplateBounds(r,i,s,d)):c.drawTemplate(s,r),c.restore(_)}}}else if(n&&i){s=n;var c=i.graphics,_=c.save();if(i.rotation!==t.PdfRotationAngle.angle0){var d=new br(c._size,c._sw._stream,c._crossReference,i);d.drawTemplate(s,this._calculateTemplateBounds(r,i,s,d))}else c.drawTemplate(s,r);c.restore(_)}},i.prototype._calculateTemplateBounds=function(t,e,i,r){var n=t.x,s=t.y;if(e){var a=this._obtainGraphicsRotation(e.graphics._matrix);90===a?(r.translateTransform(i._size[1],0),r.rotateTransform(90),n=t.x,s=-(e._size[1]-t.y-t.height)):180===a?(r.translateTransform(i._size[0],i._size[1]),r.rotateTransform(180),n=-(e._size[0]-(t.x+i._size[0])),s=-(e._size[1]-t.y-i._size[1])):270===a&&(r.translateTransform(0,i._size[0]),r.rotateTransform(270),n=-(e._size[0]-t.x-t.width),s=t.y)}return{x:n,y:s,width:t.width,height:t.height}},i.prototype._obtainGraphicsRotation=function(t){var e=Math.round(180*Math.atan2(t._matrix._elements[2],t._matrix._elements[0])/Math.PI);switch(e){case-90:e=90;break;case-180:e=180;break;case 90:e=270}return e},i.prototype._getItemTemplate=function(t){var e;if(t&&t.has("AP")){var i=t.get("AP");if(i&&i.has("N")){var r=i.get("N"),n=i.getRaw("N");n&&(r.reference=n),r&&(e=new fe(r,this._crossReference))}}return e},i.prototype._checkSigned=function(){if(this._dictionary&&this._dictionary.has("V")){var t=this._dictionary.get("V");null!==t&&void 0!==t&&t.size>0&&(this._isSigned=!0)}},i}(fi),Si=function(){function t(t){var e,i="",r=0;if(t&&"string"==typeof t&&""!==t){var n=t.split(" ");n.forEach(function(t,s){switch(t){case"g":e=[Number.parseFloat(n[s-1])];break;case"rg":e=[Number.parseFloat(n[s-3]),Number.parseFloat(n[s-2]),Number.parseFloat(n[s-1])];break;case"k":e=[Number.parseFloat(n[s-4]),Number.parseFloat(n[s-3]),Number.parseFloat(n[s-2]),Number.parseFloat(n[s-1])];break;case"Tf":r=Number.parseFloat(n[s-1]),(i=n[s-2].substring(1)).includes("#2C")&&i.replace("#2C",",")}})}this.fontName=i,this.fontSize=r,this.color=void 0!==e?M(e):[0,0,0]}return t.prototype.toString=function(){var t=[Number.parseFloat((this.color[0]/255).toFixed(3)),Number.parseFloat((this.color[1]/255).toFixed(3)),Number.parseFloat((this.color[2]/255).toFixed(3))];return"/"+this.fontName+" "+this.fontSize+" Tf "+t[0].toString()+" "+t[1].toString()+" "+t[2].toString()+" rg"},t}(),Pi=function(){function t(t,e){this._isNormalKey=!0,this._dictionary=new $r,Ut(t)?this._bounds=t:this._bounds={x:0,y:0,width:0,height:0},e instanceof xi?(this._annotations=e,this._crossReference=e._crossReference):this._isNormalKey=!1,this._initialize()}return Object.defineProperty(t.prototype,"normal",{get:function(){return!this._templateNormal&&this._dictionary&&this._dictionary.has("AP")&&(this._templateNormal=this._dictionary.get("N")),this._templateNormal},set:function(t){t&&(this._templateNormal=t,this._isNormalKey&&this._dictionary.set("N",this._templateNormal))},enumerable:!0,configurable:!0}),t.prototype._initialize=function(){this.normal=new fe(this._bounds,this._crossReference)},t}(),Ai=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),xi=function(){function e(){this._isImported=!1,this._isLoaded=!1,this._setAppearance=!1,this._isExport=!1,this._opacity=1,this._isAllRotation=!0,this._flatten=!1,this._popUpFont=new ti(t.PdfFontFamily.helvetica,10.5),this._authorBoldFont=new ti(t.PdfFontFamily.helvetica,10.5,t.PdfFontStyle.bold),this._lineCaptionFont=new ti(t.PdfFontFamily.helvetica,10,t.PdfFontStyle.regular),this._circleCaptionFont=new ti(t.PdfFontFamily.helvetica,8,t.PdfFontStyle.regular),this._isTransparentColor=!1,this._isRotated=!1,this._isChanged=!1}return Object.defineProperty(e.prototype,"author",{get:function(){if(void 0===this._author&&this._dictionary.has("Author")&&(t=this._dictionary.get("Author"))&&(this._author=t),void 0===this._author&&this._dictionary.has("T")){var t=this._dictionary.get("T");t&&(this._author=t)}return this._author},set:function(t){if(this._isLoaded&&"string"==typeof t&&t!==this.author){var e=!1;this._dictionary&&this._dictionary.has("T")&&(this._dictionary.update("T",t),this._author=t,e=!0),this._dictionary&&this._dictionary.has("Author")&&(this._dictionary.update("Author",t),this._author=t,e=!0),e||(this._dictionary.update("T",t),this._author=t)}this._isLoaded||"string"!=typeof t||this._dictionary.update("T",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){if(void 0===this._border){var e=new rr;if(e._dictionary=this._dictionary,this._dictionary&&this._dictionary.has("Border")&&(i=this._dictionary.getArray("Border"))&&i.length>=3&&(e._hRadius=i[0],e._vRadius=i[1],e._width=i[2]),this._dictionary&&this._dictionary.has("BS")){var i=this._dictionary.get("BS");if(i){if(i.has("W")){var r=i.get("W");void 0===r||Number.isNaN(r)||(e._width=r)}if(i.has("S")){var n=i.get("S");if(n)switch(n.name){case"D":e._style=t.PdfBorderStyle.dashed;break;case"B":e._style=t.PdfBorderStyle.beveled;break;case"I":e._style=t.PdfBorderStyle.inset;break;case"U":e._style=t.PdfBorderStyle.underline;break;default:e._style=t.PdfBorderStyle.solid}}if(i.has("D")){var s=i.getArray("D");s&&(e._dash=s)}}}this._border=e}return this._border},set:function(t){var e,i=this.border;(!this._isLoaded||void 0!==t.width&&i.width!==t.width)&&(e=t.width);var r;(!this._isLoaded||void 0!==t.hRadius&&i.hRadius!==t.hRadius)&&(r=t.hRadius);var n;(!this._isLoaded||void 0!==t.vRadius&&i.vRadius!==t.vRadius)&&(n=t.vRadius);var s;(!this._isLoaded||void 0!==t.style&&i.style!==t.style)&&(s=t.style);var a;if(void 0!==t.dash&&i.dash!==t.dash&&(a=t.dash),(!this._isWidget&&this._dictionary&&this._dictionary.has("Border")||e||n||r)&&(this._border._hRadius=void 0!==r?r:i.hRadius,this._border._vRadius=void 0!==n?n:i.vRadius,this._border._width=void 0!==e?e:i.width,this._dictionary.update("Border",[this._border.hRadius,this._border.vRadius,this._border.width])),null!==this._dictionary&&this._dictionary&&this._dictionary.has("BS")||e||s||a){this._border._width=void 0!==e?e:i.width,this._border._style=void 0!==s?s:i.style,this._border._dash=void 0!==a?a:i.dash;var o=this._dictionary.has("BS")?this._dictionary.get("BS"):new $r(this._crossReference);o.update("Type",Xr.get("Border")),o.update("W",this._border.width),o.update("S",N(this._border.style)),void 0!==this._border.dash&&o.update("D",this._border.dash),this._dictionary.update("BS",o),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flags",{get:function(){return void 0===this._annotFlags&&(this._annotFlags=t.PdfAnnotationFlag.default,this._dictionary&&this._dictionary.has("F")&&(this._annotFlags=this._dictionary.get("F"))),this._annotFlags},set:function(t){void 0!==t&&t!==this._annotFlags&&(this._annotFlags=t,this._dictionary.update("F",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return void 0===this._color&&this._dictionary.has("C")&&(this._color=M(this._dictionary.getArray("C"))),this._color},set:function(t){if(void 0!==t&&3===t.length){var e=this.color;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._color=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(7)),Number.parseFloat((t[1]/255).toFixed(7)),Number.parseFloat((t[2]/255).toFixed(7))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"innerColor",{get:function(){return void 0===this._innerColor&&this._dictionary.has("IC")&&(this._innerColor=M(this._dictionary.getArray("IC"))),this._innerColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.innerColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._innerColor=t,this._dictionary.update("IC",[Number.parseFloat((t[0]/255).toFixed(7)),Number.parseFloat((t[1]/255).toFixed(7)),Number.parseFloat((t[2]/255).toFixed(7))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"creationDate",{get:function(){if((void 0===this._creationDate||null===this._creationDate)&&this._dictionary.has("CreationDate")){var t=this._dictionary.get("CreationDate");null!==t&&"string"==typeof t&&(this._creationDate=this._stringToDate(t))}return this._creationDate},set:function(t){this._creationDate=t,this._dictionary.update("CreationDate",this._dateToString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modifiedDate",{get:function(){if(void 0===this._modifiedDate||null===this._modifiedDate){var t=void 0;this._dictionary&&this._dictionary.has("ModDate")?t=this._dictionary.get("ModDate"):this._dictionary.has("M")&&(t=this._dictionary.get("M")),null!==t&&"string"==typeof t&&(this._modifiedDate=this._stringToDate(t))}return this._modifiedDate},set:function(t){this._modifiedDate=t,this._dictionary.update("M",this._dateToString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return this._isLoaded&&(this._bounds=L(this._dictionary,this._page)),this._bounds},set:function(t){if(t)if(this._isBounds=!0,this._isLoaded){if(t.x!==this.bounds.x||t.y!==this.bounds.y||t.width!==this.bounds.width||t.height!==this.bounds.height){var e=this._page.size;if(e){var i=e[1]-(t.y+t.height),r=i+t.height;this._dictionary.update("Rect",[t.x,i,t.x+t.width,r]),this._bounds=t,this._isChanged=!0}}}else this._bounds=t,this._isChanged=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"caption",{get:function(){if(void 0===this._caption){var e=new tr;if(e._dictionary=this._dictionary,this._dictionary&&this._dictionary.has("Cap")&&(e._cap=this._dictionary.get("Cap")),this._dictionary&&this._dictionary.has("CP")){var i=this._dictionary.get("CP");i&&(e._type="Top"===i.name?t.PdfLineCaptionType.top:t.PdfLineCaptionType.inline)}this._dictionary&&this._dictionary.has("CO")&&(e._offset=this._dictionary.getArray("CO")),this._caption=e}return this._caption},set:function(t){var e=this.caption;t&&(this._isLoaded&&t.cap===e.cap||(this._caption.cap=t.cap),this._isLoaded&&t.type===e.type||(this._caption.type=t.type),this._isLoaded&&t.offset===e.offset||(this._caption.offset=t.offset))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"opacity",{get:function(){if(this._dictionary&&this._dictionary.has("CA")){var t=this._dictionary.get("CA");void 0!==t&&(this._opacity=t)}return this._opacity},set:function(t){void 0===t||Number.isNaN(t)||(t>=0&&t<=1?(this._dictionary.update("CA",t),this._opacity=t):t<0?this._dictionary.update("CA",0):this._dictionary.update("CA",1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subject",{get:function(){return void 0===this._subject&&(this._subject=this._dictionary.get("Subject","Subj")),this._subject},set:function(t){"string"==typeof t&&this.subject!==t&&(this._dictionary.update("Subj",t),this._subject=t,this._dictionary.has("Subject")&&this._dictionary.update("Subject",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return void 0===this._name&&this._dictionary.has("NM")&&(this._name=this._dictionary.get("NM")),this._name},set:function(t){"string"==typeof t&&(this._dictionary.update("NM",t),this._name=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return void 0===this._text&&this._dictionary.has("Contents")&&(this._text=this._dictionary.get("Contents")),this._text},set:function(t){"string"==typeof t&&(this._text=this._dictionary.get("Contents"),t!==this._text&&(this._dictionary.update("Contents",t),this._text=t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){return void 0===this._rotate&&this._dictionary&&this._dictionary.has("Rotate")&&(this._rotate=this._dictionary.get("Rotate")/90),null!==this._rotate&&void 0!==this._rotate||(this._rotate=t.PdfRotationAngle.angle0),this._rotate},set:function(t){var e=this.rotationAngle;void 0!==t&&void 0!==e&&(t=(t+e)%4),this._dictionary.update("Rotate",90*t),this._isRotated=!0,this._rotate=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){var t=this._getRotationAngle();return t<0&&(t=360+t),t>=360&&(t=360-t),t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flattenPopups",{get:function(){return this._isFlattenPopups},set:function(t){void 0!==t&&(this._isFlattenPopups=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_hasFlags",{get:function(){return this._dictionary.has("F")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_degreeToRadian",{get:function(){return void 0===this._ratio&&(this._ratio=Math.PI/180),this._ratio},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"layer",{get:function(){return this._layer||(this._layer=this._getDocumentLayer()),this._layer},set:function(t){this._layer||(this._layer=t,this._layer?this._dictionary.update("OC",this._layer._referenceHolder):delete this._dictionary._map.OC)},enumerable:!0,configurable:!0}),e.prototype.setAppearance=function(t){this._setAppearance=t,t&&(this._dictionary._updated=!0)},e.prototype.getValues=function(t){var e=[];if(!this._dictionary||!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(Array.isArray(i))(i=this._dictionary.getArray(t)).forEach(function(t){t instanceof Xr?e.push(t.name):"string"==typeof t?e.push(t):"number"==typeof t&&e.push(t.toString())});else if(i instanceof Xr)e.push(i.name);else{if("string"!=typeof i)throw new Error("PdfException: "+t+" is not found");e.push(i)}return e},e.prototype.setValues=function(t,e){t&&""!==t&&e&&""!==e&&this._dictionary.update(t,e)},e.prototype._initialize=function(t,e){this._page=t,this._crossReference=t._crossReference,e&&(this._dictionary=e),this._isLoaded||(this._dictionary.set("P",this._page._ref),this._dictionary.assignXref(this._crossReference))},e.prototype._getRotationAngle=function(){var t=0;return!this._dictionary||this instanceof Li||this instanceof Di||(this._dictionary.has("Rotate")?t=this._dictionary.get("Rotate"):this._dictionary.has("Rotation")&&(t=this._dictionary.get("Rotation"))),t},e.prototype._getMediaOrCropBox=function(t){var e;return t&&t._pageDictionary&&t._pageDictionary.has("MediaBox")?e=t._pageDictionary.get("MediaBox"):t&&t._pageDictionary&&t._pageDictionary.has("CropBox")&&(e=t._pageDictionary.get("CropBox")),e},e.prototype._getBoundsValue=function(t,e){var i=0;Ut(t)&&(i=t.length);var r=[],n=[];if(i>0&&t.forEach(function(t,e){e%2==0?r.push(t):n.push(t)}),r.sort(function(t,e){return t>e?1:-1}),n.sort(function(t,e){return t>e?1:-1}),e){var s=2*this.border.width;return{x:r[0]-s,y:n[0]-s,width:r[r.length-1]-r[0]+2*s,height:n[n.length-1]-n[0]+2*s}}return{x:r[0],y:n[0],width:r[r.length-1]-r[0],height:n[n.length-1]-n[0]}},e.prototype._validateTemplateMatrix=function(t,e){var i=!1,r=!0;if(null===e||void 0===e){if(t&&t.has("Matrix")){if((d=t.getArray("Matrix"))&&d.length>3&&void 0!==d[0]&&void 0!==d[1]&&void 0!==d[2]&&void 0!==d[3]&&1===d[0]&&0===d[1]&&0===d[2]&&1===d[3]){i=!0;var n=0,s=0,a=0,o=0;d.length>4&&(a=-d[4],d.length>5&&(o=-d[5]));var h=void 0;this._dictionary&&this._dictionary.has("Rect")&&(h=this._dictionary.getArray("Rect"))&&h.length>1&&(n=h[0],s=h[1]),n===a&&s===o||0!==a||0!==o||(this._locationDisplaced=!0)}}else i=!0;return i}var c=this.bounds;if(t&&t.has("Matrix")){var _=t.getArray("BBox"),d=t.getArray("Matrix");if(d&&_&&d.length>3&&_.length>2&&void 0!==d[0]&&void 0!==d[1]&&void 0!==d[2]&&void 0!==d[3]&&1===d[0]&&0===d[1]&&0===d[2]&&1===d[3]&&void 0!==_[0]&&void 0!==_[1]&&void 0!==_[2]&&void 0!==_[3]&&(this._page&&_[0]!==-d[4]&&_[1]!==-d[5]||0===_[0]&&0==-d[4])){var l=this._page.graphics,f=l.save();void 0!==this.opacity&&this._opacity<1&&l.setTransparency(this._opacity),c.x-=_[0],c.y+=_[1],l.drawTemplate(e,c),l.restore(f),this._page.annotations.remove(this),r=!1}}return r},e.prototype._flattenAnnotationTemplate=function(e,i,r){void 0===r&&(r=!1),this._page._isLineAnnotation=r;var n=this._page.graphics,s=this.bounds;if(this instanceof Ci&&this._dictionary&&!this._dictionary.has("AP"))if(s=this._isLoaded?this._bounds:this instanceof Ci&&!this.measure?D([this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]):this._setAppearance&&this.flatten&&!this.measure?this._bounds:D([this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]),this._page){var a=this._page.size,o=this._page.mediaBox,h=this._page.cropBox;h&&Array.isArray(h)&&4===h.length&&this._page._pageDictionary.has("CropBox")&&!this._isLoaded&&!this._flatten?0===h[0]&&0===h[1]&&a[0]!==h[2]&&a[1]!==h[3]||s.x===h[0]?s.y=a[1]-(s.y+s.height):(s.x-=h[0],s.y=h[3]-(s.y+s.height)):o&&Array.isArray(o)&&4===o.length&&this._page._pageDictionary.has("MediaBox")&&!this._isLoaded&&!this._flatten?o[0]>0||o[1]>0||a[0]===o[2]||a[1]===o[3]?(s.x-=o[0],s.y=o[3]-(s.y+s.height)):s.y=a[1]-(s.y+s.height):this instanceof Ci&&!this.measure&&!this._isLoaded?s.y=a[1]-(s.y+s.height):this._setAppearance&&this.flatten&&!this.measure?s=this.bounds:this._isLoaded||(s.y=a[1]-(s.y+s.height))}else s.y=s.y+s.height;if(void 0!==s&&null!==s){var c=n.save();if(this._page._needInitializeGraphics=!0,this._type===t._PdfAnnotationType.rubberStampAnnotation){m=!0;if(this._dictionary&&this._dictionary.has("AP")){var _=this._dictionary.get("AP");if(_&&_.has("N")){var d=_.get("N");270===this.rotate&&this._page.rotation===t.PdfRotationAngle.angle270&&d&&d.dictionary&&d.dictionary.has("Matrix")&&(u=d.dictionary.getArray("Matrix"))&&6===u.length&&0===u[4]&&0!==u[5]&&(m=!1)}!i&&this.rotate!==t.PdfRotationAngle.angle180&&m&&(e._isAnnotationTemplate=!0,e._needScale=!0)}}i||this._type===t._PdfAnnotationType.rubberStampAnnotation||(e._isAnnotationTemplate=!0,e._needScale=!0),void 0!==this.opacity&&this._opacity<1&&n.setTransparency(this._opacity);var l=this._calculateTemplateBounds(s,this._page,e,i,n);if(this._type===t._PdfAnnotationType.rubberStampAnnotation){var f,a=void 0;this.rotate===t.PdfRotationAngle.angle0?(a=[l.width,l.height],f=[l.x,l.y]):(a=e._size,f=[l.x,l.y]);var p=!1;if(this.rotate!==t.PdfRotationAngle.angle0&&e._content&&e._content.dictionary.has("Matrix")){var u=e._content.dictionary.getArray("Matrix");u&&6===u.length&&0===u[4]&&0!==u[5]&&(p=!0)}var g=e._size[0]>0?l.width/e._size[0]:1,y=e._size[1]>0?l.height/e._size[1]:1,m=!(Math.trunc(1e3*g)/1e3==1&&Math.trunc(1e3*y)/1e3==1);this.rotate!==t.PdfRotationAngle.angle0&&p&&(this.rotate===t.PdfRotationAngle.angle90?this._page&&this._page.rotation===t.PdfRotationAngle.angle270?!m||0===l.x&&0===l.y?(f[0]+=a[1],f[1]+=a[0]-a[1]+(a[0]-a[1])):(f[0]+=a[0]-a[1],f[1]+=a[0]):m||(f[0]+=a[1]):this.rotate===t.PdfRotationAngle.angle270?this._page&&this._page.rotation===t.PdfRotationAngle.angle270?m&&e._isAnnotationTemplate?f[1]=l.y-l.width:m&&(f[1]+=a[0]-a[1]):m||0===l.x&&0===l.y?f[1]+=-(a[0]-a[1]):f[1]+=-a[0]:this.rotate===t.PdfRotationAngle.angle180&&(f[0]+=a[0],f[1]+=-a[1]))}if(!e._content.dictionary.has("Matrix")&&e._content.dictionary.has("BBox")){var b=e._content.dictionary.getArray("BBox");l.x-=b[0],l.y+=b[1]}this instanceof Oi&&!this._isLoaded&&(l=L(this._dictionary,this._page)),n.drawTemplate(e,l),n.restore(c)}this._page.annotations.remove(this)},e.prototype._calculateTemplateBounds=function(e,i,r,n,s){var a=e,o=e.x,h=e.y,c=e.width,_=e.height;if(!n){var d=this._dictionary.getArray("Rect");d&&(a=D(d))}if(void 0!==i){var l=this._obtainGraphicsRotation(s._matrix);if(90===l)s.translateTransform(r._size[1],0),s.rotateTransform(90),n||void 0!==this._rotate&&this._rotate===t.PdfRotationAngle.angle180?(o=e.x,h=this._locationDisplaced?i._origin&&0!==i._o[1]?e.y+e.height:-(i.size[1]-(e.height+e.y)+(e.height-r._size[1])):-(i.size[1]-e.y-e.height)):(o=e.x,h=-(i.size[1]-(e.height+e.y)+(e.width-r._size[1])),c=e.height,_=e.width);else if(180===l)s.translateTransform(r._size[0],r._size[1]),s.rotateTransform(180),n?(o=-(i.size[0]-(e.x+e.width)),h=-(i.size[1]-e.y-e.height)):(o=-(i.size[0]-(e.x+r._size[0])),h=-(i.size[1]-e.y-r._size[1]),void 0===this.rotationAngle||this._rotate!==t.PdfRotationAngle.angle90&&this._rotate!==t.PdfRotationAngle.angle270||(h=-(i.size[1]-e.y-r._size[1])-(e.width-e.height),c=e.height,_=e.width));else if(270===l)if(s.translateTransform(0,r._size[0]),s.rotateTransform(270),n||void 0!==this.rotationAngle&&this._rotate===t.PdfRotationAngle.angle180)o=-(i.size[0]-e.x-e.width),h=e.y;else{o=-(i.size[0]-a.x-r._size[0]);var f=r._content.dictionary.getArray("Matrix"),p=r._content.dictionary.getArray("BBox");h=f&&p&&f[5]!==p[2]?e.y-(e.height-e.width):e.y+e.height-e.width,c=e.height,_=e.width}else 0===l&&(n||void 0===this.rotationAngle||this.rotationAngle!==t.PdfRotationAngle.angle90&&this.rotationAngle!==t.PdfRotationAngle.angle270||(o=e.x,h=e.y+e.height-e.width,c=e.height,_=e.width))}return{x:o,y:h,width:c,height:_}},e.prototype._obtainGraphicsRotation=function(t){var e=Math.atan2(t._matrix._elements[2],t._matrix._elements[0]),i=Math.round(180*e/Math.PI);switch(i){case-90:i=90;break;case-180:i=180;break;case 90:i=270}return i},e.prototype._removeAnnotation=function(t,e){t&&e&&(t.annotations.remove(e),t._pageDictionary._updated=!0)},e.prototype._drawCloudStyle=function(t,e,i,r,n,s,a){Ut(s)&&this._isClockWise(s)&&s.reverse();var o,h=[],c=2*r*n;Ut(s)?o=s[s.length-1]:s=[];for(y=0;y<s.length;y++){var _=s[y],d=_[0]-o[0],l=_[1]-o[1],f=Math.sqrt(d*d+l*l);d/=f,l/=f;for(var p=0;p+.1*c<f;p+=c){var u=new ar;u.point=[o[0]+p*d,o[1]+p*l],h.push(u)}o=_}for(var g=h[h.length-1],y=0;y<h.length;y++){var m=h[y],b=this._getIntersectionDegrees(g.point,m.point,r);g.endAngle=b[0],m.startAngle=b[1],g=m}for(var v=new oi,y=0;y<h.length;y++){var w=(C=h[y]).startAngle%360,S=C.endAngle%360,P=0;if(w>0&&S<0)P=180-w+(180-(S<0?-S:S));else if(w<0&&S>0)P=-w+S;else if(w>0&&S>0){P=w>S?360-(w-S):S-w}else if(w<0&&S<0){P=w>S?360-(w-S):-(w+-S)}P<0&&(P=-P),C.endAngle=P,v.addArc(C.point[0]-r,C.point[1]-r,2*r,2*r,w,P)}v.closeFigure();var A=[];a&&(A=v._points.map(function(t){return[t[0],-t[1]]}));var x;a?((x=new oi)._points=A,x._pathTypes=v._pathTypes):((x=new oi)._points=v._points,x._pathTypes=v._pathTypes),Ut(e)&&t.drawPath(x,e);var k=180/(3*Math.PI);v=new oi;for(y=0;y<h.length;y++){var C=h[y];v.addArc(C.point[0]-r,C.point[1]-r,2*r,2*r,C.startAngle,C.endAngle+k)}v.closeFigure(),A=[],a&&(A=v._points.map(function(t){return[t[0],-t[1]]})),a?((x=new oi)._points=A,x._pathTypes=v._pathTypes):((x=new oi)._points=v._points,x._pathTypes=v._pathTypes),t.drawPath(x,i)},e.prototype._isClockWise=function(t){var e=0;if(Ut(t))for(var i=0;i<t.length;i++){var r=t[i],n=t[(i+1)%t.length];e+=(n[0]-r[0])*(n[1]+r[1])}return e>0},e.prototype._getIntersectionDegrees=function(t,e,i){var r=e[0]-t[0],n=e[1]-t[1],s=.5*Math.sqrt(r*r+n*n)/i;s<-1?s=-1:s>1&&(s=1);var a=Math.atan2(n,r),o=Math.acos(s);return[(a-o)*(180/Math.PI),(Math.PI+a+o)*(180/Math.PI)]},e.prototype._obtainStyle=function(e,i,r,n){var s=this.border.dash;if(s&&s.length>0){var a=s.slice();s.some(function(t){return t>0})&&this.border.style===t.PdfBorderStyle.dashed&&(e._dashStyle=t.PdfDashStyle.dash,e._dashPattern=a)}if(n)if(n instanceof sr)!this._isBounds&&this._dictionary.has("RD")?(h=this._dictionary.getArray("RD"))&&(i[0]=i[0]+h[0],i[1]=i[1]+r+h[1],i[2]=i[2]-(h[0]+h[2]),i[3]=i[3]-(h[1]+h[3])):(i[0]=i[0]+r,i[1]=i[1]+r,i[2]=i[2]-this.border.width,i[3]=i[3]-this.border.width),n.bounds=i;else if(0!==n.intensity&&n.style===t.PdfBorderEffectStyle.cloudy){var o=5*n.intensity;i[0]=i[0]+o+r,i[1]=i[1]+o+r,i[2]=i[2]-2*o-2*r,i[3]=i[3]-2*o-2*r}else i[0]=i[0]+r,i[1]=i[1]+r,i[2]=i[2]-this.border.width,i[3]=this.bounds.height-this.border.width;else if(!this._isBounds&&this._dictionary&&this._dictionary.has("RD")){var h=this._dictionary.getArray("RD");h&&(i[0]=i[0]+h[0],i[1]=i[1]+r+h[1],i[2]=i[2]-2*h[2],i[3]=i[3]-this.border.width,i[3]=i[3]-2*h[3])}else i[1]=i[1]+r,i[3]=this.bounds.height-this.border.width;return i},e.prototype._createRectangleAppearance=function(e){var i=this.border.width,r=this._dictionary.getArray("RD");if(!r&&null!==e&&void 0!==e&&0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy){n={x:this.bounds.x-5*e.intensity-i/2,y:this.bounds.y-5*e.intensity-i/2,width:this.bounds.width+10*e.intensity+i,height:this.bounds.height+10*e.intensity+i};r=[(s=5*e.intensity)+i/2,s+i/2,s+i/2,s+i/2],this._dictionary.set("RD",r),this.bounds=n}if(!this._isBounds&&r){var n={x:this.bounds.x+r[0],y:this.bounds.y+r[1],width:this.bounds.width-2*r[2],height:this.bounds.height-2*r[3]};if(0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy){n.x=n.x-5*e.intensity-i/2,n.y=n.y-5*e.intensity-i/2,n.width=n.width+10*e.intensity+i,n.height=n.height+10*e.intensity+i;var s=5*e.intensity;this._dictionary.set("RD",[s+i/2,s+i/2,s+i/2,s+i/2])}else delete this._dictionary._map.RD;this.bounds=n}var a=i/2,o=[0,0,this.bounds.width,this.bounds.height],h=new fe(o,this._crossReference);et(h,this._getRotationAngle()),0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy&&(h._writeTransformation=!1);var c=h.graphics,_=new sr;this.innerColor&&(_.backBrush=new Ar(this._innerColor)),i>0&&this.color&&(_.borderPen=new xr(this._color,i)),this.color&&(_.foreBrush=new Ar(this._color));var d=this._obtainStyle(_.borderPen,o,a,e);return void 0!==this.opacity&&this._opacity<1&&(c.save(),c.setTransparency(this._opacity)),0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy?this._drawRectangleAppearance(d,c,_,e.intensity):c.drawRectangle(d[0],d[1],d[2],d[3],_.borderPen,_.backBrush),void 0!==this.opacity&&this._opacity<1&&c.restore(),h},e.prototype._drawRectangleAppearance=function(t,e,i,r){var n=new oi;Ut(t)&&4===t.length&&n.addRectangle(t[0],t[1],t[2],t[3]);var s=0;if(Ut(r)&&(s=4.25*r),s>0){var a=n._points.map(function(t){return[t[0],-t[1]]});(n=new oi).addPolygon(a),this._drawCloudStyle(e,i.backBrush,i.borderPen,s,.833,n._points,!1)}else e.drawRectangle(t[0],t[1],t[2],t[3],i.borderPen,i.backBrush)},e.prototype._createCircleAppearance=function(){var e=[0,0,this.bounds.width,this.bounds.height],i=new fe(e,this._crossReference);et(i,this._getRotationAngle()),this._dictionary.has("BE")&&(i._writeTransformation=!1),void 0===this.color&&(this._isTransparentColor=!0);var r=i.graphics,n=this.border.width,s=new xr(this.color,n);this.border.style===t.PdfBorderStyle.dashed?(s._dashStyle=t.PdfDashStyle.dash,s._dashPattern=[3,1]):this.border.style===t.PdfBorderStyle.dot&&(s._dashStyle=t.PdfDashStyle.dot,s._dashPattern=[1,1]);var a=new sr;this.innerColor&&(a.backBrush=new Ar(this._innerColor)),n>0&&(a.borderPen=s),this.color&&(a.foreBrush=new Ar(this._color)),a.borderWidth=n;var o=n/2,h=this._obtainStyle(s,e,o);return void 0!==this.opacity&&this._opacity<1&&(r.save(),r.setTransparency(this._opacity)),this._dictionary.has("BE")?this._drawCircleAppearance(h,o,r,a):r.drawEllipse(h[0]+o,h[1],h[2]-n,h[3],a.borderPen,a.backBrush),void 0!==this._opacity&&this._opacity<1&&r.restore(),i},e.prototype._drawCircleAppearance=function(t,e,i,r){var n=0;if(this._dictionary.has("RD")){var s=this._dictionary.getArray("RD");s&&s.length>0&&(n=s[0])}if(n>0){var a=[t[0]+e,-t[1]-t[3],t[2]-this.border.width,t[3]],o=a[0],h=a[1],c=a[0]+a[2],_=a[1]+a[3],d=[];d.push([c,_]),d.push([o,_]),d.push([o,h]),d.push([c,h]);var l=[];l.push([c,h+a[3]/2]),l.push([o+a[2]/2,_]),l.push([o,h+a[3]/2]),l.push([o+a[2]/2,h]);var f=[];f.push([o+a[2]/2,_]),f.push([o,h+a[3]/2]),f.push([o+a[2]/2,h]),f.push([c,h+a[3]/2]);for(var p=[],u=0;u<d.length;u++)this._createBezier(l[u],d[u],f[u],p);this._drawCloudStyle(i,r.backBrush,r.borderPen,n,.833,p,!1)}else i.drawEllipse(t[0]+e,-t[1],t[2]-this.border.width,-t[3],r.borderPen,r.backBrush)},e.prototype._createBezier=function(t,e,i,r){r.push(t),this._populateBezierPoints(t,e,i,0,r),r.push(i)},e.prototype._populateBezierPoints=function(t,e,i,r,n){if(r<2){var s=this._midPoint(t,e),a=this._midPoint(e,i),o=this._midPoint(s,a);r++,this._populateBezierPoints(t,s,o,r,n),n.push(o),this._populateBezierPoints(o,a,i,r,n)}},e.prototype._midPoint=function(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]},e.prototype._getAngle=function(t){var e=t[0],i=t[1],r=t[2],n=t[3],s=0;if(r-e==0)s=n>i?90:270;else{var a=(n-i)/(r-e);s=Math.atan(a)*(180/Math.PI),(r-e<0||n-i<0)&&(s+=180),r-e>0&&n-i<0&&(s-=180),s<0&&(s+=360)}return s},e.prototype._getAxisValue=function(t,e,i){return null!==i&&void 0!==i||(i=0),[t[0]+Math.cos(e*this._degreeToRadian)*i,t[1]+Math.sin(e*this._degreeToRadian)*i]},e.prototype._prepareOpenArrow=function(t,e,i,r){var n=t?30:150,s=9*r,a=this._getAxisValue(e,i,t?r:-r);return{startPoint:a,first:this._getAxisValue(a,i+n,s),second:this._getAxisValue(a,i-n,s)}},e.prototype._prepareReverseOpenArrow=function(t,e,i,r){var n=t?150:30,s=9*r,a=this._getAxisValue(e,i,t?-r:r);return{startPoint:a,first:this._getAxisValue(a,i+n,s),second:this._getAxisValue(a,i-n,s)}},e.prototype._prepareClosedArrow=function(t,e,i,r){var n=t?30:150,s=9*r,a=this._getAxisValue(e,i,t?r:-r);return{startPoint:a,first:this._getAxisValue(a,i+n,s),second:this._getAxisValue(a,i-n,s)}},e.prototype._prepareReverseCloseArrow=function(t,e,i,r){var n=t?150:30,s=9*r,a=this._getAxisValue(e,i,t?-r:r);return{startPoint:a,first:this._getAxisValue(a,i+n,s),second:this._getAxisValue(a,i-n,s)}},e.prototype._prepareSlash=function(t,e,i){var r=9*i;return{first:this._getAxisValue(t,e+60,r),second:this._getAxisValue(t,e-120,r)}},e.prototype._prepareDiamond=function(t,e){var i=3*e;return{first:this._getAxisValue(t,180,i),second:this._getAxisValue(t,90,i),third:this._getAxisValue(t,0,i),fourth:this._getAxisValue(t,-90,i)}},e.prototype._prepareButt=function(t,e,i){var r=3*i;return{first:this._getAxisValue(t,e+90,r),second:this._getAxisValue(t,e-90,r)}},e.prototype._getBoundsFromLineEndStyle=function(e,i,r,n,s,a){var o,h,c,_;switch(n){case t.PdfLineEndingStyle.square:case t.PdfLineEndingStyle.circle:o={x:e[0]-3*s,y:e[1]+3*s,width:6*s,height:6*s};break;case t.PdfLineEndingStyle.openArrow:_=this._prepareOpenArrow(a,e,i,s),(h=new oi)._pen=r,h.addLine(_.startPoint[0],_.startPoint[1],_.first[0],_.first[1]),h.addLine(_.startPoint[0],_.startPoint[1],_.second[0],_.second[1]),o={x:(c=h._getBounds())[0],y:c[1],width:c[2],height:c[3]};break;case t.PdfLineEndingStyle.closedArrow:_=this._prepareClosedArrow(a,e,i,s),o=this._getBoundsValue([_.startPoint[0],_.startPoint[1],_.first[0],_.first[1],_.second[0],_.second[1]]);break;case t.PdfLineEndingStyle.rOpenArrow:_=this._prepareReverseOpenArrow(a,e,i,s),(h=new oi)._pen=r,h.addLine(_.startPoint[0],_.startPoint[1],_.first[0],_.first[1]),h.addLine(_.startPoint[0],_.startPoint[1],_.second[0],_.second[1]),o={x:(c=h._getBounds())[0],y:c[1],width:c[2],height:c[3]};break;case t.PdfLineEndingStyle.rClosedArrow:_=this._prepareReverseCloseArrow(a,e,i,s),o=this._getBoundsValue([_.startPoint[0],_.startPoint[1],_.first[0],_.first[1],_.second[0],_.second[1]]);break;case t.PdfLineEndingStyle.slash:_=this._prepareSlash(e,i,s),o=this._getBoundsValue([e[0],e[1],_.first[0],_.first[1],_.second[0],_.second[1]]);break;case t.PdfLineEndingStyle.diamond:_=this._prepareDiamond(e,s),o=this._getBoundsValue([_.first[0],_.first[1],_.second[0],_.second[1],_.third[0],_.third[1],_.fourth[0],_.fourth[1]]);break;case t.PdfLineEndingStyle.butt:_=this._prepareButt(e,i,s),o=this._getBoundsValue([_.first[0],_.first[1],_.second[0],_.second[1]])}return o},e.prototype._drawLineEndStyle=function(e,i,r,n,s,a,o,h){var c,_;switch(a){case t.PdfLineEndingStyle.square:i.drawRectangle(e[0]-3*o,-(e[1]+3*o),6*o,6*o,n,s);break;case t.PdfLineEndingStyle.circle:i.drawEllipse(e[0]-3*o,-(e[1]+3*o),6*o,6*o,n,s);break;case t.PdfLineEndingStyle.openArrow:_=this._prepareOpenArrow(h,e,r,o),(c=new oi)._pen=n,c.addLine(_.startPoint[0],-_.startPoint[1],_.first[0],-_.first[1]),c.addLine(_.startPoint[0],-_.startPoint[1],_.second[0],-_.second[1]),i._stateControl(n,null,null),i._buildUpPath(c._points,c._pathTypes),i._drawGraphicsPath(n,null,c._fillMode,!1);break;case t.PdfLineEndingStyle.closedArrow:_=this._prepareClosedArrow(h,e,r,o),i.drawPolygon([[_.startPoint[0],-_.startPoint[1]],[_.first[0],-_.first[1]],[_.second[0],-_.second[1]]],n,s);break;case t.PdfLineEndingStyle.rOpenArrow:_=this._prepareReverseOpenArrow(h,e,r,o),(c=new oi)._pen=n,c.addLine(_.startPoint[0],-_.startPoint[1],_.first[0],-_.first[1]),c.addLine(_.startPoint[0],-_.startPoint[1],_.second[0],-_.second[1]),i._stateControl(n,null,null),i._buildUpPath(c._points,c._pathTypes),i._drawGraphicsPath(n,null,c._fillMode,!1);break;case t.PdfLineEndingStyle.rClosedArrow:_=this._prepareReverseCloseArrow(h,e,r,o),i.drawPolygon([[_.startPoint[0],-_.startPoint[1]],[_.first[0],-_.first[1]],[_.second[0],-_.second[1]]],n,s);break;case t.PdfLineEndingStyle.slash:_=this._prepareSlash(e,r,o),i.drawLine(n,e[0],-e[1],_.first[0],-_.first[1]),i.drawLine(n,e[0],-e[1],_.second[0],-_.second[1]);break;case t.PdfLineEndingStyle.diamond:_=this._prepareDiamond(e,o),i.drawPolygon([[_.first[0],-_.first[1]],[_.second[0],-_.second[1]],[_.third[0],-_.third[1]],[_.fourth[0],-_.fourth[1]]],n,s);break;case t.PdfLineEndingStyle.butt:_=this._prepareButt(e,r,o),i.drawLine(n,_.first[0],-_.first[1],_.second[0],-_.second[1])}},e.prototype._getCombinedRectangleBounds=function(t,e){var i=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:i,y:r,width:Math.max(t.x+t.width,e.x+e.width)-i,height:Math.max(t.y+t.height,e.y+e.height)-r}},e.prototype._drawLineStyle=function(t,e,i,r,n,s,a,o){0===o&&(o=1,n=null),this._drawLineEndStyle(t,i,r,n,s,a.begin,o,!0),this._drawLineEndStyle(e,i,r,n,s,a.end,o,!1)},e.prototype._obtainFontDetails=function(){var e,i="",r=t.PdfFontStyle.regular;if(this._dictionary.has("DS")||this._dictionary.has("DA")){var n;if(this._dictionary.has("DS"))this._dictionary.get("DS").split(";").forEach(function(t){var r=t.split(":");if(-1!==t.indexOf("font-family"))i=r[1];else if(-1!==t.indexOf("font-size"))r[1].endsWith("pt")&&(e=Number.parseFloat(r[1].replace("pt","")));else if(-1!==t.indexOf("font-style")||-1!==t.indexOf("style"))n=r[1];else if(-1!==t.indexOf("font")){for(r[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(i+=t+" "),t.endsWith("pt")&&(e=Number.parseFloat(t.replace("pt","")))});" "!==i&&i.endsWith(" ");)i=i.substring(0,i.length-1);-1!==i.indexOf(",")&&(i=i.split(",")[0])}});else{var s=this._dictionary.get("DA");if(s&&""!==s&&-1!==s.indexOf("Tf")){var a=s.split(" ");a.forEach(function(t,r){if(-1!==t.indexOf("Tf")){for(i=a[r-2];""!==i&&i.length>1&&"/"===i[0];)i=i.substring(1);e=Number.parseFloat(a[r-1])}})}}if(n&&""!==n){var o=[n];n.includes(":")?o=n.split(":"):n.includes(",")&&(o=n.split(",")),o&&o.forEach(function(e){switch((e=e.trim()).toLowerCase()){case"bold":r|=t.PdfFontStyle.bold;break;case"italic":r|=t.PdfFontStyle.italic;break;case"strikeout":r|=t.PdfFontStyle.strikeout;break;case"underline":r|=t.PdfFontStyle.underline}})}i&&(i=i.trim())}return{name:i,size:e,style:r}},e.prototype._obtainFont=function(){var t=this._obtainFontDetails();return Ft(t.name,t.size,t.style,this)},e.prototype._getEqualPdfGraphicsUnit=function(e,i){var r;switch(e){case t.PdfMeasurementUnit.inch:r=t._PdfGraphicsUnit.inch,i="in";break;case t.PdfMeasurementUnit.centimeter:r=t._PdfGraphicsUnit.centimeter,i="cm";break;case t.PdfMeasurementUnit.millimeter:r=t._PdfGraphicsUnit.millimeter,i="mm";break;case t.PdfMeasurementUnit.pica:r=t._PdfGraphicsUnit.pica,i="p";break;case t.PdfMeasurementUnit.point:r=t._PdfGraphicsUnit.point,i="pt";break;default:r=t._PdfGraphicsUnit.inch,i="in"}return{graphicsUnit:r,unitString:i}},e.prototype._createMeasureDictionary=function(t){var e=new $r;e.set("C",1),e.set("D",100),e.set("F",Xr.get("D")),e.set("RD","."),e.set("RT",""),e.set("SS",""),e.set("U",t);var i=new $r;i.set("C",1),i.set("D",100),i.set("F",Xr.get("D")),i.set("RD","."),i.set("RT",""),i.set("SS",""),i.set("U","sq "+t);var r=new $r;"in"===t?r.set("C",.0138889):"cm"===t?r.set("C",.0352778):"mm"===t?r.set("C",.352778):"pt"===t?r.set("C",1):"p"===t&&r.set("C",.0833333),r.set("D",100),r.set("F",Xr.get("D")),r.set("RD","."),r.set("RT",""),r.set("SS",""),r.set("U",t);var n=new $r;return n.set("A",[i]),n.set("D",[e]),n.set("R","1 "+t+" = 1 "+t),n.set("Type",Xr.get("Measure")),n.set("X",[r]),n},e.prototype._colorToHex=function(t){return t?"#"+this._componentToHex(t[0])+this._componentToHex(t[1])+this._componentToHex(t[2]):"#"+this._componentToHex(0)+this._componentToHex(0)+this._componentToHex(0)},e.prototype._componentToHex=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e},e.prototype._getRotatedBounds=function(t,e){if(t.width>0&&t.height>0){var i=new vr;i._rotate(e);var r=[];r.push([t.x,t.y]),r.push([t.x+t.width,t.y]),r.push([t.x+t.width,t.y+t.height]),r.push([t.x,t.y+t.height]),r=r.map(function(t){return i._matrix._transform(t)});var n=new oi;n.addRectangle(t.x,t.y,t.width,t.height),n._points=r.slice(0,4);for(var s=r[0][0],a=r[3][0],o=r[0][1],h=r[3][1],c=0;c<4;c++)r[c][0]<s&&(s=r[c][0]),r[c][0]>a&&(a=r[c][0]),r[c][1]<o&&(o=r[c][1]),r[c][1]>h&&(h=r[c][1]);return{x:t.x,y:t.y,width:Math.round(a-s),height:Math.round(h-o)}}return t},e.prototype._flattenPopUp=function(){this._flattenPop(this._page,this.color,this.bounds,this.border,this.author,this.subject,this.text)},e.prototype._flattenPop=function(e,i,r,n,s,a,o){var h=[0,0];e&&e.size&&(h=e.size);var c=r,_=[h[0]-180,c.y+142<h[1]?c.y:h[1]-142,180,142];if(this._dictionary.has("Popup")&&this._dictionary.get("Popup")){var d=this._dictionary.getArray("Rect");if(d&&4===d.length){var l=d[0],f=d[1];_=[l,f,d[2]-l,d[3]-f]}}void 0===i&&(i=[0,0,0]);var p=new Ar(i),u=n.width/2,g=new xr([0,0,0],1),y=0,m=new Ar(this._getForeColor(i));if(void 0!==s&&null!==s&&""!==s)y=this._drawAuthor(s,a,_,p,m,e,y,n);else if(void 0!==a&&null!==a&&""!==a){v=[_[0]+u,_[1]+u,_[2]-n.width,40];this._saveGraphics(e,t.PdfBlendMode.hardLight),this._isTransparentColor?e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g):e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g,p),e.graphics.restore();var b=[v[0]+11,v[1],v[2],v[3]/2];b=[b[0],b[1]+b[3]-2,b[2],v[3]/2],this._saveGraphics(e,t.PdfBlendMode.normal),this._drawSubject(a,b,e),e.graphics.restore(),y=40}else{this._saveGraphics(e,t.PdfBlendMode.hardLight);var v=[_[0]+u,_[1]+u,_[2]-n.width,20];this._isTransparentColor?e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g):e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g,p),y=20,e.graphics.restore()}var w=[_[0]+u,_[1]+u+y,_[2]-n.width,_[3]-(y+n.width)];this._saveGraphics(e,t.PdfBlendMode.hardLight),e.graphics.drawRectangle(w[0],w[1],w[2],w[3],new xr([0,0,0],1),new Ar([255,255,255])),w[0]+=11,w[1]+=5,w[2]-=22,e.graphics.restore(),this._saveGraphics(e,t.PdfBlendMode.normal),void 0!==o&&null!==o&&""!==o&&e.graphics.drawString(o,this._popUpFont,w,null,new Ar([0,0,0]),null),e.graphics.restore()},e.prototype._flattenLoadedPopUp=function(){var e="";this._dictionary.has("Contents")&&(e=this._dictionary.get("Contents"));var i=this.author,r=this.subject,n=new xr([0,0,0],1);if(this._dictionary.has("Popup")){var s=this._getRectangleBoundsValue();void 0===this.color&&(this.color=[0,0,0]);var a=new Ar(this.color),o=this.border.width/2,h=0,c=new Ar(this._getForeColor(this.color));if(void 0!==this.author&&null!==this.author&&""!==this.author)h=this._drawAuthor(this.author,this.subject,s,a,c,this._page,h,this.border);else if(void 0!==this.subject&&null!==this.subject&&""!==this.subject){d=[s[0]+o,s[1]+o,s[2]-this.border.width,40];this._saveGraphics(this._page,t.PdfBlendMode.hardLight),this._page.graphics.drawRectangle(d[0],d[1],d[2],d[3],n,a),this._page.graphics.restore();var _=[d[0]+11,d[1],d[2],d[3]/2];_=[_[0],_[1]+_[3]-2,_[2],d[3]/2],this._saveGraphics(this._page,t.PdfBlendMode.normal),this._drawSubject(this.subject,_,this._page),h=40,this._page.graphics.restore()}else{this._saveGraphics(this._page,t.PdfBlendMode.hardLight);var d=[s[0]+o,s[1]+o,s[2]-this.border.width,20];this._page.graphics.drawRectangle(d[0],d[1],d[2],d[3],n,a),h=20,this._page.graphics.restore()}this._saveGraphics(this._page,t.PdfBlendMode.hardLight);var l=[s[0]+o,s[1]+o+h,s[2]-this.border.width,s[3]-(h+this.border.width)];this._page.graphics.drawRectangle(l[0],l[1],l[2],l[3],n,new Ar([255,255,255])),l[0]+=11,l[1]+=5,l[2]-=22,this._page.graphics.restore(),this._saveGraphics(this._page,t.PdfBlendMode.normal),this._page.graphics.restore(),void 0!==e&&null!==e&&""!==e&&this._page.graphics.drawString(e,this._popUpFont,l,null,new Ar([0,0,0]),null),this._page.graphics.restore(),this._page.annotations.remove(this)}else this._flattenPop(this._page,this.color,this.bounds,this.border,i,r,e),this._page.annotations.remove(this)},e.prototype._getRectangleBoundsValue=function(){if(this._dictionary.has("Popup")){var t=this._dictionary.get("Popup").getArray("Rect");return null!==t?(null!==this._page?0===t[1]&&0===t[3]?t[1]=t[1]+t[3]:t[1]=this._page._size[1]-(t[1]+t[3]):t[1]=t[1]-t[3],t):[0,0,0,0]}return[0,0,0,0]},e.prototype._getForeColor=function(t){return(t[0]+t[1]+t[2])/3>128?[0,0,0]:[255,255,255]},e.prototype._drawAuthor=function(e,i,r,n,s,a,o,h){var c=this.border.width/2,_=new xr([0,0,0],1),d=new pe(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle),l=[r[0]+c,r[1]+c,r[2]-h.width,20];if(void 0!==i&&null!==i&&""!==i){l[3]+=20,o=l[3],this._saveGraphics(a,t.PdfBlendMode.hardLight),this._isTransparentColor?a.graphics.drawRectangle(l[0],l[1],l[2],l[3],_):a.graphics.drawRectangle(l[0],l[1],l[2],l[3],_,n),a.graphics.restore();f=[l[0]+11,l[1],l[2],l[3]/2];this._saveGraphics(this._page,t.PdfBlendMode.normal),a.graphics.drawString(e,this._authorBoldFont,f,null,s,d),f=[f[0],f[1]+f[3]-2,f[2],l[3]/2],this._drawSubject(i,f,a),a.graphics.restore()}else{this._saveGraphics(a,t.PdfBlendMode.hardLight),this._isTransparentColor?a.graphics.drawRectangle(l[0],l[1],l[2],l[3],_):a.graphics.drawRectangle(l[0],l[1],l[2],l[3],_,n),a.graphics.restore();var f=[l[0]+11,l[1],l[2],l[3]];this._saveGraphics(a,t.PdfBlendMode.normal),a.graphics.drawString(e,this._popUpFont,f,null,s,d),o=l[3],a.graphics.restore()}return o},e.prototype._drawSubject=function(e,i,r){var n=new pe(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle);r.graphics.drawString(e,this._authorBoldFont,i,null,new Ar([0,0,0]),n)},e.prototype._saveGraphics=function(t,e){t.graphics.save(),t.graphics.setTransparency(.8,.8,e)},e.prototype._getBorderColorString=function(t){return(t[0]/255).toFixed(3)+" "+(t[1]/255).toFixed(3)+" "+(t[2]/255).toFixed(3)+" rg "},e.prototype._stringToDate=function(t){var e=new Date;if("D"===t[0]&&":"===t[1]){var i=t.substring(2,6),r=t.substring(6,8),n=t.substring(8,10),s=t.substring(10,12),a=t.substring(12,14),o=t.substring(14,16),h=0;if(23===t.length){var c=t.substring(16,22);if("+05'30'"!==c){var _=c[0],d=c.substring(1,3),l=c.substring(4,6);h=5.5-("-"===_?-1:1)*(parseInt(d,10)+parseInt(l,10)/60)}}e=new Date(i+"-"+r+"-"+n+"T"+s+":"+a+":"+o),0!==h&&e.setTime(e.getTime()+60*h*60*1e3)}else if(-1!==t.indexOf("/")){var f=t.split("/"),i=f[2].split(" ")[0];"10"!==(r=f[0])&&"11"!==r&&"12"!==r&&(r="0"+r);var n=f[1],s=f[2].split(" ")[1].split(":")[0],a=f[2].split(" ")[1].split(":")[1],o=f[2].split(" ")[1].split(":")[2];e=new Date(i+"-"+r+"-"+n+"T"+s+":"+a+":"+o)}else e=new Date(t);return e},e.prototype._dateToString=function(t){var e=(t.getMonth()+1).toString();"10"!==e&&"11"!==e&&"12"!==e&&(e="0"+e);var i=t.getDate().toString();Number(i)<10&&(i="0"+i);var r=t.getHours().toString();Number(r)<10&&(r="0"+r);var n=t.getMinutes().toString();Number(n)<10&&(n="0"+n);var s=t.getSeconds().toString();return Number(s)<10&&(s="0"+s),"D:"+t.getFullYear().toString()+e+i+r+n+s+"+05'30'"},e.prototype._obtainNativeRectangle=function(){var t=[this._bounds.x,this._bounds.y,this.bounds.x+this._bounds.width,this.bounds.y+this._bounds.height],e=this._getCropOrMediaBox();if(this._page){var i=this._page.size;t[1]=i[1]-t[3],e&&e.length>2&&(0!==e[0]||0!==e[1])&&(t[0]+=e[0],t[1]+=e[1])}return t},e.prototype._getPoints=function(t){var e=this._getCropOrMediaBox(),i=t;if(e&&e.length>3&&"number"==typeof e[0]&&"number"==typeof e[1]&&(0!==e[0]||0!==e[1]))for(var r=i.map(function(t){return t}),n=0;n<r.length;n+=2){var s=r[n],a=r[n+1];e&&(i[n]=s+e[0],this._page._pageDictionary.has("MediaBox")&&!this._page._pageDictionary.has("CropBox")&&0===e[3]&&e[1]>0?i[n+1]=a+e[3]:i[n+1]=a+e[1])}return i},e.prototype._getCropOrMediaBox=function(){var t;if(this._page&&((t=this._page.cropBox)&&0!==t.length||(t=this._page.mediaBox)),t&&t[3]<0){var e=t[1],i=t[3];t[3]=e,t[1]=i}return t},e.prototype._getDocumentLayer=function(){if(this._dictionary.has("OC")){var t=this._dictionary.getRaw("OC"),e=this._page;if(t&&e&&this._crossReference._document){var i=this._crossReference._document.layers;i&&this._isMatched(i,t,e)}}return this.layer},e.prototype._isMatched=function(t,e,i){for(var r=0;r<t.count;r++){var n=t.at(r)._referenceHolder;if(n&&n===e){if(t.at(r).name){this._layer=t.at(r);break}}else t.at(r).layers&&t.at(r).layers.count>0&&this._isMatched(t.at(r).layers,e,i)}},e}(),ki=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ai(e,t),Object.defineProperty(e.prototype,"comments",{get:function(){return this._comments?this._comments:this._comments=new hr(this,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reviewHistory",{get:function(){return this._reviewHistory?this._reviewHistory:this._reviewHistory=new hr(this,!0)},enumerable:!0,configurable:!0}),e}(xi),Ci=function(e){function i(i){var r=e.call(this)||this;return r._unit=t.PdfMeasurementUnit.centimeter,r._unitString="",r._dictionary=new $r,r._dictionary.update("Type",Xr.get("Annot")),r._dictionary.update("Subtype",Xr.get("Line")),null!==i&&void 0!==i&&(r.linePoints=i),r._type=t._PdfAnnotationType.lineAnnotation,r}return Ai(i,e),Object.defineProperty(i.prototype,"linePoints",{get:function(){if(void 0===this._linePoints&&this._dictionary.has("L")){var t=this._dictionary.getArray("L");t&&(this._linePoints=t)}return this._linePoints},set:function(t){if(Array.isArray(t)&&(void 0===this._linePoints||y(t,this._linePoints))){if(4!==t.length)throw new Error("Line points length should be 4.");this._dictionary.update("L",t),this._linePoints=t}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderExt",{get:function(){if(void 0===this._leaderExt&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&(this._leaderExt=t)}return this._leaderExt},set:function(t){Number.isNaN(t)||(this._dictionary.update("LLE",t),this._leaderExt=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderLine",{get:function(){if(void 0===this._leaderLine&&this._dictionary.has("LL")){var t=this._dictionary.get("LL");void 0!==t&&(this._leaderLine=t)}return this._leaderLine},set:function(t){Number.isNaN(t)||0===this.leaderExt||(this._dictionary.update("LL",t),this._leaderLine=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineEndingStyle",{get:function(){if(void 0===this._lineEndingStyle){var t=new er;if(t._dictionary=this._dictionary,this._dictionary.has("LE")){var e=this._dictionary.getArray("LE");e&&Array.isArray(e)&&(t._begin=V(e[0].name),t._end=V(e[1].name))}this._lineEndingStyle=t}return this._lineEndingStyle},set:function(t){var e=this.lineEndingStyle;e.begin===t.begin&&e.end===t.end||(e.begin=t.begin,e.end=t.end)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderOffset",{get:function(){if(void 0===this._leaderOffset&&this._dictionary.has("LLO")){var t=this._dictionary.get("LLO");void 0!==t&&t>=0&&(this._leaderOffset=t)}return this._leaderOffset},set:function(t){Number.isNaN(t)||(this._dictionary.update("LLO",t),this._leaderOffset=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineIntent",{get:function(){if(void 0===this._lineIntent&&this._dictionary.has("IT")){var e=this._dictionary.get("IT");e&&(this._lineIntent="LineDimension"===e.name?t.PdfLineIntent.lineDimension:t.PdfLineIntent.lineArrow)}return this._lineIntent},set:function(e){void 0!==e&&e!==this.lineIntent&&(this._lineIntent=e,this._dictionary.update("IT",Xr.get(e===t.PdfLineIntent.lineDimension?"LineDimension":"LineArrow")))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&(this._measure=this._dictionary.has("Measure")),this._measure},set:function(t){t&&(this._isLoaded||(this._measure=t,this.caption.cap=!0))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if((void 0===this._unit||this._isLoaded)&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=nt(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this.linePoints||null===this.linePoints)throw new Error("Line points cannot be null or undefined");var i=this._getCropOrMediaBox();i&&i.length>3&&this.linePoints.length>3&&"number"==typeof i[0]&&"number"==typeof i[1]&&(0!==i[0]||0!==i[1])&&(this._linePoints[0]+=i[0],this._linePoints[1]+=i[1],this._linePoints[2]+=i[0],this._linePoints[3]+=i[1],this._dictionary.update("L",this._linePoints)),this._dictionary.has("Cap")||this._dictionary.set("Cap",!1),this._dictionary.has("CP")||this._dictionary.set("CP",Xr.get("Inline")),this._dictionary.has("LE")||(this.lineEndingStyle=new er),this._dictionary.has("LL")||(this.leaderLine=0),this._dictionary.has("LLE")||(this.leaderExt=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var r;if(this._dictionary.has("BS"))r=this.border.width;else{var n=new $r(this._crossReference);n.set("Type",Xr.get("Border")),this._dictionary.set("BS",n)}if(void 0===r&&(r=1),null!==this.border.dash&&void 0!==this.border.dash||(this.border.dash=[],this.border.style===t.PdfBorderStyle.dashed?this.border.dash=[3,1]:this.border.style===t.PdfBorderStyle.dot&&(this.border.dash=[1,1])),this._measure)this._appearanceTemplate=this._createLineMeasureAppearance(e);else{var s=!1;if(this._setAppearance){if(this._appearanceTemplate=this._createAppearance(),this._page._isNew&&!this._flatten&&!e){h={x:(o=this._obtainLineBounds())[0],y:o[1],width:o[2],height:o[3]};this._bounds=h;c=[this._bounds.x,this._bounds.y,this._bounds.x+this._bounds.width,this._bounds.y+this._bounds.height];this._dictionary.update("Rect",c),s=!0}}else{var a=B({x:(h=this._obtainLineBounds())[0],y:h[1],width:h[2],height:h[3]});this._page._isNew&&this._page._pageSettings&&this._setAppearance&&!this.flatten&&(a=Ot(this,h)),this.bounds={x:a[0],y:a[1],width:a[2],height:a[3]},this._dictionary.update("Rect",a),s=!0}if(this._dictionary.has("Measure")&&!s){var o=this._obtainLineBounds(),h={x:o[0],y:o[1],width:o[2],height:o[3]};this._bounds=h;var c=void 0;c=this._page&&this._page._isNew&&this._page._pageSettings&&!this._setAppearance&&!this.flatten?Ot(this):[this._bounds.x,this._bounds.y,this._bounds.x+this._bounds.width,this._bounds.y+this._bounds.height],this._dictionary.update("Rect",c),this.flatten&&!this.measure&&this._page&&this._page.size&&Array.isArray(this._page.size)&&this._page.size.length>=2&&(this._bounds={x:o[0],y:this._page.size[1]-(o[1]+o[3]),width:o[2],height:o[3]})}}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded)(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createLineMeasureAppearance(t):this._appearanceTemplate=this._createAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))instanceof rn&&((s=e.getRaw("N"))&&(i.reference=s),this._appearanceTemplate=new fe(i,this._crossReference));else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(null!==e&&void 0!==e&&e.has("N")){var i=e.get("N");i&&((s=e.getRaw("N"))&&(i.reference=s),this._appearanceTemplate=new fe(i,this._crossReference))}}else this._appearanceTemplate=this._createAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var r=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,r,!0)}else t&&this._page.annotations.remove(this);var n;if(t||!this._setAppearance||this.measure){if(this.measure&&this._setAppearance&&!this._dictionary.has("AP")){s=this._crossReference._getNextReference();n=new $r(this._crossReference),this._crossReference._cacheMap.set(s,n),this._dictionary.update("AP",s)}}else if(this._dictionary.has("AP"))n=this._dictionary.get("AP");else{s=this._crossReference._getNextReference();n=new $r(this._crossReference),this._crossReference._cacheMap.set(s,n),this._dictionary.update("AP",s)}if(n&&this._appearanceTemplate&&this._appearanceTemplate._content){At(n,this._crossReference,"N");var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,this._appearanceTemplate._content),n.update("N",s)}},i.prototype._createLineMeasureAppearance=function(e){for(var i=[0,0,0,0],r=this._convertToUnit(),n=this._obtainLinePoints(),s=[],a=0;a<n.length;a+=2)s.push([n[a],n[a+1]]);var o=new oi;o._points=s,o._pathTypes=[0,1];var h=o._getBounds();this._bounds={x:h[0],y:h[1],width:h[2],height:h[3]};var c,_=new xr(void 0!==this.color?this._color:[0,0,0],this.border.width);this.innerColor&&(c=new Ar(this._innerColor)),i=this._obtainLineBounds();var d=new fe(i,this._crossReference);et(d,0);var l=new sr;d._writeTransformation=!1;var f=d.graphics;l.borderPen=_,this.border.style===t.PdfBorderStyle.dashed?(l.borderPen._dashStyle=t.PdfDashStyle.dash,l.borderPen._dashPattern=[3,1]):this.border.style===t.PdfBorderStyle.dot&&(l.borderPen._dashStyle=t.PdfDashStyle.dot,l.borderPen._dashPattern=[1,1]),l.backBrush=c,l.foreBrush=new Ar(this.color);var p=this._obtainLinePoints(),u=this._obtainFont();if((void 0===u||null===u||!this._isLoaded&&1===u.size)&&(u=this._lineCaptionFont,this._pdfFont=u),void 0!==p&&4===p.length){var g=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),y=u.measureString(r.toFixed(2)+" "+this._unitString,[0,0],g,0,0),m=this._getAngle(this._linePoints),b=0,v=0;this.leaderLine<0?(b=-this.leaderLine,v=m+180):(b=this.leaderLine,v=m);var w=void 0!==this.leaderOffset?b+this.leaderOffset:b,S=this._getAxisValue([this._linePoints[0],this._linePoints[1]],v+90,w),P=this._getAxisValue([this._linePoints[2],this._linePoints[3]],v+90,w),A=Math.sqrt(Math.pow(P[0]-S[0],2)+Math.pow(P[1]-S[1],2)),x=A/2-(y[0]/2+this.border.width),k=this._getAxisValue(S,m,x),C=this._getAxisValue(P,m+180,x),T=this.lineEndingStyle.begin===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(S,m,this.border.width):S,R=this.lineEndingStyle.end===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(P,m,-this.border.width):P,F=void 0;this.opacity&&this._opacity<1&&(F=f.save(),f.setTransparency(this._opacity)),this.caption.type===t.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===t.PdfLineCaptionType.inline?f.drawLine(_,T[0],-T[1],R[0],-R[1]):(f.drawLine(_,T[0],-T[1],k[0],-k[1]),f.drawLine(_,R[0],-R[1],C[0],-C[1])),this.opacity&&this._opacity<1&&f.restore(F),this._drawLineStyle(S,P,f,m,_,c,this.lineEndingStyle,this.border.width);var L=void 0!==this.leaderExt?this._leaderExt:0,D=this._getAxisValue(S,v+90,L);f.drawLine(_,S[0],-S[1],D[0],-D[1]);var B=this._getAxisValue(P,v+90,L);f.drawLine(_,P[0],-P[1],B[0],-B[1]);var O=this._getAxisValue(S,v-90,b);f.drawLine(_,S[0],-S[1],O[0],-O[1]);var I=this._getAxisValue(P,v-90,b);f.drawLine(_,P[0],-P[1],I[0],-I[1]);var M=A/2,N=this._getAxisValue(S,m,M),E=void 0,V=u._metrics._getHeight();E=this.caption.type===t.PdfLineCaptionType.top?this._getAxisValue(N,m+90,V):this._getAxisValue(N,m+90,V/2),f.translateTransform(E[0],-E[1]),f.rotateTransform(-m),f.drawString(r.toFixed(2)+" "+this._unitString,u,[-y[0]/2,0,0,0],null,l.foreBrush),f.restore()}if(void 0!==e&&!e||!this._isLoaded){d._content.dictionary._updated=!0;var z=this._crossReference._getNextReference();this._crossReference._cacheMap.set(z,d._content),d._content.reference=z;var U=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height],W=this._page.size;U[1]=W[1]-(this.bounds.y+this.bounds.height),this._isBounds&&!this.measure?(i=U,this._dictionary.update("Rect",[U[0],U[1],U[2],U[3]])):this._dictionary.update("Rect",[i[0],i[1],i[2],i[3]]);var H="font:"+u._metrics._postScriptName+" "+u._size+"pt; color:"+this._colorToHex(this.color);if(this._dictionary.update("DS",H),void 0!==e&&!e){this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var G=new $r;G.set("N",z),G._updated=!0,this._dictionary.set("AP",G);var K=this._createMeasureDictionary(this._unitString),X=this._crossReference._getNextReference();this._crossReference._cacheMap.set(X,K),K._updated=!0,this._dictionary.has("Measure")&&At(this._dictionary,this._crossReference,"Measure"),this._dictionary.update("Measure",X)}var q=[];if(q.push(Xr.get(j(this.lineEndingStyle.begin))),q.push(Xr.get(j(this.lineEndingStyle.end))),this._dictionary.update("LE",q),null===this._linePoints)throw new Error("LinePoints cannot be null");this._dictionary.update("L",this._linePoints),this._dictionary.update("C",[Number.parseFloat((this.color[0]/255).toFixed(3)),Number.parseFloat((this.color[1]/255).toFixed(3)),Number.parseFloat((this.color[2]/255).toFixed(3))]);w=this._dictionary.has("LLO")?this.leaderOffset:0;this._dictionary.update("Subtype",new Xr("Line")),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+r.toFixed(2)+" "+this._unitString):this._dictionary.update("Contents",r.toFixed(2)+" "+this._unitString),this._dictionary.update("IT",new Xr("LineDimension")),this._dictionary.update("LLE",this.leaderExt),this._dictionary.update("LLO",w),this._dictionary.update("LL",this.leaderLine),this._dictionary.update("CP",Xr.get(this.caption.type===t.PdfLineCaptionType.top?"Top":"Inline")),this._dictionary.update("Cap",this.caption.cap);var Q=[i[0],i[1],i[0]+i[2],i[1]+i[3]];this._dictionary.update("Rect",Q),this._bounds={x:Q[0],y:Q[1],width:Q[2],height:Q[3]}}return d},i.prototype._calculateAngle=function(t,e,i,r){return-Math.atan2(r-e,i-t)*(180/Math.PI)},i.prototype._calculateLineBounds=function(t,e,i,r,n,s){var a={x:0,y:0,width:0,height:0};if(t&&4===t.length){var o=this._getAngle(t),h=0,c=0;i<0?(h=-i,c=o+180):(h=i,c=o);var _=[t[0],t[1]],d=[t[2],t[3]];if(0!==r){var l=this._getAxisValue(_,c+90,r),f=this._getAxisValue(d,c+90,r);t[0]=l[0],t[1]=l[1],t[2]=f[0],t[3]=f[1]}var p=this._getAxisValue(_,c+90,h+r),u=this._getAxisValue(d,c+90,h+r),g=this._getAxisValue(_,c+90,e+h+r),y=this._getAxisValue(d,c+90,e+h+r),m=this._getLinePoint(n.begin,s),b=this._getLinePoint(n.end,s),v=[],w=[];c>=45&&c<=135||c>=225&&c<=315?(v[0]=m.y,w[0]=m.x,v[1]=b.y,w[1]=b.x):(v[0]=m.x,w[0]=m.y,v[1]=b.x,w[1]=b.y);var S=Math.max(v[0],v[1]),P=Math.max(w[0],w[1]);0===S&&(S=1),0===P&&(P=1),p[0]===Math.min(p[0],u[0])?(p[0]-=S*s,u[0]+=S*s,p[0]=Math.min(p[0],t[0]),p[0]=Math.min(p[0],g[0]),u[0]=Math.max(u[0],t[2]),u[0]=Math.max(u[0],y[0])):(p[0]+=S*s,u[0]-=S*s,p[0]=Math.max(p[0],t[0]),p[0]=Math.max(p[0],g[0]),u[0]=Math.min(u[0],t[2]),u[0]=Math.min(u[0],y[0])),p[1]===Math.min(p[1],u[1])?(p[1]-=P*s,u[1]+=P*s,p[1]=Math.min(p[1],t[1]),p[1]=Math.min(p[1],g[1]),u[1]=Math.max(u[1],t[3]),u[1]=Math.max(u[1],y[1])):(p[1]+=P*s,u[1]-=P*s,p[1]=Math.max(p[1],t[1]),p[1]=Math.max(p[1],g[1]),u[1]=Math.min(u[1],t[3]),u[1]=Math.min(u[1],y[1])),a=this._getBounds([{x:p[0],y:p[1]},{x:u[0],y:u[1]}])}return a},i.prototype._getLinePoint=function(e,i){var r={x:0,y:0};if(e)switch(e){case t.PdfLineEndingStyle.square:case t.PdfLineEndingStyle.circle:case t.PdfLineEndingStyle.diamond:r.x=3,r.y=3;break;case t.PdfLineEndingStyle.openArrow:case t.PdfLineEndingStyle.closedArrow:r.x=1,r.y=5;break;case t.PdfLineEndingStyle.rOpenArrow:case t.PdfLineEndingStyle.rClosedArrow:r.x=9+i/2,r.y=5+i/2;break;case t.PdfLineEndingStyle.slash:r.x=5,r.y=9;break;case t.PdfLineEndingStyle.butt:r.x=1,r.y=3;break;default:r.x=0,r.y=0}return r},i.prototype._getBounds=function(t){var e={x:0,y:0,width:0,height:0};if(t.length>0){for(var i=t[0].x,r=t[0].x,n=t[0].y,s=t[0].y,a=1;a<t.length;++a){var o=t[a];i=Math.min(o.x,i),r=Math.max(o.x,r),n=Math.min(o.y,n),s=Math.max(o.y,s)}e.x=i,e.y=n,e.width=r-i,e.height=s-n}return e},i.prototype._obtainLineBounds=function(){var t=this.bounds;if(void 0!==this.linePoints&&4===this._linePoints.length){var e=this._dictionary.has("LLO")?this.leaderOffset:0,i=this._dictionary.has("LLE")?this.leaderExt:0,r=this._dictionary.has("LL")?this.leaderLine:0;t={x:(t=this._calculateLineBounds(this._linePoints,i,r,e,this.lineEndingStyle,this.border.width)).x-8,y:t.y-8,width:t.width+16,height:t.height+16}}return[t.x,t.y,t.width,t.height]},i.prototype._createAppearance=function(){var e=this._obtainLineBounds(),i=new fe(e,this._crossReference),r=new sr;et(i,0),i._writeTransformation=!1;var n=i.graphics,s=new xr(void 0!==this.color?this._color:[0,0,0],this.border.width);this.border.style===t.PdfBorderStyle.dashed?(s._dashStyle=t.PdfDashStyle.dash,s._dashPattern=[3,1]):this.border.style===t.PdfBorderStyle.dot&&(s._dashStyle=t.PdfDashStyle.dot,s._dashPattern=[1,1]),this.border.style!==t.PdfBorderStyle.solid&&this.border.dash&&(s._dashPattern=this.border.dash),r.borderPen=s,r.foreBrush=new Ar(this.color);var a;this.innerColor&&(a=new Ar(this._innerColor));var o=this._obtainFont();(void 0===o||null===o||!this._isLoaded&&1===o.size)&&(o=this._lineCaptionFont,this._pdfFont=o),this.text||this._dictionary.has("Contents")||(this.text=this.subject);var h=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),c=0;if(this.caption.cap&&(c=o.measureString(this.text?this.text:"",[0,0],h,0,0)[0]),void 0!==this.linePoints&&4===this._linePoints.length){var _=this._getAngle(this._linePoints),d=0,l=0,f=this.leaderLine;null!==f&&void 0!==f||(this._leaderLine=0,f=0),f<0?(d=-f,l=_+180):(d=f,l=_);var p=void 0!==this.leaderOffset?d+this.leaderOffset:d,u=this._getAxisValue([this._linePoints[0],this._linePoints[1]],l+90,p),g=this._getAxisValue([this._linePoints[2],this._linePoints[3]],l+90,p),y=Math.sqrt(Math.pow(g[0]-u[0],2)+Math.pow(g[1]-u[1],2)),m=y/2-(c/2+this.border.width),b=this._getAxisValue(u,_,m),v=this._getAxisValue(g,_+180,m),w=this.lineEndingStyle.begin===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(u,_,this.border.width):u,S=this.lineEndingStyle.end===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(g,_,-this.border.width):g;if(this.opacity&&this._opacity<1){var P=n.save();n.setTransparency(this._opacity),this._drawLine(n,s,w,S,b,v),n.restore(P)}else this._drawLine(n,s,w,S,b,v);this._drawLineStyle(u,g,n,_,s,a,this.lineEndingStyle,this.border.width);var A=void 0!==this.leaderExt?this._leaderExt:0,x=this._getAxisValue(u,l+90,A);n.drawLine(s,u[0],-u[1],x[0],-x[1]);var k=this._getAxisValue(g,l+90,A);n.drawLine(s,g[0],-g[1],k[0],-k[1]);var C=this._getAxisValue(u,l-90,d);n.drawLine(s,u[0],-u[1],C[0],-C[1]);var T=this._getAxisValue(g,l-90,d);n.drawLine(s,g[0],-g[1],T[0],-T[1]);var R=y/2,F=this._getAxisValue(u,_,R),L=void 0,D=o._metrics._getHeight();L=this.caption.type===t.PdfLineCaptionType.top?this._measure?this._getAxisValue(F,_+90,2*D):this._getAxisValue(F,_+90,D):this._measure?this._getAxisValue(F,_+90,D/2*3):this._getAxisValue(F,_+90,D/2),n.translateTransform(L[0],-L[1]),n.rotateTransform(-_),this.caption.cap&&n.drawString(this.text,o,[-c/2,0,0,0],null,r.foreBrush),n.restore();var O=B({x:e[0],y:e[1],width:e[2],height:e[3]});this.bounds={x:O[0],y:O[1],width:O[2],height:O[3]},this.measure||this._dictionary.has("Measure")||this._dictionary.update("Rect",[O[0],O[1],O[2],O[3]])}return i},i.prototype._drawLine=function(e,i,r,n,s,a){void 0===this.text||""===this._text||this.caption.type===t.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===t.PdfLineCaptionType.inline?e.drawLine(i,r[0],-r[1],n[0],-n[1]):(e.drawLine(i,r[0],-r[1],s[0],-s[1]),e.drawLine(i,n[0],-n[1],a[0],-a[1]))},i.prototype._convertToUnit=function(){for(var e=this._obtainLinePoints(),i=new Array(e.length/2),r=0,n=0;n<e.length;n+=2)i[r]=[e[n],e[n+1]],r++;var s=Math.sqrt(Math.pow(i[1][0]-i[0][0],2)+Math.pow(i[1][1]-i[0][1],2)),a=this._getEqualPdfGraphicsUnit(this.unit,this._unitString);return this._unitString=a.unitString,(new kr)._convertUnits(s,t._PdfGraphicsUnit.point,a.graphicsUnit)},i.prototype._obtainLinePoints=function(){return this.linePoints?this._linePoints.slice():[]},i}(ki),Ti=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._unit=t.PdfMeasurementUnit.centimeter,a._measureType=t.PdfCircleMeasurementType.diameter,a._unitString="",a._dictionary=new $r,a._dictionary.update("Type",Xr.get("Annot")),a._dictionary.update("Subtype",Xr.get("Circle")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.circleAnnotation,a}return Ai(i,e),Object.defineProperty(i.prototype,"measure",{get:function(){return this._measure||(this._measure=this._dictionary.has("Measure")),this._measure},set:function(t){t&&(this._isLoaded||(this._measure=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if((void 0===this._unit||this._isLoaded)&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=nt(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measureType",{get:function(){if(this._dictionary.has("Contents")){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=nt(this._unitString);var i=e.substring(0,e.length-2);(new kr)._convertUnits(this.bounds.width/2,t._PdfGraphicsUnit.point,ot(this._unitString)).toString()===i?this._measureType=t.PdfCircleMeasurementType.radius:this._measureType=t.PdfCircleMeasurementType.diameter}return this._measureType},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._measureType=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new $r(this._crossReference);i.set("Type",Xr.get("Border")),this._dictionary.set("BS",i)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===e&&(e=1),this._measure?this._appearanceTemplate=this._createCircleMeasureAppearance(t):(this._dictionary.update("Rect",Ot(this)),(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createCircleMeasureAppearance(t):this._appearanceTemplate=this._createCircleAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(null!==r&&void 0!==r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else this._appearanceTemplate=this._createCircleAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else t&&this._page.annotations.remove(this);if(!t&&this._setAppearance&&!this.measure){var s=void 0;if(this._dictionary.has("AP"))s=this._dictionary.get("AP");else{var a=this._crossReference._getNextReference();s=new $r(this._crossReference),this._crossReference._cacheMap.set(a,s),this._dictionary.update("AP",a)}At(s,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),s.update("N",i)}},i.prototype._createCircleMeasureAppearance=function(e){var i=this.border.width,r=this._obtainFont();(void 0===r||null===r||!this._isLoaded&&1===r.size)&&(r=this._circleCaptionFont,this._pdfFont=r);var n=this._convertToUnit(),s=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),a=n.toFixed(2)+" "+this._unitString,o=r.measureString(a,[0,0],s,0,0),h=this.color?this.color:[0,0,0],c=new xr(h,i),_=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height];_[1]=_[1]-_[3];var d=new fe(_,this._crossReference),l=new sr;d._writeTransformation=!1;var f=d.graphics,p=i/2;l.borderPen=c,this.innerColor&&(l.backBrush=new Ar(this._innerColor)),l.foreBrush=new Ar(h);var u=[_[0],-_[1]-_[3],_[2],_[3]];if(f.save(),f.drawEllipse(u[0]+p,u[1]+p,u[2]-i,u[3]-i,new xr(h,this.border.width)),this._measureType===t.PdfCircleMeasurementType.diameter){f.save(),f.translateTransform(_[0],-_[1]);g=_[3]/2-o[0]/2;f.drawLine(l.borderPen,0,-_[3]/2,_[0]+_[2],-_[3]/2),f.translateTransform(g,-_[3]/2-r._metrics._getHeight()),f.drawString(n.toFixed(2)+" "+this._unitString,r,[0,0,0,0],null,l.foreBrush),f.restore()}else{f.save(),f.translateTransform(_[0],-_[1]);var g=_[2]/2+(_[2]/4-o[0]/2);f.drawLine(l.borderPen,_[2]/2,-_[3]/2,_[0]+_[2],-_[3]/2),f.translateTransform(g,-_[3]/2-r._metrics._getHeight()),f.drawString(n.toFixed(2)+" "+this._unitString,r,[0,0,0,0],null,l.foreBrush),f.restore()}if(f.restore(),void 0!==e&&!e||!this._isLoaded){this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var y=new $r;f._template._content.dictionary._updated=!0;var m=this._crossReference._getNextReference();this._crossReference._cacheMap.set(m,f._template._content),f._template._content.reference=m,y.set("N",m),y._updated=!0,this._dictionary.set("AP",y),this._dictionary.update("Rect",Ot(this)),this._dictionary.has("Measure")&&At(this._dictionary,this._crossReference,"Measure");var b=this._createMeasureDictionary(this._unitString),v=this._crossReference._getNextReference();this._crossReference._cacheMap.set(v,b),b._updated=!0,this._dictionary.update("Measure",v),this._dictionary.update("Subtype",new Xr("Circle")),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+n.toFixed(2)+" "+this._unitString):this._dictionary.update("Contents",n.toFixed(2)+" "+this._unitString);var w="font:"+r._metrics._postScriptName+" "+r._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",w)}return d},i.prototype._convertToUnit=function(){var e=new kr,i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString);this._unitString=i.unitString;var r=e._convertUnits(this.bounds.width/2,t._PdfGraphicsUnit.point,i.graphicsUnit);return this._measureType===t.PdfCircleMeasurementType.diameter&&(r*=2),r},i}(ki),Ri=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new $r,a._dictionary.update("Type",Xr.get("Annot")),a._dictionary.update("Subtype",Xr.get("Circle")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.ellipseAnnotation,a}return Ai(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new $r(this._crossReference);i.set("Type",Xr.get("Border")),this._dictionary.set("BS",i)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===e&&(e=1),(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),this._dictionary.update("Rect",Ot(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else this._appearanceTemplate=this._createCircleAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else t&&this._page.annotations.remove(this);if(!t&&this._setAppearance){var s=void 0;if(this._dictionary.has("AP"))s=this._dictionary.get("AP");else{var a=this._crossReference._getNextReference();s=new $r(this._crossReference),this._crossReference._cacheMap.set(a,s),this._dictionary.update("AP",a)}At(s,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),s.update("N",i)}},i}(ki),Fi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._unit=t.PdfMeasurementUnit.centimeter,a._dictionary=new $r,a._dictionary.update("Type",Xr.get("Annot")),a._dictionary.update("Subtype",Xr.get("Square")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.squareAnnotation,a}return Ai(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var e=new nr;if(e._dictionary=this._dictionary,this._dictionary.has("BE")){var i=this._dictionary.get("BE");e._intensity=i.get("I"),e._style=E(i.get("S").name)}else e._style=t.PdfBorderEffectStyle.solid;this._borderEffect=e}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){void 0!==t&&(this._isLoaded||(this._measure=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if(void 0===this._unit&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=nt(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var i;if(this._dictionary.has("BS")?i=this.border.width:((r=new $r(this._crossReference)).set("Type",Xr.get("Border")),this._dictionary.set("BS",r)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===i&&(i=1),this._measure)this._appearanceTemplate=this._createSquareMeasureAppearance(e);else if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),this._dictionary.update("Rect",Ot(this)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var r=new $r(this._crossReference);r.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&r.set("S",Xr.get("C")),this._dictionary.update("BE",r)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createSquareMeasureAppearance(t):this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect);if(void 0!==this.flattenPopups&&this.flattenPopups&&!this.measure&&(this._isLoaded&&!this._dictionary.has("Measure")?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else t&&this._page.annotations.remove(this);if(!t&&this._setAppearance&&!this.measure){var s=void 0;if(this._dictionary.has("AP"))s=this._dictionary.get("AP");else{var a=this._crossReference._getNextReference();s=new $r(this._crossReference),this._crossReference._cacheMap.set(a,s),this._dictionary.update("AP",a)}At(s,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),s.update("N",i)}},i.prototype._createSquareMeasureAppearance=function(e){var i=this.border.width,r=this._obtainFont();(void 0===r||null===r||!this._isLoaded&&1===r.size)&&(r=this._circleCaptionFont,this._pdfFont=r);var n,s=this._calculateAreaOfSquare(),a=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),o=s.toFixed(2)+" sq "+this._unitString,h=r.measureString(o,[0,0],a,0,0),c=new xr(this.color,i);this.innerColor&&(n=new Ar(this._innerColor));var _=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height],d=new Pi({x:this.bounds.x,y:this.bounds.y,width:this.bounds.width,height:this.bounds.height},this);_[1]=_[1]-_[3],d.normal=new fe(_,this._crossReference);var l=d.normal,f=new sr;l._writeTransformation=!1;var p=d.normal.graphics,u=i/2;f.borderPen=c,f.backBrush=n,f.foreBrush=new Ar(this.color);var g=[_[0],-_[1]-_[3],_[2],_[3]];p.drawRectangle(g[0]+u,g[1]+u,g[2]-i,g[3]-i,new xr(this.color,this.border.width)),p.save(),p.translateTransform(_[0],-_[1]);var y=_[2]/2-h[0]/2,m=_[3]/2-h[1]/2;if(p.translateTransform(y,-m-r._metrics._getHeight()),p.drawString(s.toFixed(2)+" sq "+this._unitString,r,[0,0,0,0],null,f.foreBrush),p.restore(),void 0!==e&&!e||!this._isLoaded){this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var b=new $r,v=p._template._content;v.dictionary._updated=!0;var w=this._crossReference._getNextReference();this._crossReference._cacheMap.set(w,v),p._template._content.reference=w,b.set("N",w),b._updated=!0,this._dictionary.set("AP",b);var S=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],P=this._page.size;S[1]=P[1]-(this.bounds.y+this.bounds.height),S[2]=this.bounds.x+this.bounds.width,S[3]=P[1]-this.bounds.y,this._isBounds&&(_=S),this._page._isNew&&this._page._pageSettings&&(S=Ot(this)),this._dictionary.update("Rect",[S[0],S[1],S[2],S[3]]),this._dictionary.has("Measure")&&At(this._dictionary,this._crossReference,"Measure");var A=this._crossReference._getNextReference(),x=this._createMeasureDictionary(this._unitString);this._crossReference._cacheMap.set(A,x),x._updated=!0,this._dictionary.update("Measure",A);var k="font:"+r._metrics._postScriptName+" "+r._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",k),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+s.toFixed(2)+" sq "+this._unitString):this._dictionary.update("Contents",s.toFixed(2)+" sq "+this._unitString),this._dictionary.update("Subject","Area Measurement"),void 0===this.subject&&this._dictionary.update("Subject","Area Measurement"),this._dictionary.update("MeasurementTypes",129),this._dictionary.update("Subtype",new Xr("Square")),this._dictionary.update("IT",new Xr("SquareDimension"));var C=this._dictionary.getArray("Rect"),T=new Array(2*C.length);T[0]=C[0],T[1]=C[3],T[2]=C[0],T[3]=C[1],T[4]=C[2],T[5]=C[1],T[6]=C[2],T[7]=C[3],this._dictionary.update("Vertices",T)}return l},i.prototype._calculateAreaOfSquare=function(){var e,i,r=new kr;if(this.bounds.width===this.bounds.height)i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString,e=(n=r._convertUnits(this.bounds.width,t._PdfGraphicsUnit.point,i.graphicsUnit))*n;else{i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString;var n=r._convertUnits(this.bounds.width,t._PdfGraphicsUnit.point,i.graphicsUnit);i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString,e=n*r._convertUnits(this.bounds.height,t._PdfGraphicsUnit.point,i.graphicsUnit)}return e},i}(ki),Li=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new $r,a._dictionary.update("Type",Xr.get("Annot")),a._dictionary.update("Subtype",Xr.get("Square")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.rectangleAnnotation,a}return Ai(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var e=new nr;if(e._dictionary=this._dictionary,this._dictionary.has("BE")){var i=this._dictionary.get("BE");e._intensity=i.get("I"),e._style=E(i.get("S").name)}else e._style=t.PdfBorderEffectStyle.solid;this._borderEffect=e}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var i;if(this._dictionary.has("BS")?i=this.border.width:((r=new $r(this._crossReference)).set("Type",Xr.get("Border")),this._dictionary.set("BS",r)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===i&&(i=1),this._dictionary.update("Rect",Ot(this)),(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var r=new $r(this._crossReference);r.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&r.set("S",Xr.get("C")),this._dictionary.update("BE",r)}},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded){if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(n=this._dictionary.get("AP"))&&n.has("N")){var i=n.get("N"),r=n.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new fe(i,this._crossReference))}}else if(this._postProcess(e),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){var n=this._dictionary.get("AP");if(n&&n.has("N")){var i=n.get("N"),r=n.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new fe(i,this._crossReference))}}else this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect);if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);(s&&this._page&&this._page.rotation!==t.PdfRotationAngle.angle0||this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate))&&this._flattenAnnotationTemplate(this._appearanceTemplate,s)}else e&&this._page.annotations.remove(this);if(!e&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new $r(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}At(a,this._crossReference,"N");r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),a.update("N",r)}},i.prototype._isValidTemplateMatrix=function(t,e,i){var r=!0,n=e;if(t&&t.has("Matrix")){var s=t.getArray("BBox"),a=t.getArray("Matrix");if(a&&s&&a.length>3&&s.length>2&&void 0!==a[0]&&void 0!==a[1]&&void 0!==a[2]&&void 0!==a[3]&&1===a[0]&&0===a[1]&&0===a[2]&&1===a[3]&&void 0!==s[0]&&void 0!==s[1]&&void 0!==s[2]&&void 0!==s[3]&&(Math.round(s[0])!==Math.round(-a[4])&&Math.round(s[1])!==Math.round(-a[5])||0===s[0]&&0===Math.round(-a[4]))){var o=this._page.graphics,h=o.save();void 0!==this.opacity&&this._opacity<1&&o.setTransparency(this._opacity),n.x-=s[0],n.y+=s[1],o.drawTemplate(i,n),o.restore(h),this._page.annotations.remove(this),r=!1}}return r},i}(ki),Di=function(e){function i(i){var r=e.call(this)||this;return r._dictionary=new $r,r._dictionary.update("Type",Xr.get("Annot")),r._dictionary.update("Subtype",Xr.get("Polygon")),void 0!==i&&(r._points=i),r._type=t._PdfAnnotationType.polygonAnnotation,r}return Ai(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var e=new nr;if(e._dictionary=this._dictionary,this._dictionary.has("BE")){var i=this._dictionary.get("BE");e._intensity=i.get("I"),e._style=E(i.get("S").name)}else e._style=t.PdfBorderEffectStyle.solid;this._borderEffect=e}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineExtension",{get:function(){if(void 0===this._lineExtension&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&t>=0&&(this._lineExtension=t)}return this._lineExtension},set:function(t){if(!Number.isNaN(t)){if(!(t>=0))throw new Error("LineExtension should be non negative number");this._dictionary.update("LLE",t),this._lineExtension=t}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("LLE")||(this.lineExtension=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var i;this._dictionary.has("BS")?i=this.border.width:((a=new $r(this._crossReference)).set("Type",Xr.get("Border")),this._dictionary.set("BS",a)),void 0===i&&(i=1);var r=[];r.push.apply(r,this._points),this._points=this._getPoints(this._points),r[0]===r[r.length-2]&&r[1]===r[r.length-1]||(this._points.push(this._points[0]),this._points.push(this._points[1]));var n=this._getBoundsValue(this._points),s=[n.x,n.y,n.x+n.width,n.y+n.height];if(this._dictionary.update("Rect",s),this._dictionary.update("LLE",this._lineExtension),(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolygonAppearance(e)),this._dictionary.update("Vertices",this._points),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var a=new $r(this._crossReference);a.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&a.set("S",Xr.get("C")),this._dictionary.update("BE",a)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._flatten=t,this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolygonAppearance(t)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t&&this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}if(void 0!==this.flattenPopups&&this.flattenPopups&&this._isLoaded&&this._flattenLoadedPopUp(),t)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&s.length>=2&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._page.annotations.remove(this);if(!t&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new $r(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}At(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}},i.prototype._createPolygonAppearance=function(e){if(void 0!==e&&e){var i=void 0;this.color&&this.border.width>0&&(i=new xr(this.color,this.border.width));var r=void 0;this.innerColor&&(r=new Ar(this.innerColor));c=this._page.graphics;if(i||r){var n=void 0;if(void 0!==this.opacity&&this._opacity<1&&(n=c.save(),c.setTransparency(this._opacity)),0!==this.borderEffect.intensity&&this.borderEffect.style===t.PdfBorderEffectStyle.cloudy){d=4*this.borderEffect.intensity+.5*this.border.width;(l=new oi).addPolygon(this._getLinePoints()),this._drawCloudStyle(c,r,i,d,.833,l._points,!1)}else c.drawPolygon(this._getLinePoints(),i,r);void 0!==this.opacity&&this._opacity<1&&c.restore(n)}return c._template}var s=void 0,a={x:0,y:0,width:0,height:0};void 0===this._points&&this._dictionary.has("Vertices")?(this._points=this._dictionary.get("Vertices"),s=this._getBoundsValue(this._points)):s=this._getBoundsValue(this._points),void 0!==this._borderEffect&&void 0!==this.borderEffect.intensity&&0!==this.borderEffect.intensity&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy?(a.x=s.x-5*this.borderEffect.intensity-this.border.width,a.y=s.y-5*this.borderEffect.intensity-this.border.width,a.width=s.width+10*this.borderEffect.intensity+2*this.border.width,a.height=s.height+10*this.borderEffect.intensity+2*this.border.width):(a.x=s.x-this.border.width,a.y=s.y-this.border.width,a.width=s.width+2*this.border.width,a.height=s.height+2*this.border.width);var o=new Pi({x:a.x,y:a.y,width:a.width,height:a.height},this);o.normal=new fe([a.x,a.y,a.width,a.height],this._crossReference);var h=o.normal;et(h,this._getRotationAngle()),h._writeTransformation=!1;var c=o.normal.graphics,_=new sr;if(this.innerColor&&(_.backBrush=new Ar(this._innerColor)),this.border.width>0&&this.color&&(_.borderPen=new xr(this._color,this.border.width)),this.color&&(_.foreBrush=new Ar(this._color)),void 0!==this.opacity&&this._opacity<1?(c.save(),c.setTransparency(this._opacity)):c.save(),Ut(this.borderEffect)&&Ut(this.borderEffect.intensity)&&0!==this.borderEffect.intensity&&this.borderEffect.style===t.PdfBorderEffectStyle.cloudy){var d=4*this.borderEffect.intensity+.5*this.border.width,l=new oi;l.addPolygon(this._getLinePoints()),this._drawCloudStyle(c,_.backBrush,_.borderPen,d,.833,l._points,!1)}else c.drawPolygon(this._getLinePoints(),_.borderPen,_.backBrush);return void 0!==this.opacity&&this._opacity<1&&c.restore(),c.restore(),this._isBounds&&(h._content.dictionary._updated=!0,this._dictionary.update("LLE",this.lineExtension),this._dictionary.update("Vertices",this._points)),this._dictionary.update("Rect",[a.x,a.y,a.x+a.width,a.y+a.height]),h},i.prototype._getLinePoints=function(){var e,i=this,r=this._page.size,n=r[1],s=r[0];if(this._dictionary.has("Vertices")&&!this._isBounds){var a=void 0;this._page._pageDictionary.has("Rotate")&&(a=this._page._pageDictionary.get("Rotate")),this._page&&this._page.rotation&&(this._page.rotation===t.PdfRotationAngle.angle90?a=90:this._page.rotation===t.PdfRotationAngle.angle180?a=180:this._page.rotation===t.PdfRotationAngle.angle270&&(a=270));var o=this._dictionary.getArray("Vertices");if(o){h=o.slice();e=[];for(c=0;c<h.length;c+=2){_=this.flatten?n-h[c+1]:-h[c+1];e.push([h[c],_])}a&&(270===a?e.forEach(function(t){var e=t[0];t[0]=t[1],t[1]=s-e}):90===a?e.forEach(function(t){var e=t[0];0!==i._page._origin[1]?t[0]=n-(t[1]-n):t[0]=n-t[1],t[1]=e}):180===a&&e.forEach(function(t){var e=t[0];t[0]=s-e,t[1]=n-t[1]}))}}else if(this._points){var h=this._points.slice();e=[];for(var c=0;c<this._points.length;c+=2){var _=this.flatten?n-h[c+1]:-h[c+1];e.push([h[c],_])}}return e},i}(ki),Bi=function(e){function i(i){var r=e.call(this)||this;return r._beginLine=t.PdfLineEndingStyle.none,r._endLine=t.PdfLineEndingStyle.none,r._dictionary=new $r,r._dictionary.update("Type",Xr.get("Annot")),r._dictionary.update("Subtype",Xr.get("PolyLine")),r._points=void 0!==i?i:[],r._type=t._PdfAnnotationType.polyLineAnnotation,r}return Ai(i,e),Object.defineProperty(i.prototype,"beginLineStyle",{get:function(){if(this._dictionary.has("LE")){var t=this._dictionary.getArray("LE");t&&Array.isArray(t)&&(this._beginLine=V(t[0].name))}return this._beginLine},set:function(t){if(t!==this._beginLine&&(this._beginLine=t,this._dictionary)){var e=[];e.push(Xr.get(j(t))),e.push(Xr.get(j(this.endLineStyle))),this._dictionary.update("LE",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"endLineStyle",{get:function(){if(this._dictionary.has("LE")){var t=this._dictionary.getArray("LE");t&&Array.isArray(t)&&(this._endLine=V(t[1].name))}return this._endLine},set:function(t){if(t!==this._endLine&&(this._endLine=t,this._dictionary)){var e=[];e.push(Xr.get(j(this.beginLineStyle))),e.push(Xr.get(j(t))),this._dictionary.update("LE",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineExtension",{get:function(){if(void 0===this._lineExtension&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&t>=0&&(this._lineExtension=t)}return this._lineExtension},set:function(t){if(!Number.isNaN(t)){if(!(t>=0))throw new Error("LineExtension should be non negative number");this._dictionary.update("LLE",t),this._lineExtension=t}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("LLE")||(this.lineExtension=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new $r(this._crossReference);i.set("Type",Xr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1);var r=this._getLinePoints(),n=[];n.push(0);for(var s=1;s<r.length;s++)n.push(1);this._polylinePoints=r,this._pathTypes=n;var a=new oi;a._points=r,a._pathTypes=n,this._dictionary.update("Vertices",this._points);var o=[];o.push(Xr.get(j(this.beginLineStyle))),o.push(Xr.get(j(this.endLineStyle))),this._dictionary.update("LE",o),this._dictionary.update("LLE",this._lineExtension);var h=this._getBoundsValue(this._points),c=[h.x,h.y,h.x+h.width,h.y+h.height];this._dictionary.update("Rect",c),(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolyLineAppearance(t))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._flatten=t,this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolyLineAppearance(t)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else this._appearanceTemplate=this._createPolyLineAppearance(t);if(void 0!==this.flattenPopups&&this.flattenPopups&&this._isLoaded&&this._flattenLoadedPopUp(),t)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._page.annotations.remove(this);if(!t&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new $r(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}At(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}},i.prototype._transformToPdfCoordinates=function(t){for(var e=[],i=0;i<t.length;i+=2)e.push(t[i]),e.push(-t[i+1]);return e},i.prototype._updateBorder=function(t,e){return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}},i.prototype._prepareStartEndAngle=function(t){var e=this._transformToPdfCoordinates(t._points[0]),i=this._transformToPdfCoordinates(t._points[1]),r=this._transformToPdfCoordinates(t._points[t._points.length-1]),n=this._transformToPdfCoordinates(t._points[t._points.length-2]);return{startAngle:this._getAngle([e[0],e[1],i[0],i[1]]),endAngle:this._getAngle([n[0],n[1],r[0],r[1]]),transformedStart:e,transformedEnd:r}},i.prototype._createPolyLineAppearance=function(e){var i=this.color?this.color:[0,0,0];if(void 0!==e&&e){var r=void 0;this.border.width>0&&(r=new xr(i,this.border.width));var n=void 0;this.innerColor&&(n=new Ar(this._innerColor));P=this._page.graphics;if(r){var s=void 0;void 0!==this.opacity&&this._opacity<1&&(s=P.save(),P.setTransparency(this._opacity));var a=this._getLinePoints(),o=[];if(o.push(0),a&&a.length>0){for(p=1;p<a.length;p++)o.push(1);(f=new oi)._points=a,f._pathTypes=o;var h=this._prepareStartEndAngle(f),c=u=this._getAxisValue(h.transformedStart,h.startAngle+90),_=g=this._getAxisValue(h.transformedEnd,h.endAngle+90);this.beginLineStyle!==t.PdfLineEndingStyle.closedArrow&&this.beginLineStyle!==t.PdfLineEndingStyle.openArrow||(c=this._getAxisValue(u,h.startAngle,this.border.width),f._points[0][0]=c[0],f._points[0][1]=-c[1]),this.endLineStyle!==t.PdfLineEndingStyle.closedArrow&&this.endLineStyle!==t.PdfLineEndingStyle.openArrow||(_=this._getAxisValue(g,h.endAngle,-this.border.width),f._points[f._points.length-1][0]=_[0]),P.drawPath(f,r),this.beginLineStyle!==t.PdfLineEndingStyle.none&&this._drawLineEndStyle(u,P,h.startAngle,r,n,this.beginLineStyle,this.border.width,!0),this.endLineStyle!==t.PdfLineEndingStyle.none&&this._drawLineEndStyle(g,P,h.endAngle,r,n,this.endLineStyle,this.border.width,!1),void 0!==this.opacity&&this._opacity<1&&P.restore(s)}}return P._template}var d={x:0,y:0,width:0,height:0};(void 0===this._points||this._points&&0===this._points.length)&&this._dictionary.has("Vertices")&&(this._points=this._dictionary.get("Vertices")),d=this._updateBorder(this._getBoundsValue(this._points),this.border.width);var l=new sr;this.innerColor&&(l.backBrush=new Ar(this._innerColor)),this.border.width>0&&i&&(l.borderPen=new xr(i,this.border.width)),i&&(l.foreBrush=new Ar(i));var f=new oi;if(void 0!==this._polylinePoints&&null!==this._polylinePoints?f._points=this._polylinePoints:f._points=this._getLinePoints(),void 0!==this._pathTypes&&null!==this._polylinePoints)f._pathTypes=this._pathTypes;else{this._pathTypes=[],this._pathTypes.push(0);for(var p=1;p<f._points.length;p++)this._pathTypes.push(1);f._pathTypes=this._pathTypes}var h=this._prepareStartEndAngle(f),u=this._getAxisValue(h.transformedStart,h.startAngle+90),g=this._getAxisValue(h.transformedEnd,h.endAngle+90),y=u,m=g;this.beginLineStyle!==t.PdfLineEndingStyle.closedArrow&&this.beginLineStyle!==t.PdfLineEndingStyle.openArrow||(y=this._getAxisValue(u,h.startAngle,this.border.width),f._points[0][0]=y[0],f._points[0][1]=-y[1]),this.endLineStyle!==t.PdfLineEndingStyle.closedArrow&&this.endLineStyle!==t.PdfLineEndingStyle.openArrow||(m=this._getAxisValue(g,h.endAngle,-this.border.width),f._points[f._points.length-1][0]=m[0]);var b=void 0;this.beginLineStyle!==t.PdfLineEndingStyle.none&&(b=this._getBoundsFromLineEndStyle(u,h.startAngle,l.borderPen,this.beginLineStyle,this.border.width,!0),d=this._getCombinedRectangleBounds(d,b));var v=void 0;this.endLineStyle!==t.PdfLineEndingStyle.none&&(v=this._getBoundsFromLineEndStyle(g,h.endAngle,l.borderPen,this.endLineStyle,this.border.width,!1),d=this._getCombinedRectangleBounds(d,v));var w=new Pi({x:d.x,y:d.y,width:d.width,height:d.height},this);w.normal=new fe([d.x,d.y,d.width,d.height],this._crossReference);var S=w.normal;et(S,0),S._writeTransformation=!1;var P=w.normal.graphics;return void 0!==this.opacity&&this._opacity<1?(P.save(),P.setTransparency(this._opacity)):P.save(),P.drawPath(f,l.borderPen),this.beginLineStyle!==t.PdfLineEndingStyle.none&&this._drawLineEndStyle(u,P,h.startAngle,l.borderPen,l.backBrush,this.beginLineStyle,this.border.width,!0),this.endLineStyle!==t.PdfLineEndingStyle.none&&this._drawLineEndStyle(g,P,h.endAngle,l.borderPen,l.backBrush,this.endLineStyle,this.border.width,!1),void 0!==this.opacity&&this._opacity<1&&P.restore(),P.restore(),this._isBounds&&(S._content.dictionary._updated=!0,this._dictionary.update("LE",[Xr.get(j(this.beginLineStyle)),Xr.get(j(this.endLineStyle))]),this._dictionary.update("LLE",this.lineExtension),this._dictionary.update("Vertices",this._points)),this._dictionary.update("Rect",[d.x,d.y,d.x+d.width,d.y+d.height]),S},i.prototype._getLinePoints=function(){var t,e=this._page.size[1];if(this._dictionary.has("Vertices")&&!this._isBounds&&(!this._setAppearance||this._setAppearance&&this.flatten)){var i=this._dictionary.getArray("Vertices");if(i){t=[];for(n=0;n<i.length;n+=2)t.push([i[n],e-i[n+1]])}}else if(this._points){this._points=this._getPoints(this._points);var r=this._points.slice();t=[];for(var n=0;n<r.length;n+=2){var s=this.flatten?e-r[n+1]:-r[n+1];t.push([r[n],s])}}return t},i}(ki),Oi=function(e){function i(i){var r=e.call(this)||this;if(r._linePoints=[],r._firstIntersectionPoint=[0,0],r._secondIntersectionPoint=[0,0],r._dictionary=new $r,r._dictionary.update("Type",Xr.get("Annot")),r._dictionary.update("Subtype",Xr.get("PolyLine")),void 0!==i&&i.length>0){if(i.length>6)throw new Error("Points length should not be greater than 3");r._pointArray=i,i.forEach(function(t){r._linePoints.push(t[0]),r._linePoints.push(t[1])})}return r._type=t._PdfAnnotationType.angleMeasurementAnnotation,r}return Ai(i,e),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){t&&!this._isLoaded&&(this._measure=t,this.caption.cap=!0)},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(!this._pointArray)throw new Error("Points cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new $r(this._crossReference);e.set("Type",Xr.get("Border")),this._dictionary.set("BS",e)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===t&&(t=1),this._appearanceTemplate=this._createAngleMeasureAppearance()},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if(!t&&this._setAppearance&&(this._appearanceTemplate=this._createAngleMeasureAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else this._appearanceTemplate=this._createAngleMeasureAppearance();if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else t&&this._page.annotations.remove(this)},i.prototype._createAngleMeasureAppearance=function(){var e=this.border.width,i=this._obtainFont();(void 0===i||null===i||!this._isLoaded&&1===i.size)&&(i=this._circleCaptionFont,this._pdfFont=i);var r=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),n=this._calculateAngle()*(180/Math.PI);n<0&&(n=-n),n>180&&(n=360-n),this._dictionary.update("Vertices",this._linePoints);var s="font:"+i._metrics._postScriptName+" "+i._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",s),this.text===" "+n.toFixed(2)+"°"?this._dictionary.update("Contents",this.text):this.text&&this._dictionary.update("Contents",this.text),void 0===this.subject&&this._dictionary.update("Subject","Angle Measurement"),this._dictionary.update("MeasurementTypes",1152),this._dictionary.update("Subtype",new Xr("PolyLine")),this._dictionary.update("IT",new Xr("PolyLineAngle"));var a=new $r,o=[],h=[],c=[],_=[],d=[];a.set("Type",Xr.get("measureDictionary")),a.set("R","1 in = 1 in"),a.set("Subtype","RL"),a.set("TargetUnitConversion",.1388889);var l=new $r;l.set("U","in"),l.set("Type","NumberFormat"),l.set("C",1),l.set("D",1),l.set("SS",""),o.push(l);var f=new $r;f.set("U","°"),f.set("Type","NumberFormat"),f.set("C",1),f.set("D",1),f.set("FD",!0),f.set("SS",""),h.push(f);var p=new $r;p.set("U","sq in"),p.set("Type","NumberFormat"),p.set("C",1),p.set("D",1),p.set("FD",!0),p.set("SS",""),c.push(p);var u=new $r;u.set("U","cu in"),u.set("Type","NumberFormat"),u.set("C",1),u.set("D",1),u.set("FD",!0),u.set("SS",""),d.push(u);var g=new $r;g.set("U","in"),g.set("Type","NumberFormat"),g.set("C",1),g.set("D",1),g.set("SS",""),_.push(g),a.set("D",o),a.set("T",h),a.set("A",c),a.set("X",_),a.set("V",d),this._dictionary.has("Measure")&&At(this._dictionary,this._crossReference,"Measure");var y=this._crossReference._getNextReference();this._crossReference._cacheMap.set(y,a),a._updated=!0,this._dictionary.update("Measure",y);var m=[0,0,0,0],b=this._getAngleBoundsValue(),v=this._obtainLinePoints(),w=[];w.push(0);for(var S=1;S<v.length;S++)w.push(1);(new oi).addRectangle(v[1][0]-this._radius,-(v[1][1]+this._radius),2*this._radius,2*this._radius);var P=i.measureString(n.toString()+"°",[0,0],r,0,0),A=[(this._firstIntersectionPoint[0]+this._secondIntersectionPoint[0])/2,(this._firstIntersectionPoint[1]+this._secondIntersectionPoint[1])/2],x=[v[1][0],-v[1][1]],k=v[1][0]+this._radius*Math.cos((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),C=v[1][1]+this._radius*Math.sin((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),T=[A[0],A[1]],R=T[0]-x[0],F=T[1]-x[1],L=Math.atan2(F,R)*(180/Math.PI),D=!1,B=!1,O=!1,I=!1;L>0?L<45?B=!0:L>=45&&L<135?O=!0:D=!0:0===(L=-L)?(new oi).addRectangle(b[0],b[1],b[2],b[3]):L<45?B=!0:L>=45&&L<135?I=!0:D=!0,0===m[0]&&0===m[1]&&0===m[2]&&0===m[3]&&(m=b,this.bounds={x:b[0],y:b[1],width:b[2],height:b[3]});var M=new oi;M._pathTypes=w,M._points=v,this._dictionary.set("Rect",[m[0],m[1],m[0]+m[2],m[1]+m[3]]);var N=new Pi({x:b[0],y:b[1],width:b[2],height:b[3]},this);N.normal=new fe(m,this._crossReference);var E=N.normal;E._writeTransformation=!1;var j=N.normal.graphics,V=e/2,z=new xr(this._color,V);this.border.style===t.PdfBorderStyle.dashed&&(z._dashStyle=t.PdfDashStyle.dash);var U=new Ar(this._color);j.save(),j.drawPath(M,z),M.addArc(v[1][0]-this._radius,v[1][1]-this._radius,2*this._radius,2*this._radius,this._startAngle,this._sweepAngle),O?j.drawString(n.toString()+"°",i,[k-P[0]/2,-(-C+i._metrics._getHeight()+2),0,0],null,U):B?j.drawString(n.toString()+"°",i,[k+2,-(-C+i._metrics._getHeight()/2),0,0],null,U):D?j.drawString(n.toString()+"°",i,[k-P[0]-2,-(-C+i._metrics._getHeight()/2),0,0],null,U):I&&j.drawString(n.toString()+"°",i,[k-P[0]/2,C+2,0,0],null,U),j.restore(),j._template._content.dictionary._updated=!0;var W=this._crossReference._getNextReference();this._crossReference._cacheMap.set(W,j._template._content),j._template._content.reference=W,this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var H=new $r;return H.set("N",W),H._updated=!0,this._dictionary.set("AP",H),E},i.prototype._getAngleBoundsValue=function(){for(var t=this._obtainLinePoints(),e=0;e<t.length;e++)t[e][1]=-t[e][1];var i=new oi;return i._points=t,i._pathTypes=[0,1,1],i._getBounds()},i.prototype._obtainLinePoints=function(){var t,e;if(this._linePoints){t=this._linePoints.slice(),e=new Array(t.length/2);for(var i=0,r=0;r<t.length;r+=2)e[i]=[t[r],-t[r+1]],i++}return e},i.prototype._calculateAngle=function(){var t=[0,0];void 0!==this._linePoints&&0===this._linePoints.length&&this._isLoaded&&this._dictionary.has("Vertices")&&(this._linePoints=this._dictionary.get("Vertices")),t=this._linePoints.slice();for(var e=[],i=0;i<t.length;i+=2)e.push([t[i],t[i+1]]);var r=e[0],n=e[1],s=e[2],a=Math.sqrt(Math.pow(n[0]-r[0],2)+Math.pow(n[1]-r[1],2)),o=Math.sqrt(Math.pow(n[0]-s[0],2)+Math.pow(n[1]-s[1],2));this._radius=Math.min(a,o)/4;var h=new oi;h._points=e,h._pathTypes=[0,1,1];var c,_,d=this._findLineCircleIntersectionPoints(n[0],n[1],this._radius,r,n,c,_);c=d.first,_=d.second,0===this._firstIntersectionPoint[0]&&0===this._firstIntersectionPoint[1]&&(this._firstIntersectionPoint=_),c=[0,0],_=[0,0],c=(d=this._findLineCircleIntersectionPoints(n[0],n[1],this._radius,s,n,c,_)).first,_=d.second,0===this._secondIntersectionPoint[0]&&0===this._secondIntersectionPoint[1]&&(this._secondIntersectionPoint=_);var l=this._firstIntersectionPoint[0]-n[0],f=this._firstIntersectionPoint[1]-n[1],p=Math.atan2(f,l)*(180/Math.PI);l=this._secondIntersectionPoint[0]-n[0],f=this._secondIntersectionPoint[1]-n[1];var u=Math.atan2(f,l)*(180/Math.PI);return p=p>0?p=360-p:-p,u=u>0?u=360-u:-u,180===p&&0===u?(this._startAngle=p,this._sweepAngle=180):0===p&&180===u?(this._startAngle=u,this._sweepAngle=180):p<180?p>u?(this._startAngle=u,this._sweepAngle=p-u):p+180<u?(this._startAngle=u,this._sweepAngle=360-u+p):(this._startAngle=p,this._sweepAngle=u-p):p<u?(this._startAngle=p,this._sweepAngle=u-p):p-180>u?(this._startAngle=p,this._sweepAngle=360-p+u):(this._startAngle=u,this._sweepAngle=p-u),Math.atan2(s[0]-n[0],s[1]-n[1])-Math.atan2(r[0]-n[0],r[1]-n[1])},i.prototype._findLineCircleIntersectionPoints=function(t,e,i,r,n,s,a){var o=n[0]-r[0],h=n[1]-r[1],c=o*o+h*h,_=2*(o*(r[0]-t)+h*(r[1]-e)),d=_*_-4*c*((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e)-i*i);if(c<=1e-7||d<0)s=[Number.NaN,Number.NaN],a=[Number.NaN,Number.NaN];else if(0===d){l=-_/(2*c);s=[r[0]+l*o,r[1]+l*h],a=[Number.NaN,Number.NaN]}else{var l=(-_+Math.sqrt(d))/(2*c);s=[r[0]+l*o,r[1]+l*h],l=(-_-Math.sqrt(d))/(2*c),a=[r[0]+l*o,r[1]+l*h]}return{first:s,second:a}},i}(ki),Ii=function(e){function i(i,r){var n=e.call(this)||this;return n._inkPointsCollection=[],n._previousCollection=[],n._isModified=!1,n._isEnableControlPoints=!0,n._dictionary=new $r,n._dictionary.update("Type",Xr.get("Annot")),n._dictionary.update("Subtype",Xr.get("Ink")),void 0!==i&&(n._points=i,n.bounds={x:i[0],y:i[1],width:i[2],height:i[3]}),void 0!==r&&(n._linePoints=r),n._type=t._PdfAnnotationType.inkAnnotation,n}return Ai(i,e),Object.defineProperty(i.prototype,"inkPointsCollection",{get:function(){if(0===this._inkPointsCollection.length&&this._dictionary.has("InkList")){var t=this._dictionary.get("InkList");Array.isArray(t)&&t.length>0&&(this._inkPointsCollection=t)}return this._inkPointsCollection},set:function(t){Array.isArray(t)&&t.length>0&&t!==this._inkPointsCollection&&(this._inkPointsCollection=t,this._isModified=!0,this._isLoaded&&this._dictionary.update("InkList",t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");var t;this._dictionary.has("BS")?t=this.border.width:((s=new $r(this._crossReference)).set("Type",Xr.get("Border")),this._dictionary.set("BS",s)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===t&&(t=1);var e=this._addInkPoints(),i=[e.x,e.y,e.x+e.width,e.y+e.height];if(this._dictionary.update("Rect",i),this._setAppearance){var r=new Pi(e,this);r.normal=new fe(e,this._crossReference);var n=r.normal;et(n,this._getRotationAngle()),n._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(n),this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var s=new $r;this._appearanceTemplate._content.dictionary._updated=!0;var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=a,s.set("N",a),s._updated=!0,this._dictionary.set("AP",s)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isFlatten=t,this._isLoaded){if(this._setAppearance||t&&!this._dictionary.has("AP")){0===this._inkPointsCollection.length&&(this._inkPointsCollection=this._obtainInkListCollection());var e=this._getInkBoundsValue(),i=(o=new fe(e,this._crossReference))._content.dictionary.getArray("BBox"),r=this._getRotationAngle();if(i&&null!==r&&void 0!==r&&o._content.dictionary.set("Matrix",[1,0,0,1,-i[0],-i[1]]),o._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(o),this._dictionary.update("Rect",[e[0],e[1],e[0]+e[2],e[1]+e[3]]),!t){this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var n=new $r;this._appearanceTemplate._content.dictionary._updated=!0;a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=a,n.set("N",a),n._updated=!0,this._dictionary.set("AP",n)}}if(!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(n=this._dictionary.get("AP"))&&n.has("N")){var s=n.get("N"),a=n.getRaw("N");s&&(a&&(s.reference=a),this._appearanceTemplate=new fe(s,this._crossReference))}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){if((n=this._dictionary.get("AP"))&&n.has("N")){var s=n.get("N"),a=n.getRaw("N");s&&(a&&(s.reference=a),this._appearanceTemplate=new fe(s,this._crossReference))}}else{0===this._inkPointsCollection.length&&(this._inkPointsCollection=this._obtainInkListCollection());var e=this._getInkBoundsValue(),o=new fe(e,this._crossReference);et(o,this._getRotationAngle()),o._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(o),this._dictionary.update("Rect",[e[0],e[1],e[0]+e[2],e[1]+e[3]])}if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate&&null!==this._appearanceTemplate._size&&void 0!==this._appearanceTemplate._size){var h=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._appearanceTemplate._content.dictionary.has("Matrix")||(i=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-i[0],-i[1]]),this._flattenAnnotationTemplate(this._appearanceTemplate,h)}else t&&this._page.annotations.remove(this);if(t&&!this.flattenPopups&&this._dictionary.has("Popup")){a=this._dictionary.getRaw("Popup");if(this._page._pageDictionary.has("Annots")){var c=this._page._pageDictionary.getRaw("Annots");if(c&&Array.isArray(c)&&c.length>0){var _=c.indexOf(a);_>=0&&this._page.annotations.removeAt(_)}}}},i.prototype._createInkAppearance=function(e){var i=e.graphics;if(null!==this._inkPointsCollection&&this._inkPointsCollection.length>0&&null!==this.color&&void 0!==this._color){for(var r=0;r<this._inkPointsCollection.length;r++){var n=!1;if(this._inkPointsCollection[r].length%2==0){var s=this._inkPointsCollection[r];2===s.length&&(s=[s[0]-.5,s[1]-.5,s[0]+.5,s[1]+.5],n=!0);for(var a=new Array(s.length/2),o=0,h=0;h<s.length;h+=2)a[o]=[s[h],s[h+1]],o++;var c=o+2*o-2,_=new Array(c);if(this._isEnableControlPoints){var d=[],l=[],f=this._getControlPoints(a,d,l);d=f.controlP1,l=f.controlP2;for(var p=0,u=0;u<c-1;u+=3)_[u]=a[p],_[u+1]=d[p],_[u+2]=l[p],p++}else if(o%3==1)c=o,_=new Array(c),_=a;else if(o%3==0){c=o+1,_=new Array(c);for(u=0;u<a.length;u++)_[u]=a[u]}else{c=o+2,_=new Array(c);for(u=0;u<a.length;u++)_[u]=a[u];_[c-2]=a[a.length-2]}if(_[c-1]=a[a.length-1],null!==_){for(var g=_,y=0;y<g.length;y++){var m=g[y];g[y]=[m[0],-m[1]]}var b=new oi,v=null;if(n){var w=a[1][0]-a[0][0],S=a[1][1]-a[0][1];b.addEllipse(a[0][0]+.5,-(a[0][1]+S+.5),w,S),(v=new oi)._pathTypes=b._pathTypes,v._points=b._points}else 2===a.length?(b.addLine(a[0][0],-a[0][1],a[1][0],-a[1][1]),(v=new oi)._pathTypes=b._pathTypes,v._points=b._points):(b._addBezierPoints(g),(v=new oi)._pathTypes=b._pathTypes,v._points=g);var P=new xr(this.color,this.border.width);if(this._isLoaded&&(P._lineCap=t.PdfLineCap.round),void 0!==this.opacity&&this._opacity<1){var A=i.save();i.setTransparency(this._opacity),i.drawPath(v,P),i.restore(A)}else i.drawPath(v,P)}}}if(this._isFlatten)if(this._page&&this._page._isNew&&this._page._pageSettings&&this._page._pageSettings.margins){var x=this._page._pageSettings.margins;this.bounds={x:this.bounds.x-x.left,y:this._page.size[1]-(this.bounds.y+this.bounds.height)-x.top,width:this.bounds.width,height:this.bounds.height}}else this.bounds={x:this.bounds.x,y:this._page.size[1]-(this.bounds.y+this.bounds.height),width:this.bounds.width,height:this.bounds.height}}return e},i.prototype._getControlPoints=function(t,e,i){if(null===t)throw new Error("pointCollection");var r=t.length-1;if(r<1)throw new Error("At least two knot PointFs required pointCollection");1===r&&(i=[[2*(e=[[(2*t[0][0]+t[1][0])/3,(2*t[0][1]+t[1][1])/3]])[0][0]-t[0][0],2*e[0][1]-t[0][1]]]);for(var n=[],s=1;s<r-1;++s)n[s]=4*t[s][0]+2*t[s+1][0];n[0]=t[0][0]+2*t[1][0],n[r-1]=(8*t[r-1][0]+t[r][0])/2;for(var a=this._getSingleControlPoint(n),s=1;s<r-1;++s)n[s]=4*t[s][1]+2*t[s+1][1];n[0]=t[0][1]+2*t[1][1],n[r-1]=(8*t[r-1][1]+t[r][1])/2;var o=this._getSingleControlPoint(n);e=new Array(r),i=new Array(r);for(s=0;s<r;++s)if(e[s]=[a[s],o[s]],s<r-1)i[s]=[2*t[s+1][0]-a[s+1],2*t[s+1][1]-o[s+1]];else{var h=(t[r][0]+a[r-1])/2,c=(t[r][1]+o[r-1])/2;i[s]=[h,c]}return{controlP1:e,controlP2:i}},i.prototype._getSingleControlPoint=function(t){var e=t.length,i=[],r=[],n=2;i[0]=t[0]/n;for(s=1;s<e;s++)r[s]=1/n,n=(s<e-1?4:3.5)-r[s],i[s]=(t[s]-i[s-1])/n;for(var s=1;s<e;s++)i[e-s-1]-=r[e-s]*i[e-s];return i},i.prototype._addInkPoints=function(){var t,e=this,i=[];null===this._linePoints||0!==this._previousCollection.length&&!this._isModified||this._inkPointsCollection.unshift(this._linePoints);var r=Bt(this._inkPointsCollection,this._previousCollection);null===this._inkPointsCollection||r||(this._inkPointsCollection.forEach(function(t){var e=t.slice();i.push(e)}),this._dictionary.update("InkList",i)),this._inkPointsCollection.length>0&&(!r||this._isModified)&&((t=this._previousCollection).push.apply(t,this._inkPointsCollection),this._isModified=!1);var n=this._getCropOrMediaBox(),s=!1;if(n&&n.length>3&&"number"==typeof n[0]&&"number"==typeof n[1]&&(0!==n[0]||0!==n[1])&&(s=!0,i.forEach(function(t,r){for(var s=t,a=0;a<t.length;a+=2){var o=t[a],h=t[a+1];o+=n[0],e._page._pageDictionary.has("MediaBox")&&!e._page._pageDictionary.has("CropBox")&&0===n[3]&&n[1]>0?h+=n[3]:h+=n[1],s[a]=o,s[a+1]=h,i[r]=s}}),this._dictionary.update("InkList",i)),this._isEnableControlPoints||s){var a=this._getInkBoundsValue(i);return{x:a[0],y:a[1],width:a[2],height:a[3]}}return this._isFlatten||this._updateInkListCollection(i),this.bounds},i.prototype._updateInkListCollection=function(t){var e=this;t.forEach(function(t,i){e._inkPointsCollection[i]=t.slice()})},i.prototype._getInkBoundsValue=function(t){var e=[0,0,0,0];this._points&&(this.bounds={x:this._points[0],y:this._points[1],width:this._points[2],height:this._points[3]}),e=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];var i=this.border.width;if(null!==this._inkPointsCollection&&this._inkPointsCollection.length>0){var r=[];this._inkPointsCollection.forEach(function(t){null!==t&&t.length%2==0&&r.push.apply(r,t)});var n=!1;this._isLoaded||2!==r.length||(n=!0,r.push(r[0]+1),r.push(r[1]+1));for(var s=new Array(r.length/2),a=0,o=0;o<r.length;o+=2)s[a]=[r[o],r[o+1]],a++;if(this._isLoaded)if(s.length>0){var h=0,c=0,_=0,d=0,l=!0;s.forEach(function(t){l?(h=t[0],c=t[1],l=!1):(t[0]<h?h=t[0]:t[0]>_&&(_=t[0]),t[1]<c?c=t[1]:t[1]>d&&(d=t[1]))}),e=[h,c,_-h,d-c],this.bounds={x:e[0],y:e[1],width:e[2],height:e[3]},(this._isFlatten||this._setAppearance)&&(e[0]=this.bounds.x-i,e[1]=this.bounds.y-i,e[2]=this.bounds.width+2*i,e[3]=this.bounds.height+2*i)}else e=this._points?this._points:s.length>0?this._dictionary.get("Rect"):[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];else e=t?this._calculateInkBounds(s,e,i,n,t):this._calculateInkBounds(s,e,i,n);this.bounds={x:e[0],y:e[1],width:e[2],height:e[3]}}return e},i.prototype._calculateInkBounds=function(t,e,i,r,n){if(t.length>5){var s=0,a=0,o=0,h=0,c=!0;t.forEach(function(t){c?(s=t[0],a=t[1],o=t[0],h=t[1],c=!1):(t[0]<s?s=t[0]:t[0]>o&&(o=t[0]),t[1]<a?a=t[1]:t[1]>h&&(h=t[1]))});var _=this._getCropOrMediaBox();if(e[2]<o?o=e[2]:_&&(o-=s),e[3]<h?h=e[3]:_&&(h-=a),_&&(s+=_[0],a+=_[1]),e=[s,a,o,h],this._isFlatten||this._setAppearance){var d=r?2:3;e[0]=e[0]-i,e[1]=e[1]-i,e[2]=e[2]+d*i,e[3]=e[3]+d*i}}else e=void 0===this._points&&t.length>0?this._dictionary.get("Rect"):this._points;return!this._isFlatten&&n&&this._updateInkListCollection(n),e},i.prototype._obtainInkListCollection=function(){var t=[];if(this._dictionary.has("InkList"))for(var e=this._dictionary.getArray("InkList"),i=[],r=0;r<e.length;r++){for(var n=e[r],s=0;s<n.length;s++)i.push(n[s]);t.push(i),i.length===n.length&&(i=[])}return t},i}(ki),Mi=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._icon=t.PdfPopupIcon.note,o._iconString="",o._stateModel=t.PdfAnnotationStateModel.none,o._state=t.PdfAnnotationState.none,o._open=!1,o._isReview=!1,o._isComment=!1,o._comment="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 9 5.0908 cm 7.74 12.616 m -7.74 12.616 l -8.274 12.616 -8.707 12.184 -8.707 11.649 c h f Q 0 G ",o._commentSecondHalf="0 i 0.60 w 4 M 1 j 0 J [0 100]1 d 1 0 0 1 9 5.0908 cm 4.1 1.71 m -0.54 -2.29 l -0.54 1.71 l -5.5 1.71 l -5.5 14.42 l 10.5 14.42 l 10.5 1.71 l 4.1 1.71 l -2.33 9.66 m 7.34 9.66 l 7.34 8.83 l -2.33 8.83 l -2.33 9.66 l -2.33 7.28 m 5.88 7.28 l 5.88 6.46 l -2.33 6.46 l -2.33 7.28 l 14.9 23.1235 m -14.9 23.1235 l -14.9 -20.345 l 14.9 -20.345 l 14.9 23.1235 l b ",o._note="0 G 0 i 0.61 w 4 M 0 j 0 J []0 d q 1 0 0 1 16.959 1.3672 cm 0 0 m 0 -0.434 -0.352 -0.785 -0.784 -0.785 c -14.911 -0.785 l -15.345 -0.785 -15.696 -0.434 -15.696 0 c -15.696 17.266 l -15.696 17.699 -15.345 18.051 -14.911 18.051 c -0.784 18.051 l -0.352 18.051 0 17.699 0 17.266 c h b Q q 1 0 0 1 4.4023 13.9243 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4019 11.2207 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4023 8.5176 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4023 5.8135 cm 0 0 m 9.418 0 l S Q ",o._help="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 12.1465 10.5137 cm -2.146 9.403 m -7.589 9.403 -12.001 4.99 -12.001 -0.453 c -12.001 -5.895 -7.589 -10.309 -2.146 -10.309 c 3.296 -10.309 7.709 -5.895 7.709 -0.453 c 7.709 4.99 3.296 9.403 -2.146 9.403 c h f Q ",o._helpSecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d 1 0 0 1 12.1465 10.5137 cm 0 0 m -0.682 -0.756 -0.958 -1.472 -0.938 -2.302 c -0.938 -2.632 l -3.385 -2.632 l -3.403 -2.154 l -3.459 -1.216 -3.147 -0.259 -2.316 0.716 c -1.729 1.433 -1.251 2.022 -1.251 2.647 c -1.251 3.291 -1.674 3.715 -2.594 3.751 c -3.202 3.751 -3.937 3.531 -4.417 3.2 c -5.041 5.205 l -4.361 5.591 -3.274 5.959 -1.968 5.959 c 0.46 5.959 1.563 4.616 1.563 3.089 c 1.563 1.691 0.699 0.771 0 0 c -2.227 -6.863 m -2.245 -6.863 l -3.202 -6.863 -3.864 -6.146 -3.864 -5.189 c -3.864 -4.196 -3.182 -3.516 -2.227 -3.516 c -1.233 -3.516 -0.589 -4.196 -0.57 -5.189 c -0.57 -6.146 -1.233 -6.863 -2.227 -6.863 c -2.146 9.403 m -7.589 9.403 -12.001 4.99 -12.001 -0.453 c -12.001 -5.895 -7.589 -10.309 -2.146 -10.309 c 3.296 -10.309 7.709 -5.895 7.709 -0.453 c 7.709 4.99 3.296 9.403 -2.146 9.403 c b ",o._insert=" 0 i 0.59 w 4 M 0 j 0 J []0 d 1 0 0 1 8.5386 19.8545 cm 0 0 m -8.39 -19.719 l 8.388 -19.719 l h B ",o._key="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 6.5 12.6729 cm 0.001 5.138 m -2.543 5.138 -4.604 3.077 -4.604 0.534 c -4.604 -1.368 -3.449 -3.001 -1.802 -3.702 c -1.802 -4.712 l -0.795 -5.719 l -1.896 -6.82 l -0.677 -8.039 l -1.595 -8.958 l -0.602 -9.949 l -1.479 -10.829 l -0.085 -12.483 l 1.728 -10.931 l 1.728 -3.732 l 1.737 -3.728 1.75 -3.724 1.76 -3.721 c 3.429 -3.03 4.604 -1.385 4.604 0.534 c 4.604 3.077 2.542 5.138 0.001 5.138 c f Q ",o._keySecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d 1 0 0 1 6.5 12.6729 cm 0 0 m -1.076 0 -1.95 0.874 -1.95 1.95 c -1.95 3.028 -1.076 3.306 0 3.306 c 1.077 3.306 1.95 3.028 1.95 1.95 c 1.95 0.874 1.077 0 0 0 c 0.001 5.138 m -2.543 5.138 -4.604 3.077 -4.604 0.534 c -4.604 -1.368 -3.449 -3.001 -1.802 -3.702 c -1.802 -4.712 l -0.795 -5.719 l -1.896 -6.82 l -0.677 -8.039 l -1.595 -8.958 l -0.602 -9.949 l -1.479 -10.829 l -0.085 -12.483 l 1.728 -10.931 l 1.728 -3.732 l 1.737 -3.728 1.75 -3.724 1.76 -3.721 c 3.429 -3.03 4.604 -1.385 4.604 0.534 c 4.604 3.077 2.542 5.138 0.001 5.138 c b ",o._newParagraph="1 0.819611 0 rg 0 G 0 i 0.58 w 4 M 0 j 0 J []0 d ",o._newParagraphSecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d q 1 0 0 1 6.4995 20 cm 0 0 m -6.205 -12.713 l 6.205 -12.713 l h b Q q 1 0 0 1 1.1909 6.2949 cm 0 0 m 1.278 0 l 1.353 0 1.362 -0.02 1.391 -0.066 c 2.128 -1.363 3.78 -4.275 3.966 -4.713 c 3.985 -4.713 l 3.976 -4.453 3.957 -3.91 3.957 -3.137 c 3.957 -0.076 l 3.957 -0.02 3.976 0 4.041 0 c 4.956 0 l 5.021 0 5.04 -0.029 5.04 -0.084 c 5.04 -6.049 l 5.04 -6.113 5.021 -6.133 4.947 -6.133 c 3.695 -6.133 l 3.621 -6.133 3.611 -6.113 3.574 -6.066 c 3.052 -4.955 1.353 -2.063 0.971 -1.186 c 0.961 -1.186 l 0.999 -1.68 0.999 -2.146 1.008 -3.025 c 1.008 -6.049 l 1.008 -6.104 0.989 -6.133 0.933 -6.133 c 0.009 -6.133 l -0.046 -6.133 -0.075 -6.123 -0.075 -6.049 c -0.075 -0.066 l -0.075 -0.02 -0.056 0 0 0 c f Q q 1 0 0 1 9.1367 3.0273 cm 0 0 m 0.075 0 0.215 -0.008 0.645 -0.008 c 1.4 -0.008 2.119 0.281 2.119 1.213 c 2.119 1.969 1.633 2.381 0.737 2.381 c 0.354 2.381 0.075 2.371 0 2.361 c h -1.146 3.201 m -1.146 3.238 -1.129 3.268 -1.082 3.268 c -0.709 3.275 0.02 3.285 0.729 3.285 c 2.613 3.285 3.248 2.314 3.258 1.232 c 3.258 -0.27 2.007 -0.914 0.607 -0.914 c 0.327 -0.914 0.057 -0.914 0 -0.904 c 0 -2.789 l 0 -2.836 -0.019 -2.865 -0.074 -2.865 c -1.082 -2.865 l -1.119 -2.865 -1.146 -2.846 -1.146 -2.799 c h f Q ",o._paragraph="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 19.6973 10.0005 cm 0 0 m 0 -5.336 -4.326 -9.662 -9.663 -9.662 c -14.998 -9.662 -19.324 -5.336 -19.324 0 c -19.324 5.335 -14.998 9.662 -9.663 9.662 c -4.326 9.662 0 5.335 0 0 c h f Q ",o._paragraphSecondHalf="0 G 0 i 0.59 w 4 M 1 j 0 J []0 d q 1 0 0 1 19.6973 10.0005 cm 0 0 m 0 -5.336 -4.326 -9.662 -9.663 -9.662 c -14.998 -9.662 -19.324 -5.336 -19.324 0 c -19.324 5.335 -14.998 9.662 -9.663 9.662 c -4.326 9.662 0 5.335 0 0 c h S Q q 1 0 0 1 11.6787 2.6582 cm 0 0 m -1.141 0 l -1.227 0 -1.244 0.052 -1.227 0.139 c -0.656 1.157 -0.52 2.505 -0.52 3.317 c -0.52 3.594 l -2.833 3.783 -5.441 4.838 -5.441 8.309 c -5.441 10.778 -3.714 12.626 -0.57 13.024 c -0.535 13.508 -0.381 14.129 -0.242 14.389 c -0.207 14.44 -0.174 14.475 -0.104 14.475 c 1.088 14.475 l 1.156 14.475 1.191 14.458 1.175 14.372 c 1.105 14.095 0.881 13.127 0.881 12.402 c 0.881 9.431 0.932 7.324 0.95 4.06 c 0.95 2.298 0.708 0.813 0.189 0.07 c 0.155 0.034 0.103 0 0 0 c b Q ",o._dictionary=new $r,o._dictionary.update("Type",Xr.get("Annot")),o._dictionary.update("Subtype",Xr.get("Text")),void 0!==i&&(o.text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a}),o._type=t._PdfAnnotationType.popupAnnotation,o}return Ai(i,e),Object.defineProperty(i.prototype,"open",{get:function(){return this._dictionary.has("Open")&&(this._open=this._dictionary.get("Open")),this._open},set:function(t){void 0!==t&&(this._open=t,this._dictionary.update("Open",this._open))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=ct(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",Xr.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"stateModel",{get:function(){return this._dictionary.has("StateModel")&&(this._stateModel=ft(this._dictionary.get("StateModel"))),this._stateModel},set:function(t){void 0!==t&&(this._stateModel=t,this._dictionary.update("StateModel",lt(this._stateModel)))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"state",{get:function(){return this._dictionary.has("State")&&(this._state=dt(this._dictionary.get("State"))),this._state},set:function(t){void 0!==t&&(this._state=t,this._dictionary.update("State",_t(this._state)))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),e.has("IRT")&&(r._isReview=wt(e),r._isReview||(r._isComment=St(e))),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){void 0!==this.bounds&&null!==this.bounds||(this._bounds={x:0,y:0,width:0,height:0});var t;this._dictionary.has("BS")?t=this.border.width:((i=new $r(this._crossReference)).set("Type",Xr.get("Border")),this._dictionary.set("BS",i)),void 0===t&&(t=1);var e=[this.bounds.x,this.bounds.y,this.bounds.x+this.bounds.width,this.bounds.y+this.bounds.height];if(this._dictionary.update("Rect",e),this._setAppearance&&(this._appearanceTemplate=this._createPopupAppearance(),this._appearanceTemplate)){this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var i=new $r;this._appearanceTemplate._content.dictionary._updated=!0;var r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=r,i.set("N",r),i._updated=!0,this._dictionary.set("AP",i)}this._dictionary.update("Rect",Ot(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if(!this._appearanceTemplate&&this._isFlattenPopups&&this._dictionary.has("AP")&&(n=this._dictionary.get("AP"))&&n.has("N")){var e=n.get("N"),i=n.getRaw("N");if(e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference)),null!==this._appearanceTemplate){var r=this._page.graphics.save();this.opacity<1&&this._page.graphics.setTransparency(this.opacity),this._page.graphics.drawTemplate(this._appearanceTemplate,this.bounds),this._page.graphics.restore(r)}}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var n=this._dictionary.get("AP");if(n&&n.has("N")){var e=n.get("N"),i=n.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new fe(e,this._crossReference))}}else this._appearanceTemplate=this._createPopupAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&this.flatten&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,s)}t&&this._removeAnnotation(this._page,this)},i.prototype._createPopupAppearance=function(){var e=[0,0,this.bounds.width,this.bounds.height],i=new fe(e,this._crossReference),r=i.graphics;switch(r._sw._clear(),this.opacity<1&&(r.save(),r.setTransparency(this.opacity)),this.icon){case t.PdfPopupIcon.comment:r._sw._write(this._comment),r._sw._setColorSpace(this.color,t._PdfColorSpace.rgb,!1),r._sw._write(this._commentSecondHalf);break;case t.PdfPopupIcon.paragraph:r._sw._write(this._paragraph),r._sw._setColorSpace(this.color,t._PdfColorSpace.rgb,!1),r._sw._write(this._paragraphSecondHalf);break;case t.PdfPopupIcon.help:r._sw._write(this._help),r._sw._setColorSpace(this.color,t._PdfColorSpace.rgb,!1),r._sw._write(this._helpSecondHalf);break;case t.PdfPopupIcon.note:r._sw._setColorSpace(this.color,t._PdfColorSpace.rgb,!1),r._sw._write(this._note);break;case t.PdfPopupIcon.insert:r._sw._write("0 G "),r._sw._setColorSpace(this.color,t._PdfColorSpace.rgb,!1),r._sw._write(this._insert);break;case t.PdfPopupIcon.key:r._sw._write(this._key),r._sw._setColorSpace(this.color,t._PdfColorSpace.rgb,!1),r._sw._write(this._keySecondHalf);break;case t.PdfPopupIcon.newParagraph:r._sw._write(this._newParagraph),r._sw._setColorSpace(this.color,t._PdfColorSpace.rgb,!1),r._sw._write(this._newParagraphSecondHalf)}return this.opacity<1&&r.restore(),i},i.prototype._obtainIconName=function(e){switch(e){case t.PdfPopupIcon.note:this._iconString="Note";break;case t.PdfPopupIcon.comment:this._iconString="Comment";break;case t.PdfPopupIcon.help:this._iconString="Help";break;case t.PdfPopupIcon.insert:this._iconString="Insert";break;case t.PdfPopupIcon.key:this._iconString="Key";break;case t.PdfPopupIcon.newParagraph:this._iconString="NewParagraph";break;case t.PdfPopupIcon.paragraph:this._iconString="Paragraph"}return this._iconString},i}(ki),Ni=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._dictionary=new $r,o._dictionary.update("Type",Xr.get("Annot")),o._dictionary.update("Subtype",Xr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(o.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&null!==a&&(o._fileName=a),o._type=t._PdfAnnotationType.fileLinkAnnotation,o}return Ai(i,e),Object.defineProperty(i.prototype,"action",{get:function(){var t=this;if(void 0===this._action&&this._dictionary.has("A")){var e=this._dictionary.get("A");if(e&&e.has("Next")){var i=e.get("Next");Array.isArray(i)&&i.forEach(function(e){if(e&&e instanceof Qr){var i=t._crossReference._fetch(e);i.has("JS")&&(t._action=i.get("JS"))}})}}return this._action},set:function(t){var e=this;if(this._isLoaded||"string"!=typeof t||(this._action=t),this._isLoaded&&"string"==typeof t&&this.action!==t&&this._dictionary.has("A")){var i=this._dictionary.get("A");if(i&&i.has("Next")){var r=i.get("Next");Array.isArray(r)&&r.forEach(function(i){if(i&&i instanceof Qr){var r=e._crossReference._fetch(i);r.has("JS")&&(r.update("JS",t),e._action=t,e._dictionary._updated=!0)}})}}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new $r(this._crossReference);e.set("Type",Xr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",Ot(this))},i.prototype._addAction=function(){var t=this;if(this._dictionary.has("A")){var e=this._dictionary.get("A");if(e){if(void 0!==this._action&&null!==this._action&&e.has("Next")){var i=e.get("Next");Array.isArray(i)&&i.length>0&&i.forEach(function(e){e&&e instanceof Qr&&e._isNew&&t._crossReference._cacheMap.delete(e)})}e.has("F")&&At(e,this._crossReference,"F")}At(this._dictionary,this._crossReference,"A")}var r=new $r;r.set("Type",Xr.get("Action")),r.set("S",Xr.get("Launch"));var n=new $r;if(n.set("Type",Xr.get("Filespec")),n.set("UF",this._fileName),void 0!==this._action&&null!==this._action){var s=new $r;s.set("Type",Xr.get("Action")),s.set("S",Xr.get("JavaScript")),s.set("JS",this._action);var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,s),s._updated=!0,r.set("Next",[a])}var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,n),n._updated=!0,r.set("F",o),r._updated=!0,this._dictionary.set("A",r)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new fe(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(xi),Ei=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._dictionary=new $r,o._dictionary.update("Type",Xr.get("Annot")),o._dictionary.update("Subtype",Xr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(o.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&null!==a&&(o._uri=a),o._type=t._PdfAnnotationType.uriAnnotation,o}return Ai(i,e),Object.defineProperty(i.prototype,"uri",{get:function(){if(void 0===this._uri&&this._dictionary.has("A")){var t=this._dictionary.get("A");t.has("URI")&&(this._uri=t.get("URI"))}return this._uri},set:function(t){if("string"==typeof t)if(this._isLoaded&&this._dictionary.has("A")&&t!==this.uri){var e=this._dictionary.get("A");e.has("URI")&&(this._uri=t,e.update("URI",t),this._dictionary._updated=!0)}else this._uri=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new $r(this._crossReference);e.set("Type",Xr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",Ot(this))},i.prototype._addAction=function(){var t=new $r;t.set("Type",Xr.get("Action")),t.set("S",Xr.get("URI")),void 0!==this._uri&&t.set("URI",this._uri),t._updated=!0,this._dictionary.set("A",t),this._dictionary.update("Border",[this.border.hRadius,this.border.vRadius,this.border.width])},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new fe(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(xi),ji=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new $r,a._dictionary.update("Type",Xr.get("Annot")),a._dictionary.update("Subtype",Xr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.documentLinkAnnotation,a}return Ai(i,e),Object.defineProperty(i.prototype,"destination",{get:function(){if(this._isLoaded&&!this._destination){var t=void 0;if(this._dictionary.has("Dest"))t=new gr(this._dictionary,"Dest"),this.destination=t._obtainDestination();else if(!this._destination&&this._dictionary.has("A")){var e=this._dictionary.get("A");e&&e instanceof $r&&e.has("D")&&(t=new gr(e,"D"),this.destination=t._obtainDestination())}}return this._destination},set:function(t){t&&(this._destination=t,this._isLoaded&&this._destination._initializePrimitive())},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._addDocument(),this._dictionary.update("Rect",Ot(this))},i.prototype._addDocument=function(){this.destination&&this._dictionary.set("Dest",this.destination._array)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded?this._destination&&this._dictionary.update("Dest",this._destination._array):this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new fe(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(xi),Vi=function(e){function i(i,r,n,s,a,o,h,c){var _=e.call(this)||this;return _._isActionAdded=!1,_._dictionary=new $r,_._dictionary.update("Type",Xr.get("Annot")),_._dictionary.update("Subtype",Xr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(_.bounds={x:i,y:r,width:n,height:s}),_._textWebLink=void 0!==c&&null!==c?c:"",void 0!==a&&null!==a&&(_._brush=new Ar(a)),void 0!==o&&null!==o&&(_._pen=new xr(o,h||1)),_._type=t._PdfAnnotationType.textWebLinkAnnotation,_}return Ai(i,e),Object.defineProperty(i.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"url",{get:function(){if(void 0===this._url&&this._dictionary.has("A")){var t=this._dictionary.get("A");t.has("URI")&&(this._url=t.get("URI"))}return this._url},set:function(t){if("string"==typeof t)if(this._isLoaded&&this._dictionary.has("A")){var e=this._dictionary._get("A"),i=this._dictionary.get("A");i&&i.has("URI")&&(this._url=t,i.update("URI",t),e instanceof Qr||(this._dictionary._updated=i._updated))}else this._url=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._isActionAdded||(this._addAction(),this._isActionAdded=!0),this._dictionary.update("Rect",Ot(this))},i.prototype._addAction=function(){var e=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];void 0!==this.font&&null!==this.font||(this.font=this._lineCaptionFont);var i=new pe(t.PdfTextAlignment.left,t.PdfVerticalAlignment.top);this._page.graphics.drawString(this._textWebLink,this.font,e,this._pen,this._brush,i);var r=new $r;r.set("Type",Xr.get("Action")),r.set("S",Xr.get("URI")),void 0!==this._url&&r.set("URI",this._url),r._updated=!0,this._dictionary.set("A",r),this._dictionary.update("Border",[0,0,0])},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new fe(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(xi),zi=function(e){function i(i,r,n,s,a,o){var h=e.call(this)||this;return h._icon=t.PdfAttachmentIcon.pushPin,h._iconString="",h._dictionary=new $r,h._dictionary.update("Type",Xr.get("Annot")),h._dictionary.update("Subtype",Xr.get("FileAttachment")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(h.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&(h._fileName=a),h._stream=new nn("string"==typeof o?k(o):o),h._type=t._PdfAnnotationType.fileAttachmentAnnotation,h}return Ai(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=pt(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",Xr.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._dictionary.update("Rect",Ot(this)),this._addAttachment()},i.prototype._addAttachment=function(){if(this._dictionary.has("FS")){var t=this._dictionary.get("FS");if(t&&t.has("EF")){var e=t.get("EF");e&&e.has("F")&&At(e,this._crossReference,"F")}At(this._dictionary,this._crossReference,"FS")}var i=new $r;i.set("Type",Xr.get("Filespec")),i.set("Desc",this._fileName),i.set("F",this._fileName),i.set("UF",this._fileName);var r=new $r;r.set("Type",Xr.get("EmbeddedFile"));var n=new $r,s=new Date;n.set("CreationDate",s.toTimeString()),n.set("ModDate",(new Date).toTimeString()),n.set("Size",this._stream.length),r.set("Params",n),this._stream.dictionary=new $r,this._stream.dictionary=r,r._crossReference=this._crossReference;var a=[this._crossReference._newLine.charCodeAt(0),this._crossReference._newLine.charCodeAt(1),37,80,68,70,45];r._crossReference._writeObject(this._stream,a);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,this._stream),r._updated=!0;var h=new $r;h.set("F",o),i.set("EF",h);var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,i),i._updated=!0,this._dictionary.update("FS",c)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new fe(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i.prototype._obtainIconName=function(e){switch(e){case t.PdfAttachmentIcon.pushPin:this._iconString="PushPin";break;case t.PdfAttachmentIcon.tag:this._iconString="Tag";break;case t.PdfAttachmentIcon.graph:this._iconString="Graph";break;case t.PdfAttachmentIcon.paperClip:this._iconString="Paperclip"}return this._iconString},i}(ki),Ui=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.movieAnnotation,i}return Ai(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new fe(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(xi),Wi=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._textMarkupType=t.PdfTextMarkupAnnotationType.highlight,o._quadPoints=new Array(8),o._boundsCollection=[],o._dictionary=new $r,o._dictionary.update("Type",Xr.get("Annot")),void 0!==i&&(o._text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a}),o._type=t._PdfAnnotationType.textMarkupAnnotation,o}return Ai(i,e),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._isLoaded&&(this._bounds=L(this._dictionary,this._page)),this._bounds},set:function(t){if(t)if(this._isLoaded){if(t.x!==this.bounds.x||t.y!==this.bounds.y||t.width!==this.bounds.width||t.height!==this.bounds.height){var e=this._page.size;if(e){var i=e[1]-(t.y+t.height),r=i+t.height;this._dictionary.update("Rect",[t.x,i,t.x+t.width,r]),this._bounds=t,this._isChanged=!0}}}else{this._bounds=t;var n=this._obtainNativeRectangle();this._dictionary.update("Rect",B({x:n[0],y:n[1],width:n[2],height:n[3]})),this._isChanged=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textMarkUpColor",{get:function(){return void 0===this._textMarkUpColor&&this._dictionary.has("C")&&(this._textMarkUpColor=M(this._dictionary.getArray("C"))),this._textMarkUpColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.color;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._color=t,this._textMarkUpColor=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textMarkupType",{get:function(){if(this._dictionary.has("Subtype")){var t=this._dictionary.get("Subtype");this._textMarkupType=st(t.name)}return this._textMarkupType},set:function(t){void 0!==t&&(this._textMarkupType=t,this._dictionary.update("Subtype",Xr.get(at(t))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boundsCollection",{get:function(){if(this._isLoaded){var t=[];if(this._dictionary.has("QuadPoints")){var e=this._dictionary.getArray("QuadPoints");if(e&&e.length>0)for(var i=e.length/8,r=0;r<i;r++){var n=e[4+8*r]-e[8*r],s=e[5+8*r]-e[1+8*r],a=Math.sqrt(n*n+s*s);n=e[6+8*r]-e[4+8*r],s=e[7+8*r]-e[5+8*r];var o=Math.sqrt(n*n+s*s),h=[e[8*r],this._page.size[1]-e[1+8*r],o,a];t.push(h)}}return t}return this._boundsCollection},set:function(t){var e;if(this._isLoaded||void 0===t||(t.length>0?(this._quadPoints=new Array(8*t.length),(e=this._boundsCollection).push.apply(e,t)):(this._quadPoints=new Array(8),this._boundsCollection=t),this._isChanged=!0),this._isLoaded&&void 0!==t){var i=!1;if(this.boundsCollection.length===t.length){for(a=0;a<t.length;a++)for(var r=t[a],n=0;n<r.length;n++)if(t[a][n]!==this.boundsCollection[a][n]){i=!0;break}}else i=!0;if(i){this._quadPoints=new Array(8*t.length);for(var s=this._page.size[1],a=0;a<t.length;a++)this._quadPoints[0+8*a]=t[a][0],this._quadPoints[1+8*a]=s-t[a][1],this._quadPoints[2+8*a]=t[a][0]+t[a][2],this._quadPoints[3+8*a]=s-t[a][1],this._quadPoints[4+8*a]=t[a][0],this._quadPoints[5+8*a]=this._quadPoints[1+8*a]-t[a][3],this._quadPoints[6+8*a]=t[a][0]+t[a][2],this._quadPoints[7+8*a]=this._quadPoints[5+8*a];this._dictionary.update("QuadPoints",this._quadPoints),this._isChanged=!0}}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._obtainNativeRectangle=function(){var t,e=[this._bounds.x,this._bounds.y+this._bounds.height,this._bounds.width,this._bounds.height];if(this._page&&!this._page._isNew){i=this._page.size;e[1]=i[1]-e[1],t=this._getCropOrMediaBox()}else if(this._page&&this._page._isNew){var i=this._page._getActualBounds(this._page._pageSettings);e[0]+=i[0],e[1]=this._page._pageSettings.size[1]-(i[1]+e[1]),t=this._getCropOrMediaBox()}if(t){if(t[3]<0){var r=t[1],n=t[3];t[1]=n,t[3]=r}t.length>2&&(0!==t[0]||0!==t[1])&&(e[0]+=t[0],this._page&&this._page._pageDictionary.has("MediaBox")&&!this._page._pageDictionary.has("CropBox")&&t[1]>0&&0===t[3]?e[1]+=t[3]:e[1]+=t[1])}return e},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;this._dictionary.has("BS")?t=this.border.width:((r=new $r(this._crossReference)).set("Type",Xr.get("Border")),r.set("W",this.border.width),this._dictionary.set("BS",r)),void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0);var e=this._page.size;if(this._dictionary.update("Subtype",Xr.get(at(this._textMarkupType))),this._isChanged&&(this._setQuadPoints(e),this._dictionary.update("Rect",Ot(this))),this._setAppearance){if(this._appearanceTemplate=this._createMarkupAppearance(),!this._isLoaded&&this._boundsCollection.length>1&&this._isChanged){var i=this._obtainNativeRectangle();this._dictionary.update("Rect",[i[0],i[1],i[0]+i[2],i[1]+i[3]])}this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var r=new $r;this._appearanceTemplate._content.dictionary._updated=!0;var n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=n,r.set("N",n),r._updated=!0,this._dictionary.set("AP",r)}void 0!==this._text&&null!==this._text&&this._dictionary.set("Contents",this._text),this._isChanged=!1},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded){if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createMarkupAppearance(),!e)){this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var i=new $r;this._appearanceTemplate._content.dictionary._updated=!0;var r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=r,i.set("N",r),i._updated=!0,this._dictionary.set("AP",i)}!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(i=this._dictionary.get("AP"))&&i.has("N")&&(n=i.get("N"))&&((r=i.getRaw("N"))&&(n.reference=r),this._appearanceTemplate=new fe(n,this._crossReference))}else if(this._postProcess(),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){if((i=this._dictionary.get("AP"))&&i.has("N")){var n=i.get("N");n&&((r=i.getRaw("N"))&&(n.reference=r),this._appearanceTemplate=new fe(n,this._crossReference))}}else this._appearanceTemplate=this._createMarkupAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")&&!this._isLoaded){var a=this._appearanceTemplate._content.dictionary.getArray("BBox");a&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-a[0],-a[1]])}s&&void 0!==this._page.rotation&&this._page.rotation!==t.PdfRotationAngle.angle0?this._flattenAnnotationTemplate(this._appearanceTemplate,s):s&&this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary,this._appearanceTemplate)?this._flattenAnnotationTemplate(this._appearanceTemplate,s):!this._dictionary.has("AP")&&this._appearanceTemplate&&this._flattenAnnotationTemplate(this._appearanceTemplate,s)}e&&this._page.annotations.remove(this)},i.prototype._createMarkupAppearance=function(){var e,i=0,r=0;if(this.boundsCollection.length>1){for(var n=new oi,s=0;s<this.boundsCollection.length;s++)(w=[])[0]=this.boundsCollection[s][0],w[1]=this.boundsCollection[s][1],w[2]=this.boundsCollection[s][2],w[3]=this.boundsCollection[s][3],n.addRectangle(w[0],w[1],w[2],w[3]);e={x:(P=n._getBounds())[0],y:P[1],width:P[2],height:P[3]},this.bounds=e,i=e.width,r=e.height}else if(this._dictionary.has("QuadPoints")){var a=this._dictionary.get("QuadPoints");if(null!==this._quadPoints)for(s=0;s<a.length/8;s++)if(this._isLoaded){for(var o=new Array,h=0,c=0;c<a.length;){var _=a[c],d=a[c+1];o[h]=[_,d],c+=2,h++}var l=new oi;l._addLines(o),i=(e={x:(P=l._getBounds())[0],y:P[1],width:P[2],height:P[3]}).width,r=e.height}else{var f=Math.floor(a[4+8*s])-Math.floor(a[0+8*s]),p=Math.floor(a[5+8*s])-Math.floor(a[1+8*s]);r=Math.sqrt(f*f+p*p),f=Math.floor(a[6+8*s])-Math.floor(a[4+8*s]),p=Math.floor(a[7+8*s])-Math.floor(a[5+8*s]),i=Math.sqrt(f*f+p*p),this.bounds={x:this.bounds.x,y:this.bounds.y,width:i,height:r}}}var u=new fe([0,0,i,r],this._crossReference);et(u,this._getRotationAngle());var g=u.graphics;if(void 0!==this.opacity&&g.setTransparency(this.opacity,this.opacity,t.PdfBlendMode.multiply),this.textMarkUpColor){var y=new xr(this.textMarkUpColor,this.border.width),m=new Ar(this.textMarkUpColor),_=0,d=0,b=0,v=0;if(this.boundsCollection.length>1)for(s=0;s<this.boundsCollection.length;s++){var w=[];w[0]=this.boundsCollection[s][0],w[1]=this.boundsCollection[s][1],w[2]=this.boundsCollection[s][2],w[3]=this.boundsCollection[s][3],this.textMarkupType===t.PdfTextMarkupAnnotationType.highlight?g.drawRectangle(w[0]-e.x,w[1]-e.y,w[2],w[3],m):this.textMarkupType===t.PdfTextMarkupAnnotationType.underline?(_=w[0]-e.x,d=w[1]-e.y+(w[3]-w[3]/2/3),b=w[2]+(w[0]-e.x),v=w[1]-e.y+(w[3]-w[3]/2/3),g.drawLine(y,_,d,b,v)):this.textMarkupType===t.PdfTextMarkupAnnotationType.strikeOut?(_=w[0]-e.x,d=w[1]-e.y+(w[3]-w[3]/2),b=w[2]+(w[0]-e.x),v=w[1]-e.y+(w[3]-w[3]/2),g.drawLine(y,_,d,b,v)):this.textMarkupType===t.PdfTextMarkupAnnotationType.squiggly&&(y._width=.02*w[3],g.save(),g.translateTransform(w[0]-e.x,w[1]-e.y),g.setClip([0,0,w[2],w[3]]),g.drawPath(this._drawSquiggly(w[2],w[3]),y),g.restore())}else if(this.textMarkupType===t.PdfTextMarkupAnnotationType.highlight?g.drawRectangle(0,0,i,r,m):this.textMarkupType===t.PdfTextMarkupAnnotationType.underline?g.drawLine(y,0,r-r/2/3,i,r-r/2/3):this.textMarkupType===t.PdfTextMarkupAnnotationType.strikeOut?g.drawLine(y,0,r/2,i,r/2):this.textMarkupType===t.PdfTextMarkupAnnotationType.squiggly&&(y._width=.02*r,g.drawPath(this._drawSquiggly(Math.round(i),Math.round(r)),y)),this._isLoaded){var S=[e.x,e.y,e.x+e.width,e.y+e.height],P=this._setAppearance?Ot(this):S;this._dictionary.update("Rect",P)}}return u},i.prototype._drawSquiggly=function(t,e){(Math.floor(t)%2!=0||Math.round(t)>t)&&(t=Math.floor(t)+1);for(var i=new oi,r=new Array,n=Math.ceil(t/e*16),s=t/(n/2),a=parseFloat((.6*(s+s)).toFixed(2)),o=a,h=0,c=0;c<n;c++){var _=e-a+o-.02*e,d=[h,parseFloat(_.toFixed(2))];r.push(d),o=0===o?a:0,h+=s}return i._addLines(r),i},i.prototype._setQuadPoints=function(t){var e,i=[],r=t[1];if(this._page&&this._page._isNew&&this._page._pageSettings&&this._page._pageSettings.margins){var n=this._page._pageSettings.margins;e={left:n.left,top:n.top,right:n.right,bottom:n.bottom}}else e={left:0,top:0,right:0,bottom:0};0!==this.bounds.x&&0!==this.bounds.y&&0!==this.bounds.width&&0!==this.bounds.height&&(this._boundsCollection[0]=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]);var s=this._quadPoints.length/8,a=this._getMediaOrCropBox(this._page),o=!1;if(!this._isLoaded&&a&&a.length>3&&!this.flatten){var h=a[0],c=a[1];if(0!==h||0!==c){for(l=0;l<s;l++){var _=this._boundsCollection[l][0]+e.left+h,d=c+e.top;i[0+8*l]=_+e.left,i[1+8*l]=r- -d-e.top-this._boundsCollection[l][1],i[2+8*l]=_+this._boundsCollection[l][2]+e.left,i[3+8*l]=r- -d-e.top-this._boundsCollection[l][1],i[4+8*l]=_+e.left,i[5+8*l]=i[1+8*l]-this._boundsCollection[l][3],i[6+8*l]=_+this._boundsCollection[l][2]+e.left,i[7+8*l]=i[5+8*l]}o=!0}}if(!o)for(var l=0;l<s;l++){var _=this._boundsCollection[l][0],d=this._boundsCollection[l][1];i[0+8*l]=_+e.left,i[1+8*l]=r-d-e.top,i[2+8*l]=_+this._boundsCollection[l][2]+e.left,i[3+8*l]=r-d-e.top,i[4+8*l]=_+e.left,i[5+8*l]=i[1+8*l]-this._boundsCollection[l][3],i[6+8*l]=_+this._boundsCollection[l][2]+e.left,i[7+8*l]=i[5+8*l]}this._points=i,this._dictionary.set("QuadPoints",this._points)},i}(ki),Hi=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._watermarkText="",o._dictionary=new $r,o._dictionary.update("Type",Xr.get("Annot")),o._dictionary.update("Subtype",Xr.get("Watermark")),void 0!==i&&(o._watermarkText=i,o.text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a}),o._type=t._PdfAnnotationType.watermarkAnnotation,o}return Ai(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new $r(this._crossReference);e.set("Type",Xr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),void 0===this.color&&(this.color=[0,0,0]),this._appearanceTemplate=this._createWatermarkAppearance(),this._dictionary.update("Rect",Ot(this)),void 0!==this.opacity&&1!==this._opacity&&this._dictionary.set("CA",this._opacity)},i.prototype._createWatermarkAppearance=function(){var e=this._obtainFont();(void 0===e||null===e||(!this._isLoaded||this._page&&this._page._isDuplicate)&&1===e.size)&&(e=this._lineCaptionFont,this._pdfFont=e),this._rotateAngle=this._getRotationAngle(),(void 0!==this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0||this._rotateAngle!==t.PdfRotationAngle.angle0)&&(0===this._rotateAngle&&(this._rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this._rotateAngle));var i=[0,0,this.bounds.width,this.bounds.height],r=new Pi({x:0,y:0,width:this.bounds.width,height:this.bounds.height},this);r.normal=new fe(i,this._crossReference);var n=r.normal;et(n,this._rotateAngle);var s,a=r.normal.graphics,o=this.border.width/2,h=new pe(t.PdfTextAlignment.left,t.PdfVerticalAlignment.top),c=new xr(this.color,o);if(this.innerColor&&(s=new Ar(this._innerColor)),this._isLoaded?(this._dictionary.has("Contents")&&(this._watermarkText=this._dictionary.get("Contents")),this._dictionary.update("Contents",this._watermarkText)):this._dictionary.update("Contents",this._watermarkText),void 0!==this._watermarkText&&a.drawString(this._watermarkText,e,[0,0,0,0],c,s,h),this._dictionary.has("AP")){var _=this._dictionary.get("AP");_&&_ instanceof $r&&At(_,this._crossReference,"N")}var d=new $r;a._template._content.dictionary._updated=!0;var l=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(l,a._template._content),a._template._content.reference=l,d.set("N",l),d._updated=!0,this._dictionary.set("AP",d),n},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded)t||(this._appearanceTemplate=this._createWatermarkAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((r=e.getRaw("N"))&&(i.reference=r),this._appearanceTemplate=new fe(i,this._crossReference));else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){var r=e.getRaw("N");r&&(i.reference=r),this._appearanceTemplate=new fe(i,this._crossReference)}}}else this._appearanceTemplate=this._createWatermarkAppearance();if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else t&&this._page.annotations.remove(this)},i}(xi),Gi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._icon=t.PdfRubberStampAnnotationIcon.draft,a._stampWidth=0,a._iconString="",a.rotateAngle=0,a._alterRotateBounds=!0,a._stampAppearanceFont=new ti(t.PdfFontFamily.helvetica,20,t.PdfFontStyle.italic|t.PdfFontStyle.bold),a._dictionary=new $r,a._dictionary.update("Type",Xr.get("Annot")),a._dictionary.update("Subtype",Xr.get("Stamp")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.rubberStampAnnotation,a}return Ai(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=ht(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",Xr.get("#"+this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"appearance",{get:function(){if(this._isLoaded)return null;if(void 0===this._appearance){var t={x:0,y:0,width:this.bounds.width,height:this.bounds.height};this._appearance=new Pi(t,this),this._appearance.normal=new fe(t,this._crossReference)}return this._appearance},enumerable:!0,configurable:!0}),i.prototype.createTemplate=function(){var t;if(this._isLoaded)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){(t=new fe)._isExported=!0;var r=i.dictionary,n=r.getArray("Matrix"),s=r.getArray("BBox");if(n){for(var a=[],o=0;o<n.length;o++){var h=n[o];a[o]=h}if(s&&s.length>3){var c=D(s),_=this._transformBBox(c,a);t._size=[_[2],_[3]],t._templateOriginalSize=[c.width,c.height]}}else s&&(r.update("Matrix",[1,0,0,1,-s[0],-s[1]]),t._size=[s[2],s[3]]);t._exportStream(e,this._crossReference)}}}else t=this._createRubberStampAppearance();return t},Object.defineProperty(i.prototype,"_innerTemplateBounds",{get:function(){var t;return this._isLoaded&&((t=this._obtainInnerBounds()).x=this.bounds.x,t.y=this.bounds.y),t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new $r(this._crossReference);e.set("Type",Xr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0),this._dictionary.has("AP")&&this._isLoaded&&!this._isRotated?this._parseStampAppearance():this._appearanceTemplate=this._createRubberStampAppearance()},i.prototype._transformBBox=function(t,e){var i=[],r=[],n=this._transformPoint(t.x,t.y+t.height,e);i[0]=n[0],r[0]=n[1];var s=this._transformPoint(t.x+t.width,t.y,e);i[1]=s[0],r[1]=s[1];var a=this._transformPoint(t.x,t.y,e);i[2]=a[0],r[2]=a[1];var o=this._transformPoint(t.x+t.width,t.y+t.height,e);return i[3]=o[0],r[3]=o[1],[this._minValue(i),this._minValue(r),this._maxValue(i),this._maxValue(r)]},i.prototype._transformPoint=function(t,e,i){var r=[];return r[0]=t*i[0]+e*i[2]+i[4],r[1]=t*i[1]+e*i[3]+i[5],r},i.prototype._minValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[i]<e&&(e=t[i]);return e},i.prototype._maxValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[i]>e&&(e=t[i]);return e},i.prototype._doPostProcess=function(t){void 0===t&&(t=!1);var e=!1;if(this._isLoaded&&(this._setAppearance||t||this._isExport))(!t&&!this._isExport||this._setAppearance||this._isRotated)&&(this._appearanceTemplate=this._createRubberStampAppearance()),!this._appearanceTemplate&&(this._isExport||t)&&this._dictionary.has("AP")&&(e=this._parseStampAppearance());else if(this._isImported&&this._dictionary.has("AP")||this._postProcess(),!this._appearanceTemplate&&(t||this._isImported))if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){var r=i.get("N");if(r){var n=i.getRaw("N");n&&(r.reference=n),this._appearanceTemplate=new fe(r,this._crossReference)}}}else this._appearanceTemplate=this._createRubberStampAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var a=this._appearanceTemplate._content.dictionary.getArray("BBox");a&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-a[0],-a[1]])}e?this._flattenAnnotationTemplate(this._appearanceTemplate,e):this._flattenAnnotationTemplate(this._appearanceTemplate,s)}else t&&this._page.annotations.remove(this)},i.prototype._parseStampAppearance=function(){var e=!1,i=this._dictionary.get("AP");if(i&&i.has("N")){var r=i.get("N");if(r){var n=i.getRaw("N");n&&(r.reference=n);var s=!1;if(this._type===t._PdfAnnotationType.rubberStampAnnotation){var a=!1,o=void 0,h=void 0;if(r&&((a=this._page.rotation===t.PdfRotationAngle.angle0&&this.rotationAngle===t.PdfRotationAngle.angle0)||(a=this._page.rotation!==t.PdfRotationAngle.angle0&&this.rotationAngle===t.PdfRotationAngle.angle0)),this._appearanceTemplate=new fe(r,this._crossReference),s=!0,(e=!!a)&&r instanceof rn){var c=r.dictionary.getArray("Matrix");if(c){var _=c.slice(),d=r.dictionary.getArray("BBox");if(d&&d.length>3){h=D(d);var l=this._transformBBox(h,_);o=[l[2],l[3]],this._appearanceTemplate._size=o}else o=[h.width,h.height]}}else h&&(o=[h.width,h.height])}s||(this._appearanceTemplate=new fe(r,this._crossReference))}}return e},i.prototype._createRubberStampAppearance=function(){var e,i={x:0,y:0,width:this.bounds.width,height:this.bounds.height};this._appearance?(e=this._appearance,this._dictionary.has("Name")||this._dictionary.update("Name",Xr.get("#23CustomStamp"))):(this._iconString=this._obtainIconName(this.icon),this._dictionary.update("Name",Xr.get("#23"+this._iconString)),(e=new Pi(i,this)).normal=new fe(i,this._crossReference));var r=e.normal;!this._alterRotateBounds||void 0===this._rotate||this._rotate===t.PdfRotationAngle.angle0&&0===this._getRotationAngle()?this.rotateAngle=this._getRotationAngle():(this.rotateAngle=this._getRotationAngle(),0===this.rotateAngle&&(this.rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this.rotateAngle)),et(r,this.rotateAngle),this._appearance||this._drawStampAppearance(r),this._dictionary.has("AP")&&At(this._dictionary.get("AP"),this._crossReference,"N");var n=new $r;r._content.dictionary._updated=!0;var s=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(s,r._content),r._content.reference=s,n.set("N",s),n._updated=!0,this._dictionary.set("AP",n),this._dictionary.set("Border",[this.border.hRadius,this.border.vRadius,this.border.width]),this._dictionary.update("Rect",Ot(this)),r},i.prototype._drawStampAppearance=function(e){var i=new pe;i.alignment=t.PdfTextAlignment.center,i.lineAlignment=t.PdfVerticalAlignment.middle;var r=new Ar(this._obtainBackGroundColor()),n=new xr(this._obtainBorderColor(),this.border.width),s=e.graphics;s.save(),s.scaleTransform(e._size[0]/(this._stampWidth+4),e._size[1]/28);var a=this._stampAppearanceFont;void 0!==this.opacity&&this._opacity<1&&s.setTransparency(this._opacity),this._drawRubberStamp(s,n,r,a,i),s.restore()},i.prototype._obtainIconName=function(e){switch(e){case t.PdfRubberStampAnnotationIcon.approved:this._iconString="Approved",this._stampWidth=126;break;case t.PdfRubberStampAnnotationIcon.asIs:this._iconString="AsIs",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.confidential:this._iconString="Confidential",this._stampWidth=166;break;case t.PdfRubberStampAnnotationIcon.departmental:this._iconString="Departmental",this._stampWidth=186;break;case t.PdfRubberStampAnnotationIcon.draft:this._iconString="Draft",this._stampWidth=90;break;case t.PdfRubberStampAnnotationIcon.experimental:this._iconString="Experimental",this._stampWidth=176;break;case t.PdfRubberStampAnnotationIcon.expired:this._iconString="Expired",this._stampWidth=116;break;case t.PdfRubberStampAnnotationIcon.final:this._iconString="Final",this._stampWidth=90;break;case t.PdfRubberStampAnnotationIcon.forComment:this._iconString="ForComment",this._stampWidth=166;break;case t.PdfRubberStampAnnotationIcon.forPublicRelease:this._iconString="ForPublicRelease",this._stampWidth=240;break;case t.PdfRubberStampAnnotationIcon.notApproved:this._iconString="NotApproved",this._stampWidth=186;break;case t.PdfRubberStampAnnotationIcon.notForPublicRelease:this._iconString="NotForPublicRelease",this._stampWidth=290;break;case t.PdfRubberStampAnnotationIcon.sold:this._iconString="Sold",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.topSecret:this._iconString="TopSecret",this._stampWidth=146;break;case t.PdfRubberStampAnnotationIcon.completed:this._iconString="Completed",this._stampWidth=136;break;case t.PdfRubberStampAnnotationIcon.void:this._iconString="Void",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.informationOnly:this._iconString="InformationOnly",this._stampWidth=230;break;case t.PdfRubberStampAnnotationIcon.preliminaryResults:this._iconString="PreliminaryResults",this._stampWidth=260}return this._iconString},i.prototype._obtainBackGroundColor=function(){return this._icon===t.PdfRubberStampAnnotationIcon.notApproved||this._icon===t.PdfRubberStampAnnotationIcon.void?[251,222,221]:this._icon===t.PdfRubberStampAnnotationIcon.approved||this._icon===t.PdfRubberStampAnnotationIcon.final||this._icon===t.PdfRubberStampAnnotationIcon.completed?[229,238,222]:[219,227,240]},i.prototype._obtainBorderColor=function(){return this._icon===t.PdfRubberStampAnnotationIcon.notApproved||this._icon===t.PdfRubberStampAnnotationIcon.void?[151,23,15]:this._icon===t.PdfRubberStampAnnotationIcon.approved||this._icon===t.PdfRubberStampAnnotationIcon.final||this._icon===t.PdfRubberStampAnnotationIcon.completed?[73,110,38]:[24,37,100]},i.prototype._drawRubberStamp=function(t,e,i,r,n){t.drawRoundedRectangle(2,1,this._stampWidth,26,3,e,i);var s=new Ar(this._obtainBorderColor());t.drawString(this._iconString.toUpperCase(),r,[this._stampWidth/2+1,15,0,0],null,s,n)},i.prototype._obtainInnerBounds=function(){var t={x:0,y:0,width:0,height:0};if(this._dictionary&&this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i&&void 0!==i.dictionary){var r=i.dictionary;if(r.has("BBox")){var n=r.getArray("BBox");n&&4===n.length&&(t=D(n))}}}}return t},i}(ki),Ki=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.soundAnnotation,i}return Ai(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new fe(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(ki),Xi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._intentString="",a._markUpFont=new ti(t.PdfFontFamily.helvetica,7,t.PdfFontStyle.regular),a._textAlignment=t.PdfTextAlignment.left,a._cropBoxValueX=0,a._cropBoxValueY=0,a._dictionary=new $r,a._dictionary.update("Type",Xr.get("Annot")),a._dictionary.update("Subtype",Xr.get("FreeText")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._isContentUpdated=!1,a._type=t._PdfAnnotationType.freeTextAnnotation,a._parsedXMLData=[],a}return Ai(i,e),Object.defineProperty(i.prototype,"calloutLines",{get:function(){return void 0===this._calloutLines&&(this._calloutLines=this._getCalloutLinePoints()),this._calloutLines},set:function(t){this._isLoaded||(this._calloutLines=t);var e=!1;if(this._isLoaded&&t.length>=2)if(this._calloutLines.length===t.length){for(a=0;a<t.length;a++)for(var i=t[a],r=0;r<i.length;r++)if(t[a][r]!==this._calloutLines[a][r]){e=!0;break}}else e=!0;if(e){for(var n=this._page.size[1],s=[],a=0;a<t.length&&a<t.length;a++)s.push(t[a][0]+this._cropBoxValueX),s.push(n+this._cropBoxValueY-t[a][1]);this._calloutLines=t,this._dictionary.update("CL",s)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineEndingStyle",{get:function(){return this._isLoaded?this._lineEndingStyle=this._obtainLineEndingStyle():void 0===this._lineEndingStyle&&(this._lineEndingStyle=t.PdfLineEndingStyle.none),this._lineEndingStyle},set:function(t){void 0!==t&&this._dictionary.update("LE",Xr.get(j(t))),this._lineEndingStyle=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textMarkUpColor",{get:function(){if(void 0===this._textMarkUpColor){var t=void 0;if(this._dictionary.has("TextColor"))return this._textMarkUpColor=M(this._dictionary.getArray("TextColor")),this._textMarkUpColor;if(this._dictionary.has("DS"))for(var e=this._dictionary.get("DS").split(";"),i=0;i<e.length;i++)if(-1!==e[i].indexOf("color"))return(t=e[i].split(":")[1]).startsWith("#")&&(t=t.substring(1)),this._textMarkUpColor=I(t),this._textMarkUpColor;if(!this._textMarkUpColor&&this._dictionary.has("RC")){var r=[];this._parsedXMLData.length>0&&this._parsedXMLData[3]&&(r=this._parsedXMLData[3]._color,this._textMarkUpColor=r)}}return this._textMarkUpColor},set:function(t){void 0!==t&&3===t.length&&(this._textMarkUpColor=t,this._updateStyle(this.font,t,this.textAlignment)),this._isContentUpdated=!0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){if(this._dictionary.has("Q"))this._textAlignment=this._dictionary.get("Q");else if(this._dictionary.has("RC")){var t=void 0;this._parsedXMLData.length>0&&this._parsedXMLData[1]&&(t=this._parsedXMLData[1],this._textAlignment=t)}return this._textAlignment},set:function(t){this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t,this._isContentUpdated=!0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){return this._font||(this._font=this._obtainFont(),(null===this._font||void 0===this._font||!this._isLoaded&&1===this._font.size)&&(this._font=this._markUpFont)),this._font},set:function(t){this._font=t,this._isContentUpdated=!0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return void 0===this._borderColor&&this._dictionary.has("DA")&&(this._borderColor=this._obtainColor()),this._borderColor},set:function(t){void 0!==t&&3===t.length&&(this._borderColor=t,this._dictionary.update("DA",this._getBorderColorString(this.borderColor)))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"annotationIntent",{get:function(){return void 0!==this._annotationIntent&&null!==this._annotationIntent||(this._dictionary.has("IT")?this._annotationIntent=ut(this._dictionary.get("IT").name):this._annotationIntent=t.PdfAnnotationIntent.none),this._annotationIntent},set:function(e){void 0!==e&&(this._annotationIntent=e,void 0!==this.subject&&"null"!==this.subject||e!==t.PdfAnnotationIntent.none||this._calloutLines&&(!this._calloutLines||0!==this._calloutLines.length)?this._dictionary.update("IT",Xr.get(this._obtainAnnotationIntent(this._annotationIntent))):this._dictionary.update("Subj","Text Box"))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_innerBounds",{get:function(){var t=this.border.width/2,e=this._obtainAppearanceBounds(),i=new sr,r=this._obtainColor(),n=new xr(r,this.border.width);this.border.width>0&&(i.borderPen=n);var s=this._obtainStyle(n,e,t,i);return this.calloutLines&&this._calloutLines.length>0&&(this._innerTextBoxBounds={x:s[0],y:this._page.size[1]-(s[1]+s[3]),width:s[2],height:s[3]}),this._innerTextBoxBounds},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),e.has("RC")&&(r._parsedXMLData=r._parseMarkupLanguageData(e.get("RC"))),r},i.prototype._setPaddings=function(t){this._paddings=t},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new $r(this._crossReference);i.set("Type",Xr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1),this._dictionary.has("C")||(this._isTransparentColor=!0);var r=this._getCropOrMediaBox();r&&r.length>3&&"number"==typeof r[0]&&"number"==typeof r[1]&&(0!==r[0]||0!==r[1])&&(this._cropBoxValueX=r[0],this._cropBoxValueY=r[1]),(t||this._setAppearance)&&(this._appearanceTemplate=this._createAppearance()),t||(this._dictionary.update("Rect",Ot(this)),this._saveFreeTextDictionary())},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded)(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createAppearance()),!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(i=this._dictionary.get("AP"))&&i.has("N")&&(r=i.get("N"))&&((h=i.getRaw("N"))&&(r.reference=h),this._appearanceTemplate=new fe(r,this._crossReference));else if(this._postProcess(e),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){var r=i.get("N");r&&((h=i.getRaw("N"))&&(r.reference=h),this._appearanceTemplate=new fe(r,this._crossReference))}}else this._appearanceTemplate=this._createAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")&&!this._isLoaded){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}n&&void 0!==this._page.rotation&&this._page.rotation!==t.PdfRotationAngle.angle0?this._flattenAnnotationTemplate(this._appearanceTemplate,n):this._appearanceTemplate&&!this._dictionary.has("AP")?this._flattenAnnotationTemplate(this._appearanceTemplate,n):this._dictionary.has("AP")&&this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate)&&this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else e&&this._page.annotations.remove(this);if(this._dictionary.has("RC")&&this._isContentUpdated&&this._updateStyle(this.font,this._textMarkUpColor,this.textAlignment),!e&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new $r(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}At(a,this._crossReference,"N");var h=this._crossReference._getNextReference();this._crossReference._cacheMap.set(h,this._appearanceTemplate._content),a.update("N",h)}},i.prototype._isValidTemplateMatrix=function(t,e,i){var r=!0,n=e;if(t&&t.has("Matrix")){var s=t.getArray("BBox"),a=t.getArray("Matrix");if(a&&s&&a.length>3&&s.length>2&&void 0!==a[0]&&void 0!==a[1]&&void 0!==a[2]&&void 0!==a[3]&&1===a[0]&&0===a[1]&&0===a[2]&&1===a[3]&&void 0!==s[0]&&void 0!==s[1]&&void 0!==s[2]&&void 0!==s[3]&&(Math.round(s[0])!==Math.round(-a[4])&&Math.round(s[1])!==Math.round(-a[5])||0===s[0]&&0===Math.round(-a[4]))){var o=this._page.graphics,h=o.save();void 0!==this.opacity&&this._opacity<1&&o.setTransparency(this._opacity),n.x-=s[0],n.y+=s[1],o.drawTemplate(i,n),o.restore(h),this._page.annotations.remove(this),r=!1}}return r},i.prototype._createAppearance=function(){var e,i=this.border.width/2,r=this._obtainAppearanceBounds(),n=this.rotate;0!==n&&90!==n&&180!==n&&270!==n||(this._isAllRotation=!1);var s=(e=n>0&&this._isAllRotation?new fe([0,0,r[2],r[3]],this._crossReference):new fe(r,this._crossReference))._content.dictionary.getArray("BBox"),a=this._getRotationAngle();s&&null!==a&&void 0!==a&&e._content.dictionary.set("Matrix",[1,0,0,1,-s[0],-s[1]]);var o=new sr,h=this._obtainText();e._writeTransformation=!1;var c=e.graphics,_=this._obtainTextAlignment(),d=this._obtainColor(),l=new xr(d,this.border.width);this.border.width>0&&(o.borderPen=l);var f=this._obtainStyle(l,r,i,o);if(this.color&&(o.foreBrush=new Ar(this._color)),this.textMarkUpColor&&(o.backBrush=new Ar(this._textMarkUpColor)),o.borderWidth=this.border.width,this.calloutLines&&this._calloutLines.length>=2){if(this._drawCallOuts(c,l),this._isLoaded&&void 0===this._lineEndingStyle&&(this._lineEndingStyle=this.lineEndingStyle),this._lineEndingStyle!==t.PdfLineEndingStyle.none){var p=this._obtainLinePoints(),u=this._getAngle(p),g=this._getAxisValue([p[2],p[3]],90,0);this._drawLineEndStyle(g,c,u,l,o.foreBrush,this.lineEndingStyle,this.border.width,!1)}(f=this._dictionary.has("RD")?[f[0],-f[1],f[2],-f[3]]:[this.bounds.x,-(this._page.size[1]-(this.bounds.y+this.bounds.height)),this.bounds.width,-this.bounds.height])[0]=f[0]+this._cropBoxValueX,f[1]=f[1]-this._cropBoxValueY,this._calculateRectangle(f),o.bounds=f}else f=[f[0],-f[1],f[2],-f[3]],o.bounds=f;for(var y=this._obtainAppearanceBounds(),m=[f[0]-y[0],-f[1]-y[1],f[2]-y[2],-f[1]-y[1]-f[3]-y[3]],b=0;b<m.length;b++)m[b]<0&&(m[b]=-m[b]);this._dictionary.update("RD",m),this.opacity&&this._opacity<1&&(c.save(),c.setTransparency(this._opacity)),this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0&&c.save(),this._drawFreeTextRectangle(c,o,f,_),h&&this._drawFreeMarkUpText(c,o,f,h,_),this.opacity&&this._opacity<1&&c.restore(),this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0&&c.restore();var v=this._obtainAppearanceBounds();return this.flatten&&(this._bounds={x:v[0],y:this._page.size[1]-(v[1]+v[3]),width:v[2],height:v[3]}),this._dictionary.set("Rect",[v[0],v[1],v[0]+v[2],v[1]+v[3]]),e},i.prototype._calculateRectangle=function(t){for(var e=this._obtainAppearanceBounds(),i=[t[0]-e[0],-t[1]-e[1],t[2]-e[2],-t[1]-e[1]-t[3]-e[3]],r=0;r<4;r++)i[r]<0&&(i[r]=-i[r]);this._dictionary.set("RD",i)},i.prototype._obtainAnnotationIntent=function(e){switch(e){case t.PdfAnnotationIntent.freeTextCallout:this._intentString="FreeTextCallout";break;case t.PdfAnnotationIntent.freeTextTypeWriter:this._intentString="FreeTextTypeWriter"}return this._intentString},i.prototype._obtainFont=function(){var t=this._obtainFontDetails();if(!t.size&&this._dictionary.has("RC")){var e=void 0;if(this._parsedXMLData.length>0&&this._parsedXMLData[0]&&(e=this._parsedXMLData[0]),e instanceof ti){i=e;t.size=i.size,t.style=i.style,t.name=i._fontFamily.toString()}else if(e instanceof ei){var i=e;t.size=i.size,t.style=i.style,t.name=i._fontFamily.toString()}}return Ft(t.name,t.size,t.style,this)},i.prototype._updateStyle=function(e,i,r){var n="font:"+e._metrics._name+" "+e.size+"pt;style:"+gt(e.style)+";color:"+this._colorToHex(i);this._dictionary.update("DS",n);var s,a,o='<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" style="font:'+e._metrics._name+" "+e.size+"pt;font-weight:"+(e.isBold?"bold":"normal")+";color:"+this._colorToHex(i)+'"><p dir="ltr">';if(null!==r&&void 0!==r){switch(r){case t.PdfTextAlignment.left:a="left";break;case t.PdfTextAlignment.center:a="center";break;case t.PdfTextAlignment.right:a="right";break;case t.PdfTextAlignment.justify:a="justify"}a&&(s="text-align:"+a+";")}var h,c="",_="font-style:italic",d="font-style:bold";e.isUnderline?(c=e.isStrikeout?"text-decoration:word line-through":"text-decoration:word",e.isItalic?c+=";"+_:e.isBold&&(c+=";"+d)):e.isStrikeout?(c="text-decoration:line-through",e.isItalic?c+=";"+_:e.isBold&&(c+=";"+d)):e.isItalic?c+=_:e.isBold&&(c+=d),h=""!==c?'<span style = "'+s+c+'">'+(this.text?this._getXmlFormattedString(this.text):"")+"</span>":'<span style = "'+s+'">'+(this.text?this._getXmlFormattedString(this.text):"")+"</span>",this._dictionary.update("RC",o+h+"</p></body>")},i.prototype._drawFreeMarkUpText=function(e,i,r,n,s){var a=!1,o=this.rotate;if(this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation?0!==o||this._isAllRotation||(r=[r[0],r[1]+r[3],r[2],r[3]]):r=[r[1]+r[3],-(r[0]+r[2]),-r[3],r[2]]:r=[-(r[2]+r[0]),-r[1],r[2],-r[3]]:r=[-r[1],r[0],-r[3],r[2]],(void 0===this._font||null===this._font||!this._isLoaded&&1===this._font.size)&&(this._font=this._markUpFont),o>0&&this._isAllRotation){a=!0;var h=this.bounds,c=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),_=this._font.measureString(n,[0,0],c,0,0);o>0&&o<=91?e.translateTransform(_[1],-h.height):o>91&&o<=181?e.translateTransform(h.width-_[1],-(h.height-_[1])):o>181&&o<=271?e.translateTransform(h.width-_[1],-_[1]):o>271&&o<360&&e.translateTransform(_[1],-_[1]),e.rotateTransform(o),i.bounds=[0,0,i.bounds[2],i.bounds[3]]}var d=[r[0],r[1],r[2],r[3]];if(this._paddings&&!this._isLoaded){var l=this._paddings._left,f=this._paddings._top,p=this._paddings._right+this._paddings._left,u=this._paddings._top+this._paddings._bottom;if(i.borderWidth>0){r=[r[0]+(i.borderWidth+l),r[1]+(i.borderWidth+f),m=r[2]-(2*i.borderWidth+p),r[3]>0?r[3]-(2*i.borderWidth+u):-r[3]-(2*i.borderWidth+u)]}else{var g=r[0]+l,y=r[1]+f,m=r[2]-p;r=[g,y,m,r[3]>0?r[3]-u:-r[3]-u]}}else i.borderWidth>0&&(r=[r[0]+1.5*i.borderWidth,r[1]+1.5*i.borderWidth,r[2]-3*i.borderWidth,r[3]>0?r[3]-3*i.borderWidth:-r[3]-3*i.borderWidth]);var b=this._font._metrics._getHeight()>(r[3]>0?r[3]:-r[3]),v=this._font._metrics._getHeight()<=(d[3]>0?d[3]:-d[3]),w=b&&v;this._drawFreeTextAnnotation(e,i,n,this._font,w?d:r,!0,s,a)},i.prototype._drawFreeTextRectangle=function(e,i,r,n){if(this._dictionary.has("BE")){for(var s=0;s<r.length;s++)r[s]<0&&(r[s]=-r[s]);this._drawAppearance(e,i,r),this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation||e.rotateTransform(-270):e.rotateTransform(-180):e.rotateTransform(-90)}else this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation||(e.rotateTransform(-270),i.bounds=[r[1]+r[3],-r[0],-r[3],-r[2]]):(e.rotateTransform(-180),i.bounds=[-(r[2]+r[0]),-(r[3]+r[1]),r[2],r[3]]):(e.rotateTransform(-90),i.bounds=[-r[1],r[2]+r[0],-r[3],-r[2]]),i.borderWidth>0&&!this._isAllRotation&&(r=i.bounds),this._drawFreeTextAnnotation(e,i,"",this._font,r,!1,n,!1)},i.prototype._drawAppearance=function(t,e,i){var r=new oi;if(r.addRectangle(i[0],i[1],i[2],i[3]),this._dictionary.has("BE")){var n=this._dictionary.get("BE");if(n&&n.has("I")){var s=1===n.get("I")?4:9;this._drawCloudStyle(t,e.foreBrush,e.borderPen,s,.833,r._points,!0)}}},i.prototype._drawFreeTextAnnotation=function(e,i,r,n,s,a,o,h){if(a){var c=new pe;c.lineAlignment=t.PdfVerticalAlignment.top,c.alignment=o,c.lineSpacing=0,h?e.drawString(r,n,i.bounds,null,i.backBrush,c):e.drawString(r,n,s,null,i.backBrush,c)}else e.drawRectangle(s[0],s[1],s[2],s[3],i.borderPen,i.foreBrush)},i.prototype._getCalloutLinePoints=function(){if(this._dictionary.has("CL")){var t=this._dictionary.getArray("CL");if(t){this._calloutLines=[];for(var e=0;e<t.length;e+=2){var i=[t[Number.parseInt(e.toString(),10)],this._page.size[1]-t[e+1]];this._calloutLines.push(i)}}}return this._calloutLines},i.prototype._obtainAppearanceBounds=function(){var e=[0,0,0,0];if(this.calloutLines&&this._calloutLines.length>0){for(var i=new oi,r=[],n=2===this._calloutLines.length?2:3,s=0;s<n;s++)r.push([0,0]);if(this._calloutLines.length>=2){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)r[s]=[this._calloutsClone[s][0],this._calloutsClone[s][1]]}r.length>0&&(this.lineEndingStyle!==t.PdfLineEndingStyle.none&&this._expandAppearance(r),i._addLines(r)),i.addRectangle(this.bounds.x+this._cropBoxValueX-2,this._page.size[1]+this._cropBoxValueY-(this.bounds.y+this.bounds.height)-2,this.bounds.width+4,this.bounds.height+4),e=i._getBounds()}else if(this._page)if(this._page._isNew){var a=this._page._pageSettings.margins;e=[this.bounds.x+a.left,this._page.size[1]-(this.bounds.y+this.bounds.height+a.top),this.bounds.width,this.bounds.height]}else e=[this.bounds.x+this._cropBoxValueX,this._page.size[1]+this._cropBoxValueY-(this.bounds.y+this.bounds.height),this.bounds.width,this.bounds.height];return e},i.prototype._obtainCallOutsNative=function(){if(this.calloutLines&&this._calloutLines.length>0){var t=this._page.size;this._calloutsClone=[];for(var e=0;e<this._calloutLines.length;e++)this._calloutsClone.push([this._calloutLines[e][0]+this._cropBoxValueX,t[1]+this._cropBoxValueY-this._calloutLines[e][1]])}},i.prototype._obtainLinePoints=function(){var t=this._page.size[1];return[this.calloutLines[1][0]+this._cropBoxValueX,t+this._cropBoxValueY-this.calloutLines[1][1],this.calloutLines[0][0]+this._cropBoxValueX,t+this._cropBoxValueY-this.calloutLines[0][1]]},i.prototype._obtainLineEndingStyle=function(){var t;if(this._dictionary.has("LE")){var e=this._dictionary.get("LE");e instanceof Xr&&(e=e.name),t=V(e)}return t},i.prototype._obtainText=function(){var t="",e=this._dictionary.has("Contents");if(e){var i=this._dictionary.get("Contents");return i&&(t=i),t&&""!==t&&(this._text=t),t}return this._dictionary.has("RC")&&!e&&null===t?t=this._rcText:t},i.prototype._obtainTextAlignment=function(){var e,i=t.PdfTextAlignment.left;if(this._dictionary.has("Q"))void 0!==(n=this._dictionary.get("Q"))&&(i=n,e=!0);else if(this._dictionary.has("RC")&&this._parsedXMLData.length>0&&this._parsedXMLData[1]){var r=this._parsedXMLData[1];i=r,e=!0}if(!e&&this._dictionary.has("DS")){var n=this._dictionary.get("DS");n.split(";").forEach(function(e){if(-1!==e.indexOf("text-align"))switch(e){case"left":i=t.PdfTextAlignment.left;break;case"right":i=t.PdfTextAlignment.right;break;case"center":i=t.PdfTextAlignment.center;break;case"justify":i=t.PdfTextAlignment.justify}})}return i},i.prototype._obtainColor=function(){var t;if(this._isLoaded)if(this._dictionary.has("DA")){var e=this._dictionary.get("DA");Array.isArray(e)&&e.length>0?t=[e[0],e[1],e[2]]:"string"==typeof e&&(this._da=new Si(e),t=this._da.color)}else if(this._dictionary.has("MK")){var i=this._mkDictionary;i&&i.has("BC")&&(t=M(i.getArray("BC")))}else t=[0,0,0];else t=this._borderColor?this._borderColor:[0,0,0];return t},i.prototype._expandAppearance=function(e){var i=e[0][1],r=e[0][0];this._isLoaded||(i=this._page.size[1]-i),i>this.bounds.y?this.lineEndingStyle!==t.PdfLineEndingStyle.openArrow&&(e[0][1]-=11*this.border.width):e[0][1]+=11*this.border.width,r<=this.bounds.x?e[0][0]-=11*this.border.width:e[0][0]+=11*this.border.width},i.prototype._drawCallOuts=function(t,e){for(var i=new oi,r=[],n=2===this._calloutLines.length?2:3,s=0;s<n;s++)r.push([0,0]);if(this._calloutLines.length>=2){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)r[s]=[this._calloutsClone[s][0],-this._calloutsClone[s][1]]}r.length>0&&i._addLines(r),t.drawPath(i,e)},i.prototype._saveFreeTextDictionary=function(){if((void 0===this.font||null===this.font||!this._isLoaded&&1===this.font.size)&&(this.font=this._markUpFont),"string"==typeof this.text&&null!==this.text&&this._dictionary.update("Contents",this.text),this._isLoaded&&(this._textAlignment=this.textAlignment),this._dictionary.update("Q",this._textAlignment),void 0!==this.subject&&"null"!==this.subject||this.annotationIntent!==t.PdfAnnotationIntent.none||this._calloutLines&&(!this._calloutLines||0!==this._calloutLines.length)?(this._calloutLines&&this._calloutLines.length>=2&&this.annotationIntent===t.PdfAnnotationIntent.none&&(this._annotationIntent=t.PdfAnnotationIntent.freeTextCallout),this._dictionary.update("IT",Xr.get(this._obtainAnnotationIntent(this._annotationIntent)))):this._dictionary.update("Subj","Text Box"),this._updateStyle(this.font,this.textMarkUpColor,this._textAlignment),this._dictionary.update("DA",this._getBorderColorString(this.borderColor?this._borderColor:[0,0,0])),this._calloutLines&&this._calloutLines.length>=2){for(var e=this._page.size[1],i=[],r=0;r<this._calloutLines.length&&r<3;r++)i.push(this._calloutLines[r][0]+this._cropBoxValueX),i.push(e+this._cropBoxValueY-this._calloutLines[r][1]);this._dictionary.update("CL",i)}if(this._setAppearance){var n=this._obtainAppearanceBounds();this._dictionary.update("Rect",[n[0],n[1],n[0]+n[2],n[1]+n[3]])}},i.prototype._getXmlFormattedString=function(t){return t=t.replace("&","&"),t=t.replace("<","<"),t=t.replace(">",">")},i.prototype._parseMarkupLanguageData=function(e){var i,r=this,n=t.PdfFontStyle.regular,s=[],a=e;if(!(this._dictionary.has("Contents")?this._dictionary.get("Contents"):"").split("").some(function(t){return r._isSymbol(t)})&&null!==a&&void 0!==a){var o=(i=(new DOMParser).parseFromString(a,"text/xml")).documentElement,h=o&&o.namespaceURI||"";if(o){var c=this._collectStyles(o),_=void 0;if(c.size>0){_=this._extractStylesToInput(c);var d=this._getFontDetails(_,this.font.size,this.textAlignment,n,null),l=this._updateFontProperties(d,"",n,null),f=l.fontName,p=l.fontStyle,u=l.brush,g=Ft(f,this.font._size,p,this);s=this._fontCollection(s,g,h,this._textAlignment,u)}else 0===c.size&&this._dictionary.has("DS")&&(_=this._dictionary.get("DS").split(";")||[]);var y=this._getFontDetails(_,this.font.size,this.textAlignment,n,null),m=this._updateFontProperties(y,"",n,null),b=m.fontName,v=m.fontStyle,w=m.brush,S=Ft(b,this.font._size,v,this);s=this._fontCollection(s,S,h,this._textAlignment,w)}}return this._parsedXMLData=s,s},i.prototype._collectStyles=function(t,e){if(void 0===e&&(e=new Map),!t)return e;var i=t.tagName.toLowerCase(),r=t.getAttribute("style");if(r){var n=r.split(";").map(function(t){return t.trim()}).filter(Boolean);e.set(i,n)}for(var s=t.firstElementChild;s;)this._collectStyles(s,e),s=s.nextElementSibling;return e},i.prototype._extractStylesToInput=function(t){var e=[];return t.forEach(function(t){e.push.apply(e,t)}),e},i.prototype._isSymbol=function(t){var e=t.charCodeAt(0);return"_"!==t&&"+"!==t&&"-"!==t&&"*"!==t&&"="!==t&&(e>=8352&&e<=8399||e>=8704&&e<=8959||e>=10752&&e<=11007||e>=8448&&e<=8527||e>=8960&&e<=9215||11088===e)},i.prototype._updateFontProperties=function(t,e,i,r){var n=this;return t.forEach(function(t,s){switch(s){case"font-family":e=t;break;case"font-size":n.font._size=parseFloat(t);break;case"font-style":case"font-weight":case"text-decoration":i=n._obtainFontStyle(t,s);break;case"text-align":n._textAlignment=n._parseTextAlignment(t);break;case"color":r=t;break;case"xfa-spacerun":n._rcText=t}}),{fontName:e,fontStyle:i,brush:r}},i.prototype._obtainFontStyle=function(e,i){var r=parseFloat(e);switch(i){case"font-style":return 0===r?t.PdfFontStyle.regular:1===r?t.PdfFontStyle.bold:2===r?t.PdfFontStyle.italic:8===r?t.PdfFontStyle.strikeout:4===r?t.PdfFontStyle.underline:t.PdfFontStyle.regular;case"font-weight":return 1===r?t.PdfFontStyle.bold:t.PdfFontStyle.regular;case"text-decoration":return 8===r?t.PdfFontStyle.strikeout:4===r?t.PdfFontStyle.underline:t.PdfFontStyle.regular;default:return t.PdfFontStyle.regular}},i.prototype._parseTextAlignment=function(e){switch(parseFloat(e)){case 0:return t.PdfTextAlignment.left;case 1:return t.PdfTextAlignment.center;case 2:return t.PdfTextAlignment.right;case 3:return t.PdfTextAlignment.justify;default:return t.PdfTextAlignment.left}},i.prototype._getFontDetails=function(t,e,i,r,n){var s=this,a=new Map;return t.forEach(function(t){var o=t.split(":").map(function(t){return t.trim()}),h=o[0],c=o[1];if(h&&c)switch(h.toLowerCase()){case"font":s._parseFont(c,a);break;case"font-size":e=s._parseFontSize(c),a.set("font-size",e);break;case"font-weight":r=s._parseFontWeight(c,r),a.set("font-weight",r);break;case"font-family":a.set("font-family",s._parseFontFamily(c));break;case"color":n=new Ar(s._rgbStringToArray(c)),a.set("color",n);break;case"font-style":r=s._parseFontStyle(c,r),a.set("font-style",r);break;case"text-decoration":r=s._parseTextDecoration(c,r),a.set("text-decoration",r);break;case"text-align":i=s._parseTextAlign(c),a.set("text-align",i);break;case"xfa-spacerun":s._rcText=c.length>1&&c.includes("yes")?s._rcText+" ":s._rcText,a.set("xfa-spacerun",s._rcText)}}),a},i.prototype._parseFont=function(t,e){var i="";t.split(" ").map(function(t){return t.trim()}).forEach(function(t){t&&!t.endsWith("pt")?i+=t+" ":t.endsWith("pt")&&e.set("font-size",parseFloat(t.replace("pt","").replace(",",".").trim()))}),e.set("font-family",i.trim().replace(/['",]/g,""))},i.prototype._parseFontSize=function(t){return t.endsWith("pt")?parseFloat(t.replace("pt","").replace(",",".").trim()):0},i.prototype._parseFontWeight=function(e,i){return e.includes("bold")&&(i|=t.PdfFontStyle.bold),i},i.prototype._parseFontFamily=function(t){return t.replace(/^'+|'+$/g,"").trim()},i.prototype._parseFontStyle=function(e,i){return e.includes("normal")||e.includes("regular")?t.PdfFontStyle.regular:e.includes("underline")?t.PdfFontStyle.underline:e.includes("strikeout")?t.PdfFontStyle.strikeout:e.includes("italic")?t.PdfFontStyle.italic:e.includes("bold")?t.PdfFontStyle.bold:i},i.prototype._parseTextDecoration=function(e,i){return e.includes("word")?t.PdfFontStyle.underline:e.includes("line-through")?t.PdfFontStyle.strikeout:i},i.prototype._parseTextAlign=function(e){switch(e.trim().toLowerCase()){case"left":return t.PdfTextAlignment.left;case"right":return t.PdfTextAlignment.right;case"center":return t.PdfTextAlignment.center;case"justify":return t.PdfTextAlignment.justify;default:return t.PdfTextAlignment.left}},i.prototype._rgbStringToArray=function(t){var e=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(e)return[r=parseInt(e[1],10),n=parseInt(e[2],10),s=parseInt(e[3],10)];var i=t.match(/^#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);if(i){var r=parseInt(i[1],16),n=parseInt(i[2],16),s=parseInt(i[3],16);return[r,n,s]}throw new Error("Invalid RGB string format")},i.prototype._fontCollection=function(t,e,i,r,n){return t.concat([e,r,i,n])},i}(ki),qi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._textAlignment=t.PdfTextAlignment.left,a._dictionary=new $r,a._dictionary.update("Type",Xr.get("Annot")),a._dictionary.update("Subtype",Xr.get("Redact")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.redactionAnnotation,a}return Ai(i,e),Object.defineProperty(i.prototype,"repeatText",{get:function(){return void 0===this._repeat&&this._dictionary.has("Repeat")&&(this._repeat=this._dictionary.get("Repeat")),this._repeat},set:function(t){t!==this._repeat&&(this._repeat=t,this._dictionary&&this._dictionary.update("Repeat",t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textColor",{get:function(){return void 0===this._textColor&&this._dictionary.has("C")&&(this._textColor=M(this._dictionary.getArray("C"))),this._textColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.textColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._textColor=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return void 0===this._borderColor&&this._dictionary.has("OC")&&(this._borderColor=M(this._dictionary.getArray("OC"))),this._borderColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.borderColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._borderColor=t,this._dictionary.update("OC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"overlayText",{get:function(){return void 0===this._overlayText&&this._dictionary.has("OverlayText")&&(this._overlayText=this._dictionary.get("OverlayText")),this._overlayText},set:function(t){"string"==typeof t&&(this._dictionary.update("OverlayText",t),this._overlayText=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new $r(this._crossReference);i.set("Type",Xr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1),this._setAppearance&&(this._appearanceTemplate=this._createRedactionAppearance(t)),this._dictionary.update("Rect",Ot(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),!this._isImported){if(this._isLoaded)this._appearanceTemplate=this._createRedactionAppearance(t);else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){var r=e.getRaw("N");r&&(i.reference=r),this._appearanceTemplate=new fe(i,this._crossReference)}}}else this._appearanceTemplate=this._createRedactionAppearance(t);if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else t&&this._page.annotations.remove(this)}},i.prototype._createRedactionAppearance=function(t){var e=this._createNormalAppearance();if(t)this._isLoaded&&null!==this._page&&this._page.annotations.remove(this);else{var i=this._createBorderAppearance();if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");r&&r instanceof $r&&(At(r,this._crossReference,"N"),At(r,this._crossReference,"R"))}var n=new $r(this._crossReference);i._content.dictionary._updated=!0;var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,i._content),i._content.reference=s,n.set("N",s),e._content.dictionary._updated=!0;var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,e._content),e._content.reference=a,n.set("R",a),n._updated=!0,this._dictionary.set("AP",n)}return e},i.prototype._createBorderAppearance=function(){var t,e=[0,0,this.bounds.width,this.bounds.height],i=new fe(e,this._crossReference),r=this.border.width/2,n=i.graphics,s=this.border.width;this.border.width>0&&this.borderColor&&(t=new xr(this.borderColor,s));var a=[e[0],e[1],e[2],e[3]];if(this.opacity<1){var o=n.save();n.setTransparency(this.opacity),n.drawRectangle(a[0]+r,a[1]+r,a[2]-s,a[3]-s,t,null),n.restore(o)}else n.drawRectangle(a[0]+r,a[1]+r,a[2]-s,a[3]-s,t,null);return i},i.prototype._createNormalAppearance=function(){var e=[0,0,this.bounds.width,this.bounds.height],i=new fe(e,this._crossReference);et(i,this._getRotationAngle());var r,n=this.border.width/2,s=i.graphics,a=new sr;this.textColor&&this.border.width>0&&(r=new xr(this.textColor,this.border.width));var o,h;this.innerColor&&(o=new Ar(this.innerColor)),h=new Ar(this.textColor?this.textColor:[128,128,128]),a.backBrush=o,a.borderWidth=n;var c=this.border.width,_=[e[0],e[1],e[2],e[3]];if(this.opacity<1){var d=s.save();s.setTransparency(this.opacity),s.drawRectangle(_[0]+n,_[1]+n,_[2]-c,_[3]-c,r,o),s.restore(d)}else s.drawRectangle(_[0]+n,_[1]+n,_[2]-c,_[3]-c,r,o);if(s.restore(),this.overlayText&&Ut(this.overlayText)&&""!==this._overlayText){var l=0,f=0;void 0!==this.font&&null!==this.font||(this.font=this._lineCaptionFont);var p=0,u=0,g=0,y=void 0;this._isLoaded&&(this._textAlignment=this.textAlignment);var m=new pe(this._textAlignment,t.PdfVerticalAlignment.top),b=this.font.measureString(this.overlayText,[0,0],m,0,0);if(this._isLoaded&&void 0===this._repeat&&(this._repeat=this.repeatText),this._repeat){b[0]<=0&&(b[0]=1),l=this.bounds.width/b[0],f=Math.floor(this.bounds.height/this.font._size),g=Math.abs(this.bounds.width-Math.floor(l)*b[0]),this._textAlignment===t.PdfTextAlignment.center&&(u=g/2),this._textAlignment===t.PdfTextAlignment.right&&(u=g);for(var v=1;v<l;v++){for(var w=0;w<f;w++)y=[u,p,0,0],s.drawString(this.overlayText,this.font,y,null,h,null),p+=this.font._size;u+=b[0],p=0}}else g=Math.abs(this.bounds.width-b[0]),this._textAlignment===t.PdfTextAlignment.center&&(u=g/2),this._textAlignment===t.PdfTextAlignment.right&&(u=g),y=[u,0,this.bounds.width-this.border.width,this.bounds.height-this.border.width],s.drawString(this.overlayText,this.font,y,null,h,m)}return i},i}(xi),Qi=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.richMediaAnnotation,i}return Ai(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),void 0!==this.flattenPopups&&this.flattenPopups&&this._flattenPopUp(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new fe(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(xi),Ji=function(e){function i(){var i=e.call(this)||this;return i._isAutoResize=!1,i._visibility=t.PdfFormFieldVisibility.visible,i._isFont=!1,i._isTransparentBackColor=!1,i._isTransparentBorderColor=!1,i._isWidget=!0,i._type=t._PdfAnnotationType.widgetAnnotation,i}return Ai(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._dictionary=t,r._crossReference=e,r},Object.defineProperty(i.prototype,"page",{get:function(){return this._getPage()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return void 0===this._color&&this._defaultAppearance&&(this._color=this._da.color),this._color},set:function(t){void 0!==this.color&&this._color===t||(this._color=t);var e=!1;this._defaultAppearance||(this._da=new Si(""),e=!0),(e||this._da.color!==t)&&(this._da.color=t,this._dictionary.update("DA",this._da.toString()))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor()},set:function(t){this._updateBackColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_hasBackColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;return t&&t.has("BG")}return!this._isTransparentBackColor},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_hasBorderColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;return t&&t.has("BC")}return!this._isTransparentBorderColor},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return this._parseBorderColor()},set:function(t){this._updateBorderColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rotate",{get:function(){return void 0===this._rotationAngle&&(this._mkDictionary&&this._mkDictionary.has("R")?this._rotationAngle=this._mkDictionary.get("R"):this._dictionary.has("R")&&(this._rotationAngle=this._dictionary.get("R"))),this._rotationAngle},set:function(t){void 0!==this.rotate&&this._rotationAngle===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new $r(this._crossReference)),this._mkDictionary.update("R",t),this._rotationAngle=t,this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){if(void 0===this._highlightMode&&this._dictionary.has("H")){var t=this._dictionary.get("H");this._highlightMode=z(t.name)}return this._highlightMode},set:function(t){this._highlightMode!==t&&this._dictionary.update("H",U(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._isLoaded&&void 0===this._bounds&&(this._bounds=L(this._dictionary,this._getPage())),void 0!==this._bounds&&null!==this._bounds||(this._bounds={x:0,y:0,width:0,height:0}),this._bounds},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");this._bounds=t,this._page&&this._page._isNew&&this._page._pageSettings?this._dictionary.update("Rect",Ot(this)):this._dictionary.update("Rect",O([t.x,t.y,t.width,t.height],this._getPage()))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return void 0===this._textAlignment&&this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){void 0!==this._textAlignment&&this._textAlignment===t||this._dictionary.update("Q",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visibility",{get:function(){var e;if(!this._isLoaded)return this._visibility;e=t.PdfFormFieldVisibility.visible;var i=t.PdfAnnotationFlag.default;if(this._hasFlags){var r=3;switch(((i=this.flags)&t.PdfAnnotationFlag.hidden)===t.PdfAnnotationFlag.hidden&&(r=0),(i&t.PdfAnnotationFlag.noView)===t.PdfAnnotationFlag.noView&&(r=1),(i&t.PdfAnnotationFlag.print)!==t.PdfAnnotationFlag.print&&(r&=2),r){case 0:e=t.PdfFormFieldVisibility.hidden;break;case 1:e=t.PdfFormFieldVisibility.hiddenPrintable;break;case 2:e=t.PdfFormFieldVisibility.visibleNotPrintable;break;case 3:e=t.PdfFormFieldVisibility.visible}}else e=t.PdfFormFieldVisibility.visibleNotPrintable;return e},set:function(e){if(this._isLoaded)Pt(this._dictionary,e),this._dictionary._updated=!0;else{switch(e){case t.PdfFormFieldVisibility.hidden:this.flags=t.PdfAnnotationFlag.hidden;break;case t.PdfFormFieldVisibility.hiddenPrintable:this.flags=t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visible:this.flags=t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visibleNotPrintable:this.flags=t.PdfAnnotationFlag.default}this._visibility=e}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){var e=this;if(!this._pdfFont){var i=void 0;if(this._crossReference){var r=this._crossReference._document.form,n=this._obtainFontDetails();if(r&&r._dictionary.has("DR")){var s=r._dictionary.get("DR");if(s.has("Font")){var a=s.get("Font");if(a.has(n.name)){var o=a.get(n.name);if(o&&n.name&&o.has("BaseFont")){var h=o.get("BaseFont"),c=t.PdfFontStyle.regular;h&&(i=h.name,c=Rt(h.name),i.includes("-")&&(i=i.substring(0,i.indexOf("-"))),this._pdfFont=Ft(i,n.size,c,this))}}}}null!==r&&void 0!==r&&(null===this._pdfFont||void 0===this._pdfFont)&&r._parsedFields&&r._parsedFields.size>0&&r._parsedFields.forEach(function(t){t instanceof pi&&t._kidsCount>0&&(e._pdfFont=Tt(r,e,t))})}}return(null===this._pdfFont||void 0===this._pdfFont||!this._isLoaded&&1===this._pdfFont.size)&&(this._pdfFont=this._circleCaptionFont),this._pdfFont},set:function(t){t&&t instanceof $e&&(this._pdfFont=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_defaultAppearance",{get:function(){if(void 0===this._da&&this._dictionary.has("DA")){var t=this._dictionary.get("DA");t&&""!==t&&(this._da=new Si(t))}return this._da},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),i.prototype._create=function(e,i,r){return this._page=e,this._crossReference=e._crossReference,this._ref=this._crossReference._getNextReference(),this._dictionary=new $r(this._crossReference),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary._currentObj=this,this._dictionary.objId=this._ref.toString(),this._dictionary.update("Type",Xr.get("Annot")),this._dictionary.update("Subtype",Xr.get("Widget")),this.flags|=t.PdfAnnotationFlag.print,this._dictionary.update("P",e._ref),e._addWidget(this._ref),this.border=new rr,this.bounds=i,r&&(this._field=r,this._dictionary.update("Parent",this._field._ref)),this._dictionary},i.prototype._doPostProcess=function(e,i){if(void 0===e&&(e=!1),void 0===i&&(i=!1),e||i){var r=void 0;if(i||e&&this._dictionary.has("AP"),!r&&this._dictionary.has("AP")){var n=this._dictionary.get("AP");n&&n.has("N")&&(r=n.get("N"),(d=n.getRaw("N"))&&r&&(r.reference=d))}if(r){var s=void 0;if(e){var a=new fe(r,this._crossReference),o=this._getPage();if(o){var h=o.graphics;h.save(),o.rotation===t.PdfRotationAngle.angle90?(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(90)):o.rotation===t.PdfRotationAngle.angle180?(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(-180)):o.rotation===t.PdfRotationAngle.angle270&&(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(270)),s={x:this.bounds.x,y:this.bounds.y,width:a._size[0],height:a._size[1]},h.drawTemplate(a,s),h.restore()}}else{var c=void 0;if(this._dictionary.has("AP"))c=this._dictionary.get("AP");else{var _=this._crossReference._getNextReference();c=new $r(this._crossReference),this._crossReference._cacheMap.set(_,c),this._dictionary.update("AP",_)}At(c,this._crossReference,"N");var d=this._crossReference._getNextReference();this._crossReference._cacheMap.set(d,r),c.update("N",d)}}this._dictionary._updated=!1}},i.prototype._initializeFont=function(t){this._pdfFont=t;var e;if(this._crossReference){var i=void 0;(e=this._crossReference._document)&&(i=e.form._dictionary.has("DR")?e.form._dictionary.get("DR"):new $r(this._crossReference));var r=void 0,n=!1;if(i.has("Font")){var s=i.getRaw("Font");s&&s instanceof Qr?(n=!0,r=this._crossReference._fetch(s)):s instanceof $r&&(r=s)}r||(r=new $r(this._crossReference),i.update("Font",r));var a=Xr.get(X()),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,this._pdfFont._dictionary),t instanceof ii?this._pdfFont._pdfFontInternals&&this._crossReference._cacheMap.set(o,this._pdfFont._pdfFontInternals):this._pdfFont._dictionary&&this._crossReference._cacheMap.set(o,this._pdfFont._dictionary),r.update(a.name,o),i._updated=!0,e.form._dictionary.update("DR",i),e.form._dictionary._updated=!0,this._fontName=a.name;var h=new Si;h.fontName=this._fontName,h.fontSize=this._pdfFont._size,h.color=this.color?this.color:[0,0,0],this._dictionary.update("DA",h.toString()),n&&(i._updated=!0),this._isFont=!0}},i.prototype._getPage=function(){if(!this._page){var t;this._crossReference&&(t=this._crossReference._document);var e=void 0;if(this._dictionary.has("P")){var i=this._dictionary.getRaw("P");if(i&&t)for(var r=0;r<t.pageCount;r++){var n=t.getPage(r);if(n&&n._ref===i){e=n;break}}}!e&&t&&this._ref&&(e=J(t,this._ref)),this._page=e}return this._page},i.prototype._beginSave=function(){if(!this._isLoaded&&!this._page._isNew){var t=this._bounds;this._dictionary.update("Rect",O([t.x,t.y,t.width,t.height],this._page))}},i.prototype._parseBackColor=function(){var t;if(this._isLoaded&&this._hasBackColor||!this._isLoaded&&!this._isTransparentBackColor){if(void 0===this._backColor){var e=this._mkDictionary;if(e&&e.has("BG")){var i=e.getArray("BG");i&&(this._backColor=M(i))}}void 0!==this._backColor&&null!==this._backColor||(this._backColor=[255,255,255]),t=this._backColor}return t},i.prototype._parseBorderColor=function(){var t;if(this._isLoaded&&this._hasBorderColor||!this._isLoaded&&!this._isTransparentBorderColor){if(void 0===this._borderColor){var e=this._mkDictionary;if(e&&e.has("BC")){var i=e.getArray("BC");i&&(this._borderColor=M(i))}}void 0!==this._borderColor&&null!==this._borderColor||(this._borderColor=[0,0,0]),t=this._borderColor}return t},i.prototype._updateBackColor=function(t,e){void 0===e&&(e=!1);var i=!1;if(4===t.length&&255!==t[3]){this._isTransparentBackColor=!0,this._dictionary.has("BG")&&(delete this._dictionary._map.BG,i=!0);var r=this._mkDictionary;r&&r.has("BG")&&(delete r._map.BG,this._dictionary._updated=!0,i=!0)}else this._isTransparentBackColor=!1,void 0!==this.backColor&&this._backColor===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new $r(this._crossReference)),this._mkDictionary.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._backColor=[t[0],t[1],t[2]],this._dictionary._updated=!0,i=!0);e&&i&&this._field&&(this._field._setAppearance=!0)},i.prototype._updateBorderColor=function(t){if(4===t.length&&255!==t[3]){this._isTransparentBorderColor=!0,this._dictionary.has("BC")&&delete this._dictionary._map.BC;var e=this._mkDictionary;if(e&&e.has("BC")){if(delete e._map.BC,this._dictionary.has("BS")){var i=this._dictionary.get("BS");i&&i.has("W")&&delete i._map.W}this._dictionary._updated=!0}}else this._isTransparentBorderColor=!1,void 0!==this.borderColor&&this.borderColor===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new $r(this._crossReference)),this._mkDictionary.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._borderColor=[t[0],t[1],t[2]],this._dictionary._updated=!0)},i}(xi),Yi=function(e){function i(){return e.call(this)||this}return Ai(i,e),i._load=function(t,e,r){var n=new i;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=r,n},Object.defineProperty(i.prototype,"checked",{get:function(){return Y(this._dictionary)},set:function(t){this.checked!==t&&(this._field&&(this._setCheckedStatus(t),this._field._setAppearance=!0),this._dictionary.update("AS",Xr.get(t?"Yes":"Off")))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"style",{get:function(){if(this._isLoaded){var e=this._mkDictionary;e&&e.has("CA")?this._style=rt(e.get("CA")):this._style=t.PdfCheckBoxStyle.check}return this._style},set:function(t){if(this.style!==t){this._style=t;var e=this._mkDictionary;e||(e=new $r(this._crossReference),this._dictionary.update("MK",e)),e.update("CA",it(t))}},enumerable:!0,configurable:!0}),i.prototype._setCheckedStatus=function(t){var e=t,i=this._getItemValue(this._dictionary);if(this._unCheckOthers(this,i,t),e)i||(i="Yes"),this._field._dictionary.update("V",i),this._dictionary.update("AS",Xr.get(i)),this._dictionary.update("V",Xr.get(i));else if(this._field._dictionary){if(this._field._dictionary.has("V")){var r=this._field._dictionary.get("V");r&&r.name===i&&delete this._field._dictionary._map.V}this._field._dictionary.update("AS",Xr.get("Off"))}},i.prototype._unCheckOthers=function(t,e,i){if(!this._field._isUpdating){this._field._isUpdating=!0;for(var r=this._field.itemsCount,n=0;n<r;++n){var s=this._field.itemAt(n);s&&(s!==t?s.checked=this._getItemValue(s._dictionary)===e&&i:s.checked||(s.checked=!0))}}},i.prototype._getItemValue=function(t){var e="";if(t&&t.has("AS")){var i=t.get("AS");i&&"Off"!==i.name&&(e="Off")}if(""===e&&t&&t.has("AP")){var r=t.get("AP");if(r&&r.has("N")){var n=[];if(r.get("N").forEach(function(t,e){n.push(t)}),n.length>0)for(var s=0;s<n.length;s++){var a=n[s];if(a&&"Off"!==a){e=a;break}}}}return e},i.prototype._doPostProcess=function(){var e=$(this.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked,this);if(e){var i=this._getPage();if(i){var r=i.graphics;r.save(),i.rotation===t.PdfRotationAngle.angle90?(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(90)):i.rotation===t.PdfRotationAngle.angle180?(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(-180)):i.rotation===t.PdfRotationAngle.angle270&&(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(270)),r._sw._setTextRenderingMode(t._TextRenderingMode.fill),r.drawTemplate(e,this.bounds),r.restore()}}this._dictionary._updated=!1},i.prototype._postProcess=function(t){var e=this._field;t||(t=e&&e.checked?"Yes":"Off"),this._dictionary.update("AS",Xr.get(t))},i.prototype._setField=function(e){this._field=e,this._field._stringFormat=new pe(this.textAlignment,t.PdfVerticalAlignment.middle),this._field._addToKid(this)},i}(Ji),Zi=function(e){function i(t,i,r){var n=e.call(this)||this;return r&&t&&i&&(r instanceof fi?n._initializeItem(t,i,r.page,r):n._initializeItem(t,i,r)),n}return Ai(i,e),i._load=function(t,e,r){var n=new i;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=r,n},Object.defineProperty(i.prototype,"selected",{get:function(){return this._index===this._field.selectedIndex},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"value",{get:function(){return this._isLoaded&&!this._optionValue&&(this._optionValue=Z(this._dictionary)),this._optionValue},set:function(t){this._optionValue=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor()},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._initializeItem=function(e,i,r,n){this._optionValue=e,this._page=r,this._create(this._page,i,this._field),this.textAlignment=t.PdfTextAlignment.left,this._dictionary.update("MK",new $r(this._crossReference)),this._mkDictionary.update("BC",[0,0,0]),this._mkDictionary.update("BG",[1,1,1]),this.style=t.PdfCheckBoxStyle.circle,this._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg"),n&&(this._setField(n),this._dictionary.update("Parent",n._ref))},i.prototype._postProcess=function(t){var e=this._field;!t&&e&&-1!==e.selectedIndex&&(t=e.itemAt(e.selectedIndex).value),this.value===t?this._dictionary.update("AS",Xr.get(this.value)):this._dictionary.update("AS",Xr.get("Off"))},i}(Yi),$i=function(t){function e(e,i,r){var n=t.call(this)||this;return e&&i&&n._initializeItem(e,i,r),n}return Ai(e,t),e._load=function(t,i,r){var n=new e;return n._isLoaded=!0,n._dictionary=t,n._crossReference=i,n._field=r,n},Object.defineProperty(e.prototype,"text",{get:function(){return void 0===this._text&&void 0!==this._field&&(this._field instanceof vi||this._field instanceof bi)&&(this._text=this._field._options[this._index][1]),this._text},set:function(t){"string"==typeof t&&void 0!==this._field&&(this._field instanceof vi||this._field instanceof bi)&&t!==this._field._options[this._index][1]&&(this._field._options[this._index][1]=t,this._text=t,this._field._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selected",{get:function(){return this._index===this._field.selectedIndex},enumerable:!0,configurable:!0}),e.prototype._initializeItem=function(t,e,i){this._text=t,this._value=e,i&&i instanceof vi&&i._addToOptions(this,i)},e}(Yi),tr=function(){function e(e,i,r){this._cap=void 0!==e&&e,this._type=void 0!==i?i:t.PdfLineCaptionType.inline,this._offset=void 0!==r?r:[0,0]}return Object.defineProperty(e.prototype,"cap",{get:function(){return this._cap},set:function(t){t!==this._cap&&(this._cap=t,this._dictionary&&this._dictionary.update("Cap",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){e!==this._type&&(this._type=e,this._dictionary&&this._dictionary.update("CP",Xr.get(e===t.PdfLineCaptionType.top?"Top":"Inline")))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"offset",{get:function(){return this._offset},set:function(t){y(t,this._offset)&&(this._offset=t,this._dictionary&&this._dictionary.update("CO",t))},enumerable:!0,configurable:!0}),e}(),er=function(){function e(e,i){this._begin=void 0!==e?e:t.PdfLineEndingStyle.none,this._end=void 0!==i?i:t.PdfLineEndingStyle.none}return Object.defineProperty(e.prototype,"begin",{get:function(){return this._begin},set:function(t){t!==this._begin&&(this._begin=t,this._dictionary&&this._dictionary.update("LE",[Xr.get(j(t)),Xr.get(j(this._end))]))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},set:function(t){t!==this._end&&(this._end=t,this._dictionary&&this._dictionary.update("LE",[Xr.get(j(this._begin)),Xr.get(j(t))]))},enumerable:!0,configurable:!0}),e}(),ir=function(){function e(e,i,r){this._width=void 0!==e?e:1,this._style=void 0!==i?i:t.PdfBorderStyle.solid,void 0!==r&&Array.isArray(r)&&(this._dash=r)}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){if(t!==this._width&&(this._width=t,this._dictionary)){var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new $r(this._crossReference);e.update("Type",Xr.get("Border")),e.update("W",this._width),e.update("S",N(this._style)),this._dash&&e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(e){if(e!==this._style&&(this._style=e,this._dash||(e===t.PdfBorderStyle.dot?this._dash=[1,1]:e===t.PdfBorderStyle.dashed&&(this._dash=[3,1])),this._dictionary)){var i=this._dictionary.has("BS")?this._dictionary.get("BS"):new $r(this._crossReference);i.update("Type",Xr.get("Border")),i.update("W",this._width),i.update("S",N(this._style)),this._dash&&i.update("D",this._dash),this._dictionary.update("BS",i),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){if((void 0===this._dash||y(t,this._dash))&&(this._dash=t,this._dictionary)){var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new $r(this._crossReference);e.update("Type",Xr.get("Border")),e.update("W",this._width),e.update("S",N(this._style)),e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),e}(),rr=function(t){function e(e,i,r,n,s){var a=t.call(this,e,n,s)||this;return a._hRadius=void 0!==i?i:0,a._vRadius=void 0!==r?r:0,a}return Ai(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){if(t!==this._width&&(this._width=t,this._dictionary)){this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]);var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new $r(this._crossReference);e.update("Type",Xr.get("Border")),e.update("W",this._width),e.update("S",N(this._style)),this._dash&&e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hRadius",{get:function(){return this._hRadius},set:function(t){t!==this._hRadius&&(this._hRadius=t,this._dictionary&&this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vRadius",{get:function(){return this._vRadius},set:function(t){t!==this._vRadius&&(this._vRadius=t,this._dictionary&&this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]))},enumerable:!0,configurable:!0}),e}(ir),nr=function(){function e(t){if(this._intensity=0,void 0!==t&&null!==t){if(t.has("BE")){var e=this._dictionary.get("BE");e&&(e.has("I")&&(this._intensity=e.get("I")),e.has("S")&&(this._style=this._getBorderEffect(e.get("S"))))}}else this._dictionary=new $r,this._dictionary.set("I",this._intensity),this._dictionary.set("S",this._styleToEffect(this._style))}return Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){if(t!==this._intensity){if(this._intensity=t,this._dictionary){var e=this._dictionary.has("BE")?this._dictionary.get("BE"):new $r(this._crossReference);e.update("I",this._intensity),e.update("S",this._styleToEffect(this._style)),this._dictionary.update("BE",e),this._dictionary._updated=!0}this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){if(t!==this._style&&(this._style=t,this._dictionary)){var e=this._dictionary.has("BE")?this._dictionary.get("BE"):new $r(this._crossReference);e.update("I",this._intensity),e.update("S",this._styleToEffect(this._style)),this._dictionary.update("BE",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),e.prototype._getBorderEffect=function(e){return"/C"===e?t.PdfBorderEffectStyle.cloudy:t.PdfBorderEffectStyle.solid},e.prototype._styleToEffect=function(e){return e===t.PdfBorderEffectStyle.cloudy?"C":"S"},e}(),sr=function(){function t(){this.borderWidth=1}return t}(),ar=function(){function t(){this.startAngle=0,this.endAngle=0}return t}(),or=function(){function t(t,e,i){this._isExport=!1,Ut(t)?this._annotations=t:this._annotations=[],this._page=i,this._crossReference=e,this._parsedAnnotations=new Map,this._comments=[]}return Object.defineProperty(t.prototype,"count",{get:function(){return this._annotations.length},enumerable:!0,configurable:!0}),t.prototype.at=function(t){if(t<0||t>=this._annotations.length)throw Error("Index out of range.");if(!this._parsedAnnotations.has(t)){var e=this._annotations[t];if(e&&e instanceof Qr&&(e=this._crossReference._fetch(e)),e&&e instanceof $r){var i=this._parseAnnotation(e,t);i&&(i._ref=this._annotations[t],this._parsedAnnotations.set(t,i))}}return this._parsedAnnotations.get(t)},t.prototype.add=function(t){if(void 0===t||null===t)throw Error("annotation cannot be null or undefined");if(t instanceof Mi&&(t._isReview||t._isComment)&&t.bounds&&(t.bounds.y=-t.bounds.y,t.bounds.height=-t.bounds.height),t._isLoaded)throw Error("cannot add an existing annotation");t._initialize(this._page);var e;void 0!==t._ref&&t._ref._isNew?e=t._ref:(e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,t._dictionary),t._ref=e);var i=this._annotations.length;this._annotations.push(e),this._parsedAnnotations.set(i,t);var r=!1;if(this._page&&this._page._pageDictionary.has("Annots")){var n=this._page._pageDictionary.get("Annots");null!==n&&void 0!==n&&-1===n.indexOf(e)&&(n.push(e),this._page._pageDictionary.set("Annots",n),r=!0)}return r||this._page._pageDictionary.set("Annots",this._annotations),this._page._pageDictionary._updated=!0,t&&t instanceof ki&&this._addCommentsAndReview(t,t._dictionary.get("F")),this._updateCustomAppearanceResource(t),i},t.prototype.remove=function(t){if(t&&t._ref){var e=this._annotations.lastIndexOf(t._ref);e>-1&&this.removeAt(e)}},t.prototype.removeAt=function(t){if(t<0||t>=this._annotations.length)throw Error("Index out of range.");var e=this._annotations[t];if(e&&this._page){var i=this._page._getProperty("Annots"),r=void 0;if(this._parsedAnnotations.has(t))r=this._parsedAnnotations.get(t);else{var n=this._crossReference._fetch(e);(r=this._parseAnnotation(n))._ref=e}if(r){var s=r.comments,a=r.reviewHistory;this._processAnnotations(s,i),this._processAnnotations(a,i)}var o=i.indexOf(e);o>-1&&i.splice(o,1),this._page._pageDictionary.set("Annots",i),this._page._pageDictionary._updated=!0,this._annotations.indexOf(e)>-1&&this._annotations.splice(t,1),this._parsedAnnotations.has(t)&&(this._parsedAnnotations.delete(t),this._reorderParsedAnnotations(t));var h=this._page._crossReference;h&&h._cacheMap.has(e)&&h._cacheMap.delete(e)}},t.prototype._processReferences=function(t,e){var i=this;t.forEach(function(t){if(t&&-1!==e.indexOf(t)){var r=e.indexOf(t);e.splice(r,1);var n=i._annotations.indexOf(t);n>-1&&i._annotations.splice(n,1),i._parsedAnnotations.has(r)&&(i._parsedAnnotations.delete(r),i._reorderParsedAnnotations(r));var s=i._page._crossReference;s&&s._cacheMap.has(t)&&s._cacheMap.delete(t)}})},t.prototype._processAnnotations=function(t,e){var i=this;t&&t._collection.length>0&&t._collection.forEach(function(t){var r=[t._ref];t.reviewHistory&&t.reviewHistory._collection.length>0&&r.push.apply(r,t.reviewHistory._collection.map(function(t){return t._ref})),i._processReferences(r,e)})},t.prototype._reorderParsedAnnotations=function(t){var e=new Map;this._parsedAnnotations.forEach(function(i,r){r>t?e.set(r-1,i):e.set(r,i)}),this._parsedAnnotations=e},t.prototype._updateCustomAppearanceResource=function(t){t&&t instanceof Gi&&void 0!==t._appearance&&t._appearance.normal.graphics._processResources(t._crossReference)},t.prototype._addCommentsAndReview=function(t,e){this._updateChildReference(t,t.comments,e),this._updateChildReference(t,t.reviewHistory,e)},t.prototype._updateChildReference=function(t,e,i){var r=this;if(e&&e.count>0){if(30===i)throw new Error("Could not add comments/reviews to the review");e._collection.forEach(function(i,n){i&&!i._dictionary.has("IRT")&&(0!==n&&e._isReview?i._dictionary.update("IRT",e._collection[n-1]._ref):i._dictionary.update("IRT",t._ref),e._isReview?i._isReview=!0:i._isComment=!0,r.add(i))})}},t.prototype._getAnnotations=function(){if(0===this._parsedAnnotations.size)for(var t=0;t<this._annotations.length;t++){var e=this._annotations[t];if(e&&e instanceof Qr&&(e=this._crossReference._fetch(e)),e&&e instanceof $r){var i=this._isPopupWithExternalParent(e),r=this._parseAnnotation(e,t);r?(r._ref=this._annotations[t],this._parsedAnnotations.set(t,r)):i&&t--}}},t.prototype._isPopupWithExternalParent=function(t){if(t&&t.has("Subtype")){var e=t.get("Subtype");if(e&&"Popup"===e.name&&t.has("Parent"))return!0}return!1},t.prototype._parseAnnotation=function(t,e){var i,r=!1;if(t&&t.has("Subtype")&&null!==this._page&&void 0!==this._page){var n=t.get("Subtype"),s=t.get("Rect");if(n){var a=void 0;switch(n.name){case"Line":i=Ci._load(this._page,t);break;case"Circle":i=t.has("Measure")?Ti._load(this._page,t):s[2]-s[0]===s[3]-s[1]?Ti._load(this._page,t):Ri._load(this._page,t);break;case"Square":i=s&&s.length>=4&&s[2]===s[3]?Fi._load(this._page,t):Li._load(this._page,t);break;case"Polygon":i=Di._load(this._page,t);break;case"PolyLine":t.has("Measure")&&t.has("IT")&&(o=t.get("IT"))&&"PolyLineAngle"===o.name&&(i=Oi._load(this._page,t)),i||(i=Bi._load(this._page,t));break;case"Ink":i=Ii._load(this._page,t);break;case"Popup":r=this._isPopupWithExternalParent(t),"number"==typeof e&&r?this._annotations.splice(e,1):i=Mi._load(this._page,t);break;case"Text":i=Mi._load(this._page,t);break;case"Link":if(t.has("A")&&(a=t.get("A")),a&&a.has("S")){var o=a.get("S").name;if(o){var h=this._hasValidBorder(t.getArray("Border"));"URI"===o?i=h?Vi._load(this._page,t):this._getLinkAnnotation(t):"Launch"===o?i=Ni._load(this._page,t):"GoToR"===o?i=this._getLinkAnnotation(t):"GoTo"===o&&(i=ji._load(this._page,t))}}else"Link"===n.name&&(i=ji._load(this._page,t));break;case"FileAttachment":i=zi._load(this._page,t);break;case"3D":i=Ui._load(this._page,t);break;case"FreeText":i=Xi._load(this._page,t);break;case"Redact":i=qi._load(this._page,t);break;case"RichMedia":i=Qi._load(this._page,t);break;case"Watermark":i=Hi._load(this._page,t);break;case"Stamp":i=Gi._load(this._page,t);break;case"Sound":i=Ki._load(this._page,t);break;case"Caret":case"Highlight":case"Squiggly":case"StrikeOut":case"Underline":i=Wi._load(this._page,t)}}}return i},t.prototype._getLinkAnnotation=function(t){var e;if(this._page)if(t&&t.has("A")){var i=t.get("A");if(i&&i.has("S")){var r=i.get("S");r&&"GoToR"===r.name&&i.has("F")?e=Ni._load(this._page,t):r&&"URI"===r.name&&(e=Ei._load(this._page,t))}}else e=Ei._load(this._page,t);return e},t.prototype._hasValidBorder=function(t){return void 0!==t&&null!==t&&!t.some(function(t){return void 0!==t&&null!==t&&t>0})},t.prototype._doPostProcess=function(t){for(var e=0;e<this.count;){var i=this.at(e);if(i){var r=i.flatten||t;i._isExport=this._isExport,r&&-1===this._annotations.lastIndexOf(i._ref)&&e++,i._doPostProcess(r),r||e++}else e++}},t.prototype._reArrange=function(t,e,i){if(this._annotations){e>this._annotations.length&&(e=0),i>=this._annotations.length&&(i=this._annotations.indexOf(t));var r=this._crossReference._fetch(this._annotations[i]);if(r&&r.has("Parent")){var n=r.getRaw("Parent");if(n&&n===t||t===this._annotations[i]){var s=this._annotations[i];this._annotations[i]=this._annotations[e],this._annotations[e]=s}}}return this._annotations},t.prototype._clear=function(){this._annotations=[],this._parsedAnnotations=new Map,this._comments=[]},t}(),hr=function(){function e(t,e){this._collection=[],t&&(this._annotation=t),this._isReview=e,(t&&this._annotation._isLoaded||t._page)&&(this._page=t._page,this._parentDictionary=t._dictionary,this._annotation._isLoaded&&this._parseCommentsOrReview())}return Object.defineProperty(e.prototype,"count",{get:function(){return this._collection.length},enumerable:!0,configurable:!0}),e.prototype.at=function(t){if(t<0||t>=this._collection.length)throw Error("Index out of range.");return this._collection[t]},e.prototype.add=function(e){if(30===this._annotation._dictionary.get("F"))throw new Error("Could not add comments/reviews to the review");if(e._dictionary.update("F",this._annotation.flags===t.PdfAnnotationFlag.locked?128:this._isReview?30:28),this._annotation&&(this._annotation._isLoaded||this._page&&this._annotation._ref)){this._page.annotations.add(e);var i=this._collection.length;0!==i&&this._isReview?e._dictionary.update("IRT",this._collection[i-1]._ref):e._dictionary.update("IRT",this._annotation._ref),this._isReview?e._isReview=!0:e._isComment=!0}this._collection.push(e)},e.prototype.remove=function(t){var e=this._collection.indexOf(t);e>-1&&this.removeAt(e)},e.prototype.removeAt=function(t){if(!(t>-1&&t<this._collection.length))throw new Error("Index out of range.");var e=this._collection[t];if(this._isReview&&t<this._collection.length-1){var i=this._collection[t+1],r=e._dictionary._get("IRT");i._dictionary.set("IRT",r),i._dictionary._updated=!0}this._collection.splice(t,1),this._page.annotations.remove(e)},e.prototype._parseCommentsOrReview=function(){this._isReview?this._parseReview():this._parseComments()},e.prototype._parseReview=function(){var t,e=this;this._page&&(t=this._page.annotations);var i=new Map;if(i.set(this._annotation._ref,this._annotation),t&&t._comments&&t._comments.length>0){var r=[];t._comments.forEach(function(t){var n=t._dictionary._get("IRT");t._isReview&&n&&i.has(n)?(e._collection.push(t),i.set(t._ref,t)):r.push(t)}),r.length>0?t._comments=r:t._comments=[]}else if(t)for(var n=t.count,s=0;s<n;s++){var a=t.at(s);if(a&&a instanceof Mi){var o=a._dictionary;if(a._dictionary.has("IRT")){var h=o._get("IRT");a._isReview&&h&&i.has(h)?(this._collection.push(a),i.set(a._ref,a)):t._comments.push(a)}}}i.clear()},e.prototype._parseComments=function(){var t,e=this;if(this._page&&(t=this._page.annotations),t&&t._comments&&t._comments.length>0){var i=[];t._comments.forEach(function(t){var r=t._dictionary,n=wt(r),s=r._get("IRT");s&&s===e._annotation._ref&&!n?e._collection.push(t):i.push(t)}),i.length>0?t._comments=i:t._comments=[]}else if(t)for(var r=t.count,n=0;n<r;n++){var s=t.at(n);if(s&&s instanceof Mi){var a=s._dictionary;if(s._dictionary.has("IRT")){var o=wt(a),h=a._get("IRT");h&&h===this._annotation._ref&&!o?this._collection.push(s):t._comments.push(s)}}}},e}(),cr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),_r=function(){function t(t,e){this._bookMarkList=[],this._isExpanded=!1,this._isLoadedBookmark=!1,this._dictionary=t,this._crossReference=e}return Object.defineProperty(t.prototype,"count",{get:function(){return this._isLoadedBookmark&&0===this._bookMarkList.length&&this._reproduceTree(),this._bookMarkList.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isExpanded",{get:function(){return this._dictionary&&this._dictionary.has("Count")?this._dictionary.get("Count")>=0:this._isExpanded},set:function(t){this._isExpanded=t,this.count>0&&this._dictionary&&this._dictionary.update("Count",t?this._bookMarkList.length:-this._bookMarkList.length)},enumerable:!0,configurable:!0}),t.prototype.at=function(t){var e;if(t<0||t>=this.count)throw Error("Index out of range.");return Ut(this._bookMarkList)&&this._bookMarkList.length>0&&t<this._bookMarkList.length&&(e=this._bookMarkList[t]),e},t.prototype.contains=function(t){return-1!==this._bookMarkList.indexOf(t)},t.prototype.add=function(t,e){var i;if(this._dictionary){var r=new $r(this._crossReference);r.update("Parent",this._reference);var n=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(n,r),i=new dr(r,this._crossReference),i._reference=n,i.title=t,void 0===e){if(0===this.count)this._dictionary.update("First",n),this._dictionary.update("Last",n);else{s=this.at(this.count-1);this._dictionary.update("Last",n),s&&s._reference&&(r.update("Prev",s._reference),s._dictionary.update("Next",n))}this._bookMarkList.push(i)}else{if(e<0||e>this.count)throw new Error("Index out of range");if(0===this.count)this._dictionary.update("First",n),this._dictionary.update("Last",n),this._bookMarkList.push(i);else if(e===this.count){var s=this.at(this.count-1);this._dictionary.update("Last",n),s&&s._reference&&(r.update("Prev",s._reference),s._dictionary.update("Next",n)),this._bookMarkList.push(i)}else if(0===e){var a=this.at(0);this._dictionary.update("First",n),a&&a._reference&&(r.update("Next",a._reference),a._dictionary.update("Prev",n)),this._updateBookmarkList(e,i)}else{var o=this.at(e),h=this.at(e-1);h&&h._reference&&o&&o._reference&&(r.update("Prev",h._reference),h._dictionary.update("Next",n),o._dictionary.update("Prev",n),r.update("Next",o._reference)),this._updateBookmarkList(e,i)}}this._updateCount()}return i},t.prototype.remove=function(t){if("string"==typeof t)for(var e=this._bookMarkList.length-1;e>=0;e--){var i=this.at(e);i.title===t?this.remove(e):i.count>0&&i.remove(t)}else if(t>=0&&t<this.count)if(1===this.count)this._removeFirst(this._dictionary),this._removeLast(this._dictionary),this._removeCount(this._dictionary),this._bookMarkList=[];else{if(0===t){n=this.at(t+1);this._dictionary&&n&&n._reference&&(this._removePrevious(n._dictionary),this._dictionary.update("First",n._reference))}else if(t===this.count-1){r=this.at(t-1);this._dictionary&&r&&r._reference&&(this._removeNext(r._dictionary),this._dictionary.update("Last",r._reference))}else{var r=this.at(t-1),n=this.at(t+1);r&&r._reference&&n&&n._reference&&(r._dictionary.update("Next",n._reference),n._dictionary.update("Prev",r._reference))}this._updateBookmarkList(t),this._dictionary&&this._updateCount()}},t.prototype.clear=function(){this._removeFirst(this._dictionary),this._removeLast(this._dictionary),this._removeCount(this._dictionary),this._bookMarkList=[]},t.prototype._removeFirst=function(t){t&&t.has("First")&&(delete t._map.First,t._updated=!0)},t.prototype._removeLast=function(t){t&&t.has("Last")&&(delete t._map.Last,t._updated=!0)},t.prototype._removeNext=function(t){t&&t.has("Next")&&(delete t._map.Next,t._updated=!0)},t.prototype._removePrevious=function(t){t&&t.has("Prev")&&(delete t._map.Prev,t._updated=!0)},t.prototype._removeCount=function(t){t&&t.has("Count")&&(delete t._map.Count,t._updated=!0)},t.prototype._updateBookmarkList=function(t,e){var i=this,r=[],n=0;void 0===e?this._bookMarkList.forEach(function(e){if(n!==t)r.push(e);else{var s=e._reference;s&&i._crossReference._cacheMap.has(s)&&(i._crossReference._cacheMap.get(s)._updated=!1)}n++}):this._bookMarkList.forEach(function(i){n===t&&r.push(e),r.push(i),n++}),this._bookMarkList=r},t.prototype._updateCount=function(){this.isExpanded||!this._dictionary.has("Count")?this._dictionary.update("Count",this._bookMarkList.length):this._dictionary.update("Count",-this._bookMarkList.length)},t.prototype._reproduceTree=function(){for(var t=this._getBookmark(this),e=!!t;e&&t._dictionary;)this._bookMarkList.push(t),e=!!(t=t._next)},t.prototype._getBookmark=function(t,e){void 0===e&&(e=!0);var i,r=t._dictionary;if(r&&r.has(e?"First":"Last")){var n=r._get(e?"First":"Last");if(Ut(n)){var s=this._crossReference._fetch(n);s&&((i=new dr(s,this._crossReference))._reference=n)}}return i},t}(),dr=function(e){function i(t,i){var r=e.call(this,t,i)||this;if(r._dictionary&&!r._dictionary.has("Dest")&&r._dictionary.has("A")){var n=r._dictionary.get("A");if(n&&n.has("D")){var s=n.getRaw("D");r._dictionary.update("Dest",s)}}return r._isLoadedBookmark=!0,r}return cr(i,e),Object.defineProperty(i.prototype,"destination",{get:function(){if(!this._destination){var t=this._obtainNamedDestination();if(null===t||void 0===t){var e=new gr(this._dictionary,"Dest");this._destination=e._obtainDestination()}}return this._destination},set:function(t){t&&(t._parent=this,this._destination=t,this._destination._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"namedDestination",{get:function(){return null!==this._namedDestination&&void 0!==this._namedDestination||(this._namedDestination=this._obtainNamedDestination()),this._namedDestination},set:function(t){if(this._namedDestination!==t&&this._dictionary){this._namedDestination=t;var e=new $r(this._crossReference);e.update("D",t.title),e.update("S",Xr.get("GoTo"));var i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,e),this._dictionary.update("A",i)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"title",{get:function(){return null!==this._title&&void 0!==this._title||(this._dictionary&&this._dictionary.has("Title")?this._title=this._dictionary.get("Title"):this._title=""),this._title},set:function(t){this._title=t,this._dictionary&&this._dictionary.update("Title",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return null!==this._color&&void 0!==this._color||this._dictionary&&this._dictionary.has("C")&&(this._color=M(this._dictionary.getArray("C"))),this._color?this._color:[0,0,0]},set:function(t){this._color=t,this._dictionary&&this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(7)),Number.parseFloat((t[1]/255).toFixed(7)),Number.parseFloat((t[2]/255).toFixed(7))])},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textStyle",{get:function(){return null!==this._textStyle&&void 0!==this._textStyle||(this._textStyle=this._obtainTextStyle()),this._textStyle},set:function(t){this._textStyle=t,this._updateTextStyle(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_next",{get:function(){var t;if(this._dictionary&&this._dictionary.has("Next")){var e=this._dictionary._get("Next");if(Ut(e)){var r=this._crossReference._fetch(e);r&&((t=new i(r,this._crossReference))._reference=e)}}return t},enumerable:!0,configurable:!0}),i.prototype._updateTextStyle=function(e){e===t.PdfTextStyle.regular?this._dictionary&&this._dictionary.has("F")&&delete this._dictionary._map.F:this._dictionary&&this._dictionary.update("F",e)},i.prototype._obtainTextStyle=function(){var e=t.PdfTextStyle.regular;if(this._dictionary&&this._dictionary.has("F")){var i=this._dictionary.get("F"),r=0;void 0!==i&&null!==i&&(r=i),e|=r}return e},i.prototype._obtainNamedDestination=function(){var t,e=this._crossReference._document;e&&(t=e._destinationCollection);var i,r;if(t){var n=this._dictionary;if(n)if(n.has("A")){var s=n.get("A");s&&s.has("D")&&(i=s.get("D"))}else n.has("Dest")&&(i=n.get("Dest"));if(i){var a;if(i instanceof Xr?a=i.name:"string"==typeof i&&(a=i),a){var o=t._namedDestinations;if(o&&o.length>0){var h=o.find(function(t){return t._title===a});h&&(i=h,r=h)}}}}return r},i}(_r),lr=function(){function t(t,e){"string"==typeof t?(this._initialize(),this.title=t):(this._dictionary=t,this._crossReference=e)}return Object.defineProperty(t.prototype,"destination",{get:function(){return this._destination},set:function(t){t&&(t._parent=this,this._destination=t,this._destination._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this._title},set:function(t){if(t!==this._title&&this._dictionary){var e=this._title;this._title=t,this._dictionary.update("Title",t),this._dictionary._updated=!0,this._updateNamedDestinationTitle(t,e)}},enumerable:!0,configurable:!0}),t.prototype._updateNamedDestinationTitle=function(t,e){var i=this._crossReference;if(i&&i._document){var r=i._document._catalog._catalogDictionary;if(r&&r.has("Names")){var n=r.get("Names");if(n&&n.has("Dests")){var s=n.get("Dests");if(s&&s.has("Names")){var a=s.get("Names"),o=a.indexOf(e);-1!==o&&(a.splice(o,1,t),delete s._map.Names,s.update("Names",a),s._updated=!0)}}}}},t.prototype._initialize=function(){this._dictionary=new $r,this._dictionary.update("S",Xr.get("GoTo"))},t}(),fr=function(){function e(t,e){var i=this;if(this._namedDestinations=[],t&&(this._dictionary=t),e&&(this._crossReference=e),t&&t.has("Dests")){var r=t.get("Dests");r&&(r.has("Names")?this._addCollection(r):r.has("Kids")&&r.getArray("Kids").forEach(function(t){i._findDestination(t)}))}}return e.prototype._findDestination=function(t){var e=this;if(t)if(t.has("Names"))this._addCollection(t);else if(t.has("Kids")){var i=t.getArray("Kids");i&&Array.isArray(i)&&i.length>0&&i.forEach(function(t){e._findDestination(t)})}},e.prototype._addCollection=function(e){var i,r,n=e.getRaw("Names");if(n&&n instanceof Qr&&(i=this._crossReference._fetch(n)),i&&Array.isArray(i)&&i.length>0&&(n=i),n&&Array.isArray(n)&&n.length>0)for(var s=1;s<n.length;s+=2){var a=n[s];if(a&&a instanceof Qr){var o=this._crossReference._fetch(a);o&&Array.isArray(o)&&o.length>0?(r=new $r).update("D",o):r=this._crossReference._fetch(a)}else null!==r&&void 0!==r||!Array.isArray(a)||(r=new $r).update("D",a);if(r){var h=new lr(r,this._crossReference),d=n[s-1],l=void 0,f=void 0;if(d&&(h._title=d,r.has("D"))){f=r.get("D"),l=new ur;var p=f[0];if(p&&f&&f[0]instanceof Qr){var u=this._crossReference._fetch(p),g=this._crossReference._document,y=void 0;g&&u&&void 0!==(y=_(g,u))&&null!==y&&y>=0&&(l._index=y,l.page=g.getPage(y))}}if(f[1]instanceof Xr){var m=void 0,b=void 0,v=void 0,w=f[1].name,S=l.page;switch(w){case"Fit":l._destinationMode=t.PdfDestinationMode.fitToPage;break;case"XYZ":if(l._destinationMode=t.PdfDestinationMode.location,f.length>2&&(m=f[2]),f.length>3&&(b=f[3]),f.length>4&&(v=f[4]),S){var P=S.size,A=null===b||void 0===b?0:P[1]-b,x=null===m||void 0===m?0:m;l._location=[x,A],S.rotation!==t.PdfRotationAngle.angle0&&(A=c(S,b,m)),l._zoom=void 0!==v&&null!==v?v:0,null!==m&&null!==b&&null!==v&&void 0!==m&&void 0!==b&&void 0!==v||(l._isValid=!1)}break;case"FitH":case"FitBH":if(l._destinationMode=t.PdfDestinationMode.fitH,f.length>=3&&(b=f[2]),S){var P=S.size,A=null===b||void 0===b?0:P[1]-b;l._location=[0,A]}null!==b&&void 0!==b||(l._isValid=!1);break;case"FitR":l._destinationMode=t.PdfDestinationMode.fitR}}l._parent=h,h._destination=l,this._namedDestinations.push(h)}}},e}(),pr=function(){function e(t,e,i,r){this._isAnnotationParsed=!1,this._isNew=!1,this._isDuplicate=!1,this._isLineAnnotation=!1,this._pageIndex=e,this._pageDictionary=i,this._crossReference=t,this._ref=r}return Object.defineProperty(e.prototype,"annotations",{get:function(){if(void 0===this._annotations){if(this._pageDictionary&&this._pageDictionary.has("Annots")){var t=this._getProperty("Annots");if(Ut(t)&&Array.isArray(t)){var e;if(this._crossReference._document._catalog._catalogDictionary.has("AcroForm")&&(e=this._crossReference._document.form._parseWidgetReferences()),e&&e.length>0){var i=[];t.forEach(function(t){-1===e.indexOf(t)&&i.push(t)}),this._annotations=new or(i,this._crossReference,this)}else this._annotations=new or(t,this._crossReference,this)}}void 0===this._annotations&&(this._annotations=new or([],this._crossReference,this)),this._annotations._getAnnotations()}return this._annotations},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(void 0===this._size){var t=R(this._pageDictionary,"MediaBox",!1,!0),e=R(this._pageDictionary,"CropBox",!1,!0),i=0,r=0,n=this._pageDictionary&&this._pageDictionary.has("Rotate")?R(this._pageDictionary,"Rotate",!1,!0):0;if(e&&null!==n&&void 0!==n){i=e[2]-e[0],r=e[3]-e[1];var s=!(t&&t[2]-t[0]<i);(0===n||180===n)&&i<r||(90===n||270===n)&&i>r||s||0!==n||!t||(i=t[2]-t[0],r=0!==t[3]?t[3]-t[1]:t[1])}else t?(i=t[2]-t[0],r=0!==t[3]?t[3]-t[1]:t[1]):(this._pageDictionary.update("MediaBox",[0,0,612,792]),i=612,r=792);this._size=[Math.abs(i),Math.abs(r)]}return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){var e=0;return void 0===this._rotation&&((e=R(this._pageDictionary,"Rotate",!1,!0))<0&&(e+=360),this._rotation=void 0!==e?e/90%4:t.PdfRotationAngle.angle0),this._rotation},set:function(t){if(!this._isNew){this._rotation=t;var e=90*Math.floor(this._rotation);e>=360&&(e%=360),this._pageDictionary.update("Rotate",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabOrder",{get:function(){return this._obtainTabOrder()},set:function(e){this._tabOrder=e;var i="";this._tabOrder!==t.PdfFormFieldsTabOrder.none&&(this._tabOrder===t.PdfFormFieldsTabOrder.row?i="R":this._tabOrder===t.PdfFormFieldsTabOrder.column?i="C":this._tabOrder===t.PdfFormFieldsTabOrder.structure&&(i="S")),this._pageDictionary.update("Tabs",Xr.get(i))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cropBox",{get:function(){return void 0===this._cBox&&(this._cBox=R(this._pageDictionary,"CropBox",!1,!0)),void 0===this._cBox&&(this._cBox=[0,0,0,0]),this._cBox},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mediaBox",{get:function(){return void 0===this._mBox&&(this._mBox=R(this._pageDictionary,"MediaBox",!1,!0)),void 0===this._mBox&&(this._mBox=[0,0,0,0]),this._mBox},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){if(void 0===this._orientation&&void 0!==this.size){var e=this.size;e[0]>e[1]?this._orientation=t.PdfPageOrientation.landscape:this._orientation=t.PdfPageOrientation.portrait}return this._orientation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_origin",{get:function(){return(void 0===this._o||0===this._o[0]&&0===this._o[1])&&(this._o=[this.mediaBox[0],this._mBox[1]]),this._o},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"graphics",{get:function(){return(void 0===this._g||this._needInitializeGraphics)&&this._parseGraphics(),this._g},enumerable:!0,configurable:!0}),e.prototype._addWidget=function(t){var e;if(this._pageDictionary.has("Annots")){var i=this._pageDictionary.getRaw("Annots");e=this._getProperty("Annots"),i&&i instanceof Qr&&(delete this._pageDictionary._map.Annots,this._pageDictionary.update("Annots",e))}e&&Array.isArray(e)?e.push(t):this._pageDictionary.update("Annots",[t]),this._pageDictionary._updated=!0},e.prototype._getProperty=function(t,e){void 0===e&&(e=!1);var i=R(this._pageDictionary,t,e,!1);return Array.isArray(i)?1!==i.length&&i[0]instanceof $r?$r.merge(this._crossReference,i):i[0]:i},e.prototype._parseGraphics=function(){this._loadContents();var t=new sn([32,113,32,10]),e=this._crossReference._getNextReference();this._crossReference._cacheMap.set(e,t),this._contents.splice(0,0,e);var i=new sn([32,81,32,10]),r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,i),this._contents.push(r);var n=new sn([]),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),this._contents.push(s),this._pageDictionary.set("Contents",this._contents),this._pageDictionary._updated=!0,this._initializeGraphics(n)},e.prototype._loadContents=function(){var t,e=this._pageDictionary.getRaw("Contents");null!==e&&void 0!==e&&e instanceof Qr&&(t=e,e=this._crossReference._fetch(t)),e&&e instanceof rn?this._contents=[t]:e&&Array.isArray(e)?this._contents=e:this._contents=[]},e.prototype._initializeGraphics=function(e){var i=!1,r=0,n=0,s=0,a=0,o=this.size,h=this.mediaBox;h&&h.length>=4&&(r=h[0],n=h[1],s=h[2],a=h[3]);var c;if(this._pageDictionary.has("CropBox"))if((c=this.cropBox)&&c.length>=4){var _=c[0],d=c[1],l=c[2],f=c[3];(_<0||d<0||l<0||f<0)&&Math.floor(Math.abs(d))===Math.floor(Math.abs(o[1]))&&Math.floor(Math.abs(_))===Math.floor(Math.abs(o[0]))?this._g=new br([Math.max(_,l),Math.max(d,f)],e,this._crossReference,this):(this._g=new br(o,e,this._crossReference,this),this._g._cropBox=c)}else this._g=new br(o,e,this._crossReference,this);else if((r<0||n<0||s<0||a<0)&&Math.floor(Math.abs(n))===Math.floor(Math.abs(o[1]))&&Math.floor(Math.abs(s))===Math.floor(Math.abs(o[0]))){var p=Math.max(r,s),u=Math.max(n,a);(p<=0||u<=0)&&(i=!0,r<0&&(r=-r),n<0&&(n=-n),s<0&&(s=-s),a<0&&(a=-a),p=Math.max(r,s),u=Math.max(n,a)),this._g=new br([p,u],e,this._crossReference,this)}else this._g=new br(o,e,this._crossReference,this);this._pageDictionary.has("MediaBox")&&(this._g._mediaBoxUpperRightBound=i?-n:a),this._graphicsState=this._g.save();var g=this._origin;if(g[0]>=0&&g[1]>=0||Math.sign(g[0])!==Math.sign(g[1])?this._g._initializeCoordinates():this._g._initializeCoordinates(this),!this._isNew){var y=this.rotation;if(!Number.isNaN(y)&&(y!==t.PdfRotationAngle.angle0||this._pageDictionary.has("Rotate"))){var m=void 0;m=this._pageDictionary.has("Rotate")?this._pageDictionary.get("Rotate"):90*y;var b=this._g._clipBounds;90===m?(this._g.translateTransform(0,o[1]),this._g.rotateTransform(-90),this._g._clipBounds=[b[0],b[1],o[0],o[1]]):180===m?(this._g.translateTransform(o[0],o[1]),this._g.rotateTransform(-180)):270===m&&(this._g.translateTransform(o[0],0),this._g.rotateTransform(-270),this._g._clipBounds=[b[0],b[1],o[1],o[0]])}}if(this._isNew&&this._pageSettings&&!this._isLineAnnotation){var v=this._getActualBounds(this._pageSettings);this._g._clipTranslateMargins(v)}this._needInitializeGraphics=!1},e.prototype._getActualBounds=function(t){var e=t._getActualSize();return[t.margins.left,t.margins.top,e[0],e[1]]},e.prototype._fetchResources=function(){if(void 0===this._resourceObject)if(this._pageDictionary&&this._pageDictionary.has("Resources")){var t=this._pageDictionary.getRaw("Resources");null!==t&&void 0!==t&&t instanceof Qr?(this._hasResourceReference=!0,this._resourceObject=this._crossReference._fetch(t)):t&&t instanceof $r&&(this._resourceObject=t)}else this._resourceObject=new $r(this._crossReference),this._pageDictionary.update("Resources",this._resourceObject);return this._resourceObject},e.prototype._getCropOrMediaBox=function(){var t;return this._pageDictionary&&(this._pageDictionary.has("CropBox")?t=this._pageDictionary.getArray("CropBox"):this._pageDictionary.has("MediaBox")&&(t=this._pageDictionary.getArray("MediaBox"))),t},e.prototype._beginSave=function(){void 0!==this._graphicsState&&(this.graphics.restore(this._graphicsState),this._graphicsState=null,this._needInitializeGraphics=!0)},e.prototype._destroy=function(){this._pageDictionary=void 0,this._size=void 0,this._mBox=void 0,this._cBox=void 0,this._o=void 0,this._g=void 0,this._graphicsState=void 0,this._contents=void 0},e.prototype._obtainTabOrder=function(){if(this._pageDictionary&&this._pageDictionary.has("Tabs")){var e=this._pageDictionary.get("Tabs");e===Xr.get("R")?this._tabOrder=t.PdfFormFieldsTabOrder.row:e===Xr.get("C")?this._tabOrder=t.PdfFormFieldsTabOrder.column:e===Xr.get("S")?this._tabOrder=t.PdfFormFieldsTabOrder.structure:e===Xr.get("W")&&(this._tabOrder=t.PdfFormFieldsTabOrder.widget)}return null!==this._tabOrder&&void 0!==this._tabOrder||(this._tabOrder=t.PdfFormFieldsTabOrder.none),this._tabOrder},e.prototype._removeAnnotation=function(t){if(this._pageDictionary&&this._pageDictionary.has("Annots")){var e=this._getProperty("Annots");if(Ut(e)&&Array.isArray(e)){var i=e.indexOf(t);i>=0&&e.splice(i,1),this._pageDictionary.set("Annots",e),this._pageDictionary._updated=!0}}},Object.defineProperty(e.prototype,"_contentTemplate",{get:function(){this._fetchResources();var t=this._combineContent(),e=new sn(Array.from(t)),i=new fe(e,this._crossReference);return i._content.dictionary.set("Resources",this._resourceObject),this.cropBox[0]>0||this.cropBox[1]>0?(i._content.dictionary.set("BBox",this.cropBox),i._size=[this.cropBox[0],this.cropBox[1]]):this.mediaBox[0]>0||this.mediaBox[1]>0?(i._content.dictionary.set("BBox",this.mediaBox),i._size=[this.mediaBox[0],this.mediaBox[1]]):(i._content.dictionary.set("BBox",[0,0,this.size[0],this.size[1]]),i._size=[this.size[0],this.size[1]]),i},enumerable:!0,configurable:!0}),e.prototype._combineIntoSingleArray=function(t){var e=t.reduce(function(t,e){return t+e.length},0),i=new Uint8Array(e),r=0;return t.forEach(function(t){i.set(t,r),r+=t.length}),i},e.prototype._combineContent=function(){var t,e=this,i=[];return this._loadContents(),i.push(new Uint8Array([32,113,32,10])),this._contents.forEach(function(r){var n=e._crossReference._fetch(r);n&&(n instanceof sn?t=new Uint8Array(n._bytes):n instanceof rn&&(t=n.getBytes()),t&&(i.push(t),i.push(new Uint8Array([13,10]))))}),i.push(new Uint8Array([32,81,32,10])),i.push(new Uint8Array([13,10])),this._combineIntoSingleArray(i)},e}(),ur=function(){function e(e,i){this._location=[0,0],this._destinationMode=t.PdfDestinationMode.location,this._zoom=0,this._isValid=!0,this._destinationBounds=[0,0,0,0],this._array=Array(),void 0!==e&&null!==e&&(e.rotation===t.PdfRotationAngle.angle180?this._location=[e.graphics._size[0],this._location[1]]:e.rotation===t.PdfRotationAngle.angle90?this._location=[0,0]:e.rotation===t.PdfRotationAngle.angle270?this._location=[e.graphics._size[0],0]:this._location=[0,this._location[1]],this._page=e,this._index=e._pageIndex),void 0!==i&&2===i.length&&(this._location=i),void 0!==i&&4===i.length&&(this._location=[i[0],i[1]],this._destinationBounds=i)}return Object.defineProperty(e.prototype,"zoom",{get:function(){return this._zoom},set:function(t){t!==this._zoom&&(this._zoom=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){return this._page},set:function(t){t!==this._page&&(this._page=t,this._initializePrimitive(),this._index=t._pageIndex)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageIndex",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._destinationMode},set:function(t){t!==this._destinationMode&&(this._destinationMode=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"location",{get:function(){return this._location},set:function(t){t!==this._location&&(this._location=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"destinationBounds",{get:function(){return this._destinationBounds},set:function(t){t!==this._destinationBounds&&(this._destinationBounds=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this._isValid},enumerable:!0,configurable:!0}),e.prototype._setValidation=function(t){this._isValid=t},e.prototype._initializePrimitive=function(){this._array=[];var e=this._page;if(e&&e._pageDictionary){var i=e._pageDictionary;switch(void 0!==i&&null!==i&&this._array.push(this._page._ref),this._destinationMode){case t.PdfDestinationMode.location:this._array.push(Xr.get("XYZ")),void 0!==e&&null!==e?(this._array.push(this._location[0]),this._array.push(this._page.graphics._size[1]-this._location[1])):(this._array.push(0),this._array.push(0)),this._array.push(this._zoom);break;case t.PdfDestinationMode.fitToPage:this._array.push(Xr.get("Fit"));break;case t.PdfDestinationMode.fitR:this._array.push(Xr.get("FitR")),this._array.push(this._destinationBounds[0]),this._array.push(this._destinationBounds[1]),this._array.push(this._destinationBounds[2]),this._array.push(this._destinationBounds[3]);break;case t.PdfDestinationMode.fitH:this._array.push(Xr.get("FitH")),this._array.push(void 0!==e&&null!==e?e.size[1]-this._location[1]:0)}this._parent&&(this._parent._dictionary.set(this._parent instanceof lr?"D":"Dest",this._array),this._parent._dictionary._updated=!0)}},e}(),gr=function(){function e(t,e){t&&"string"==typeof e&&(this._dictionary=t,this._key=e)}return e.prototype._obtainDestination=function(){var e,i,r;if(this._dictionary&&this._dictionary.has(this._key)){this._dictionary&&this._dictionary._crossReference&&this._dictionary._crossReference._document&&(r=this._dictionary._crossReference._document);var n=this._dictionary.getArray(this._key);("string"==typeof n||n instanceof Xr&&"string"==typeof n.name)&&r&&(n=this._getDestination(n,r));var s;Array.isArray(n)&&n.length>0&&(s=n[0]);var a,o,h,d,l,f,p,u,g;if("number"==typeof s)p=s;else if(s instanceof $r)p=_(r,s);else if(s){var y=r._crossReference._fetch(s);y&&y instanceof $r&&(p=_(r,y))}if(!i&&"number"==typeof p&&p>=0&&p<r.pageCount&&(i=r.getPage(p)),Array.isArray(n)&&n.length>0&&(a=n[1]),a&&i&&n)switch(a.name){case"XYZ":o=n[2],h=n[3],f=n[4],u="number"==typeof h?i.size[1]-h:0,g="number"==typeof o?o:0,i.rotation!==t.PdfRotationAngle.angle0&&(u=c(i,h,o)),(e=new ur(i,[g,u]))._index=i._pageIndex,e.zoom=void 0!==f&&null!==f?f:0,null!==o&&null!==h&&null!==f&&void 0!==o&&void 0!==h&&void 0!==f||e._setValidation(!1);break;case"FitR":n.length>2&&(o=n[2]),n.length>3&&(d=n[3]),n.length>4&&(l=n[4]),n.length>5&&(h=n[5]),(e=new ur(i,[o=void 0!==o&&null!==o?o:0,d=void 0!==d&&null!==d?d:0,l=void 0!==l&&null!==l?l:0,h=void 0!==h&&null!==h?h:0]))._index=i._pageIndex,e.mode=t.PdfDestinationMode.fitR;break;case"FitH":case"FitBH":n.length>2&&(h=n[2]),u="number"==typeof h?i.size[1]-h:0,(e=new ur(i,[0,u]))._index=i._pageIndex,e.mode=t.PdfDestinationMode.fitH,null!==h&&void 0!==h||e._setValidation(!1);break;case"Fit":(e=new ur(i))._index=i._pageIndex,e.mode=t.PdfDestinationMode.fitToPage}else Array.isArray(n)&&(e=new ur,n.length>4&&(f=n[4]),n.length>1&&(a=n[1]),"number"==typeof f&&(e.zoom=f),a&&("Fit"===a.name?e.mode=t.PdfDestinationMode.fitToPage:"XYZ"===a.name&&(n.length>2&&(o=n[2]),n.length>3&&(u=n[3]),(void 0===o&&null===o||void 0===u&&null===u||void 0===f&&null===f)&&e._setValidation(!1))),"number"==typeof p&&p>=0&&p<r.pageCount&&(e._index=p));return e}},e.prototype._getDestination=function(t,e){var i;return e&&(i=this._getNamedDestination(e,t)),i},e.prototype._getNamedDestination=function(t,e){var i,r=t._catalog;if(r&&r._catalogDictionary)if(e&&"string"==typeof e){if(r._catalogDictionary.has("Names")){var n=r._catalogDictionary.get("Names");if(n&&n.has("Dests")){var s=n.get("Dests");if(s){var a=this._getNamedObjectFromTree(s,e);i=this._extractDestination(a,t)}}}}else if(e&&e instanceof Xr){var o=r._catalogDictionary.get("Dests");o&&(i=o.get(e.name))}return i},e.prototype._extractDestination=function(t,e){var i,r;return t&&t instanceof Qr&&(i=e._crossReference._fetch(t)),i&&(i instanceof $r&&i.has("D")?r=i.getRaw("D"):Array.isArray(i)&&(r=i)),r||t},e.prototype._getNamedObjectFromTree=function(t,e){for(var i,r=!1,n=t;!r&&n;)n&&n.has("Kids")?n=this._getProperKid(n,e):n&&n.has("Names")&&(i=this._findName(n,e),r=!0);return i},e.prototype._findName=function(t,e){for(var i,r=t.get("Names"),n=0,s=r.length/2-1,a=0,o=!1;!(o||(a=Math.floor((n+s)/2),n>s));){var h=r[2*Number.parseInt(a.toString(),10)];h&&h instanceof Qr&&(h=t._crossReference._fetch(h));var c=this._stringCompare(e,h);if(c>0)n=a+1;else{if(!(c<0)){o=!0;break}s=a-1}}return o&&(i=r[2*a+1]),i},e.prototype._getProperKid=function(t,e){var i,r;if(t&&t.has("Kids")&&(i=t.getRaw("Kids")),i&&Array.isArray(i)&&0!==i.length){i=t.getArray("Kids");for(var n=0;n<i.length&&(r=i[Number.parseInt(n.toString(),10)],!this._checkLimits(r,e));n++);}return r},e.prototype._checkLimits=function(t,e){var i=!1;if(t&&t.has("Limits")){var r=t.get("Limits"),n=r[0],s=r[1],a=this._stringCompare(n,e),o=this._stringCompare(s,e);i=0===a||0===o||a<0&&o>0}return i},e.prototype._stringCompare=function(t,e){for(var i=p(t),r=p(e),n=Math.min(i.length,r.length),s=0,a=0;a<n&&0===(s=i[Number.parseInt(a.toString(),10)]-r[Number.parseInt(a.toString(),10)]);a++);return 0===s&&(s=i.length-r.length),s},e}(),yr=function(){function e(t){this._newLine="\r\n",this._whiteSpace=" ",this._stream=t}return e.prototype._writeOperator=function(t){this._stream.write(t),this._stream.write(this._newLine)},e.prototype._saveGraphicsState=function(){this._writeOperator("q")},e.prototype._restoreGraphicsState=function(){this._writeOperator("Q")},e.prototype._writeComment=function(t){t&&t.length>0&&this._writeOperator("% "+t)},e.prototype._setGraphicsState=function(t){this._stream.write("/"+q(t.name)+" "),this._writeOperator("gs")},e.prototype._modifyCtm=function(t){this._stream.write(t._toString()+" "),this._writeOperator("cm")},e.prototype._modifyTM=function(t){this._stream.write(t._toString()+" "),this._writeOperator("Tm")},e.prototype._setColorSpace=function(e,i,r){if("string"==typeof e&&"boolean"==typeof i)this._stream.write("/"+e+" "),this._writeOperator(i?"CS":"cs");else if(Array.isArray(e)&&"number"==typeof i&&"boolean"==typeof r){var n=void 0;switch(i){case t._PdfColorSpace.rgb:n="DeviceRGB";break;case t._PdfColorSpace.cmyk:n="DeviceCMYK";break;case t._PdfColorSpace.grayScale:n="DeviceGray";break;default:n="DeviceRGB"}this._stream.write("/"+n+" "),this._writeOperator(r?"CS":"cs"),this._setColor(e,r)}},e.prototype._setColor=function(t,e){this._stream.write((t[0]/255).toFixed(3)+" "+(t[1]/255).toFixed(3)+" "+(t[2]/255).toFixed(3)+" "),this._writeOperator(e?"RG":"rg")},e.prototype._appendRectangle=function(t,e,i,r){this._writePoint(t,e),this._writePoint(i,r),this._writeOperator("re")},e.prototype._writePoint=function(t,e){this._stream.write(t.toFixed(3)+" "+(-e).toFixed(3)+" ")},e.prototype._clipPath=function(t){this._stream.write((t?"W*":"W")+" n"+this._newLine)},e.prototype._fillPath=function(t){this._writeOperator(t?"f*":"f")},e.prototype._closeFillPath=function(t){this._writeOperator("h"),this._fillPath(t)},e.prototype._strokePath=function(){this._writeOperator("S")},e.prototype._closeStrokePath=function(){this._writeOperator("s")},e.prototype._fillStrokePath=function(t){this._writeOperator(t?"B*":"B")},e.prototype._closeFillStrokePath=function(t){this._writeOperator(t?"b*":"b")},e.prototype._endPath=function(){this._writeOperator("n")},e.prototype._setFont=function(t,e){this._stream.write("/"+t+" "+e.toFixed(3)+" "),this._writeOperator("Tf")},e.prototype._setTextScaling=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tz")},e.prototype._closePath=function(){this._writeOperator("h")},e.prototype._startNextLine=function(t,e){void 0===t?this._writeOperator("T*"):(this._writePoint(t,e),this._writeOperator("Td"))},e.prototype._setLeading=function(t){this._write(t.toFixed(3)+" "),this._write(this._whiteSpace),this._writeOperator("TL")},e.prototype._showText=function(t){this._writeText(t),this._writeOperator("Tj")},e.prototype._write=function(t){var e="";e+=t,e+="\r\n",this._writeOperator(e)},e.prototype._writeText=function(t){for(var e="",i=this._escapeSymbols(t),r=0;r<i.length;r++)e+=String.fromCharCode(i[r]);e="("+e+")",this._stream.write(e)},e.prototype._beginText=function(){this._writeOperator("BT")},e.prototype._endText=function(){this._writeOperator("ET")},e.prototype._beginPath=function(t,e){this._writePoint(t,e),this._writeOperator("m")},e.prototype._appendLineSegment=function(t,e){this._writePoint(t,e),this._writeOperator("l")},e.prototype._appendBezierSegment=function(t,e,i,r,n,s){this._writePoint(t,e),this._writePoint(i,r),this._writePoint(n,s),this._writeOperator("c")},e.prototype._setTextRenderingMode=function(t){this._stream.write(t.toString()+" "),this._writeOperator("Tr")},e.prototype._setCharacterSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tc")},e.prototype._setWordSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tw")},e.prototype._showNextLineText=function(t,e){null!==e&&void 0!==e&&e?(this._writeText(t),this._writeOperator("'")):(this._stream.write(t),this._writeOperator("'"))},e.prototype._setLineDashPattern=function(t,e){var i="[";if(t.length>=1)for(var r=0;r<t.length;r++)r===t.length-1?i+=t[r].toString():i+=t[r].toString()+" ";i+="] ",i+=e.toString(),i+=" d",this._writeOperator(i)},e.prototype._setMiterLimit=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("M")},e.prototype._setLineWidth=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("w")},e.prototype._setLineCap=function(t){this._stream.write(t+" "),this._writeOperator("J")},e.prototype._setLineJoin=function(t){this._stream.write(t+" "),this._writeOperator("j")},e.prototype._executeObject=function(t){this._stream.write("/"+t.name+" "),this._writeOperator("Do")},e.prototype._beginMarkupSequence=function(t){this._stream.write("/"+t+" "),this._writeOperator("BMC")},e.prototype._endMarkupSequence=function(){this._writeOperator("EMC")},e.prototype._clear=function(){this._stream._bytes=[]},e.prototype._escapeSymbols=function(t){for(var e=[],i=0;i<t.length;i++){var r=t.charCodeAt(i);switch(r){case 40:case 41:e.push(92),e.push(r);break;case 13:e.push(92),e.push(114);break;case 92:e.push(92),e.push(r);break;default:e.push(r)}}return e},e}(),mr=function(){function e(){}return Object.defineProperty(e.prototype,"width",{get:function(){return this._imageWidth},set:function(t){this._imageWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._imageHeight},set:function(t){this._imageHeight=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"physicalDimension",{get:function(){return this._imagePhysicalDimension=this._getPointSize(this.width,this.height,this._horizontalResolution),[this.width,this.height]},enumerable:!0,configurable:!0}),e.prototype.draw=function(t,e,i){null!==e&&void 0!==e||null!==i&&void 0!==i||(e=0,i=0);var r=0!==e||0!==i,n=null;r&&(n=t.save(),t.translateTransform(e,i)),t.drawImage(this,0,0),r&&t.restore(n)},e.prototype._getPointSize=function(e,i,r){if(null===r||void 0===r){return a=this._getPointSize(e,i,96)}var n=new kr,s=new kr,a=[n._convertUnits(e,t._PdfGraphicsUnit.pixel,t._PdfGraphicsUnit.point),s._convertUnits(i,t._PdfGraphicsUnit.pixel,t._PdfGraphicsUnit.point)];return a},e}(),br=function(){function e(t,e,i,r){if(this._pendingResource=[],this._isItalic=!1,this._hasResourceReference=!1,r instanceof pr?(this._source=r._pageDictionary,this._page=r):r instanceof fe&&(this._source=r._content.dictionary,this._template=r),this._source){var n=void 0;if(this._source.has("Resources"))n=this._source.getRaw("Resources");else if(this._source.has("Parent")){var s=this._source.get("Parent");s&&s.has("Resources")&&(n=s.getRaw("Resources"))&&n instanceof $r&&this._source.update("Resources",n)}n&&n instanceof Qr?(this._hasResourceReference=!0,this._resourceObject=i._fetch(n)):n&&n instanceof $r?this._resourceObject=n:(this._resourceObject=new $r,this._source.update("Resources",this._resourceObject))}this._crossReference=i,this._sw=new yr(e),this._size=t,K("PDF",this._resourceObject),this._initialize()}return Object.defineProperty(e.prototype,"clientSize",{get:function(){return[this._clipBounds[2],this._clipBounds[3]]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_matrix",{get:function(){return void 0===this._m&&(this._m=new vr),this._m},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_resources",{get:function(){var t=this;if(void 0===this._resourceMap){if(this._resourceMap=new Map,this._resourceObject&&this._resourceObject.has("Font")){var e=this._resourceObject.get("Font");e&&e.size>0&&e.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof Qr&&t._resourceMap.set(i,Xr.get(e))})}if(this._resourceObject.has("XObject")){var i=this._resourceObject.get("XObject");i&&i.size>0&&i.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof Qr&&t._resourceMap.set(i,Xr.get(e))})}if(this._resourceObject.has("ExtGState")){var r=this._resourceObject.get("ExtGState");r&&r.size>0&&(this._transparencies||(this._transparencies=new Map),r.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof Qr&&t._setTransparencyData(i,Xr.get(e))}))}}return this._resourceMap},enumerable:!0,configurable:!0}),e.prototype.save=function(){var t=new Sr(this,this._matrix);return t._textRenderingMode=this._textRenderingMode,t._charSpacing=this._characterSpacing,t._textScaling=this._textScaling,t._wordSpacing=this._wordSpacing,t._currentBrush=this._currentBrush,t._currentPen=this._currentPen,t._currentFont=this._currentFont,this._graphicsState.push(t),this._sw._saveGraphicsState(),t},e.prototype.restore=function(t){if(this._graphicsState.length>0)if(void 0===t)this._doRestore();else if(this._graphicsState.length>0&&-1!==this._graphicsState.indexOf(t))for(;this._graphicsState.length>0&&this._doRestore()!==t;);},e.prototype._doRestore=function(){var t=this._graphicsState.pop();return this._m=t._transformationMatrix,this._currentBrush=t._currentBrush,this._currentPen=t._currentPen,this._currentFont=t._currentFont,this._characterSpacing=t._charSpacing,this._wordSpacing=t._wordSpacing,this._textScaling=t._textScaling,this._textRenderingMode=t._textRenderingMode,this._sw._restoreGraphicsState(),t},e.prototype.drawRectangle=function(t,e,i,r,n,s){this._beginMarkContent();var a=this._setPenBrush(n,s);this._sw._appendRectangle(t,e,i,r),this._drawGraphicsPath(a.pen,a.brush),this._endMarkContent()},e.prototype.drawBezier=function(t,e,i,r,n,s,a,o,h){this._beginMarkContent(),this._stateControl(h,null,null),this._sw._beginPath(t,e),this._sw._appendBezierSegment(i,r,n,s,a,o),this._drawGraphicsPath(h),this._endMarkContent()},e.prototype.drawPie=function(t,e,i,r,n,s,a,o){this._beginMarkContent();var h=this._setPenBrush(a,o);this._constructPiePath(t,e,t+i,e+r,n,s),this._sw._appendLineSegment(t+i/2,e+r/2),this._drawGraphicsPath(h.pen,h.brush,null,!0),this._endMarkContent()},e.prototype.drawPolygon=function(e,i,r){var n=this;if(this._beginMarkContent(),e.length>0){var s=this._setPenBrush(i,r);this._sw._beginPath(e[0][0],e[0][1]),e.forEach(function(t,e){e>0&&n._sw._appendLineSegment(t[0],t[1])}),this._drawGraphicsPath(s.pen,s.brush,t.PdfFillMode.winding,!0)}this._endMarkContent()},e.prototype.drawEllipse=function(e,i,r,n,s,a){this._beginMarkContent();var o=this._setPenBrush(s,a);this._constructArcPath(e,i,e+r,i+n,0,360),this._drawGraphicsPath(o.pen,o.brush,t.PdfFillMode.winding,!0),this._endMarkContent()},e.prototype.drawArc=function(e,i,r,n,s,a,o){0!==a&&(this._beginMarkContent(),this._stateControl(o),this._constructArcPath(e,i,e+r,i+n,s,a),this._drawGraphicsPath(o,null,t.PdfFillMode.winding,!1),this._endMarkContent())},e.prototype._beginMarkContent=function(){this._layer&&this._layer._beginLayer(this)},e.prototype._endMarkContent=function(){if(this._layer){if(this._layer._isEndState&&0!==this._layer._parentLayer.length)for(var t=0;t<this._layer._parentLayer.length;t++)this._sw._write("EMC");this._layer._isEndState&&this._sw._write("EMC")}},e.prototype.drawImage=function(t,e,i,r,n){if(this._beginMarkContent(),"number"==typeof e&&"number"==typeof i&&void 0===r){var s=t.physicalDimension;this.drawImage(t,e,i,s[0],s[1])}else{t._save();var a=new vr;this._getTranslateTransform(e,i+n,a),this._getScaleTransform(r,n,a),this._sw._write("q"),this._sw._modifyCtm(a);var o=void 0,h=void 0,c=!0;if(this._resourceObject.has("XObject")){var _=this._resourceObject.getRaw("XObject");_ instanceof $r?o=_:_ instanceof Qr&&this._crossReference&&(o=this._crossReference._fetch(_)),o&&(c=!1)}c&&(o=new $r(this._crossReference),this._resourceObject.update("XObject",o)),void 0===h&&(t._key||(t._key=X()),h=Xr.get(t._key)),this._crossReference?(this._updateImageResource(t,h,o,this._crossReference),this._source.update("Resources",this._resourceObject),this._source._updated=!0):this._pendingResource.push({resource:t,key:h,source:o}),this._sw._executeObject(h),this._sw._write("Q"),this._sw._write("\r\n"),K("ImageB",this._resourceObject),K("ImageC",this._resourceObject),K("ImageI",this._resourceObject),K("Text",this._resourceObject)}this._endMarkContent()},e.prototype.drawTemplate=function(t,e){var i=this;this._beginMarkContent();var r=!0;if(void 0!==t){(t._isExported||t._isResourceExport)&&(this._crossReference?(t._crossReference=this._crossReference,t._importStream(!0,t._isResourceExport)):(t._importStream(!1,t._isResourceExport),this._pendingResource.push(t),r=!1));var n=t&&t._size[0]>0?e.width/t._size[0]:1,s=t&&t._size[1]>0?e.height/t._size[1]:1,a=!(Math.trunc(1e3*n)/1e3==1&&Math.trunc(1e3*s)/1e3==1),o=void 0,h=void 0;this._page&&(o=this._page.cropBox,h=this._page.mediaBox,this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&o[0]>0&&o[1]>0&&h[0]<0&&h[1]<0&&(this.translateTransform(o[0],-o[1]),e.x=-o[0],e.y=o[1]));var c=this.save(),_=new vr;if(this._page){var d=this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&o&&h&&o[0]===h[0]&&o[1]===h[1]&&o[2]===h[2]&&o[3]===h[3]||this._page._pageDictionary.has("MediaBox")&&h&&0===h[3];_._translate(e.x,-(e.y+(this._page._origin[0]>=0||d?e.height:0)))}else _._translate(e.x,-(e.y+e.height));var l=!1;if(t._content&&t._content.dictionary){var f=t._content.dictionary;if(f.has("Matrix")&&f.has("BBox")){var p=f.getArray("Matrix"),u=f.getArray("BBox");if(p&&u&&p.length>5&&u.length>3){var y=Number.parseFloat(g(-p[1])),m=Number.parseFloat(g(p[2])),b=Number.parseFloat(g(n)),v=Number.parseFloat(g(s));b===y&&v===m&&u[2]===t._size[0]&&u[3]===t._size[1]&&t._isAnnotationTemplate&&t._needScale&&a?((_=new vr)._translate(e.x-p[4],-(e.y+p[5])),_._scale(1,1),l=!0):0!==u[0]&&0!==u[1]&&u[0]===e.x&&this._page&&t._isSignature&&(_._translate(e.x-u[0],-this._page.size[1]),_._scale(n,s),l=!0)}}}a&&!l&&_._scale(n,s),this._sw._modifyCtm(_);var w,S,P=void 0,A=!1,x=!0;if(this._resourceObject.has("XObject")){var k=this._resourceObject.getRaw("XObject");k&&(k instanceof Qr?(A=!0,P=this._crossReference._fetch(k)):k instanceof $r&&(P=k)),P&&(x=!1,this._resources.forEach(function(e,r){if(r&&r instanceof Qr){var n=i._crossReference._fetch(r);n&&t&&n===t._content&&(w=e,S=r)}}))}x&&(P=new $r(this._crossReference),this._resourceObject.update("XObject",P)),void 0===w&&(t._key||(t._key=X()),w=Xr.get(t._key),t&&t._content.reference?S=t._content.reference:this._crossReference?S=this._crossReference._getNextReference():(this._pendingResource.push({resource:t._content,key:w,source:P}),this._template&&r&&this._pendingResource.push(t)),S&&this._crossReference&&(!this._crossReference._cacheMap.has(S)&&t&&t._content&&this._crossReference._cacheMap.set(S,t._content),P.update(w.name,S),this._resources.set(S,w)),this._resourceObject._updated=!0),t._isNew&&this._crossReference&&t.graphics._processResources(this._crossReference),A&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._executeObject(w),this.restore(c),K("ImageB",this._resourceObject),K("ImageC",this._resourceObject),K("ImageI",this._resourceObject),K("Text",this._resourceObject)}this._endMarkContent()},e.prototype._processResources=function(t){var e=this;this._crossReference=t,this._pendingResource.length>0&&(this._pendingResource.forEach(function(i,r){if(i instanceof fe)i._crossReference=t,i._isNew?i.graphics._processResources(t):i._updatePendingResource(t);else if(i.resource instanceof rn||i.resource instanceof $r){var n=void 0;i.resource._reference?n=i.resource._reference:(n=t._getNextReference(),i.resource._reference=n),!t._cacheMap.has(n)&&i.resource&&t._cacheMap.set(n,i.resource),i.source.update(i.key.name,n),e._resources.set(n,i.key)}else i.resource instanceof mr?e._updateImageResource(i.resource,i.key,i.source,t):i.resource instanceof $e&&e._updateFontResource(i.resource,i.key,i.source,t);e._source.update("Resources",e._resourceObject),e._source._updated=!0}),this._pendingResource=[])},e.prototype._updateImageResource=function(t,e,i,r){var n;if(t._reference?n=t._reference:(n=r._getNextReference(),t._reference=n),!r._cacheMap.has(n)&&t&&t._imageStream&&t._imageStream.dictionary&&(r._cacheMap.set(n,t._imageStream),t._imageStream.dictionary._updated=!0,t._maskStream&&t._maskStream.dictionary)){var s=void 0;t._maskReference?s=t._maskReference:(s=r._getNextReference(),t._maskReference=s),r._cacheMap.set(s,t._maskStream),t._maskStream.dictionary._updated=!0,t._imageStream.dictionary.set("SMask",s)}i.update(e.name,n),this._resources.set(n,e),this._resourceObject._updated=!0},e.prototype._updateFontResource=function(t,e,i,r){var n;if(t._reference?n=t._reference:(n=r._getNextReference(),t._reference=n),!r._cacheMap.has(n))if(t._dictionary)r._cacheMap.set(n,t._dictionary),i.update(e.name,n),this._resources.set(n,e);else if(t instanceof ii){var s=t._fontInternal;s&&s._fontDictionary&&r._cacheMap.set(n,s._fontDictionary),i.update(e.name,n),this._resources.set(n,e)}},e.prototype.drawPath=function(t,e,i){this._beginMarkContent();var r=this._setPenBrush(e,i);(r.pen||r.brush)&&(this._buildUpPath(t._points,t._pathTypes),this._drawGraphicsPath(r.pen,r.brush,t.fillMode,!1)),this._endMarkContent()},e.prototype.drawRoundedRectangle=function(t,e,i,r,n,s,a){if(null===s)throw new Error("pen");if(null===a)throw new Error("brush");var o=[t,e,i,r],h=2*n,c=[h,h],_=[o[0],o[1],c[0],c[1]],d=new oi;0===n?(d.addRectangle(o[0],o[1],o[2],o[3]),this.drawPath(d,s,a)):(d._isRoundedRectangle=!0,d.addArc(_[0],_[1],_[2],_[3],180,90),_[0]=o[0]+o[2]-h,d.addArc(_[0],_[1],_[2],_[3],270,90),_[1]=o[1]+o[3]-h,d.addArc(_[0],_[1],_[2],_[3],0,90),_[0]=o[0],d.addArc(_[0],_[1],_[2],_[3],90,90),d.closeFigure(),this.drawPath(d,s,a))},e.prototype._constructArcPath=function(t,e,i,r,n,s){var a=Q(t,e,i,r,n,s);if(8!==a.length){var o=[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]];this._sw._beginPath(o[0],o[1]);for(var h=0;h<a.length;h+=8)o=[a[h],a[h+1],a[h+2],a[h+3],a[h+4],a[h+5],a[h+6],a[h+7]],this._sw._appendBezierSegment(o[2],o[3],o[4],o[5],o[6],o[7])}},e.prototype._constructPiePath=function(t,e,i,r,n,s){var a=Q(t,e,i,r,n,s);if(8===a.length){var o=[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]];this._sw._beginPath(o[0],o[1]);for(var h=0;h<a.length;h+=8)o=[a[h],a[h+1],a[h+2],a[h+3],a[h+4],a[h+5],a[h+6],a[h+7]],this._sw._appendBezierSegment(o[2],o[3],o[4],o[5],o[6],o[7])}},e.prototype._writePen=function(t){var e=t._width,i=t._dashPattern;this._sw._setLineDashPattern(i,t._dashOffset*e),this._sw._setLineWidth(t._width),this._sw._setLineJoin(t._lineJoin),this._sw._setLineCap(t._lineCap),t._miterLimit>0&&this._sw._setMiterLimit(t._miterLimit),this._sw._setColor(t._color,!0)},e.prototype.drawString=function(t,e,i,r,n,s){this._beginMarkContent();var a=new Pe;s||(s=new pe),t&&(t=this._normalizeText(e,t));var o=a._layout(t,e,s,[i[2],i[3]]);if(!o._empty){var h=this._checkCorrectLayoutRectangle(o._actualSize,i[0],i[1],s);i[2]<=0&&(i[0]=h[0],i[2]=h[2]),i[3]<=0&&(i[1]=h[1],i[3]=h[3]),this._drawStringLayoutResult(o,e,r,n,i,s)}K("Text",this._resourceObject),this._endMarkContent()},e.prototype._normalizeText=function(t,e){var i="";if(t instanceof ti){var r=[];if(null!==e&&void 0!==e&&e.length>0)for(s=0;s<e.length;s++){var n=e.charCodeAt(s);n>=19968&&n<=40959||r.push(n)}if(r&&r.length>0)for(var s=0;s<r.length;++s)i+=String.fromCharCode(r[Number.parseInt(s.toString(),10)])}else i=e;return i},e.prototype._buildUpPath=function(e,i){for(var r=0;r<e.length;r++){var n=e[r],s=i[r];switch(15&s){case t.PathPointType.start:this._sw._beginPath(n[0],n[1]);break;case t.PathPointType.bezier:var a=this._getBezierPoint(e,i,r);r=a.index;var o=a.point;r=(a=this._getBezierPoint(e,i,r)).index;var h=a.point;this._sw._appendBezierSegment(n[0],n[1],o[0],o[1],h[0],h[1]);break;case t.PathPointType.line:this._sw._appendLineSegment(n[0],n[1]);break;default:throw new Error("Incorrect path formation.")}((s=i[Number.parseInt(r.toString(),10)])&t.PathPointType.closePath)===t.PathPointType.closePath&&this._sw._closePath()}},e.prototype._getBezierPoint=function(e,i,r){if(i[r]!==t.PathPointType.bezier)throw new Error("Malforming path.");return r++,{index:r,point:e[r]}},e.prototype._initialize=function(){this._mediaBoxUpperRightBound=0,this._characterSpacing=-1,this._wordSpacing=-1,this._textScaling=-100,this._textRenderingMode=-1,this._graphicsState=[],this._clipBounds=[0,0,this._size[0],this._size[1]],this._colorSpaceInitialized=!1,this._startCutIndex=-1},e.prototype._initializeCurrentColorSpace=function(){this._colorSpaceInitialized||(this._sw._setColorSpace("DeviceRGB",!0),this._sw._setColorSpace("DeviceRGB",!1),this._colorSpaceInitialized=!0)},e.prototype._brushControl=function(t){this._sw._setColor(t._color,!1),this._currentBrush=t},e.prototype._penControl=function(t){this._currentPen=t,this._writePen(t),this._currentPen=t},e.prototype._fontControl=function(t,e){var i=this,r=t._metrics._getSize(e);this._currentFont=t;var n,s,a,o=!1,h=!0,c=!1;if(this._resourceObject.has("Font")){var _=this._resourceObject.getRaw("Font");null!==_&&void 0!==_&&(_ instanceof Qr?(o=!0,n=this._crossReference._fetch(_)):_ instanceof $r&&(n=_)),void 0!==n&&null!==n&&(h=!1,this._resources.forEach(function(e,r){if(i._crossReference){if(null!==r&&void 0!==r){var n=i._crossReference._fetch(r);n&&(t instanceof ti&&n===t._dictionary||t instanceof ii&&n===t._fontInternal._fontDictionary)&&(s=e,a=r,c=!0)}}else t._reference&&t._reference===r&&(s=e,a=r,c=!0)}))}if(h&&(n=new $r(this._crossReference),this._resourceObject.update("Font",n)),void 0===s){if(t._key||(t._key=X()),s=Xr.get(t._key),a||(t._reference?(a=t._reference,n.update(s.name,a)):this._crossReference?a=this._crossReference._getNextReference():this._pendingResource.push({resource:t,key:s,source:n})),a&&this._crossReference)if(t._reference||(t._reference=a),t._dictionary)this._crossReference._cacheMap.set(a,t._dictionary),n.update(s.name,a);else if(t instanceof ii){var d=t._fontInternal;d&&d._fontDictionary&&!d._fontDictionary._currentObj&&this._crossReference._cacheMap.set(a,d._fontDictionary),n.update(s.name,a)}!c&&a&&this._resources.set(a,s)}o&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._setFont(s.name,r)},e.prototype._setPenBrush=function(t,e){var i,r;return t&&(t instanceof xr?i=t:r=t),e&&e instanceof Ar&&(r=e),this._stateControl(i,r,null),{pen:i,brush:r}},e.prototype._stateControl=function(t,e,i,r){(t||e)&&this._initializeCurrentColorSpace(),t&&this._penControl(t),e&&this._brushControl(e),i&&this._fontControl(i,r)},e.prototype._drawStringLayoutResult=function(e,i,r,n,s,a){var o=this;if(!e._empty){var h=a&&void 0!==a.lineLimit&&!a.lineLimit,c=void 0===a||a&&void 0!==a.noClip&&!a.noClip,_=h&&c,d=void 0;if(_){d=this.save();var l=[s[0],s[1],e._actualSize[0],e._actualSize[1]];s[2]>0&&(l[2]=s[2]),a.lineAlignment===t.PdfVerticalAlignment.middle?l[1]+=(s[3]-l[3])/2:a.lineAlignment===t.PdfVerticalAlignment.bottom&&(l[1]+=s[3]-l[3]),this.setClip(l)}i&&i instanceof ii&&i._fontInternal&&i._fontInternal instanceof Ke&&i.isItalic&&(i._fontInternal._ttfMetrics._isItalic||(d=this.save(),this._isItalic=!0)),this._applyStringSettings(i,r,n,a);var f=void 0!==a&&null!==a?a.horizontalScalingFactor:100;f!==this._textScaling&&(this._sw._setTextScaling(f),this._textScaling=f);var p=this._getTextVerticalAlignShift(e._actualSize[1],s[3],a),u=void 0===a||null===a||0===a.lineSpacing?i._metrics._getHeight(a):a.lineSpacing+i._metrics._getHeight(a),y=0;if(y=null!==a&&void 0!==a&&a.subSuperScript===t.PdfSubSuperScript.subScript?u-(i.height+i._metrics._getDescent(a)):u-i._metrics._getAscent(a),a&&a.lineAlignment===t.PdfVerticalAlignment.bottom){var m=g(s[3]),b=g(i._metrics._getHeight(a));s[3]-e._actualSize[1]!=0&&s[3]-e._actualSize[1]<i._metrics._size/2-1&&+m<=+b&&(y=-u/i._metrics._size)}var v=new vr;this._isItalic?(this.translateTransform(s[0]+i.size/5,s[1]-y+p),this._skewTransform(0,-11)):(v._translate(s[0],-(s[1]+i._metrics._getHeight(a))-(i._metrics._getDescent(a)>0?-i._metrics._getDescent(a):i._metrics._getDescent(a))-p),this._sw._modifyTM(v)),s[3]<i._metrics._size&&e._actualSize[1]-s[3]<i._metrics._size/2-1&&(p=0),0!==p&&null!==a&&a.lineAlignment===t.PdfVerticalAlignment.bottom&&s[3]-e._actualSize[1]!=0&&s[3]-e._actualSize[1]>i._metrics._size/2-1&&(p-=(y-(u-i._metrics._size))/2),this._isItalic&&(this._sw._startNextLine(0,0),this._sw._setLeading(+u)),this._drawLayoutResult(e,i,a,s);var w=this._currentFont._fontInternal;i instanceof ii&&i.isUnicode&&w&&w._fontDictionary&&w._fontDictionary._currentObj&&this._resourceMap.forEach(function(t,e){o._crossReference&&o._crossReference._cacheMap&&!o._crossReference._cacheMap.has(e)&&(w._fontDictionary._currentObj._beginSave(),o._crossReference._writeFontDictionary(w._fontDictionary),o._crossReference._cacheMap.set(e,w._fontDictionary))}),0!==p&&this._sw._startNextLine(0,-(p-e._lineHeight)),K("Text",this._resourceObject),this._sw._endText(),this._isItalic&&this.restore(d),this._underlineStrikeoutText(n,e,i,s,a),_&&this.restore(d)}},e.prototype._getNextPage=function(){var t=this._crossReference._document.pageCount;return this._page._pageIndex<=t-2?this._crossReference._document.getPage(this._page._pageIndex+1):this._crossReference._document.addPage()},e.prototype._applyStringSettings=function(e,i,r,n){var s=t._TextRenderingMode.fill,a=!1;if(i&&r?s=t._TextRenderingMode.fillStroke:i?s=t._TextRenderingMode.stroke:r&&(s=t._TextRenderingMode.fill),e&&e instanceof ii&&(e.isUnicode||0!=(e._style&t.PdfFontStyle.bold))){var o=e._fontInternal._metrics._postScriptName,h=!1;o&&o.toLocaleLowerCase().includes("bold")&&(h=!0),e._fontInternal&&e._fontInternal._metrics&&e._fontInternal._metrics._isBold!==e.isBold&&!0===e.isBold&&!h&&(!i&&r&&(i=new xr(r._color,1)),s=t._TextRenderingMode.fillStroke,a=!0)}n&&n.clipPath&&(s|=t._TextRenderingMode.clipFlag),this._sw._beginText(),this._stateControl(i,r,e,n),s!==this._textRenderingMode&&(this._sw._setTextRenderingMode(s),this._textRenderingMode=s);var c=void 0!==n&&null!==n?n.characterSpacing:0;c!==this._characterSpacing&&(this._sw._setCharacterSpacing(c),this._characterSpacing=c);var _=void 0!==n&&null!==n?n.wordSpacing:0;_!==this._wordSpacing&&(this._sw._setWordSpacing(_),this._wordSpacing=_),e&&a&&this._sw._setLineWidth(e.size/30)},e.prototype._drawLayoutResult=function(t,e,i,r){for(var n=void 0===i||null===i||0===i.lineSpacing?e._metrics._getHeight(i):i.lineSpacing+e._metrics._getHeight(i),s=t._lines,a=e,o=null!==a&&a.isUnicode,h=0,c=s.length;h<c&&h!==this._startCutIndex;h++){var _=s[h],d=_._width,l=this._getHorizontalAlignShift(d,r[2],i)+this._getLineIndent(_,i,r[2],0===h);if(0!==l&&this._sw._startNextLine(l,0),o?this._drawUnicodeLine(_,r[2],e,i):this._drawAsciiLine(_,r[2],i,e),h+1!==c){var f=this._getTextVerticalAlignShift(t._actualSize[1],r[3],i),p=new vr,u=-(r[1]+e._metrics._getHeight(i))-e._metrics._getDescent(i)-f-n*(h+1);p._translate(r[0],u),this._sw._modifyTM(p)}}},e.prototype._drawUnicodeLine=function(e,i,r,n){var s=e._text,a=null!==n&&void 0!==n&&n.rightToLeft,o=null!==n&&void 0!==n&&n.wordSpacing>0,h=r,c=this._justifyLine(e,i,n,h),_=new Ye;if(a||null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none){var d=[],l=null!==n&&void 0!==n&&n.alignment===t.PdfTextAlignment.right,f=[];(d=null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none?_._layout(s,h,n.textDirection===t.PdfTextDirection.rightToLeft,o,n):_._layout(s,h,l,o,n)).length>1?null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none&&(f=_._splitLayout(s,h,n.textDirection===t.PdfTextDirection.rightToLeft,o,n)):f=[s],this._drawUnicodeBlocks(d,f,h,n,c)}else if(o){var p=this._breakUnicodeLine(s,h,null),d=p.tokens,f=p.words;this._drawUnicodeBlocks(d,f,h,n,c)}else{var u=this._convertToUnicode(s,h);this._sw._showNextLineText(u,!0)}},e.prototype._drawUnicodeBlocks=function(t,e,i,r,n){if(null!==t&&void 0!==t&&t.length>0&&null!==e&&void 0!==e&&e.length>0&&null!==i&&void 0!==i){this._sw._startNextLine();var s=0,a=0,o=0,h=0;try{null!==r&&void 0!==r&&(o=r.firstLineIndent,h=r.paragraphIndent,r.firstLineIndent=0,r.paragraphIndent=0);var c=i._getCharacterWidth(ke._whiteSpace,r)+n,_=null!==r?r.characterSpacing:0;c+=_+(null!==r&&void 0!==r&&0===n?r.wordSpacing:0);for(var d=0;d<t.length;d++){var l=t[d],f=e[d],p=0;0!==s&&this._sw._startNextLine(s,0),f.length>0&&(p+=i.measureString(f,r)[0],p+=_,this._sw._showText(l)),d!==t.length-1&&(a+=s=p+c)}a>0&&this._sw._startNextLine(-a,0)}finally{null!==r&&void 0!==r&&(r.firstLineIndent=o,r.paragraphIndent=h)}}},e.prototype._breakUnicodeLine=function(t,e,i){var r=this,n=[];return null!==t&&void 0!==t&&t.length>0&&(i=t.split(null)).forEach(function(t){var i=r._convertToUnicode(t,e);n.push(i)}),{tokens:n,words:i}},e.prototype._convertToUnicode=function(t,e){var i=null;if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e._fontInternal instanceof Ke){var r=e._fontInternal._ttfReader;e._setSymbols(t),i=m(v(i=r._convertString(t)))}return i},e.prototype._getTextVerticalAlignShift=function(e,i,r){var n=0;if(i>=0&&void 0!==r&&null!==r&&r.lineAlignment!==t.PdfVerticalAlignment.top)switch(r.lineAlignment){case t.PdfVerticalAlignment.middle:n=(i-e)/2;break;case t.PdfVerticalAlignment.bottom:n=i-e}return n},e.prototype._getHorizontalAlignShift=function(e,i,r){var n=0;if(i>=0&&void 0!==r&&null!==r&&r.alignment!==t.PdfTextAlignment.left)switch(r.alignment){case t.PdfTextAlignment.center:n=(i-e)/2;break;case t.PdfTextAlignment.right:n=i-e}return n},e.prototype._getLineIndent=function(e,i,r,n){var s=0,a=(e._lineType&t._LineType.firstParagraphLine)>0;return i&&a&&(s=n?i.firstLineIndent:i.paragraphIndent,s=r>0?Math.min(r,s):s),s},e.prototype._drawAsciiLine=function(t,e,i,r){this._justifyLine(t,e,i,r);var n="";-1===t._text.indexOf("(")&&-1===t._text.indexOf(")")||Array.from(t._text).forEach(function(t){n+="("===t?"\\(":")"===t?"\\)":t}),""===n&&(n=t._text),this._sw._showNextLineText("("+n+")")},e.prototype._justifyLine=function(e,i,r,n){var s=e._text,a=e._width,o=this._shouldJustify(e,i,r,n),h=r&&0!==r.wordSpacing,c=n._getCharacterCount(s,[" ","\t"]),_=0;return o?(h&&(a-=c*r.wordSpacing),_=(i-a)/c,this._sw._setWordSpacing(_)):r&&r.alignment===t.PdfTextAlignment.justify&&this._sw._setWordSpacing(0),_},e.prototype._shouldJustify=function(e,i,r,n){var s=e._text,a=e._width,o=r&&r.alignment===t.PdfTextAlignment.justify,h=i>=0&&a<i,c=n._getCharacterCount(s,[" ","\t"])>0&&" "!==s[0],_=(e._lineType&t._LineType.layoutBreak)>0;return o&&h&&c&&_},e.prototype._underlineStrikeoutText=function(t,e,i,r,n){var s=this;if(i.isUnderline||i.isStrikeout){var a=this._createUnderlineStrikeoutPen(t,i);if(void 0!==a&&null!==a){var o=this._getTextVerticalAlignShift(e._actualSize[1],r[3],n),h=r[1]+o+i._metrics._getAscent(n)+1.5*a._width,c=r[1]+o+i._metrics._getHeight(n)/2+1.5*a._width;e._lines.forEach(function(t,o){var _=t._width,d=s._getHorizontalAlignShift(_,r[2],n),l=s._getLineIndent(t,n,r[2],0===o),f=r[0]+d,p=s._shouldJustify(t,r[2],n,i)?f+r[2]-l:f+_-l;i.isUnderline&&(s.drawLine(a,f,h,p,h),h+=e._lineHeight),i.isStrikeout&&(s.drawLine(a,f,c,p,c),c+=e._lineHeight)})}}},e.prototype.drawLine=function(t,e,i,r,n){this._beginMarkContent(),this._stateControl(t),this._sw._beginPath(e,i),this._sw._appendLineSegment(r,n),this._sw._strokePath(),K("PDF",this._resourceObject),this._endMarkContent()},e.prototype._createUnderlineStrikeoutPen=function(t,e){return new xr(t._color,e._metrics._size/20)},e.prototype._checkCorrectLayoutRectangle=function(e,i,r,n){var s=[i,r,e[0],e[0]];if(n){switch(n.alignment){case t.PdfTextAlignment.center:s[0]=s[0]-s[2]/2;break;case t.PdfTextAlignment.right:s[0]=s[0]-s[2]}switch(n.lineAlignment){case t.PdfVerticalAlignment.middle:s[1]=s[1]-s[3]/2;break;case t.PdfVerticalAlignment.bottom:s[1]=s[1]-s[3]}}return s},e.prototype._drawGraphicsPath=function(e,i,r,n){void 0===r&&(r=t.PdfFillMode.winding);var s=void 0!==i&&null!==i,a=void 0!==e&&null!==e,o=r===t.PdfFillMode.alternate;a&&s?n?this._sw._closeFillStrokePath(o):this._sw._fillStrokePath(o):a||s?a?n?this._sw._closeStrokePath():this._sw._strokePath():n?this._sw._closeFillPath(o):this._sw._fillPath(o):this._sw._endPath()},e.prototype._initializeCoordinates=function(t){var e;if(t){var i=[0,0],r=!1;if(t._pageDictionary.has("CropBox")&&t._pageDictionary.has("MediaBox")){e=t._pageDictionary.getArray("CropBox");var n=t._pageDictionary.getArray("MediaBox");e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]&&e[3]===n[3]&&(r=!0),e[0]>0&&e[3]>0&&n[0]<0&&n[1]<0?(this.translateTransform(e[0],-e[3]),i[0]=-e[0],i[1]=e[3]):t._pageDictionary.has("CropBox")||(r=!0),r&&(this._sw._writeComment("Change co-ordinate system to left/top."),this._cropBox?this.translateTransform(this._cropBox[0],-this._cropBox[3]):-t._origin[1]<this._mediaBoxUpperRightBound||0===this._mediaBoxUpperRightBound?this.translateTransform(0,-this._size[1]):this.translateTransform(0,-this._mediaBoxUpperRightBound))}}else this._sw._writeComment("Change co-ordinate system to left/top."),this._mediaBoxUpperRightBound!==-this._size[1]&&(this._cropBox&&((e=this._cropBox)[0]>0||e[1]>0||this._size[0]===e[2]||this._size[1]===e[3])?this.translateTransform(e[0],-e[3]):this._mediaBoxUpperRightBound===this._size[1]||0===this._mediaBoxUpperRightBound?this.translateTransform(0,-this._size[1]):this.translateTransform(0,-this._mediaBoxUpperRightBound))},e.prototype.scaleTransform=function(t,e){var i=new vr;i._scale(t,e),this._sw._modifyCtm(i),this._matrix._multiply(i)},e.prototype.translateTransform=function(t,e){var i=new vr;i._translate(t,-e),this._sw._modifyCtm(i),this._matrix._multiply(i)},e.prototype.rotateTransform=function(t){var e=new vr;e._rotate(-t),this._sw._modifyCtm(e),this._matrix._multiply(e)},e.prototype.setClip=function(e,i){void 0===i&&(i=t.PdfFillMode.winding),this._sw._appendRectangle(e[0],e[1],e[2],e[3]),this._sw._clipPath(i===t.PdfFillMode.alternate)},e.prototype.setTransparency=function(e,i,r){void 0===i&&(i=e),void 0===r&&(r=t.PdfBlendMode.normal),void 0===this._transparencies&&(this._transparencies=new Map);var n,s="CA:"+e.toString()+"_ca:"+i.toString()+"_BM:"+r.toString();if(this._transparencies.size>0&&this._transparencies.forEach(function(t,e){t===s&&(n=e)}),!n){n=new Pr;var a=new $r;a.update("CA",e),a.update("ca",i),a.update("BM",W(r)),n._dictionary=a,n._key=s,n._name=Xr.get(X());var o=void 0,h=!1;if(this._resourceObject.has("ExtGState")){var c=this._resourceObject.getRaw("ExtGState");null!==c&&void 0!==c&&(c instanceof Qr?(h=!0,o=this._crossReference._fetch(c)):c instanceof $r&&(o=c))}else o=new $r(this._crossReference),this._resourceObject.update("ExtGState",o);if(this._crossReference){var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,a),n._reference=_,o.update(n._name.name,_)}else this._pendingResource.push({resource:a,key:n._name,source:o});h&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0)}this._sw._setGraphicsState(n._name)},e.prototype._setTransparencyData=function(t,e){this._resourceMap.set(t,e);var i=this._crossReference._fetch(t),r=0,n=0,s=0;i&&(i.has("CA")&&(r=i.get("CA")),i.has("ca")&&(n=i.get("ca")),i.has("ca")&&(n=i.get("ca")),i.has("BM")&&(s=H(i.get("BM"))));var a="CA:"+r.toString()+"_ca:"+n.toString()+"_BM:"+s.toString(),o=new Pr;o._dictionary=i,o._key=a,o._name=e,o._reference=t,this._transparencies.set(o,a)},e.prototype._getTranslateTransform=function(t,e,i){return i._translate(t,-e),i},e.prototype._getScaleTransform=function(t,e,i){return null!==i&&void 0!==i||(i=new vr),i._scale(t,e),i},e.prototype._clipTranslateMargins=function(t){this._clipBounds=t,this._sw._writeComment("Clip margins."),this._sw._appendRectangle(t[0],t[1],t[2],t[3]),this._sw._closePath(),this._sw._clipPath(!1),this._sw._writeComment("Translate co-ordinate system."),this.translateTransform(t[0],t[1])},e.prototype._skewTransform=function(t,e){var i=new vr;this._getSkewTransform(t,e,i),this._sw._modifyCtm(i),i._multiply(i)},e.prototype._getSkewTransform=function(t,e,i){return i._skew(-t,-e),i},e}(),vr=function(){function t(){this._matrix=new wr(1,0,0,1,0,0)}return t.prototype._translate=function(t,e){this._matrix._translate(t,e)},t.prototype._scale=function(t,e){this._matrix._elements[0]=t,this._matrix._elements[3]=e},t.prototype._rotate=function(t){t=t*Math.PI/180,this._matrix._elements[0]=Math.cos(t),this._matrix._elements[1]=Math.sin(t),this._matrix._elements[2]=-Math.sin(t),this._matrix._elements[3]=Math.cos(t)},t.prototype._multiply=function(t){this._matrix._multiply(t._matrix)},t.prototype._toString=function(){var t="";return this._matrix._elements.forEach(function(e){t+=G(e)+" "}),t},t.prototype._skew=function(t,e){var i=Math.tan(this._degreeToRadians(t)),r=Math.tan(this._degreeToRadians(e)),n=new wr(1,i,r,1,0,0);this._matrix._multiply(n)},t.prototype._degreeToRadians=function(t){return Math.PI/180*t},t}(),wr=function(){function t(t,e,i,r,n,s){this._elements=void 0===t?[]:"number"==typeof t?[t,e,i,r,n,s]:t}return Object.defineProperty(t.prototype,"_offsetX",{get:function(){return this._elements[4]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_offsetY",{get:function(){return this._elements[5]},enumerable:!0,configurable:!0}),t.prototype._clone=function(){return new t(this._elements.slice())},t.prototype._translate=function(t,e){this._elements[4]=t,this._elements[5]=e},t.prototype._transform=function(t){var e=t[0],i=t[1];return[e*this._elements[0]+i*this._elements[2]+this._offsetX,e*this._elements[1]+i*this._elements[3]+this._offsetY]},t.prototype._multiply=function(t){this._elements=[this._elements[0]*t._elements[0]+this._elements[1]*t._elements[2],this._elements[0]*t._elements[1]+this._elements[1]*t._elements[3],this._elements[2]*t._elements[0]+this._elements[3]*t._elements[2],this._elements[2]*t._elements[1]+this._elements[3]*t._elements[3],this._offsetX*t._elements[0]+this._offsetY*t._elements[2]+t._offsetX,this._offsetX*t._elements[1]+this._offsetY*t._elements[3]+t._offsetY]},t}(),Sr=function(){function e(e,i){e&&(this._g=e,this._transformationMatrix=i),this._charSpacing=0,this._wordSpacing=0,this._textScaling=100,this._textRenderingMode=t._TextRenderingMode.fill}return e}(),Pr=function(){function t(){}return t}();!function(t){t[t.fill=0]="fill",t[t.stroke=1]="stroke",t[t.fillStroke=2]="fillStroke",t[t.none=3]="none",t[t.clipFlag=4]="clipFlag",t[t.clipFill=4]="clipFill",t[t.clipStroke=5]="clipStroke",t[t.clipFillStroke=6]="clipFillStroke",t[t.clip=7]="clip"}(t._TextRenderingMode||(t._TextRenderingMode={}));var Ar=function(){function t(t){this._color=void 0!==t?t:[0,0,0]}return t}(),xr=function(){function e(e,i){this._color=e,this._width=i,this._dashOffset=0,this._dashPattern=[],this._dashStyle=t.PdfDashStyle.solid,this._miterLimit=0,this._lineCap=t.PdfLineCap.flat,this._lineJoin=t.PdfLineJoin.miter}return e}(),kr=function(){function t(){this._horizontalResolution=96,this._proportions=this._updateProportions(this._horizontalResolution)}return t.prototype._updateProportions=function(t){return[t/2.54,t/6,1,t/72,t,t/300,t/25.4]},t.prototype._convertUnits=function(t,e,i){return this._convertFromPixels(this._convertToPixels(t,e),i)},t.prototype._convertFromPixels=function(t,e){var i=e;return t/this._proportions[i]},t.prototype._convertToPixels=function(t,e){var i=e;return t*this._proportions[i]},t}(),Cr=function(){function e(){this._format=t._ImageFormat.unknown,this._height=0,this._width=0,this._bitsPerComponent=8,this._position=0,this._noOfComponents=-1}return e.prototype._reset=function(){this._position=0},e.prototype._getBuffer=function(t){return this._stream[t]},e.prototype._read=function(t,e,i,r){if(r&&Array.isArray(r)){var n=0;if(i<=r.length&&r.length-e>=i)for(var s=0;s<i;s++)t[s]=r[e],e++,n++;return{outputBuffer:t,offset:e,length:n}}for(var a=e;a<i;a++){var o=this._position;t[a]=this._getBuffer(o),this._position++}},e.prototype._readString=function(t){for(var e="",i=0;i<t;i++)e+=String.fromCharCode(this._readByte());return e},e.prototype._seek=function(t){this._position+=t},e.prototype._readByte=function(){if(this._position<this._stream.byteLength){var t=this._getBuffer(this._position);return this._position+=1,t}throw new Error("Error decoding JPEG image. Invalid offset.")},e.prototype._toUnsigned16=function(t){return t&=65535,t<0?t+65536:t},e.prototype._readUnsigned32=function(t){return this._getBuffer(t+3)|this._getBuffer(t+2)<<8|this._getBuffer(t+1)<<16|this._getBuffer(t)<<24},e}(),Tr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Rr=function(e){function i(t){var i=e.call(this)||this;return i._stream=t,i._initialize(),i}return Tr(i,e),Object.defineProperty(i.prototype,"_imageDataAsNumberArray",{get:function(){return this._imageData},enumerable:!0,configurable:!0}),i.prototype._initialize=function(){this._format=t._ImageFormat.jpeg,this._readHeader(),this._reset(),this._imageData=new Uint8Array(this._stream.byteLength),this._read(this._imageData,0,this._imageData.byteLength)},i.prototype._readHeader=function(){this._reset();var t=new Uint8Array(this._stream.byteLength);this._read(t,0,t.byteLength);for(var e=4,i=256*this._getBuffer(e)+this._getBuffer(e+1),r=!1;e<t.byteLength;){if(!((e+=i)<t.byteLength)){r=!0;break}if(192===this._getBuffer(e+1)){if(this._height=256*this._getBuffer(e+5)+this._getBuffer(e+6),this._width=256*this._getBuffer(e+7)+this._getBuffer(e+8),this._noOfComponents=this._getBuffer(e+9),0!==this._width&&0!==this._height)return}else e+=2,i=256*this._getBuffer(e)+this._getBuffer(e+1)}r&&(this._reset(),this._seek(2),this._readExceededJpegImage())},i.prototype._getImageDictionary=function(){if(this._imageStream&&this._imageStream.length>0)return this._imageStream;var t=[];this._imageStream=new nn(t,new $r),this._imageStream.isImageStream=!0;var e=this._imageDataAsNumberArray.byteLength;this._imageStream.bytes=new Uint8Array(e);for(var i=0;i<e;i+=1024)for(var r=Math.min(1024,e-i),n=0;n<r;n++)this._imageStream.bytes[i+n]=this._getBuffer(i+n);this._imageStream._isCompress=!1;var s=new $r;return s.set("Type",new Xr("XObject")),s.set("Subtype",new Xr("Image")),s.set("Width",this._width),s.set("Height",this._height),s.set("BitsPerComponent",this._bitsPerComponent),s.set("Filter",new Xr("DCTDecode")),s.set("ColorSpace",new Xr(this._getColorSpace())),s.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=s,this._imageStream.end=this._imageStream.bytes.length,this._imageStream.dictionary._updated=!0,this._imageStream},i.prototype._getColorSpace=function(){return 1===this._noOfComponents?"DeviceGray":4===this._noOfComponents?"DeviceCMYK":"DeviceRGB"},i.prototype._getDecodeParams=function(){var t=new $r;return t.set("Columns",this._width),t.set("BlackIs1",!0),t.set("K",-1),t.set("Predictor",15),t.set("BitsPerComponent",this._bitsPerComponent),t},i.prototype._skipStream=function(){var t=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1);if(this._seek(2),t<2)throw new Error("Error decoding JPEG image");t>0&&this._seek(t-2)},i.prototype._readExceededJpegImage=function(){for(var t=!0;t;)switch(this._getMarker()){case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:this._seek(3),this._height=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1),this._seek(2),this._width=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1),this._seek(2),this._noOfComponents=this._getBuffer(this._position),this._seek(1),t=!1;break;default:this._skipStream()}},i.prototype._getMarker=function(){for(var t=0,e=this._readByte();255!==e;)t++,e=this._readByte();do{e=this._readByte()}while(255===e);if(0!==t)throw new Error("Error decoding JPEG image");return this._toUnsigned16(e)},i}(Cr);!function(t){t[t.readingHeader=0]="readingHeader",t[t.readingBFinal=1]="readingBFinal",t[t.readingBType=2]="readingBType",t[t.readingNlCodes=3]="readingNlCodes",t[t.readingNdCodes=4]="readingNdCodes",t[t.readingCodes=5]="readingCodes",t[t.readingClCodes=6]="readingClCodes",t[t.readingTcBefore=7]="readingTcBefore",t[t.readingTcAfter=8]="readingTcAfter",t[t.decodeTop=9]="decodeTop",t[t.iLength=10]="iLength",t[t.fLength=11]="fLength",t[t.dCode=12]="dCode",t[t.unCompressedAligning=13]="unCompressedAligning",t[t.unCompressedByte1=14]="unCompressedByte1",t[t.unCompressedByte2=15]="unCompressedByte2",t[t.unCompressedByte3=16]="unCompressedByte3",t[t.unCompressedByte4=17]="unCompressedByte4",t[t.decodeUnCompressedBytes=18]="decodeUnCompressedBytes",t[t.srFooter=19]="srFooter",t[t.rFooter=20]="rFooter",t[t.vFooter=21]="vFooter",t[t.done=22]="done"}(t._InflaterState||(t._InflaterState={})),function(t){t[t.unCompressedType=0]="unCompressedType",t[t.staticType=1]="staticType",t[t.dynamicType=2]="dynamicType"}(t._BlockType||(t._BlockType={}));var Fr,Lr=function(){function t(){this._end=0,this._usedBytes=0,this._dOutput=Array(t._dOutSize).fill(0),this._end=0,this._usedBytes=0}return Object.defineProperty(t.prototype,"_unusedBytes",{get:function(){return t._dOutSize-this._usedBytes},enumerable:!0,configurable:!0}),t.prototype._write=function(e){this._dOutput[this._end++]=e,this._end&=t._dOutMask,++this._usedBytes},t.prototype._writeLD=function(e,i){this._usedBytes+=e;var r=this._end-i&t._dOutMask,n=t._dOutSize-e;if(r<=n&&this._end<n)if(e<=i)a(this._dOutput,this._end,this._dOutput,r,r+e),this._end+=e;else for(;e-- >0;)this._dOutput[this._end++]=this._dOutput[r++];else for(;e-- >0;)this._dOutput[this._end++]=this._dOutput[r++],this._end&=t._dOutMask,r&=t._dOutMask},t.prototype._copyFrom=function(e,i){i=Math.min(Math.min(i,t._dOutSize-this._usedBytes),e._bytes);var r,n=t._dOutSize-this._end;return i>n?(r=e._copyTo(this._dOutput,this._end,n))===n&&(r+=e._copyTo(this._dOutput,0,i-n)):r=e._copyTo(this._dOutput,this._end,i),this._end=this._end+r&t._dOutMask,this._usedBytes+=r,r},t.prototype._copyTo=function(e,i,r){var n;r>this._usedBytes?(n=this._end,r=this._usedBytes):n=this._end-this._usedBytes+r&t._dOutMask;var s=r,o=r-n,h=t._dOutSize-o;if(o>0){for(var c=0;c<o&&c+h<this._dOutput.length&&c+i<e.length;c++)e[i+c]=this._dOutput[h+c];var _=t._dOutSize-o;a(e,i,this._dOutput,_,_+o),i+=o,r=n}h=n-r;var d=n-r;return a(e,i,this._dOutput,d,n),this._usedBytes-=s,{count:s,data:e}},t._dOutSize=32768,t._dOutMask=32767,t}(),Dr=function(){function t(){this._bBuffer=0,this._bInBuffer=0,this._begin=0,this._end=0}return Object.defineProperty(t.prototype,"_bytes",{get:function(){return this._end-this._begin+Math.floor(this._bInBuffer/8)},enumerable:!0,configurable:!0}),t.prototype._needsInput=function(){return this._begin===this._end},t.prototype._availableBits=function(t){if(this._bInBuffer<t){if(this._needsInput())return!1;if(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8,this._bInBuffer<t){if(this._needsInput())return!1;this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8}}return!0},t.prototype._load16Bits=function(){return this._bInBuffer<8?(this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8)):this._bInBuffer<16&&this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._bBuffer},t.prototype._getBitMask=function(t){return(r(1,32)<<t)-1},t.prototype._getBits=function(t){if(!this._availableBits(t))return-1;var e=this._bBuffer&this._getBitMask(t);return this._bBuffer>>=t,this._bInBuffer-=t,e},t.prototype._copyTo=function(t,e,i){for(var n=0;this._bInBuffer>0&&i>0;)t[e++]=r(this._bBuffer,8),this._bBuffer>>=8,this._bInBuffer-=8,i--,n++;if(0===i)return n;var s=this._end-this._begin;i>s&&(i=s);for(var a=0;a<i&&a+this._begin<this._buffer.length&&a+e<t.length;a++)t[e+a]=this._buffer[this._begin+a];return this._begin+=i,n+i},t.prototype._setInput=function(t,e,i){this._buffer=t,this._begin=e,this._end=e+i},t.prototype._skipBits=function(t){this._bBuffer>>=t,this._bInBuffer-=t},t.prototype._skipByteBoundary=function(){this._bBuffer>>=this._bInBuffer%8,this._bInBuffer=this._bInBuffer-this._bInBuffer%8},t}(),Br=function(){function t(){}return t.prototype._load=function(t){this._clArray=t,this._initialize()},t.prototype._loadTree=function(t){this._clArray=t?this._getLengthTree():this._getDepthTree(),this._initialize()},t.prototype._initialize=function(){this._clArray.length===t._maxLengthTree?this._tBits=9:this._tBits=7,this._tMask=(1<<this._tBits)-1,this._createTable()},t.prototype._getLengthTree=function(){for(var e=Array(t._maxLengthTree).fill(0),i=0;i<=143;i++)e[i]=r(8,8);for(i=144;i<=255;i++)e[i]=r(9,8);for(i=256;i<=279;i++)e[i]=r(7,8);for(i=280;i<=287;i++)e[i]=r(8,8);return e},t.prototype._getDepthTree=function(){return Array(t._maxDepthTree).fill(5)},t.prototype._calculateHashCode=function(){for(var e=Array(17).fill(0),i=0;i<this._clArray.length;i++)e[this._clArray[i]]++;e[0]=0;for(var r=Array(17).fill(0),n=0,s=1;s<=16;s++)n=n+e[s-1]<<1,r[s]=n;for(var a=Array(t._maxLengthTree).fill(0),i=0;i<this._clArray.length;i++){var o=this._clArray[i];o>0&&(a[i]=this._bitReverse(r[o],o),r[o]++)}return a},t.prototype._bitReverse=function(t,e){var i=0;do{i|=1&t,i<<=1,t>>=1}while(--e>0);return i>>1},t.prototype._createTable=function(){var t=this._calculateHashCode();this._table=Array(1<<this._tBits).fill(0),this._left=Array(2*this._clArray.length).fill(0),this._right=Array(2*this._clArray.length).fill(0);for(var e=n(this._clArray.length),i=0;i<this._clArray.length;i++){var r=this._clArray[i];if(r>0){var s=t[i];if(r<=this._tBits){var a=1<<r;if(s>=a)throw new Error("Invalid Data.");for(var o=1<<this._tBits-r,h=0;h<o;h++)this._table[s]=n(i),s+=a}else{var c=r-this._tBits,_=1<<this._tBits,d=s&(1<<this._tBits)-1,l=this._table;do{var f=n(l[d]);if(0===f&&(l[d]=n(-e),f=n(-e),e++),f>0)throw new Error("Invalid Data.");l=0==(s&_)?this._left:this._right,d=-f,_<<=1,c--}while(0!==c);l[d]=n(i)}}}},t.prototype._getNextSymbol=function(t){var e=t._load16Bits();if(0===t._bInBuffer)return-1;var i=this._table[e&this._tMask];if(i<0){var n=r(1<<this._tBits,32);do{i=-i,i=0==(e&n)?this._left[i]:this._right[i],n<<=1}while(i<0)}var s=this._clArray[i];if(s<=0)throw new Error("Invalid Data.");return s>t._bInBuffer?-1:(t._skipBits(s),i)},t._maxLengthTree=288,t._maxDepthTree=32,t._nCLength=19,t}(),Or=function(){function e(){this._extraLengthBits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],this._staticDistanceTreeTable=[0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31],this._lengthBase=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],this._distanceBasePosition=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],this._codeOrder=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],this._bfinal=0,this._bLength=0,this._blBuffer=[0,0,0,0],this._blockType=t._BlockType.unCompressedType,this._caSize=0,this._clCodeCount=0,this._extraBits=0,this._lengthCode=0,this._length=0,this._llCodeCount=0,this._output=new Lr,this._input=new Dr,this._loopCounter=0,this._codeList=Array(Br._maxLengthTree+Br._maxDepthTree).fill(0),this._cltcl=Array(Br._nCLength).fill(0),this._inflaterState=t._InflaterState.readingBFinal}return Object.defineProperty(e.prototype,"_finished",{get:function(){return this._inflaterState===t._InflaterState.done||this._inflaterState===t._InflaterState.vFooter},enumerable:!0,configurable:!0}),e.prototype._setInput=function(t,e,i){this._input._setInput(t,e,i)},e.prototype._inflate=function(t,e,i){var r=0;do{var n=this._output._copyTo(t,e,i),s=n.count;if(t=n.data,s>0&&(e+=s,r+=s,i-=s),0===i)break}while(!this._finished&&this._decode());return{count:r,data:t}},e.prototype._decode=function(){var e=!1,i=!1;if(this._finished)return!0;if(this._inflaterState===t._InflaterState.readingBFinal){if(!this._input._availableBits(1))return!1;this._bfinal=this._input._getBits(1),this._inflaterState=t._InflaterState.readingBType}if(this._inflaterState===t._InflaterState.readingBType){if(!this._input._availableBits(2))return this._inflaterState=t._InflaterState.readingBType,!1;this._blockType=this._getBlockType(this._input._getBits(2)),this._blockType===t._BlockType.dynamicType?this._inflaterState=t._InflaterState.readingNlCodes:this._blockType===t._BlockType.staticType?(this._llTree=new Br,this._llTree._loadTree(!0),this._distanceTree=new Br,this._distanceTree._loadTree(!1),this._inflaterState=t._InflaterState.decodeTop):this._blockType===t._BlockType.unCompressedType&&(this._inflaterState=t._InflaterState.unCompressedAligning)}if(this._blockType===t._BlockType.dynamicType)this._getInflaterStateValue(this._inflaterState)<this._getInflaterStateValue(t._InflaterState.decodeTop)?i=this._decodeDynamicBlockHeader():(i=(r=this._decodeBlock(e)).result,e=r.eob,this._output=r.output);else if(this._blockType===t._BlockType.staticType)i=(r=this._decodeBlock(e)).result,e=r.eob,this._output=r.output;else if(this._blockType===t._BlockType.unCompressedType){var r=this._decodeUncompressedBlock(e);i=r.result,e=r.eob,this._output=r.output}return e&&0!==this._bfinal&&(this._inflaterState=t._InflaterState.done),i},e.prototype._decodeUncompressedBlock=function(e){for(e=!1;;)switch(this._inflaterState){case t._InflaterState.unCompressedAligning:if(this._input._skipByteBoundary(),this._inflaterState=t._InflaterState.unCompressedByte1,!this._unCompressedByte())return{result:!1,eob:e,output:this._output};break;case t._InflaterState.unCompressedByte1:case t._InflaterState.unCompressedByte2:case t._InflaterState.unCompressedByte3:case t._InflaterState.unCompressedByte4:if(!this._unCompressedByte())return{result:!1,eob:e,output:this._output};break;case t._InflaterState.decodeUnCompressedBytes:return this._bLength-=this._output._copyFrom(this._input,this._bLength),0===this._bLength?(this._inflaterState=t._InflaterState.readingBFinal,e=!0,{result:!0,eob:e,output:this._output}):0===this._output._unusedBytes?{result:!0,eob:e,output:this._output}:{result:!1,eob:e,output:this._output}}},e.prototype._unCompressedByte=function(){var e=this._input._getBits(8);if(e<0)return!1;var i=this._getInflaterStateValue(this._inflaterState),n=this._getInflaterStateValue(t._InflaterState.unCompressedByte1);if(this._blBuffer[i-n]=r(e,8),this._inflaterState===t._InflaterState.unCompressedByte4&&(this._bLength=this._blBuffer[0]+256*this._blBuffer[1],r(this._bLength,16)!==r(~(this._blBuffer[2]+256*this._blBuffer[3]),16)))throw new Error("Ivalid block length.");return this._inflaterState=this._getInflaterState(this._getInflaterStateValue(this._inflaterState)+1),!0},e.prototype._decodeBlock=function(e){e=!1;for(var i=this._output._unusedBytes;i>258;){var n=void 0,s=void 0,a=void 0,o=void 0;switch(this._inflaterState){case t._InflaterState.decodeTop:if((n=this._llTree._getNextSymbol(this._input))<0)return{result:!1,eob:e,output:this._output};if(n<256)this._output._write(r(n,8)),--i;else{if(256===n)return e=!0,this._inflaterState=t._InflaterState.readingBFinal,{result:!0,eob:e,output:this._output};if((n-=257)<8)n+=3,this._extraBits=0;else if(28===n)n=258,this._extraBits=0;else{if(n<0||n>=this._extraLengthBits.length)throw new Error("Invalid data.");this._extraBits=this._extraLengthBits[n]}if(this._length=n,o=this._inLength(i),i=o.fb,!o.value)return{result:!1,eob:e,output:this._output}}break;case t._InflaterState.iLength:if(o=this._inLength(i),i=o.fb,!o.value)return{result:!1,eob:e,output:this._output};break;case t._InflaterState.fLength:if(a=this._fLength(i),i=a.fb,!a.value)return{result:!1,eob:e,output:this._output};break;case t._InflaterState.dCode:if(s=this._dcode(i),i=s.fb,!s.value)return{result:!1,eob:e,output:this._output}}}return{result:!0,eob:e,output:this._output}},e.prototype._inLength=function(e){if(this._extraBits>0){this._inflaterState=t._InflaterState.iLength;var i=this._input._getBits(this._extraBits);if(i<0)return{value:!1,fb:e};if(this._length<0||this._length>=this._lengthBase.length)throw new Error("Invalid data.");this._length=this._lengthBase[this._length]+i}this._inflaterState=t._InflaterState.fLength;var r=this._fLength(e);return e=r.fb,r.value?{value:!0,fb:e}:{value:!1,fb:e}},e.prototype._fLength=function(e){if(this._blockType===t._BlockType.dynamicType?this._distanceCode=this._distanceTree._getNextSymbol(this._input):(this._distanceCode=this._input._getBits(5),this._distanceCode>=0&&(this._distanceCode=this._staticDistanceTreeTable[this._distanceCode])),this._distanceCode<0)return{value:!1,fb:e};this._inflaterState=t._InflaterState.dCode;var i=this._dcode(e);return e=i.fb,i.value?{value:!0,fb:e}:{value:!1,fb:e}},e.prototype._dcode=function(e){var i;if(this._distanceCode>3){this._extraBits=this._distanceCode-2>>1;var r=this._input._getBits(this._extraBits);if(r<0)return{value:!1,fb:e};i=this._distanceBasePosition[this._distanceCode]+r}else i=this._distanceCode+1;return this._output._writeLD(this._length,i),e-=this._length,this._inflaterState=t._InflaterState.decodeTop,{value:!0,fb:e}},e.prototype._decodeDynamicBlockHeader=function(){switch(this._inflaterState){case t._InflaterState.readingNlCodes:if(this._llCodeCount=this._input._getBits(5),this._llCodeCount<0)return!1;if(this._llCodeCount+=257,this._inflaterState=t._InflaterState.readingNdCodes,!this._readingNDCodes())return!1;break;case t._InflaterState.readingNdCodes:if(!this._readingNDCodes())return!1;break;case t._InflaterState.readingCodes:if(!this._readingCodes())return!1;break;case t._InflaterState.readingClCodes:if(!this._readingCLCodes())return!1;break;case t._InflaterState.readingTcBefore:case t._InflaterState.readingTcAfter:if(!this._readingTCBefore())return!1}var e=Array(Br._maxLengthTree).fill(0);a(e,0,this._codeList,0,this._llCodeCount);var i=Array(Br._maxDepthTree).fill(0);return a(i,0,this._codeList,this._llCodeCount,this._llCodeCount+this._dCodeCount),this._llTree=new Br,this._llTree._load(e),this._distanceTree=new Br,this._distanceTree._load(i),this._inflaterState=t._InflaterState.decodeTop,!0},e.prototype._readingNDCodes=function(){return this._dCodeCount=this._input._getBits(5),!(this._dCodeCount<0)&&(this._dCodeCount+=1,this._inflaterState=t._InflaterState.readingCodes,!!this._readingCodes())},e.prototype._readingCodes=function(){return this._clCodeCount=this._input._getBits(4),!(this._clCodeCount<0)&&(this._clCodeCount+=4,this._loopCounter=0,this._inflaterState=t._InflaterState.readingClCodes,!!this._readingCLCodes())},e.prototype._readingCLCodes=function(){for(;this._loopCounter<this._clCodeCount;){var e=this._input._getBits(3);if(e<0)return!1;this._cltcl[this._codeOrder[this._loopCounter]]=r(e,8),++this._loopCounter}for(var i=this._clCodeCount;i<this._codeOrder.length;i++)this._cltcl[this._codeOrder[i]]=0;return this._clTree=new Br,this._clTree._load(this._cltcl),this._caSize=this._llCodeCount+this._dCodeCount,this._loopCounter=0,this._inflaterState=t._InflaterState.readingTcBefore,!!this._readingTCBefore()},e.prototype._readingTCBefore=function(){for(;this._loopCounter<this._caSize;){if(this._inflaterState===t._InflaterState.readingTcBefore&&(this._lengthCode=this._clTree._getNextSymbol(this._input),this._lengthCode<0))return!1;if(this._lengthCode<=15)this._codeList[this._loopCounter++]=r(this._lengthCode,8);else{if(!this._input._availableBits(7))return this._inflaterState=t._InflaterState.readingTcAfter,!1;var e=void 0;if(16===this._lengthCode){if(0===this._loopCounter)throw new Error("Invalid data.");var i=r(this._codeList[this._loopCounter-1],8);if(e=this._input._getBits(2)+3,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(n=0;n<e;n++)this._codeList[this._loopCounter++]=i}else if(17===this._lengthCode){if(e=this._input._getBits(3)+3,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(n=0;n<e;n++)this._codeList[this._loopCounter++]=0}else{if(e=this._input._getBits(7)+11,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(var n=0;n<e;n++)this._codeList[this._loopCounter++]=0}}this._inflaterState=t._InflaterState.readingTcBefore}return!0},e.prototype._getBlockType=function(e){return e===t._BlockType.unCompressedType?t._BlockType.unCompressedType:e===t._BlockType.staticType?t._BlockType.staticType:t._BlockType.dynamicType},e.prototype._getInflaterState=function(e){switch(e){case 0:return t._InflaterState.readingHeader;case 2:return t._InflaterState.readingBFinal;case 3:return t._InflaterState.readingBType;case 4:return t._InflaterState.readingNlCodes;case 5:return t._InflaterState.readingNdCodes;case 6:return t._InflaterState.readingCodes;case 7:return t._InflaterState.readingClCodes;case 8:return t._InflaterState.readingTcBefore;case 9:return t._InflaterState.readingTcAfter;case 10:return t._InflaterState.decodeTop;case 11:return t._InflaterState.iLength;case 12:return t._InflaterState.fLength;case 13:return t._InflaterState.dCode;case 15:return t._InflaterState.unCompressedAligning;case 16:return t._InflaterState.unCompressedByte1;case 17:return t._InflaterState.unCompressedByte2;case 18:return t._InflaterState.unCompressedByte3;case 19:return t._InflaterState.unCompressedByte4;case 20:return t._InflaterState.decodeUnCompressedBytes;case 21:return t._InflaterState.srFooter;case 22:return t._InflaterState.rFooter;case 23:return t._InflaterState.vFooter;case 24:return t._InflaterState.done;default:return t._InflaterState.readingHeader}},e.prototype._getInflaterStateValue=function(e){switch(e){case t._InflaterState.readingHeader:return 0;case t._InflaterState.readingBFinal:return 2;case t._InflaterState.readingBType:return 3;case t._InflaterState.readingNlCodes:return 4;case t._InflaterState.readingNdCodes:return 5;case t._InflaterState.readingCodes:return 6;case t._InflaterState.readingClCodes:return 7;case t._InflaterState.readingTcBefore:return 8;case t._InflaterState.readingTcAfter:return 9;case t._InflaterState.decodeTop:return 10;case t._InflaterState.iLength:return 11;case t._InflaterState.fLength:return 12;case t._InflaterState.dCode:return 13;case t._InflaterState.unCompressedAligning:return 15;case t._InflaterState.unCompressedByte1:return 16;case t._InflaterState.unCompressedByte2:return 17;case t._InflaterState.unCompressedByte3:return 18;case t._InflaterState.unCompressedByte4:return 19;case t._InflaterState.decodeUnCompressedBytes:return 20;case t._InflaterState.srFooter:return 21;case t._InflaterState.rFooter:return 22;case t._InflaterState.vFooter:return 23;case t._InflaterState.done:return 24;default:return 0}},e}(),Ir=function(){function t(t,e,i){Ut(t)?this._data=t:this._data=[],Ut(i)&&(this._leaveOpen=i),this._offset=e,this._inflater=new Or,this._buffer=Array(8192).fill(0)}return t.prototype._read=function(t,e,i){for(var r,n=e,s=i;;){var a=this._inflater._inflate(t,n,s);if(r=a.count,t=a.data,n+=r,0===(s-=r))break;if(this._inflater._finished)break;var o=this._readBytes(),h=o.count;if(this._buffer=o.buffer,0===h)break;this._inflater._setInput(this._buffer,0,h)}return{count:i-s,data:t}},t.prototype._readBytes=function(){if(Ut(this._offset)&&this._offset>=this._data.length)return{buffer:[],count:0};for(var t=0,e=0;e<this._buffer.length&&e+this._offset<this._data.length;e++)this._buffer[e]=this._data[this._offset+e],t++;return this._offset+=t,{buffer:this._buffer,count:t}},t}(),Mr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Nr=function(e){function i(i){var r=e.call(this)||this;return r._stream=i,r._format=t._ImageFormat.png,r._isRedGreenBlue=!1,r._isDecode=!1,r._shades=!1,r._ideateDecode=!0,r._colors=0,r._bitsPerPixel=0,r._idatLength=0,r._inputBands=0,r._position=8,r._initialize(),r}return Mr(i,e),i.prototype._initialize=function(){for(var t,e=this._hasValidChunkType(t);e.hasValidChunk;){switch(t=e.type){case Fr.iHDR:this._readHeader();break;case Fr.iDAT:this._readImageData();break;case Fr.sRGB:this._isRedGreenBlue=!0,this._ignoreChunk();break;case Fr.pLTE:this._readPhotoPlate();break;case Fr.iEND:this._decodeImageData();break;case Fr.tRNS:this._readTransparency();break;case Fr.tEXt:case Fr.iTXt:case Fr.zTXt:case Fr.hIST:case Fr.sBIT:case Fr.iCCP:case Fr.pHYs:case Fr.tIME:case Fr.bKGD:case Fr.gAMA:case Fr.cHRM:case Fr.unknown:this._ignoreChunk()}e=this._hasValidChunkType(t)}},i.prototype._hasValidChunkType=function(t){if(t=Fr.unknown,this._position+8<=this._stream.byteLength){this._currentChunkLength=this._readUnsigned32(this._position),this._seek(4);var e=this._readString(4),i=this._getChunkType(e);return void 0!==i&&null!==i?(t=i,{type:t,hasValidChunk:!0}):this._stream.byteLength===this._position?{type:t,hasValidChunk:!1}:{type:t,hasValidChunk:!0}}return{type:t,hasValidChunk:!1}},i.prototype._ignoreChunk=function(){this._currentChunkLength>0&&this._seek(this._currentChunkLength+4)},i.prototype._readHeader=function(){this._header=new Er,this._header._width=this._readUnsigned32(this._position),this._seek(4),this._header._height=this._readUnsigned32(this._position),this._seek(4),this._header._bitDepth=this._readByte(),this._header._colorType=this._readByte(),this._header._compression=this._readByte(),this._header._filter=this._getFilterType(this._readByte()),this._header._interlace=this._readByte(),this._colors=3===this._header._colorType||0==(2&this._header._colorType)?1:3,this._width=this._header._width,this._height=this._header._height,this._bitsPerComponent=this._header._bitDepth,this._setBitsPerPixel(),this._seek(4)},i.prototype._setBitsPerPixel=function(){this._bitsPerPixel=16===this._header._bitDepth?2:1,0===this._header._colorType?(this._idatLength=Math.floor((this._bitsPerComponent*this._width+7)/8)*this._height,this._inputBands=1):2===this._header._colorType?(this._idatLength=this._width*this._height*3,this._inputBands=3,this._bitsPerPixel*=3):3===this._header._colorType?(1!==this._header._interlace&&0!==this._header._interlace||(this._idatLength=Math.floor((this._header._bitDepth*this._width+7)/8)*this._height),this._inputBands=1,this._bitsPerPixel=1):4===this._header._colorType?(this._idatLength=this._width*this._height,this._inputBands=2,this._bitsPerPixel*=2):6===this._header._colorType&&(this._idatLength=3*this._width*this._height,this._inputBands=4,this._bitsPerPixel*=4)},i.prototype._readImageData=function(){if(this._encodedStream&&0!==this._encodedStream.length||(this._encodedStream=[]),this._currentChunkLength<=this._stream.byteLength&&this._stream.byteLength-this._position>=this._currentChunkLength)for(var t=0;t<this._currentChunkLength;t++)this._encodedStream.push(this._readByte());this._seek(4)},i.prototype._readPhotoPlate=function(){if(3===this._header._colorType){this._colorSpace=[],this._colorSpace.push(Xr.get("Indexed")),this._colorSpace.push(this._getPngColorSpace()),this._colorSpace.push(this._currentChunkLength/3-1);var t=new Uint8Array(this._currentChunkLength);this._read(t,0,this._currentChunkLength),this._colorSpace.push(m(t)),this._seek(4)}else this._ignoreChunk()},i.prototype._readTransparency=function(){if(3===this._header._colorType){var t=new Uint8Array(this._currentChunkLength);this._read(t,0,this._currentChunkLength),this._seek(4),this._alpha=Array.from(t),this._shades=this._alpha.some(function(t){var e=255&t;return 0!==e&&255!==e})}else this._ignoreChunk()},i.prototype._getPngColorSpace=function(){if(this._isRedGreenBlue){var t=[],e=new $r,i=[1,1,1],r=[2.2,2.2,2.2];if(e.set("Gamma",r),this._isRedGreenBlue){var n=-.0737289,s=.2126390058715103,a=-.0527286/n,o=.3*a/.6,h=a*(.7/.6-1),c=-.005321898/n;i=[.9504300891509299,1,1.088921671149305],e.set("Matrix",[.4123907992659594,s,.01933081871559183,o,a,h,.1804549505010925,c,.9503960726390872])}return e.set("WhitePoint",i),t.push(Xr.get("CalRGB")),t.push(e),t}return 0==(2&this._header._colorType)?Xr.get("DeviceGray"):Xr.get("DeviceRGB")},i.prototype._decodeImageData=function(){var t=this._header;this._isDecode=1===t._interlace||16===t._bitDepth||0!=(4&t._colorType)||this._shades,this._isDecode?((0!=(4&t._colorType)||this._shades)&&(this._maskData=Array(this._width*this._height).fill(0)),this._encodedStream&&(this._dataStream=this._getDeflatedData(this._encodedStream),this._dataStreamOffset=0),this._idatLength>0&&(this._decodedImageData=Array(this._idatLength).fill(0)),this._readDecodeData(),this._decodedImageData&&0===this._decodedImageData.length&&this._shades&&(this._ideateDecode=!1,this._decodedImageData=this._encodedStream)):(this._ideateDecode=!1,this._decodedImageData=this._encodedStream)},i.prototype._getDeflatedData=function(t){for(var e=t.slice(2,t.length-4),i=new Ir(e,0,!0),r=[],n=new Array(4096);;){var s=i._read(n,0,n.length),a=s.count,o=s.data;if(a<=0)break;r=r.concat(o.slice(0,a))}return r},i.prototype._readDecodeData=function(){1!==this._header._interlace?this._decodeData(0,0,1,1,this._width,this._height):(this._decodeData(0,0,8,8,Math.floor((this._width+7)/8),Math.floor((this._height+7)/8)),this._decodeData(4,0,8,8,Math.floor((this._width+3)/8),Math.floor((this._height+7)/8)),this._decodeData(0,4,4,8,Math.floor((this._width+3)/4),Math.floor((this._height+3)/8)),this._decodeData(2,0,4,4,Math.floor((this._width+1)/4),Math.floor((this._height+3)/4)),this._decodeData(0,2,2,4,Math.floor((this._width+1)/2),Math.floor((this._height+1)/4)),this._decodeData(1,0,2,2,Math.floor(this._width/2),Math.floor((this._height+1)/2)),this._decodeData(0,1,1,2,this._width,Math.floor(this._height/2)))},i.prototype._decodeData=function(t,e,i,r,n,s){var a;if(0!==n&&0!==s)for(var o=Math.floor((this._inputBands*n*this._header._bitDepth+7)/8),h=Array(o).fill(0),c=Array(o).fill(0),_=0,d=e;_<s;_++,d+=r){var l=this._dataStream[this._dataStreamOffset++];switch(this._dataStreamOffset=this._readStream(this._dataStream,this._dataStreamOffset,h,o),this._getFilterType(l)){case jr.none:break;case jr.sub:this._decompressSub(h,o,this._bitsPerPixel);break;case jr.up:this._decompressUp(h,c,o);break;case jr.average:this._decompressAverage(h,c,o,this._bitsPerPixel);break;case jr.paeth:this._decompressPaeth(h,c,o,this._bitsPerPixel);break;default:throw new Error("Unknown PNG filter")}this._processPixels(h,t,i,d,n),c=(a=[h,c])[0],h=a[1]}},i.prototype._readStream=function(t,e,i,r){var n=this._read(i,e,r,t);if(i=n.outputBuffer,e=n.offset,n.length<=0)throw new Error("Insufficient data");return e},i.prototype._decompressSub=function(t,e,i){for(var n=i;n<e;n++)t[n]=r((255&t[n])+(255&t[n-i]),8)},i.prototype._decompressUp=function(t,e,i){for(var n=0;n<i;n++)t[n]=r((255&t[n])+(255&e[n]),8)},i.prototype._decompressAverage=function(t,e,i,n){for(var s,a,o,h=0;h<n;h++)s=255&t[h],o=255&e[h],t[h]=r(Math.floor(s+o/2),8);for(h=n;h<i;h++)s=255&t[h],a=255&t[h-n],o=255&e[h],t[h]=r(Math.floor(s+Math.floor((a+o)/2)),8)},i.prototype._decompressPaeth=function(t,e,i,n){for(var s,a,o,h,c=0;c<n;c++)s=255&t[c],o=255&e[c],t[c]=r(s+o,8);for(c=n;c<i;c++)s=255&t[c],a=255&t[c-n],o=255&e[c],h=255&e[c-n],t[c]=r(s+this._paethPredictor(a,o,h),8)},i.prototype._paethPredictor=function(t,e,i){var r=t+e-i,n=Math.abs(r-t),s=Math.abs(r-e),a=Math.abs(r-i);return n<=s&&n<=a?t:s<=a?e:i},i.prototype._processPixels=function(t,e,i,n,a){var o=0,h=0,c=0,_=this._getPixel(t);if(0===this._header._colorType||3===this._header._colorType||4===this._header._colorType?c=1:2!==this._header._colorType&&6!==this._header._colorType||(c=3),this._decodedImageData&&this._decodedImageData.length>0){h=e;var d=16===this._header._bitDepth?8:this._header._bitDepth,l=Math.floor((c*a*d+7)/8);for(o=0;o<a;o++)this._decodedImageData=this._setPixel(this._decodedImageData,_,this._inputBands*o,c,h,n,this._header._bitDepth,l),h+=i}if(0!=(4&this._header._colorType)||this._shades)if(0!=(4&this._header._colorType)){if(16===this._header._bitDepth)for(var f=0;f<a;++f){var p=f*this._inputBands+c,u=r(_[p],32);_[p]=s(u>>8)}l=a;for(h=e,o=0;o<a;o++)this._maskData=this._setPixel(this._maskData,_,this._inputBands*o+c,1,h,n,8,l),h+=i}else{var l=a,g=[0];for(h=e,o=0;o<a;o++){var y=_[o];g[0]=y<this._alpha.length?this._alpha[y]:255,this._maskData=this._setPixel(this._maskData,g,0,1,h,n,8,l),h+=i}}},i.prototype._getPixel=function(t){if(8===this._header._bitDepth)return t.map(function(t){return 255&t});if(16===this._header._bitDepth){for(var e=Array(Math.floor(t.length/2)).fill(0),i=0;i<e.length;++i)e[i]=((255&t[2*i])<<8)+(255&t[2*i+1]);return e}for(var e=Array(Math.floor(8*t.length/this._header._bitDepth)).fill(0),n=0,a=Math.floor(8/this._header._bitDepth),o=(1<<this._header._bitDepth)-1,h=0;h<t.length;++h)for(i=a-1;i>=0;--i){var c=this._header._bitDepth*i,_=t[h];e[n++]=(c<1?_:s(r(_,32)>>c))&o}return e},i.prototype._setPixel=function(t,e,i,n,s,a,o,h){if(8===o||16===o)for(var c=h*a+n*s,_=0;_<n;++_){var d=e[_+i];t[c+_]=r(8===o?d:d>>8,8)}else{var c=Math.floor((h*a+s)/(8/o)),l=e[i]<<8-o*(s%(8/o))-o;t[c]=t[c]|r(l,8)}return t},i.prototype._getImageDictionary=function(){if(this._imageStream&&this._imageStream.length>0)return this._imageStream;var t=[];this._imageStream=new nn(t,new $r),this._imageStream.isImageStream=!0;for(var e="",i=0;i<this._decodedImageData.length;i++)e+=String.fromCharCode(this._decodedImageData[i]);this._imageStream._isCompress=this._isDecode&&this._ideateDecode;var r=new $r;r.set("Type",new Xr("XObject")),r.set("Subtype",new Xr("Image")),r.set("Width",this._width),r.set("Height",this._height),16===this._bitsPerComponent?r.set("BitsPerComponent",8):r.set("BitsPerComponent",this._bitsPerComponent),this._isDecode&&this._ideateDecode||r.set("Filter",new Xr("FlateDecode")),0==(2&this._header._colorType)?r.set("ColorSpace",Xr.get("DeviceGray")):r.set("ColorSpace",Xr.get("DeviceRGB")),(!this._isDecode||this._shades&&!this._ideateDecode)&&r.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=r,this._imageStream.bytes=new Uint8Array(e.length);for(i=0;i<e.length;i++)this._imageStream.bytes[i]=e.charCodeAt(i);return this._imageStream.end=this._imageStream.bytes.length,this._imageStream.dictionary._updated=!0,this._setMask(),this._imageStream},i.prototype._setMask=function(){if(this._maskData&&this._maskData.length>0){this._maskStream=new nn(this._maskData,new $r),this._maskStream._isCompress=this._isDecode&&this._ideateDecode;var t=new $r;t.set("Type",new Xr("XObject")),t.set("Subtype",new Xr("Image")),t.set("Width",this._width),t.set("Height",this._height),16===this._bitsPerComponent?t.set("BitsPerComponent",8):t.set("BitsPerComponent",this._bitsPerComponent),t.set("ColorSpace",Xr.get("DeviceGray")),this._maskStream.dictionary=t,this._maskStream.bytes=new Uint8Array(this._maskData),this._maskStream.end=this._maskStream.bytes.length,this._maskStream.dictionary._updated=!0}},i.prototype._getDecodeParams=function(){var t=new $r;return t.set("Columns",this._width),t.set("Colors",this._colors),t.set("Predictor",15),t.set("BitsPerComponent",this._bitsPerComponent),t},i.prototype._getChunkType=function(t){switch(t){case"IHDR":return Fr.iHDR;case"PLTE":return Fr.pLTE;case"IDAT":return Fr.iDAT;case"IEND":return Fr.iEND;case"bKGD":return Fr.bKGD;case"cHRM":return Fr.cHRM;case"gAMA":return Fr.gAMA;case"hIST":return Fr.hIST;case"pHYs":return Fr.pHYs;case"sBIT":return Fr.sBIT;case"tEXt":return Fr.tEXt;case"tIME":return Fr.tIME;case"tRNS":return Fr.tRNS;case"zTXt":return Fr.zTXt;case"sRGB":return Fr.sRGB;case"iCCP":return Fr.iCCP;case"iTXt":return Fr.iTXt;case"Unknown":return Fr.unknown;default:return null}},i.prototype._getFilterType=function(t){switch(t){case 1:return jr.sub;case 2:return jr.up;case 3:return jr.average;case 4:return jr.paeth;default:return jr.none}},i}(Cr),Er=function(){function t(){this._width=0,this._height=0,this._colorType=0,this._compression=0,this._bitDepth=0,this._interlace=0,this._filter=jr.none}return t}();!function(t){t[t.iHDR=0]="iHDR",t[t.pLTE=1]="pLTE",t[t.iDAT=2]="iDAT",t[t.iEND=3]="iEND",t[t.bKGD=4]="bKGD",t[t.cHRM=5]="cHRM",t[t.gAMA=6]="gAMA",t[t.hIST=7]="hIST",t[t.pHYs=8]="pHYs",t[t.sBIT=9]="sBIT",t[t.tEXt=10]="tEXt",t[t.tIME=11]="tIME",t[t.tRNS=12]="tRNS",t[t.zTXt=13]="zTXt",t[t.sRGB=14]="sRGB",t[t.iCCP=15]="iCCP",t[t.iTXt=16]="iTXt",t[t.unknown=17]="unknown"}(Fr||(Fr={}));var jr;!function(t){t[t.none=0]="none",t[t.sub=1]="sub",t[t.up=2]="up",t[t.average=3]="average",t[t.paeth=4]="paeth"}(jr||(jr={}));var Vr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),zr=function(){function t(t,e){this.message=t,this.name=e}return t}(),Ur=function(t){function e(e){return t.call(this,e,"FormatError")||this}return Vr(e,t),e}(zr),Wr=function(t){function e(e){return t.call(this,e,"ParserEndOfFileException")||this}return Vr(e,t),e}(zr),Hr=Object.create(null),Gr=Object.create(null),Kr=Object.create(null),Xr=function(){function t(t){this.name=t}return t.get=function(e){return Hr[e]||(Hr[e]=new t(e))},t}(),qr=function(){function t(t){this.command=t}return t.get=function(e){return Gr[e]||(Gr[e]=new t(e))},t}(),Qr=function(){function t(t,e){this._isNew=!1,this.objectNumber=t,this.generationNumber=e}return t.prototype.toString=function(){return this.objectNumber+" "+this.generationNumber},t.get=function(e,i){var r=0===i?e+"R":e+"R"+i;return Kr[r]||(Kr[r]=new t(e,i))},t}(),Jr=function(){function t(t){void 0===t&&(t=null),this._set=new Set(t&&t._set)}return t.prototype.has=function(t){return this._set.has(t.toString())},t.prototype.put=function(t){this._set.add(t.toString())},t.prototype.remove=function(t){this._set.delete(t.toString())},t.prototype.clear=function(){this._set.clear()},t}(),Yr=function(){function t(){this._map=new Map}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.get=function(t){return this._map.get(t.toString())},t.prototype.has=function(t){return this._map.has(t.toString())},t.prototype.put=function(t,e){this._map.set(t.toString(),e)},t.prototype.set=function(t,e){this._map.set(t,e)},t.prototype.clear=function(){this._map.clear()},t}(),Zr=function(){function t(t){this.table={},this.nElements=0,this.toStr=t||Ct}return t.prototype.getValue=function(t){var e=this.table["$"+this.toStr(t)];if(void 0!==e)return e.value},t.prototype.setValue=function(t,e){var i="$"+this.toStr(t);this.table[i];this.nElements++,this.table[i]={key:t,value:e}},t.prototype.keys=function(){for(var t=[],e=Object.keys(this.table),i=0;i<e.length;i++){var r=this.table[e[i]];t.push(r.key)}return t},t.prototype.containsKey=function(t){return!(void 0===this.getValue(t))},t.prototype._size=function(){return this.nElements},t}(),$r=function(){function t(t){this._isFont=!1,this._isProcessed=!1,this._initialize(t)}return Object.defineProperty(t.prototype,"size",{get:function(){return Object.keys(this._map).length},enumerable:!0,configurable:!0}),t.prototype.assignXref=function(t){this._crossReference=t},t.prototype.getRaw=function(t){return this._map[t]},t.prototype.getRawValues=function(){return this._map.values},t.prototype.get=function(t,e,i){var r=this._get(t,e,i);return this._crossReference&&void 0!==r&&r instanceof Qr&&(r=this._crossReference._fetch(r)),r},t.prototype.getArray=function(t,e,i){var r=this,n=this.get(t,e,i);return this._crossReference&&Array.isArray(n)?n.map(function(t){return t instanceof Qr?r._crossReference._fetch(t):t}):n},t.prototype.set=function(t,e){this._map[t]=e},t.prototype.has=function(t){return void 0!==this._map[t]},t.prototype.forEach=function(t){for(var e in this._map)t(e,this.getRaw(e))},t.prototype.update=function(t,e){if(this.has(t)){var i=this._map[t];null!==i&&void 0!==i&&i instanceof Qr&&this._crossReference&&(i=this._crossReference._fetch(i)),i!==e&&(this._map[t]=e,this._updated=!0)}else this._map[t]=e,this._updated=!0},t.getEmpty=function(e){var i=new t(e);return i.set=function(t,e){throw new Error("Should not call set on the empty dictionary.")},i},t.merge=function(e,i,r){void 0===r&&(r=!1);for(var n=new t(e),s=Object.create(null),a=0,o=i;a<o.length;a++)if((S=o[a])instanceof t)for(var h=0,c=S._map;h<c.length;h++){var _=c[h],d=_[0],l=_[1],f=s.get(d);if(void 0===f)f=[],s.set(d,f);else if(!(r&&l instanceof t))continue;f.push(l)}for(var p=0,u=s;p<u.length;p++){var g=u[p],y=g[0],m=g[1];if(1!==m.length&&m[0]instanceof t){for(var b=new t(e),v=0,w=m;v<w.length;v++)for(var S=w[v],P=0,A=S._map;P<A.length;P++){var x=A[P],d=x[0],l=x[1];void 0===b._map[d]&&(b._map[d]=l)}b.size>0&&(n._map[y]=b)}else n._map[y]=m[0]}return s.clear(),n.size>0?n:t.getEmpty(e)},t.prototype._initialize=function(t){this._map=Object.create(null),this.suppressEncryption=!1,this._updated=!1,this.isCatalog=!1,this._isNew=!1,t&&(this._crossReference=t)},t.prototype._get=function(t,e,i){var r=this._map[t];return void 0===r&&(r=this._map[e],void 0!==e&&null!==e?r=this._map[e]:void 0!==i&&null!==i&&(r=this._map[i])),r},t}(),tn=function(){function t(t){void 0===t&&(t=[]),this.value=t}return t}(),en=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),rn=function(){function t(){this._isCompress=!0,this._isImage=!1}return t.prototype.getByte=function(){return null},t.prototype.getBytes=function(t){return null},Object.defineProperty(t.prototype,"length",{get:function(){throw new Error("Abstract getter `length` accessed")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){throw new Error("Abstract getter `isEmpty` accessed")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDataLoaded",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.peekByte=function(){var t=this.getByte();return-1!==t&&this.offset--,t},t.prototype.peekBytes=function(t){var e=this.getBytes(t);return this.offset-=e.length,e},t.prototype.getUnsignedInteger16=function(){var t=this.getByte(),e=this.getByte();return-1===t||-1===e?-1:(t<<8)+e},t.prototype.getInt32=function(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()},t.prototype.getByteRange=function(t,e){return null},t.prototype.makeSubStream=function(t,e,i){return null},t.prototype.readBlock=function(){return null},t.prototype.reset=function(){return null},t.prototype.moveStart=function(){return null},t.prototype.getString=function(t,e){return void 0===t&&(t=!1),void 0!==e&&null!==e||(e=this.getBytes()),t?w(e):m(e)},t.prototype.skip=function(t){this.offset+=t||1},t.prototype.getBaseStreams=function(){return null},t}(),nn=function(t){function e(e,i,r,n){var s=t.call(this)||this;return s.isImageStream=!1,s.bytes=e instanceof Uint8Array?e:new Uint8Array(e),s.start=void 0!==r?r:0,s.position=s.start,s.end=r+n||s.bytes.length,s.dictionary=i,s}return en(e,t),Object.defineProperty(e.prototype,"position",{get:function(){return this.offset},set:function(t){this.offset=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.end-this.start},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.length},enumerable:!0,configurable:!0}),e.prototype.getByte=function(){return this.position>=this.end?-1:this.bytes[this.position++]},e.prototype.getBytes=function(t){var e=this.bytes,i=this.position,r=this.end;if(!t)return e.subarray(i,r);var n=i+t;return n>r&&(n=r),this.position=n,e.subarray(i,n)},e.prototype.getByteRange=function(t,e){return t<0&&(t=0),e>this.end&&(e=this.end),this.bytes.subarray(t,e)},e.prototype.reset=function(){this.position=this.start},e.prototype.moveStart=function(){this.start=this.position},e.prototype.makeSubStream=function(t,i,r){return void 0===r&&(r=null),new e(this.bytes.buffer,r,t,i)},e.prototype.readBlock=function(){throw new Error("Abstract method `readBlock` called")},e.prototype._clearStream=function(){null!==this.dictionary&&void 0!==this.dictionary&&this.dictionary.has("Filter")&&delete this.dictionary._map.Filter,this._isCompress=!0,this.dictionary._updated=!0},e.prototype._write=function(t){this.bytes=new Uint8Array(t.length);for(var e=0;e<t.length;e++)this.bytes[e]=t.charCodeAt(e);this.end=this.bytes.length,this.dictionary._updated=!0},e.prototype._writeBytes=function(t){this.bytes=new Uint8Array(t),this.end=this.bytes.length,this.dictionary._updated=!0},e}(rn),sn=function(t){function e(e){var i=t.call(this)||this;return Ut(e)?i._bytes=e:i._bytes=[],i.dictionary=new $r,i.dictionary._updated=!0,i}return en(e,t),Object.defineProperty(e.prototype,"length",{get:function(){return this._bytes.length},enumerable:!0,configurable:!0}),e.prototype.write=function(t){var e;if("string"==typeof t)for(var i=0;i<t.length;i++)this._bytes.push(t.charCodeAt(i));else(e=this._bytes).push.apply(e,t);this.dictionary._updated=!0},e.prototype.getString=function(t){void 0===t&&(t=!1);var e=new Uint8Array(this._bytes);if(void 0===e||null===e||void 0===e.length)throw new Error("Invalid argument for bytesToString");if(t)return w(e);var i=e.length;if(i<8192)return String.fromCharCode.apply(null,e);for(var r=[],n=0;n<i;n+=8192)r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+8192,i))));return r.join("")},e}(rn),an=function(t){function e(){return t.call(this,new Uint8Array(0))||this}return en(e,t),e}(nn),on=function(){function e(t){this._recordCollection=[],this._operands=[],this._inlineImageBytes=[],this._isByteOperand=!1,this._lexer=new hn(t)}return e.prototype._readContent=function(){return this._parseObject(t._TokenType.eof),this._recordCollection},e.prototype._parseObject=function(e){for(var i;(i=this._getNextToken())!==t._TokenType.eof;){if(i===e||i===t._TokenType.none)return;switch(i){case t._TokenType.comment:break;case t._TokenType.number:"-"===this._lexer._operatorParams?this._operands.push("0"):this._operands.push(this._lexer._operatorParams);break;case t._TokenType.real:this._operands.push(this._lexer._operatorParams);break;case t._TokenType.string:case t._TokenType.hexString:case t._TokenType.unicodeHexString:case t._TokenType.unicodeString:case t._TokenType.name:this._operands.push(this._lexer._operatorParams);break;case t._TokenType.operator:if("ID"===this._lexer._operatorParams){this._createRecord(),this._operands=[],this._consumeValue();break}this._createRecord(),this._operands=[];break;case t._TokenType.beginArray:break;case t._TokenType.endArray:throw new Error("Error while parsing content")}}},e.prototype._consumeValue=function(){for(var t,e,i,r;;){var n=0;if("E"===(t=this._lexer._getNextCharForInlineStream())||t===String.fromCharCode(65535))if("I"===(e=this._lexer._getNextInlineChar())||e===String.fromCharCode(65535)&&t===String.fromCharCode(65535)){for(i=this._lexer._nextCharacter,r=this._lexer._nextCharacter;" "===r||"\r"===r||"\n"===r;)r=this._lexer._getNextChar(),n++;if(this._lexer._resetContentPointer(n)," "===i||"\n"===i||i===String.fromCharCode(65535)||"\r"===i){if("Q"===r||r===String.fromCharCode(65535)||"S"===r||r>="0"&&r<="9"){this._lexer._operatorParams="",this._lexer._operatorParams+=t,this._lexer._operatorParams+=e,this._isByteOperand=!0,this._createRecord(),this._isByteOperand=!1,this._inlineImageBytes=[],e=this._lexer._getNextInlineChar();break}}else this._inlineImageBytes.push(255&t.charCodeAt(0)),this._inlineImageBytes.push(255&e.charCodeAt(0)),this._inlineImageBytes.push(255&i.charCodeAt(0)),this._inlineImageBytes.push(255&r.charCodeAt(0)),t=this._lexer._getNextCharForInlineStream()}else this._inlineImageBytes.push(255&t.charCodeAt(0)),this._inlineImageBytes.push(255&e.charCodeAt(0));else this._inlineImageBytes.push(255&t.charCodeAt(0))}},e.prototype._createRecord=function(){var t,e=this._lexer._operatorParams;(t=this._isByteOperand?new cn(e,new Uint8Array(this._inlineImageBytes)):new cn(e,this._operands))._splitText=this._lexer._text,this._recordCollection.push(t)},e.prototype._getNextToken=function(){return this._lexer._getNextToken()},e}(),hn=function(){function e(e){this._tokenType=t._TokenType.none,this._currentCharacter="\0",this._nextCharacter="\0",this._offset=0,this._text=[],this._data=e instanceof Uint8Array?e:new Uint8Array(e)}return e.prototype._getNextToken=function(){this._operatorParams="";var e=this._moveToNextChar();switch(e){case"%":return this._tokenType=this._getComment();case"/":return this._tokenType=this._getName();case"[":case"(":return this._tokenType=this._getLiteralString();case"+":case"-":return this._tokenType=this._getNumber();case"<":return this._tokenType=this._getEncodedDecimalString();case".":return this._tokenType=this._getNumber();case'"':case"'":return this._tokenType=this._getOperator()}return isNaN(parseInt(e,10))?/[a-zA-Z]/.test(e)?this._tokenType=this._getOperator():e===String.fromCharCode(65535)?this._tokenType=t._TokenType.eof:this._tokenType=t._TokenType.none:this._tokenType=this._getNumber()},e.prototype._getComment=function(){this._operatorParams="";for(var e,i="\n"!==(e=this._consumeValue())&&e!==String.fromCharCode(65535);i;)i="\n"!==(e=this._consumeValue())&&e!==String.fromCharCode(65535);return t._TokenType.comment},e.prototype._getName=function(){this._operatorParams="";for(var e=!1;!e;)switch(this._consumeValue()){case"\0":case"\t":case"\n":case"\f":case"\r":case"\b":case" ":case"%":case"(":case")":case"<":case">":case"[":case"]":case"/":return e=!0,t._TokenType.name}return t._TokenType.none},e.prototype._getNumber=function(){var e=this._currentCharacter;for("+"!==e&&"-"!==e||(this._operatorParams+=this._currentCharacter,e=this._getNextChar());!isNaN(parseInt(e,10))||"."===e;){if(isNaN(parseInt(e,10))){if("."===e){if(this._operatorParams.includes("."))break;this._operatorParams+=this._currentCharacter}}else this._operatorParams+=this._currentCharacter;e=this._getNextChar()}return t._TokenType.number},e.prototype._getOperator=function(){this._operatorParams="";for(var e=this._currentCharacter;this._isOperator(e);)e=this._consumeValue();return t._TokenType.operator},e.prototype._isOperator=function(t){if(/[a-zA-Z]/.test(t))return!0;switch(t){case"*":case"'":case'"':case"1":case"0":return!0}return!1},e.prototype._getLiteralString=function(){this._operatorParams="";var e,i=this._currentCharacter,r=this._consumeValue(),n=!0,s=0,a="";for(this._text=[];n;){if("("===i){e=this._getLiteralStringValue(r),this._operatorParams+=e,r=this._getNextChar(),n=!1;break}if("("!==r){if("]"===r){n=!1,r=this._consumeValue();break}">"===r?(this._text[s]="<"+a,s++,a=""):"<"===r&&(""!==a&&(this._text[s]=a.slice(0,-1),s++),a=""),a+=r=this._consumeValue()}else""!==a&&(this._text[s]=a.slice(0,-1),a="",s++),r=this._consumeValue(),e=this._getLiteralStringValue(r),this._text[s]="("+e,s++,this._operatorParams+=e,a+=r=this._getNextChar()}return t._TokenType.string},e.prototype._getEncodedDecimalString=function(){for(var e=0,i=this._consumeValue(),r=!0;r;)if("<"===i)e++,i=this._consumeValue();else if(">"===i){if(0===e){this._consumeValue(),r=!1;break}if(1===e){if(">"===(i=this._consumeValue())&&e--,1===e&&" "===i){r=!1;break}}else">"===i&&e--,i=this._consumeValue()}else if((i=this._consumeValue())===String.fromCharCode(65535)){r=!1;break}return t._TokenType.hexString},e.prototype._getLiteralStringValue=function(t){for(var e=0,i="",r=!0;r;)if("\\"!==t)if("("!==t)if(")"!==t||0===e){if(")"===t&&0===e)return i+=t,r=!1,i;i+=t,t=this._getNextChar()}else i+=t,t=this._getNextChar(),e--;else e++,i+=t,t=this._getNextChar();else i+=t,i+=t=this._getNextChar(),t=this._getNextChar();return i},e.prototype._consumeValue=function(){return this._operatorParams+=this._currentCharacter,this._getNextChar()},e.prototype._moveToNextChar=function(){for(;this._currentCharacter!==String.fromCharCode(65535);)switch(this._currentCharacter){case"\0":case"\t":case"\n":case"\f":case"\r":case"\b":case" ":this._getNextChar();break;default:return this._currentCharacter}return this._currentCharacter},e.prototype._resetContentPointer=function(t){this._offset=this._offset-t},e.prototype._getNextInlineChar=function(){return this._data.length<=this._offset?(this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)):(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&("\n"===this._nextCharacter?this._currentCharacter="\r":this._currentCharacter="\n")),this._currentCharacter},e.prototype._getNextCharForInlineStream=function(){return this._data.length<=this._offset?(this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)):(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&"\n"===this._nextCharacter&&this._data.length<=this._offset&&(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(65535))),this._currentCharacter},e.prototype._getNextChar=function(){if(this._data.length<=this._offset){if("Q"===this._nextCharacter||"D"===this._currentCharacter&&"o"===this._nextCharacter)return this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(65535),this._currentCharacter;this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)}else this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&("\n"===this._nextCharacter?(this._currentCharacter=this._nextCharacter,this._data.length<=this._offset?this._nextCharacter=String.fromCharCode(65535):this._nextCharacter=String.fromCharCode(this._data[this._offset++])):this._currentCharacter="\n");return this._currentCharacter},e}(),cn=function(){function t(t,e){this._operator=t,Array.isArray(e)?this._operands=e:this._inlineImageBytes=e}return t}(),_n=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),dn=function(t){function e(e){var i=t.call(this)||this;if(i._rawMinBufferLength=e||0,i.offset=0,i.bufferLength=0,i.eof=!1,i.buffer=new Uint8Array(0),i.minBufferLength=512,e)for(;i.minBufferLength<e;)i.minBufferLength*=2;return i}return _n(e,t),Object.defineProperty(e.prototype,"isEmpty",{get:function(){for(;!this.eof&&0===this.bufferLength;)this.readBlock();return 0===this.bufferLength},enumerable:!0,configurable:!0}),e.prototype.ensureBuffer=function(t){var e=this.buffer;if(t<=e.byteLength)return e;for(var i=this.minBufferLength;i<t;)i*=2;var r=new Uint8Array(i);return r.set(e),this.buffer=r,this.buffer},e.prototype.getByte=function(){for(var t=this.offset;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.offset++]},e.prototype.getBytes=function(t){var e,i=this.offset;if(t){for(this.ensureBuffer(i+t),e=i+t;!this.eof&&this.bufferLength<e;)this.readBlock();var r=this.bufferLength;e>r&&(e=r)}else{for(;!this.eof;)this.readBlock();e=this.bufferLength}return this.offset=e,this.buffer.subarray(i,e)},e.prototype.reset=function(){this.offset=0},e.prototype.makeSubStream=function(t,e,i){if(void 0===e)for(;!this.eof;)this.readBlock();else for(var r=t+e;this.bufferLength<=r&&!this.eof;)this.readBlock();return new nn(this.buffer,i,t,e)},e.prototype.getBaseStreams=function(){return this.stream?this.stream.getBaseStreams():null},e.prototype.moveStart=function(){throw new Error("Invalid call from decode stream")},e.prototype.getByteRange=function(t,e){throw new Error("Invalid call from decode stream. begin: "+t+", end: "+e)},e.prototype.readBlock=function(){throw new Error("Invalid call from decode stream")},e}(rn),ln=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),fn=function(t){function e(e,i,r){var n=t.call(this,i)||this;return n._chunkSize=512,n.stream=e,n.dictionary=e.dictionary,n._cipher=r,n._nextChunk=null,n._initialized=!1,n}return ln(e,t),e.prototype.readBlock=function(){var t;if(this._initialized?t=this._nextChunk:(t=this.stream.getBytes(this._chunkSize),this._initialized=!0),!t||0===t.length)return void(this.eof=!0);this._nextChunk=this.stream.getBytes(this._chunkSize);var e=this._nextChunk&&this._nextChunk.length>0,i=(t=this._cipher._decryptBlock(t,!e)).length;this.ensureBuffer(this.bufferLength+i).set(t,this.bufferLength),this.bufferLength+=i},e}(dn),pn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),un=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gn=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),yn=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),mn=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],bn=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],vn=function(t){function e(e,i){var r=t.call(this,i)||this;r.stream=e,r.dictionary=e.dictionary;var n=e.getByte(),s=e.getByte();if(8!=(15&n))throw new Ur("Unknown compression method in flate stream: "+n+", "+s);if(((n<<8)+s)%31!=0)throw new Ur("Bad flag check in flate stream: "+n+", "+s);if(32&s)throw new Ur("Bad flag bit set in flate stream: "+n+", "+s);return r.codeSize=0,r.codeBuffer=0,r}return pn(e,t),e.prototype.getBits=function(t){for(var e,i=this.stream,r=this.codeSize,n=this.codeBuffer;r<t;)n|=(e=i.getByte())<<r,r+=8;return e=n&(1<<t)-1,this.codeBuffer=n>>t,this.codeSize=r-=t,e},e.prototype.getCode=function(t){for(var e=this.stream,i=t[0],r=t[1],n=this.codeSize,s=this.codeBuffer;n<r;)s|=e.getByte()<<n,n+=8;var a=i[s&(1<<r)-1],o=a>>16,h=65535&a;return o<1||n<o||(this.codeBuffer=s>>o,this.codeSize=n-o),h},e.prototype.generateHuffmanTable=function(t){var e,i=t.length,r=0;for(e=0;e<i;++e)t[e]>r&&(r=t[e]);for(var n=1<<r,s=new Int32Array(n),a=1,o=0,h=2;a<=r;++a,o<<=1,h<<=1)for(var c=0;c<i;++c)if(t[c]===a){var _=0,d=o;for(e=0;e<a;++e)_=_<<1|1&d,d>>=1;for(e=_;e<n;e+=h)s[e]=a<<16|c;++o}return[s,r]},e.prototype.readBlock=function(){var t,e,i=this.stream,r=this.getBits(3);if(1&r&&(this.eof=!0),0===(r>>=1)){var n=i.getByte(),s=n;s|=(n=i.getByte())<<8;var a=n=i.getByte();if(n=i.getByte(),(a|=n<<8)===(65535&~s)||0===s&&0===a){this.codeBuffer=0,this.codeSize=0;var o=this.bufferLength,h=o+s;if(t=this.ensureBuffer(h),this.bufferLength=h,0===s)-1===i.peekByte()&&(this.eof=!0);else{var c=i.getBytes(s);t.set(c,o),c.length<s&&(this.eof=!0)}return}}var _,d;if(1===r)_=mn,d=bn;else if(2===r){var l=this.getBits(5)+257,f=this.getBits(5)+1,p=this.getBits(4)+4,u=new Uint8Array(un.length),g=void 0;for(g=0;g<p;++g)u[un[g]]=this.getBits(3);var y=this.generateHuffmanTable(u);e=0,g=0;for(var m=l+f,b=new Uint8Array(m),v=void 0,w=void 0,S=void 0;g<m;){var P=this.getCode(y);if(16===P)v=2,w=3,S=e;else if(17===P)v=3,w=3,S=e=0;else{if(18!==P){b[g++]=e=P;continue}v=7,w=11,S=e=0}for(var A=this.getBits(v)+w;A-- >0;)b[g++]=S}_=this.generateHuffmanTable(b.subarray(0,l)),d=this.generateHuffmanTable(b.subarray(l,m))}for(var x=(t=this.buffer)?t.length:0,k=this.bufferLength;;){var C=this.getCode(_);if(C<256)k+1>=x&&(x=(t=this.ensureBuffer(k+1)).length),t[k++]=C;else{if(256===C)return void(this.bufferLength=k);var T=(C=gn[C-=257])>>16;T>0&&(T=this.getBits(T)),e=(65535&C)+T,C=this.getCode(d),(T=(C=yn[C])>>16)>0&&(T=this.getBits(T));var R=(65535&C)+T;k+e>=x&&(x=(t=this.ensureBuffer(k+e)).length);for(var F=0;F<e;++F,++k)t[k]=t[k-R]}}},e}(dn),wn=function(){function t(t){if(this._crossReference=t,this._catalogDictionary=t._getCatalogObj(),!(this._catalogDictionary instanceof $r))throw new Ur("Catalog object is not a dictionary.");this._catalogDictionary.isCatalog=!0,this._topPagesDictionary=this._catalogDictionary.get("Pages"),this.pageKidsCountCache=new Yr,this.pageIndexCache=new Yr}return Object.defineProperty(t.prototype,"version",{get:function(){var t;if(this._catalogDictionary.has("Version")){var e=this._catalogDictionary.get("Version");e&&(t=e.name)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageCount",{get:function(){var t=this._topPagesDictionary.get("Count");if(void 0===t||!Number.isInteger(t))throw new Ur("Invalid page count");return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"acroForm",{get:function(){var t;return this._catalogDictionary.has("AcroForm")&&(t=this._catalogDictionary.get("AcroForm")),null!==t&&void 0!==t||(t=this._createForm()),t},enumerable:!0,configurable:!0}),t.prototype._createForm=function(){var t=new $r(this._crossReference),e=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(e,t),this._catalogDictionary.set("AcroForm",e),this._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0,t._updated=!0,t},t.prototype.getPageDictionary=function(t){var e=[this._topPagesDictionary],i=new Jr,r=this._catalogDictionary.getRaw("Pages");r&&r instanceof Qr&&i.put(r);for(var n=this._crossReference,s=this.pageKidsCountCache,a=this.pageIndexCache,o=0;e.length>0;){var h=e.pop();if(null!==h&&void 0!==h&&h instanceof Qr){var c=s.get(h);if(c>=0&&o+c<=t){o+=c;continue}if(i.has(h))throw new Ur("Pages tree contains circular reference.");i.put(h);var _=n._fetch(h);if(_&&_ instanceof $r&&(null!==(p=_.getRaw("Type"))&&void 0!==p&&p instanceof Qr&&(p=n._fetch(p)),ee(p,"Page")||!_.has("Kids"))){if(s.has(h)||s.put(h,1),a.has(h)||a.put(h,o),o===t)return{dictionary:_,reference:h};o++;continue}e.push(_)}else{if(!(h instanceof $r))throw new Ur("Page dictionary kid reference points to wrong type of object.");var d=h.objId,l=h.get("Count");if(null!==l&&void 0!==l&&l instanceof Qr&&(l=n._fetch(l)),null!==l&&void 0!==l&&Number.isInteger(l)&&l>=0&&(d&&!s.has(d)&&s.set(d,l),o+l<=t))o+=l;else{var f=h.getRaw("Kids");if(null!==f&&void 0!==f&&f instanceof Qr&&(f=n._fetch(f)),!Array.isArray(f)){var p=h.getRaw("Type");if(null!==p&&void 0!==p&&p instanceof Qr&&(p=n._fetch(p)),ee(p,"Page")||!h.has("Kids")){if(o===t)return{dictionary:h,reference:null};o++;continue}throw new Ur("Page dictionary kids object is not an array.")}for(var u=f.length-1;u>=0;u--)e.push(f[u])}}}throw new Error("Page index "+t+" not found.")},t.prototype._destroy=function(){this._catalogDictionary&&(this._catalogDictionary=void 0),this._topPagesDictionary&&(this._topPagesDictionary=void 0),this.pageIndexCache&&(this.pageIndexCache.clear(),this.pageIndexCache=void 0),this.pageKidsCountCache&&(this.pageKidsCountCache.clear(),this.pageKidsCountCache=void 0)},t}(),Sn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Pn=function(t){function e(e,i,r){var n=t.call(this,i)||this;if(!(r instanceof $r))return e;var s=n.predictor=r.get("Predictor")||1;if(s<=1)return e;if(2!==s&&(s<10||s>15))throw new Ur("Unsupported predictor: "+s);n.readBlock=2===s?n.readBlockTiff:n.readBlockPng,n.stream=e,n.dictionary=e.dictionary;var a=n.colors=r.get("Colors")||1,o=n.bits=r.get("BPC","BitsPerComponent")||8,h=n.columns=r.get("Columns")||1;return n.pixBytes=a*o+7>>3,n.rowBytes=h*a*o+7>>3,n}return Sn(e,t),e.prototype.readBlockTiff=function(){var t=this.rowBytes,e=this.bufferLength,i=this.ensureBuffer(e+t),r=this.bits,n=this.colors,s=this.stream.getBytes(t);if(this.eof=!s.length,!this.eof){var a,o=0,h=0,c=0,_=0,d=e;if(1===r&&1===n)for(a=0;a<t;++a){var l=s[a]^o;l^=l>>1,l^=l>>2,o=(1&(l^=l>>4))<<7,i[d++]=l}else if(8===r){for(a=0;a<n;++a)i[d++]=s[a];for(;a<t;++a)i[d]=i[d-n]+s[a],d++}else if(16===r){var f=2*n;for(a=0;a<f;++a)i[d++]=s[a];for(;a<t;a+=2){var p=((255&s[a])<<8)+(255&s[a+1])+((255&i[d-f])<<8)+(255&i[d-f+1]);i[d++]=p>>8&255,i[d++]=255&p}}else{var u=new Uint8Array(n+1),g=(1<<r)-1,y=0,m=e,b=this.columns;for(a=0;a<b;++a)for(var v=0;v<n;++v)c<r&&(o=o<<8|255&s[y++],c+=8),u[v]=u[v]+(o>>c-r)&g,c-=r,h=h<<r|u[v],(_+=r)>=8&&(i[m++]=h>>_-8&255,_-=8);_>0&&(i[m++]=(h<<8-_)+(o&(1<<8-_)-1))}this.bufferLength+=t}},e.prototype.readBlockPng=function(){var t=this.rowBytes,e=this.pixBytes,i=this.stream.getByte(),r=this.stream.getBytes(t);if(this.eof=!r.length,!this.eof){var n=this.bufferLength,s=this.ensureBuffer(n+t),a=s.subarray(n-t,n);0===a.length&&(a=new Uint8Array(t));var o,h,c,_=n;switch(i){case 0:for(o=0;o<t;++o)s[_++]=r[o];break;case 1:for(o=0;o<e;++o)s[_++]=r[o];for(;o<t;++o)s[_]=s[_-e]+r[o]&255,_++;break;case 2:for(o=0;o<t;++o)s[_++]=a[o]+r[o]&255;break;case 3:for(o=0;o<e;++o)s[_++]=(a[o]>>1)+r[o];for(;o<t;++o)s[_]=(a[o]+s[_-e]>>1)+r[o]&255,_++;break;case 4:for(o=0;o<e;++o)h=a[o],c=r[o],s[_++]=h+c;for(;o<t;++o){h=a[o];var d=a[o-e],l=s[_-e],f=l+h-d,p=f-l;p<0&&(p=-p);var u=f-h;u<0&&(u=-u);var g=f-d;g<0&&(g=-g),c=r[o],s[_++]=p<=u&&p<=g?l+c:u<=g?h+c:d+c}break;default:throw new Ur("Unsupported predictor: "+i)}this.bufferLength+=t}},e}(dn),An=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),xn=function(){function t(t,e,i){void 0===i&&(i=""),this._isUserPassword=!0,this._hasUserPasswordOnly=!1,this._encryptOnlyAttachment=!1,this._encryptMetaData=!0,this._defaultPasswordBytes=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]);var r=t.get("Filter");if(!ee(r,"Standard"))throw new Ur("unknown encryption method");this._filterName=r.name,this._dictionary=t;var n=t.get("V");if(!Number.isInteger(n)||1!==n&&2!==n&&4!==n&&5!==n)throw new Ur("unsupported encryption algorithm");this._algorithm=n;var s=t.get("Length");if(!s)if(n<=3)s=40;else{var a=t.get("CF"),o=t.get("StmF");if(a&&o){a.suppressEncryption=!0;var h=a.get(o.name);(s=h&&h.get("Length")||128)<40&&(s<<=3)}}if(!Number.isInteger(s)||s<40||s%8!=0)throw new Ur("invalid key length");var c=p(t.get("O"),!1,!0).subarray(0,32),_=p(t.get("U"),!1,!0).subarray(0,32),d=t.get("P"),l=t.get("R");this._encryptMetaData=(4===n||5===n)&&!1!==t.get("EncryptMetadata");var f,g=p(e,!1,!0);i&&(6===l&&(i=encodeURIComponent(i)),f=p(i,!1,!0));var y;if(5!==n){if((y=this._prepareKeyData(g,f,c,_,d,l,s,this._encryptMetaData))&&(this._isUserPassword=!0,i)){var m=this._decodeUserPassword(f,c,l,s),b=this._prepareKeyData(g,m,c,_,d,l,s,this._encryptMetaData);b&&u(b,y)&&(this._hasUserPasswordOnly=!0)}}else{var v,w=p(t.get("O"),!1,!0),S=w.subarray(32,40),P=w.subarray(40,48),A=p(t.get("U"),!1,!0),x=A.subarray(0,48),k=A.subarray(32,40),C=A.subarray(40,48),T=p(t.get("OE"),!1,!0),R=p(t.get("UE"),!1,!0);v=6===l?new Dn:new Ln;var F=void 0;F=f?f.subarray(0,Math.min(127,f.length)):new Uint8Array([]),v._checkUserPassword(F,k,_)?(y=this._createEncryptionKey(!0,F,P,x,C,T,R,v),this._isUserPassword=!0,i.length&&v._checkOwnerPassword(F,S,x,c)&&(this._hasUserPasswordOnly=!0)):i.length&&v._checkOwnerPassword(F,S,x,c)&&(y=this._createEncryptionKey(!1,f,P,x,C,T,R,v),this._isUserPassword=!1)}if(!y){if(!i)throw new Error("Cannot open an encrypted document. The password is invalid.");m=this._decodeUserPassword(f,c,l,s);y=this._prepareKeyData(g,m,c,_,d,l,s,this._encryptMetaData),this._isUserPassword=!1}if(n>=4){var L=t.get("CF");if(L&&(L.suppressEncryption=!0,L.has("StdCF"))){var D=L.get("StdCF");if(D&&D.has("AuthEvent")){var B=D.get("AuthEvent");B&&"EFOpen"===B.name&&(this._encryptOnlyAttachment=!0)}}this._cipherDictionary=L,this._stream=t.get("StmF")||Xr.get("Identity"),this._string=t.get("StrF")||Xr.get("Identity"),this._eff=t.get("EFF")||this._stream}if(!y&&!this._encryptOnlyAttachment)throw new Error("Cannot open an encrypted document. The password is invalid.");this._encryptionKey=y}return Object.defineProperty(t.prototype,"_md5",{get:function(){return void 0===this._messageDigest&&(this._messageDigest=new kn),this._messageDigest},enumerable:!0,configurable:!0}),t.prototype._createEncryptionKey=function(t,e,i,r,n,s,a,o){return t?o._getUserKey(e,n,a):o._getOwnerKey(e,i,r,s)},t.prototype._prepareKeyData=function(t,e,i,r,n,s,a,o){var h,c=new Uint8Array(40+i.length+t.length),_=0,d=0;if(e)for(h=Math.min(32,e.length);_<h;++_)c[_]=e[_];for(;_<32;)c[_++]=this._defaultPasswordBytes[d++];for(d=0,h=i.length;d<h;++d)c[_++]=i[d];for(c[_++]=255&n,c[_++]=n>>8&255,c[_++]=n>>16&255,c[_++]=n>>>24&255,d=0,h=t.length;d<h;++d)c[_++]=t[d];s>=4&&!o&&(c[_++]=255,c[_++]=255,c[_++]=255,c[_++]=255);var l=this._md5.hash(c,0,_),f=a>>3;if(s>=3)for(d=0;d<50;++d)l=this._md5.hash(l,0,f);var p,u=l.subarray(0,f);if(s>=3){for(_=0;_<32;++_)c[_]=this._defaultPasswordBytes[_];for(d=0,h=t.length;d<h;++d)c[_++]=t[d];p=new On(u)._encryptBlock(this._md5.hash(c,0,_)),h=u.length;var g=new Uint8Array(h);for(d=1;d<=19;++d){for(var y=0;y<h;++y)g[y]=u[y]^d;p=new On(g)._encryptBlock(p)}for(d=0,h=p.length;d<h;++d)if(r[d]!==p[d])return null}else for(d=0,h=(p=new On(u)._encryptBlock(this._defaultPasswordBytes)).length;d<h;++d)if(r[d]!==p[d])return null;return u},t.prototype._decodeUserPassword=function(t,e,i,r){for(var n=new Uint8Array(32),s=0,a=0,o=Math.min(32,t.length);s<o;++s)n[s]=t[s];for(;s<32;)n[s++]=this._defaultPasswordBytes[a++];var h=this._md5.hash(n,0,s),c=r>>3;if(i>=3)for(a=0;a<50;++a)h=this._md5.hash(h,0,h.length);var _;if(i>=3){_=e;var d=new Uint8Array(c);for(a=19;a>=0;a--){for(var l=0;l<c;++l)d[l]=h[l]^a;_=new On(d)._encryptBlock(_)}}else _=new On(h.subarray(0,c))._encryptBlock(e);return _},t.prototype._createCipherTransform=function(t,e){if(4===this._algorithm||5===this._algorithm){var i=this._buildCipherConstructor(this._cipherDictionary,this._string,t,e,this._encryptionKey),r=this._buildCipherConstructor(this._cipherDictionary,this._stream,t,e,this._encryptionKey);return new jn(i,r)}var n=this._buildObjectKey(t,e,this._encryptionKey,!1);return new jn(new On(n),new On(n))},t.prototype._buildCipherConstructor=function(t,e,i,r,n){var s,a=t.get(e.name);if(a&&(s=a.get("CFM")),!s)return new En;switch(s.name){case"None":return new En;case"AESV2":return new Mn(this._buildObjectKey(i,r,n,!0));case"AESV3":return new Nn(n);case"V2":return new On(this._buildObjectKey(i,r,n,!1))}throw new Ur("Unknown cryptography method")},t.prototype._buildObjectKey=function(t,e,i,r){void 0===r&&(r=!1);var n,s=new Uint8Array(i.length+9);for(n=0;n<i.length;++n)s[n]=i[n];return s[n++]=255&t,s[n++]=t>>8&255,s[n++]=t>>16&255,s[n++]=255&e,s[n++]=e>>8&255,r&&(s[n++]=115,s[n++]=65,s[n++]=108,s[n++]=84),this._md5.hash(s,0,n).subarray(0,Math.min(i.length+5,16))},t}(),kn=function(){function t(){this._r=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]),this._k=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])}return t.prototype.hash=function(t,e,i){for(var r=1732584193,n=-271733879,s=-1732584194,a=271733878,o=i+72&-64,h=new Uint8Array(o),c=0,_=0;c<i;++c)h[c]=t[e++];h[c++]=128;for(var d=o-8;c<d;)h[c++]=0;h[c++]=i<<3&255,h[c++]=i>>5&255,h[c++]=i>>13&255,h[c++]=i>>21&255,h[c++]=i>>>29&255,h[c++]=0,h[c++]=0,h[c++]=0;var l=new Int32Array(16);for(c=0;c<o;){for(_=0;_<16;++_,c+=4)l[_]=h[c]|h[c+1]<<8|h[c+2]<<16|h[c+3]<<24;var f=r,p=n,u=s,g=a,y=void 0,m=void 0;for(_=0;_<64;++_){_<16?(y=p&u|~p&g,m=_):_<32?(y=g&p|~g&u,m=5*_+1&15):_<48?(y=p^u^g,m=3*_+5&15):(y=u^(p|~g),m=7*_&15);var b=g,v=f+y+this._k[_]+l[m]|0,w=this._r[_];g=u,u=p,p=p+(v<<w|v>>>32-w)|0,f=b}r=r+f|0,n=n+p|0,s=s+u|0,a=a+g|0}return new Uint8Array([255&r,r>>8&255,r>>16&255,r>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&s,s>>8&255,s>>16&255,s>>>24&255,255&a,a>>8&255,a>>16&255,a>>>24&255])},t}(),Cn=function(){function t(){}return t.prototype._rotateRight=function(t,e){return t>>>e|t<<32-e},t.prototype._sigma=function(t){return this._rotateRight(t,2)^this._rotateRight(t,13)^this._rotateRight(t,22)},t.prototype._sigmaPrime=function(t){return this._rotateRight(t,6)^this._rotateRight(t,11)^this._rotateRight(t,25)},t.prototype._littleSigma=function(t){return this._rotateRight(t,7)^this._rotateRight(t,18)^t>>>3},t.prototype._littleSigmaPrime=function(t){return this._rotateRight(t,17)^this._rotateRight(t,19)^t>>>10},t.prototype._hash=function(t,e,i){for(var r,n=1779033703,s=3144134277,a=1013904242,o=2773480762,h=1359893119,c=2600822924,_=528734635,d=1541459225,l=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=64*Math.ceil((i+9)/64),p=new Uint8Array(f),u=0;u<i;++u)p[u]=t[e++];p[u++]=128;for(var g=f-8;u<g;)p[u++]=0;p[u++]=0,p[u++]=0,p[u++]=0,p[u++]=i>>>29&255,p[u++]=i>>21&255,p[u++]=i>>13&255,p[u++]=i>>5&255,p[u++]=i<<3&255;var y=new Uint32Array(64);for(u=0;u<f;){for(r=0;r<16;++r)y[r]=p[u]<<24|p[u+1]<<16|p[u+2]<<8|p[u+3],u+=4;for(r=16;r<64;++r)y[r]=this._littleSigmaPrime(y[r-2])+y[r-7]+this._littleSigma(y[r-15])+y[r-16]|0;var m=n,b=s,v=a,w=o,S=h,P=c,A=_,x=d,k=void 0,C=void 0;for(r=0;r<64;++r)k=x+this._sigmaPrime(S)+(S&P^~S&A)+l[r]+y[r],C=this._sigma(m)+(m&b^m&v^b&v),x=A,A=P,P=S,S=w+k|0,w=v,v=b,b=m,m=k+C|0;n=n+m|0,s=s+b|0,a=a+v|0,o=o+w|0,h=h+S|0,c=c+P|0,_=_+A|0,d=d+x|0}return new Uint8Array([n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o,h>>24&255,h>>16&255,h>>8&255,255&h,c>>24&255,c>>16&255,c>>8&255,255&c,_>>24&255,_>>16&255,_>>8&255,255&_,d>>24&255,d>>16&255,d>>8&255,255&d])},t}(),Tn=function(){function t(){this._k=[new Rn(1116352408,3609767458),new Rn(1899447441,602891725),new Rn(3049323471,3964484399),new Rn(3921009573,2173295548),new Rn(961987163,4081628472),new Rn(1508970993,3053834265),new Rn(2453635748,2937671579),new Rn(2870763221,3664609560),new Rn(3624381080,2734883394),new Rn(310598401,1164996542),new Rn(607225278,1323610764),new Rn(1426881987,3590304994),new Rn(1925078388,4068182383),new Rn(2162078206,991336113),new Rn(2614888103,633803317),new Rn(3248222580,3479774868),new Rn(3835390401,2666613458),new Rn(4022224774,944711139),new Rn(264347078,2341262773),new Rn(604807628,2007800933),new Rn(770255983,1495990901),new Rn(1249150122,1856431235),new Rn(1555081692,3175218132),new Rn(1996064986,2198950837),new Rn(2554220882,3999719339),new Rn(2821834349,766784016),new Rn(2952996808,2566594879),new Rn(3210313671,3203337956),new Rn(3336571891,1034457026),new Rn(3584528711,2466948901),new Rn(113926993,3758326383),new Rn(338241895,168717936),new Rn(666307205,1188179964),new Rn(773529912,1546045734),new Rn(1294757372,1522805485),new Rn(1396182291,2643833823),new Rn(1695183700,2343527390),new Rn(1986661051,1014477480),new Rn(2177026350,1206759142),new Rn(2456956037,344077627),new Rn(2730485921,1290863460),new Rn(2820302411,3158454273),new Rn(3259730800,3505952657),new Rn(3345764771,106217008),new Rn(3516065817,3606008344),new Rn(3600352804,1432725776),new Rn(4094571909,1467031594),new Rn(275423344,851169720),new Rn(430227734,3100823752),new Rn(506948616,1363258195),new Rn(659060556,3750685593),new Rn(883997877,3785050280),new Rn(958139571,3318307427),new Rn(1322822218,3812723403),new Rn(1537002063,2003034995),new Rn(1747873779,3602036899),new Rn(1955562222,1575990012),new Rn(2024104815,1125592928),new Rn(2227730452,2716904306),new Rn(2361852424,442776044),new Rn(2428436474,593698344),new Rn(2756734187,3733110249),new Rn(3204031479,2999351573),new Rn(3329325298,3815920427),new Rn(3391569614,3928383900),new Rn(3515267271,566280711),new Rn(3940187606,3454069534),new Rn(4118630271,4000239992),new Rn(116418474,1914138554),new Rn(174292421,2731055270),new Rn(289380356,3203993006),new Rn(460393269,320620315),new Rn(685471733,587496836),new Rn(852142971,1086792851),new Rn(1017036298,365543100),new Rn(1126000580,2618297676),new Rn(1288033470,3409855158),new Rn(1501505948,4234509866),new Rn(1607167915,987167468),new Rn(1816402316,1246189591)]}return t.prototype._sigma=function(t,e,i){t.assign(e),t.rotateRight(28),i.assign(e),i.rotateRight(34),t.xor(i),i.assign(e),i.rotateRight(39),t.xor(i)},t.prototype._sigmaPrime=function(t,e,i){t.assign(e),t.rotateRight(14),i.assign(e),i.rotateRight(18),t.xor(i),i.assign(e),i.rotateRight(41),t.xor(i)},t.prototype._littleSigma=function(t,e,i){t.assign(e),t.rotateRight(1),i.assign(e),i.rotateRight(8),t.xor(i),i.assign(e),i.shiftRight(7),t.xor(i)},t.prototype._littleSigmaPrime=function(t,e,i){t.assign(e),t.rotateRight(19),i.assign(e),i.rotateRight(61),t.xor(i),i.assign(e),i.shiftRight(6),t.xor(i)},t.prototype._hash=function(t,e,i,r){void 0===r&&(r=!1);var n,s,a,o,h,c,_,d;r?(n=new Rn(3418070365,3238371032),s=new Rn(1654270250,914150663),a=new Rn(2438529370,812702999),o=new Rn(355462360,4144912697),h=new Rn(1731405415,4290775857),c=new Rn(2394180231,1750603025),_=new Rn(3675008525,1694076839),d=new Rn(1203062813,3204075428)):(n=new Rn(1779033703,4089235720),s=new Rn(3144134277,2227873595),a=new Rn(1013904242,4271175723),o=new Rn(2773480762,1595750129),h=new Rn(1359893119,2917565137),c=new Rn(2600822924,725511199),_=new Rn(528734635,4215389547),d=new Rn(1541459225,327033209));var l,f=128*Math.ceil((i+17)/128),p=new Uint8Array(f);for(l=0;l<i;++l)p[l]=t[e++];p[l++]=128;for(var u=f-16;l<u;)p[l++]=0;p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=0,p[l++]=i>>>29&255,p[l++]=i>>21&255,p[l++]=i>>13&255,p[l++]=i>>5&255,p[l++]=i<<3&255;var g=new Array(80);for(l=0;l<80;l++)g[l]=new Rn(0,0);var y,m=new Rn(0,0),b=new Rn(0,0),v=new Rn(0,0),w=new Rn(0,0),S=new Rn(0,0),P=new Rn(0,0),A=new Rn(0,0),x=new Rn(0,0),k=new Rn(0,0),C=new Rn(0,0),T=new Rn(0,0),R=new Rn(0,0);for(l=0;l<f;){var F=void 0;for(F=0;F<16;++F)g[F].high=p[l]<<24|p[l+1]<<16|p[l+2]<<8|p[l+3],g[F].low=p[l+4]<<24|p[l+5]<<16|p[l+6]<<8|p[l+7],l+=8;for(F=16;F<80;++F)y=g[F],this._littleSigmaPrime(y,g[F-2],R),y.add(g[F-7]),this._littleSigma(T,g[F-15],R),y.add(T),y.add(g[F-16]);for(m.assign(n),b.assign(s),v.assign(a),w.assign(o),S.assign(h),P.assign(c),A.assign(_),x.assign(d),F=0;F<80;++F)k.assign(x),this._sigmaPrime(T,S,R),k.add(T),T.assign(S),T.and(P),R.assign(S),R.not(),R.and(A),T.xor(R),k.add(T),k.add(this._k[F]),k.add(g[F]),this._sigma(C,m,R),T.assign(m),T.and(b),R.assign(m),R.and(v),T.xor(R),R.assign(b),R.and(v),T.xor(R),C.add(T),y=x,x=A,A=P,P=S,w.add(k),S=w,w=v,v=b,b=m,y.assign(k),y.add(C),m=y;n.add(m),s.add(b),a.add(v),o.add(w),h.add(S),c.add(P),_.add(A),d.add(x)}var L;return r?(L=new Uint8Array(48),n.copyTo(L,0),s.copyTo(L,8),a.copyTo(L,16),o.copyTo(L,24),h.copyTo(L,32),c.copyTo(L,40)):(L=new Uint8Array(64),n.copyTo(L,0),s.copyTo(L,8),a.copyTo(L,16),o.copyTo(L,24),h.copyTo(L,32),c.copyTo(L,40),_.copyTo(L,48),d.copyTo(L,56)),L},t}(),Rn=function(){function t(t,e){this.high=0|t,this.low=0|e}return t.prototype.and=function(t){this.high&=t.high,this.low&=t.low},t.prototype.or=function(t){this.high|=t.high,this.low|=t.low},t.prototype.not=function(){this.high=~this.high,this.low=~this.low},t.prototype.xor=function(t){this.high^=t.high,this.low^=t.low},t.prototype.shiftRight=function(t){t>=32?(this.low=this.high>>>t-32|0,this.high=0):(this.low=this.low>>>t|this.high<<32-t,this.high=this.high>>>t|0)},t.prototype.shiftLeft=function(t){t>=32?(this.high=this.low<<t-32,this.low=0):(this.high=this.high<<t|this.low>>>32-t,this.low<<=t)},t.prototype.rotateRight=function(t){var e,i;32&t?(i=this.low,e=this.high):(e=this.low,i=this.high),t&=31,this.low=e>>>t|i<<32-t,this.high=i>>>t|e<<32-t},t.prototype.add=function(t){var e=(this.low>>>0)+(t.low>>>0),i=(this.high>>>0)+(t.high>>>0);e>4294967295&&(i+=1),this.low=0|e,this.high=0|i},t.prototype.copyTo=function(t,e){t[e]=this.high>>>24&255,t[e+1]=this.high>>16&255,t[e+2]=this.high>>8&255,t[e+3]=255&this.high,t[e+4]=this.low>>>24&255,t[e+5]=this.low>>16&255,t[e+6]=this.low>>8&255,t[e+7]=255&this.low},t.prototype.assign=function(t){this.high=t.high,this.low=t.low},t}(),Fn=function(){function t(){}return Object.defineProperty(t.prototype,"_sha256",{get:function(){return void 0===this._sha256Obj&&(this._sha256Obj=new Cn),this._sha256Obj},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_sha512",{get:function(){return void 0===this._sha512Obj&&(this._sha512Obj=new Tn),this._sha512Obj},enumerable:!0,configurable:!0}),t}(),Ln=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return An(e,t),e.prototype._checkOwnerPassword=function(t,e,i,r){var n=new Uint8Array(t.length+56);return n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length),u(this._sha256._hash(n,0,n.length),r)},e.prototype._checkUserPassword=function(t,e,i){var r=new Uint8Array(t.length+8);return r.set(t,0),r.set(e,t.length),u(this._sha256._hash(r,0,r.length),i)},e.prototype._getOwnerKey=function(t,e,i,r){var n=new Uint8Array(t.length+56);n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length);var s=this._sha256._hash(n,0,n.length);return new Nn(s)._decryptBlock(r,!1,new Uint8Array(16))},e.prototype._getUserKey=function(t,e,i){var r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);var n=this._sha256._hash(r,0,r.length);return new Nn(n)._decryptBlock(i,!1,new Uint8Array(16))},e}(Fn),Dn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return An(e,t),e.prototype._checkOwnerPassword=function(t,e,i,r){var n=new Uint8Array(t.length+56);return n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length),u(this._hash(t,n,i),r)},e.prototype._checkUserPassword=function(t,e,i){var r=new Uint8Array(t.length+8);return r.set(t,0),r.set(e,t.length),u(this._hash(t,r,new Uint8Array([])),i)},e.prototype._getOwnerKey=function(t,e,i,r){var n=new Uint8Array(t.length+56);n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length);var s=this._hash(t,n,i);return new Nn(s)._decryptBlock(r,!1,new Uint8Array(16))},e.prototype._getUserKey=function(t,e,i){var r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);var n=this._hash(t,r,new Uint8Array([]));return new Nn(n)._decryptBlock(i,!1,new Uint8Array(16))},e.prototype._hash=function(t,e,i){for(var r=this._sha256._hash(e,0,e.length).subarray(0,32),n=new Uint8Array([0]),s=0;s<64||n[n.length-1]>s-32;){var a=t.length+r.length+i.length,o=new Uint8Array(a),h=0;o.set(t,h),h+=t.length,o.set(r,h),h+=r.length,o.set(i,h);for(var c=new Uint8Array(64*a),_=0,d=0;_<64;_++)c.set(o,d),d+=a;n=new Mn(r.subarray(0,16))._encrypt(c,r.subarray(16,32));for(var l=0,f=0;f<16;f++)l*=1,l%=3,l+=(n[f]>>>0)%3,l%=3;2===l?r=this._sha512._hash(n,0,n.length):1===l?r=this._sha512._hash(n,0,n.length,!0):0===l&&(r=this._sha256._hash(n,0,n.length)),s++}return r.subarray(0,32)},e}(Fn),Bn=function(){function t(){}return t}(),On=function(t){function e(e){var i=t.call(this)||this;i._a=0,i._b=0;for(var r=new Uint8Array(256),n=0;n<256;++n)r[n]=n;for(var s=e.length,n=0,a=0;n<256;++n){var o=r[n];a=a+o+e[n%s]&255,r[n]=r[a],r[a]=o}return i._s=r,i}return An(e,t),e.prototype._encryptBlock=function(t){for(var e=this._a,i=this._b,r=this._s,n=t.length,s=new Uint8Array(n),a=0;a<n;++a){var o=r[e=e+1&255],h=r[i=i+o&255];r[e]=h,r[i]=o,s[a]=t[a]^r[o+h&255]}return this._a=e,this._b=i,s},e.prototype._decryptBlock=function(t){return this._encryptBlock(t)},e.prototype._encrypt=function(t){return this._encryptBlock(t)},e}(Bn),In=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._buffer=new Uint8Array(16),e._position=0,e._s=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]),e._inverseS=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]),e._mix=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]),e}return An(e,t),Object.defineProperty(e.prototype,"_mixCol",{get:function(){if(void 0===this._mixC){this._mixC=new Uint8Array(256);for(var t=0;t<256;t++)this._mixC[t]=t<128?t<<1:t<<1^27}return this._mixC},enumerable:!0,configurable:!0}),e.prototype._decrypt=function(t,e){var i,r,n,s=new Uint8Array(16);s.set(t);for(var a=0,o=this._keySize;a<16;++a,++o)s[a]^=e[o];for(var h=this._cyclesOfRepetition-1;h>=1;--h){i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],n=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=n;for(a=0;a<16;++a)s[a]=this._inverseS[s[a]];for(var a=0,o=16*h;a<16;++a,++o)s[a]^=e[o];for(a=0;a<16;a+=4){var c=this._mix[s[a]],_=this._mix[s[a+1]],d=this._mix[s[a+2]],l=this._mix[s[a+3]];i=c^_>>>8^_<<24^d>>>16^d<<16^l>>>24^l<<8,s[a]=i>>>24&255,s[a+1]=i>>16&255,s[a+2]=i>>8&255,s[a+3]=255&i}}i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],n=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=n;for(a=0;a<16;++a)s[a]=this._inverseS[s[a]],s[a]^=e[a];return s},e.prototype._encryptBlock=function(t,e){var i,r,n,s=this._s,a=new Uint8Array(16);a.set(t);for(l=0;l<16;++l)a[l]^=e[l];for(var o=1;o<this._cyclesOfRepetition;o++){for(l=0;l<16;++l)a[l]=s[a[l]];n=a[1],a[1]=a[5],a[5]=a[9],a[9]=a[13],a[13]=n,n=a[2],r=a[6],a[2]=a[10],a[6]=a[14],a[10]=n,a[14]=r,n=a[3],r=a[7],i=a[11],a[3]=a[15],a[7]=n,a[11]=r,a[15]=i;for(l=0;l<16;l+=4){var h=a[l+0],c=a[l+1],_=a[l+2],d=a[l+3];i=h^c^_^d,a[l+0]^=i^this._mixCol[h^c],a[l+1]^=i^this._mixCol[c^_],a[l+2]^=i^this._mixCol[_^d],a[l+3]^=i^this._mixCol[d^h]}for(var l=0,f=16*o;l<16;++l,++f)a[l]^=e[f]}for(l=0;l<16;++l)a[l]=s[a[l]];n=a[1],a[1]=a[5],a[5]=a[9],a[9]=a[13],a[13]=n,n=a[2],r=a[6],a[2]=a[10],a[6]=a[14],a[10]=n,a[14]=r,n=a[3],r=a[7],i=a[11],a[3]=a[15],a[7]=n,a[11]=r,a[15]=i;for(var l=0,f=this._keySize;l<16;++l,++f)a[l]^=e[f];return a},e.prototype._decryptBlockHelper=function(t,e){for(var i=t.length,r=this._buffer,n=this._position,s=[],a=this._iv,o=0;o<i;++o)if(r[n]=t[o],!(++n<16)){for(var h=this._decrypt(r,this._key),c=0;c<16;++c)h[c]^=a[c];a=r,s.push(h),r=new Uint8Array(16),n=0}if(this._buffer=r,this._bufferLength=n,this._iv=a,0===s.length)return new Uint8Array(0);var _=16*s.length;if(e){var d=s[s.length-1],l=d[15];if(l<=16){for(var o=15,f=16-l;o>=f;--o)if(d[o]!==l){l=0;break}_-=l,s[s.length-1]=d.subarray(0,16-l)}}for(var p=new Uint8Array(_),o=0,c=0;o<s.length;++o,c+=16)p.set(s[o],c);return p},e.prototype._decryptBlock=function(t,e,i){var r=t.length,n=this._buffer,s=this._position;if(i)this._iv=i;else{for(var a=0;s<16&&a<r;++a,++s)n[s]=t[a];if(s<16)return this._bufferLength=s,new Uint8Array(0);this._iv=n,t=t.subarray(16)}return this._buffer=new Uint8Array(16),this._bufferLength=0,this._decryptBlock=this._decryptBlockHelper,this._decryptBlock(t,e)},e.prototype._encrypt=function(t,e){var i=t.length,r=this._buffer,n=this._position,s=[];e||(e=new Uint8Array(16));for(c=0;c<i;++c)if(r[n]=t[c],!(++n<16)){for(_=0;_<16;++_)r[_]^=e[_];var a=this._encryptBlock(r,this._key);e=a,s.push(a),r=new Uint8Array(16),n=0}if(this._buffer=r,this._bufferLength=n,this._iv=e,0===s.length)return new Uint8Array(0);for(var o=16*s.length,h=new Uint8Array(o),c=0,_=0;c<s.length;++c,_+=16)h.set(s[c],_);return h},e}(Bn),Mn=function(t){function e(e){var i=t.call(this)||this;return i._cyclesOfRepetition=10,i._keySize=160,i._key=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]),i._key=i._expandKey(e),i}return An(e,t),e.prototype._expandKey=function(t){var e=this._s,i=this._key,r=new Uint8Array(176);r.set(t);for(var n=16,s=1;n<176;++s){var a=r[n-3],o=r[n-2],h=r[n-1],c=r[n-4];a=e[a],o=e[o],h=e[h],c=e[c],a^=i[s];for(var _=0;_<4;++_)r[n]=a^=r[n-16],r[n+1]=o^=r[n-15],r[n+2]=h^=r[n-14],r[n+3]=c^=r[n-13],n+=4}return r},e}(In),Nn=function(t){function e(e){var i=t.call(this)||this;return i._cyclesOfRepetition=14,i._keySize=224,i._key=i._expandKey(e),i}return An(e,t),e.prototype._expandKey=function(t){var e=this._s,i=new Uint8Array(240);i.set(t);for(var r,n,s,a,o=1,h=32,c=1;h<240;++c){h%32==16?(r=e[r],n=e[n],s=e[s],a=e[a]):h%32==0&&(r=i[h-3],n=i[h-2],s=i[h-1],a=i[h-4],r=e[r],n=e[n],s=e[s],a=e[a],r^=o,(o<<=1)>=256&&(o=255&(27^o)));for(var _=0;_<4;++_)i[h]=r^=i[h-32],i[h+1]=n^=i[h-31],i[h+2]=s^=i[h-30],i[h+3]=a^=i[h-29],h+=4}return i},e}(In),En=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return An(e,t),e.prototype._decryptBlock=function(t){return t},e.prototype._encrypt=function(t){return t},e}(Bn),jn=function(){function t(t,e){this._stringCipher=t,this._streamCipher=e}return t.prototype.createStream=function(t,e){return new fn(t,e,this._streamCipher)},t.prototype.decryptString=function(t){var e=p(t,!1,!0);return m(this._stringCipher._decryptBlock(e,!0))},t.prototype.encryptString=function(t){if(this._stringCipher instanceof In){var e=16-t.length%16;t+=String.fromCharCode(e).repeat(e);var i=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(i);else for(var r=0;r<16;r++)i[r]=Math.floor(256*Math.random());var n=this._stringCipher._encrypt(p(t,!1,!0),i),s=new Uint8Array(16+n.length);return s.set(i),s.set(n,16),m(s)}return m(this._stringCipher._encrypt(p(t,!1,!0)))},t}(),Vn=[1,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,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,2,0,2,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,2,0,2,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,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],zn=function(){function t(t,e){void 0===e&&(e=!1),this.stream=t,this.nextChar(),this.stringBuffer=[],this._hexStringNumber=0,this.beginInlineImagePosition=-1,this._isFormsDataFormat=e}return t.prototype.nextChar=function(){return this.currentChar=this.stream.getByte()},t.prototype.peekChar=function(){return this.stream.peekByte()},t.prototype.getNumber=function(){var t=this.currentChar,e=!1,i=0,r=0;if(45===t?(r=-1,45===(t=this.nextChar())&&(t=this.nextChar())):43===t&&(r=1,t=this.nextChar()),10===t||13===t)do{t=this.nextChar()}while(10===t||13===t);if(46===t&&(i=10,t=this.nextChar()),t<48||t>57){if(A(t)||-1===t){if(10===i&&0===r)return 0;if(0===i&&-1===r)return 0}throw new Ur("Invalid number: "+String.fromCharCode(t)+" (charCode "+t+")")}r=r||1;var n=t-48,s=0,a=1;for(t=this.nextChar();t>=0;){if(t>=48&&t<=57){var o=t-48;e?s=10*s+o:(0!==i&&(i*=10),n=10*n+o)}else if(46===t){if(0!==i)break;i=1}else{if(45===t){t=this.nextChar();continue}if(69!==t&&101!==t)break;if(43===(t=this.peekChar())||45===t)a=45===t?-1:1,this.nextChar();else if(t<48||t>57)break;e=!0}t=this.nextChar()}return 0!==i&&(n/=i),e&&(n*=Math.pow(10,a*s)),r*n},t.prototype.getString=function(){var t=1,e=!1,i=this.stringBuffer;i.length=0;for(var r=this.nextChar();;){var n=!1;switch(0|r){case-1:e=!0;break;case 40:++t,i.push("(");break;case 41:0==--t?(this.nextChar(),e=!0):i.push(")");break;case 92:switch(r=this.nextChar()){case-1:e=!0;break;case 110:i.push("\n");break;case 114:i.push("\r");break;case 116:i.push("\t");break;case 98:i.push("\b");break;case 102:i.push("\f");break;case 92:case 40:case 41:i.push(String.fromCharCode(r));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:var s=15&r;n=!0,(r=this.nextChar())>=48&&r<=55&&(s=(s<<3)+(15&r),(r=this.nextChar())>=48&&r<=55&&(n=!1,s=(s<<3)+(15&r))),i.push(String.fromCharCode(s));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:i.push(String.fromCharCode(r))}break;default:i.push(String.fromCharCode(r))}if(e)break;n||(r=this.nextChar())}return i.join("")},t.prototype.getName=function(){var t,e,i=this.stringBuffer;for(i.length=0,t=this.nextChar();t>=0&&!Vn[t];){if(35===t){if(t=this.nextChar(),Vn[t]){i.push("#");break}var r=this._toHexDigit(t);if(-1!==r){e=t,t=this.nextChar();var n=this._toHexDigit(t);if(-1===n){if(i.push("#",String.fromCharCode(e)),Vn[t])break;i.push(String.fromCharCode(t)),t=this.nextChar();continue}i.push(String.fromCharCode(r<<4|n))}else i.push("#",String.fromCharCode(t))}else i.push(String.fromCharCode(t));t=this.nextChar()}return Xr.get(i.join(""))},t.prototype.getHexString=function(){var t=this.stringBuffer;t.length=0;var e,i,r=this.currentChar,n=!0;for(this._hexStringNumber=0;;){if(r<0)break;if(62===r){this.nextChar();break}if(1!==Vn[r]){if(n){if(-1===(e=this._toHexDigit(r))){r=this.nextChar();continue}}else{if(-1===(i=this._toHexDigit(r))){r=this.nextChar();continue}t.push(String.fromCharCode(e<<4|i))}n=!n,r=this.nextChar()}else r=this.nextChar()}return t.join("")},t.prototype.getObject=function(){for(var t=!1,e=this.currentChar;;){if(e<0)return"EOF";if(t)10!==e&&13!==e||(t=!1);else if(37===e)t=!0;else if(1!==Vn[e])break;e=this.nextChar()}switch(0|e){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 this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),qr.get("[");case 93:return this.nextChar(),qr.get("]");case 60:return e=this.nextChar(),60===e?(this.nextChar(),qr.get("<<")):this.getHexString();case 62:return e=this.nextChar(),62===e?(this.nextChar(),qr.get(">>")):qr.get(">");case 123:return this.nextChar(),qr.get("{");case 125:return this.nextChar(),qr.get("}");case 41:throw this.nextChar(),new Ur("Illegal character: "+e)}var i=String.fromCharCode(e);if(e<32||e>127){var r=this.peekChar();if(r>=32&&r<=127)return this.nextChar(),qr.get(i)}for(e=this.nextChar();e>=0&&!Vn[e];){var n=i+String.fromCharCode(e);if(!this._isFormsDataFormat&&128===i.length)throw new Ur("Command token too long: "+i.length);i=n,e=this.nextChar()}return"true"===i||"false"!==i&&("null"===i?null:("BI"===i&&(this.beginInlineImagePosition=this.stream.position),qr.get(i)))},t.prototype.peekObj=function(){var t,e=this.stream.position,i=this.currentChar,r=this.beginInlineImagePosition;try{t=this.getObject()}catch(t){}return this.stream.position=e,this.currentChar=i,this.beginInlineImagePosition=r,t},t.prototype.skipToNextLine=function(){for(var t=this.currentChar;t>=0;){if(13===t){10===(t=this.nextChar())&&this.nextChar();break}if(10===t){this.nextChar();break}t=this.nextChar()}},t.prototype._toHexDigit=function(t){return t>=48&&t<=57?15&t:t>=65&&t<=70||t>=97&&t<=102?9+(15&t):-1},t}(),Un=function(){function t(t,e,i,r,n){void 0===i&&(i=!1),void 0===r&&(r=!1),this._isColorSpace=!1,this._isPassword=!1,this.lexicalOperator=t,this.xref=e,this.allowStreams=i,this.recoveryMode=r,this.imageCache=new Map,this._encryptor=n,this.refill()}return t.prototype.refill=function(){this.first=this.lexicalOperator.getObject(),this.second=this.lexicalOperator.getObject()},t.prototype.shift=function(){this.second instanceof qr&&"ID"===this.second.command?(this.first=this.second,this.second=null):(this.first=this.second,this.second=this.lexicalOperator.getObject())},t.prototype.tryShift=function(){try{return this.shift(),!0}catch(t){return!1}},t.prototype.getObject=function(t,e,i){var r,n=this.first;if(this.shift(),n instanceof qr)switch(n.command){case"BI":return"number"==typeof t&&"number"==typeof e?this.makeInlineImage(t,e,i):t instanceof jn?this.makeInlineImage(t):this.makeInlineImage();case"[":for(var s=[];!ie(this.first,"]")&&"EOF"!==this.first;){var a=void 0;"number"==typeof t&&"number"==typeof e?(r=this._encryptor._createCipherTransform(t,e),a=this.getObject(t,e,i)):t instanceof jn?(r=t,a=this.getObject(t)):a=this.getObject(t),0===s.length&&ee(a,"Indexed")&&(this._isColorSpace=!0),a=It(a,this._isColorSpace,this._isPassword),s.push(a)}if("EOF"===this.first){if(this.recoveryMode)return s;throw new Wr("End of file inside array.")}return this._isColorSpace=!1,this.shift(),s;case"<<":for(var o=new $r(this.xref);!ie(this.first,">>")&&"EOF"!==this.first;)if(this.first instanceof Xr){var h=this.first.name;if("U"!==h&&"O"!==h&&"ID"!==h||(this._isPassword=!0),this.shift(),this._checkEnd()||ie(this.first,">>")&&ie(this.second,"stream"))break;"number"==typeof t&&"number"==typeof e&&(r=this._encryptor._createCipherTransform(t,e));var c=void 0;if(c="number"==typeof t&&"number"==typeof e?this.getObject(t,e,i):t instanceof jn?this.getObject(t):this.getObject(),(c=It(c,this._isColorSpace,this._isPassword))&&c instanceof Xr){var _=c.name;_.includes("#20")&&(c.name=_.replace(/#20/g," "))}this._isPassword=!1,o.set(h,c)}else this.shift();if("EOF"===this.first){if(this.recoveryMode)return o;throw new Wr("End of file inside dictionary.")}return ie(this.second,"stream")?!0===this.allowStreams?(t instanceof jn?r=t:i&&"number"==typeof e&&(r=this._encryptor._createCipherTransform(t,e)),"boolean"==typeof e&&e?this.makeStream(o,r,e):this.makeStream(o,r)):o:(this.shift(),o);default:return n}if(Number.isInteger(n)){if(Number.isInteger(this.first)&&ie(this.second,"R")){var d=Qr.get(n,this.first);return this.shift(),this.shift(),d}return n}return"string"==typeof n?(t instanceof jn?r=t:"number"==typeof t&&"number"==typeof e&&(r=this._encryptor._createCipherTransform(t,e)),r?r.decryptString(n):n):n},t.prototype.findDiscreteDecodeInlineStreamEnd=function(t){var e,i,r=t.position,n=!1;for(e=t.getByte();-1!==e;)if(255===e){switch(t.getByte()){case 0:break;case 255:t.skip(-1);break;case 217:n=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:(i=t.getUnsignedInteger16())>2?t.skip(i-2):t.skip(-2)}if(n)break;e=t.getByte()}else e=t.getByte();var s=t.position-r;return-1===e?(t.skip(-s),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),s)},t.prototype.findDecodeInlineStreamEnd=function(t){for(var e,i=t.position;-1!==(e=t.getByte());)if(126===e){var r=t.position;for(e=t.peekByte();A(e);)t.skip(),e=t.peekByte();if(62===e){t.skip();break}if(t.position>r){var n=t.peekBytes(2);if(69===n[0]&&73===n[1])break}}var s=t.position-i;return-1===e?(t.skip(-s),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),s)},t.prototype.findHexDecodeInlineStreamEnd=function(t){var e,i=t.position;for(e=t.getByte();-1!==e&&62!==e;)e=t.getByte();var r=t.position-i;return-1===e?(t.skip(-r),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),r)},t.prototype.inlineStreamSkipEI=function(t){var e,i=0;for(e=t.getByte();-1!==e;){if(0===i)i=69===e?1:0;else if(1===i)i=73===e?2:0;else if(2===i)break;e=t.getByte()}},t.prototype.makeInlineImage=function(t,e,i){var r,n,s=this.lexicalOperator,a=s.stream,o=new $r(this.xref);for(i&&(n=t instanceof jn?t:this._encryptor._createCipherTransform(t,e));!ie(this.first,"ID")&&"EOF"!==this.first;){if(!(this.first instanceof Xr))throw new Ur("Dictionary key must be a name object");var h=this.first.name;if(this.shift(),"EOF"===this.first.name)break;t instanceof jn?o.set(h,this.getObject(t)):o.set(h,this.getObject(t,e,i))}-1!==s.beginInlineImagePosition&&(r=a.position-s.beginInlineImagePosition);var c,_=o.get("F","Filter");if(_ instanceof Xr)c=_.name;else if(Array.isArray(_)){var d=_[0],l=null!==d&&void 0!==d&&d instanceof Qr?this.xref._fetch(d):d;l&&(c=l.name)}var f,p=a.position;switch(c){case"DCT":case"DCTDecode":f=this.findDiscreteDecodeInlineStreamEnd(a);break;case"A85":case"ASCII85Decode":f=this.findDecodeInlineStreamEnd(a);break;case"AHx":case"ASCIIHexDecode":f=this.findHexDecodeInlineStreamEnd(a);break;default:f=this.findDefaultInlineStreamEnd(a)}var u,g=a.makeSubStream(p,f,o);if(f<1e3&&r<5552){var y=g.getBytes();g.reset();var m=a.position;a.position=s.beginInlineImagePosition;var b=a.getBytes(r);a.position=m,u=this._computeMaxNumber(y)+"_"+this._computeMaxNumber(b);var v=this.imageCache.get(u);if(void 0!==v)return this.second=qr.get("EI"),this.shift(),v.reset(),v}return n&&(g=n.createStream(g,f)),g=this.filter(g,o,f),g.dictionary=o,void 0!==u&&this.imageCache.set(u,g),this.second=qr.get("EI"),this.shift(),g},t.prototype._computeMaxNumber=function(t){for(var e=t.length,i=1,r=0,n=0;n<e;++n)r+=i+=255&t[n];return r%65521<<16|i%65521},t.prototype.makeStream=function(t,e,i){void 0===i&&(i=!1);var r=this.lexicalOperator,n=r.stream;r.skipToNextLine();var s=n.position-1,a=t.get("Length");if(Number.isInteger(a)||(a=0),n.position=s+a,r.nextChar(),this.tryShift()&&ie(this.second,"endstream"))this.shift();else{var o=new Uint8Array([101,110,100,115,116,114,101,97,109]),h=this._findStreamLength(s,o);if(h<0){var c=o.length-1,_=o.slice(0,c),d=this._findStreamLength(s,_);if(d>=0&&A(n.peekBytes(c+1)[c])&&(h=d),h<0)throw new Ur("Missing endstream command.")}a=h,r.nextChar(),this.shift(),this.shift()}return this.shift(),n=n.makeSubStream(s,a,t),i||(e&&(n=e.createStream(n,a)),n=this.filter(n,t,a)),n.dictionary=t,n},t.prototype.filter=function(t,e,i){var r=this,n=e.get("F","Filter"),s=e.get("DP","DecodeParms");if(n instanceof Xr)return this.makeFilter(t,n.name,i,s);if(Array.isArray(n)){var a=n[0];if(a instanceof Xr)return this.makeFilter(t,a.name,i,s);if(a instanceof qr)return this.makeFilter(t,a.command,i,s)}var o=i;if(Array.isArray(n)){var h=s;n.forEach(function(e,i){if(!((n=e instanceof Qr?r.xref._fetch(e):e)instanceof Xr||n instanceof qr))throw new Ur("Bad filter name '"+n+"'");if(s=null,Array.isArray(h)&&null!==i&&void 0!==i&&i in h){var a=h[i];s=a instanceof Qr?r.xref._fetch(a):a}n instanceof Xr?t=r.makeFilter(t,n.name,o,s):n instanceof qr&&(t=r.makeFilter(t,n.command,o,s)),o=null})}return t},t.prototype.makeFilter=function(t,e,i,r){if(0===i)return new an;try{return"Fl"===e||"FlateDecode"===e?r?new Pn(new vn(t,i),i,r):new vn(t,i):t}catch(t){return new an}},t.prototype._findStreamLength=function(t,e){var i=this.lexicalOperator.stream;i.position=t;for(var r=e.length;i.position<i.end;){var n=i.peekBytes(2048),s=n.length-r;if(s<=0)break;for(var a=0;a<s;){for(var o=0;o<r&&n[a+o]===e[o];)o++;if(o>=r)return i.position+=a,i.position-t;a++}i.position+=s}return-1},t.prototype.findDefaultInlineStreamEnd=function(t){var e,i,r=t.position,n=0;for(e=t.getByte();-1!==e;){if(0===n)n=69===e?1:0;else if(1===n)n=73===e?2:0;else{if(2!==n)throw new Error("findDefaultInlineStreamEnd - invalid state.");if(32===e||10===e||13===e){i=t.position;for(var s=t.peekBytes(10),a=0,o=s.length;a<o;a++)if((0!==(e=s[a])||0===s[a+1])&&10!==e&&13!==e&&(e<32||e>127)){n=0;break}if(2!==n){e=t.getByte();continue}if(2===n)break}else n=0}e=t.getByte()}-1===e&&void 0!==i&&t.skip(-(t.position-i));var h=4;return t.skip(-h),e=t.peekByte(),t.skip(h),A(e)||h--,t.position-h-r},t.prototype._checkEnd=function(){return"EOF"===this.first},t}(),Wn=function(){function t(t){this.isValid=!1;var e=new Un(new zn(t),null),i=e.getObject(),r=e.getObject(),n=e.getObject(),s=e.getObject();if(this.isValid=Number.isInteger(i)&&Number.isInteger(r)&&ie(n,"obj")&&void 0!==s,this.isValid){var a=s.get("Linearized");this.isValid=void 0!==a&&a>0}if(this.isValid){var o=this.getInt(s,"L");if(o!==t.length)throw new Error("The L parameter in the linearization dictionary does not equal the stream length.");this.length=o,this.hints=this.getHints(s),this.objectNumberFirst=this.getInt(s,"O"),this.endFirst=this.getInt(s,"E"),this.pageCount=this.getInt(s,"N"),this.mainXRefEntriesOffset=this.getInt(s,"T"),this.pageFirst=s.has("P")?this.getInt(s,"P",!0):0}}return t.prototype.getInt=function(t,e,i){void 0===i&&(i=!1);var r=t.get(e);if(void 0!==r&&Number.isInteger(r)&&(i?r>=0:r>0))return r;throw new Error("The '"+e+"' parameter in the linearization dictionary is invalid.")},t.prototype.getHints=function(t){var e=t.getArray("H"),i=e.length;if(e&&(2===i||4===i)){for(var r=0;r<i;r++){var n=e[r];if(!(Number.isInteger(n)&&n>0))throw new Error("Hint ("+r+") in the linearization dictionary is invalid.")}return e}throw new Error("Hint array in the linearization dictionary is invalid.")},t}(),Hn=function(){function e(t,e){this._version="",this._newLine="\r\n",this._password=e,this._document=t,this._stream=t._stream,this._entries=[],this._crossReferencePosition=Object.create(null),this._cacheMap=new Map,this._offsetReference=new Map,this._pendingRefs=new Jr,this._offsets=[]}return e.prototype._setStartXRef=function(t){this._startXRefQueue=[t],this._prevStartXref=t,void 0!==this._prevXRefOffset&&null!==this._prevXRefOffset||(this._prevXRefOffset=t)},e.prototype._parse=function(e){var i;(i=e?this._indexObjects():this._readXRef()).assignXref(this);var r=i.get("Size");this._entries.length<r||this._entries.length===r?this._nextReferenceNumber=r:this._entries.length>r&&(this._nextReferenceNumber=this._entries.length>0?this._entries.length:1),this._trailer=i;var n=i.get("Encrypt");if(n){this._document._isEncrypted=!0,this._ids=i.get("ID"),this._permissionFlags=n.get("P");var s=this._ids&&this._ids.length?this._ids[0]:"";n.suppressEncryption=!0,this._encrypt=new xn(n,s,this._password),this._document._isUserPassword=this._encrypt._isUserPassword,this._document._encryptOnlyAttachment=this._encrypt._encryptOnlyAttachment,this._document.fileStructure.isIncrementalUpdate?this._document.fileStructure.crossReferenceType=t.PdfCrossReferenceType.stream:this._document.fileStructure.crossReferenceType=t.PdfCrossReferenceType.table,this._encrypt._encryptOnlyAttachment?(this._document._hasUserPasswordOnly=!0,this._document._encryptMetaData=!1):(this._document._hasUserPasswordOnly=this._encrypt._hasUserPasswordOnly,this._document._encryptMetaData=!n.has("EncryptMetadata")||n.get("EncryptMetadata"))}var a,o=!1;try{a=i.get("Root")}catch(t){throw new zr("Invalid cross reference","XRefParseException")}if(a)try{a.get("Pages")&&(this._root=a,o=!0)}catch(t){throw new zr("Invalid cross reference","InvalidXRef")}if(!o)throw e?new zr("Invalid cross reference","InvalidXRef"):new zr("Invalid cross reference","XRefParseException")},e.prototype._getEntry=function(t){var e=this._entries[t];return e&&!e.free&&e.offset?e:null},e.prototype._fetch=function(t,e){var i;if(!(t instanceof Qr))throw new Error("ref object is not a reference");var r=t.objectNumber,n=this._cacheMap.get(t);if(void 0!==n)return n instanceof $r&&!n.objId&&(n.objId=r),n;var s=this._getEntry(r);if(null===s)return this._cacheMap.set(t,s),s;if(this._pendingRefs.has(t))throw this._pendingRefs.remove(t),new Error("circular reference");this._pendingRefs.put(t);try{i=s.uncompressed?this._fetchUncompressed(t,s,e):this._fetchCompressed(t,s),this._pendingRefs.remove(t)}catch(e){throw this._pendingRefs.remove(t),e}return i},e.prototype._fetchUncompressed=function(t,e,i){var r=t.generationNumber,n=t.objectNumber;if(e.gen!==r)throw new zr("Inconsistent generation in XRef: "+t,"XRefEntryException");var s=this._stream.makeSubStream(e.offset+this._stream.start,void 0),a=new Un(new zn(s),this,!0,!1,this._encrypt),o=a.getObject(),h=a.getObject(),c=a.getObject();if(o!==n||h!==r||void 0===c)throw new zr("Bad (uncompressed) XRef entry: "+t,"XRefEntryException");var _;return(_=this._encrypt&&!i?a.getObject(t.objectNumber,t.generationNumber,!0):a.getObject(null,i))instanceof rn||this._cacheMap.set(t,_),_ instanceof $r?_.objId=t.toString():_ instanceof rn&&(_.dictionary.objId=t.toString()),_},e.prototype._fetchCompressed=function(t,e){var i=e.offset,r=this._fetch(Qr.get(i,0));if(void 0===r)throw new Ur("bad ObjStm stream");var n=r.dictionary.get("First"),s=r.dictionary.get("N"),a=t.generationNumber;if(!Number.isInteger(n)||!Number.isInteger(s))throw new Ur("invalid first and n parameters for ObjStm stream");for(var o=new Un(new zn(r),this,!0),h=new Array(s),c=new Array(s),_=0;_<s;++_){g=o.getObject();if(!Number.isInteger(g))throw new Ur("invalid object number in the ObjStm stream: "+g);var d=o.getObject();if(!Number.isInteger(d))throw new Ur("invalid object offset in the ObjStm stream: "+d);h[_]=g,c[_]=d}for(var l=(r.start||0)+n,f=new Array(s),_=0;_<s;++_){var p=_<s-1?c[_+1]-c[_]:void 0;if(p<0)throw new Ur("Invalid offset in the ObjStm stream.");var u=(o=new Un(new zn(r.makeSubStream(l+c[_],p,r.dictionary)),this,!0)).getObject();if(f[_]=u,!(u instanceof rn)){var g=h[_],y=this._entries[g];if(y&&y.offset===i&&y.gen===_){var m=g+" "+a;this._cacheMap.set(Qr.get(g,a),u),u instanceof $r&&(u.objId=m)}}}var b=f[e.gen];if(void 0===b)throw new zr("Bad (compressed) XRef entry: "+t,"XRefEntryException");return b},e.prototype._readXRef=function(e){void 0===e&&(e=!1);var i=this._stream,r=new Set;try{for(;this._startXRefQueue.length;){var n=this._startXRefQueue[0];if(this._prevStartXref<n&&(this._prevStartXref=n),r.has(n))this._startXRefQueue.shift();else{r.add(n),i.position=n+i.start;var s=new Un(new zn(i),this,!0),a=s.getObject(),o=void 0;if(ie(a,"xref")){if(void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.table),o=this._processXRefTable(s),this._topDictionary||(this._topDictionary=o),a=o.get("XRefStm"),Number.isInteger(a)){var h=a;h in this._crossReferencePosition||(this._crossReferencePosition[h]=1,this._startXRefQueue.push(h))}}else{if(!Number.isInteger(a))throw new Ur("Invalid XRef stream header");void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.stream);var c=s.getObject(),_=s.getObject();if(a=s.getObject(),!(void 0!==c&&Number.isInteger(c)&&ie(_,"obj")&&a instanceof rn))throw new Ur("Invalid cross reference stream");if(o=this._processXRefStream(a),this._topDictionary||(this._topDictionary=o),!o)throw new Ur("Failed to read XRef stream")}a=o.get("Prev"),Number.isInteger(a)?this._startXRefQueue.push(a):a instanceof Qr&&this._startXRefQueue.push(a.objectNumber),this._startXRefQueue.shift()}}return this._topDictionary}catch(t){this._startXRefQueue.shift()}if(!e)throw new zr("Invalid cross reference","XRefParseException")},e.prototype._readToken=function(t,e){for(var i="",r=t[e];10!==r&&13!==r&&60!==r&&!(++e>=t.length);)i+=String.fromCharCode(r),r=t[e];return i},e.prototype._skipUntil=function(t,e,i){for(var r=i.length,n=t.length,s=0;e<n;){for(var a=0;a<r&&t[e+a]===i[a];)++a;if(a>=r)break;e++,s++}return s},e.prototype._indexObjects=function(){var t=/^(\d+)\s+(\d+)\s+obj\b/,e=/\bendobj[\b\s]$/,i=/\s+(\d+\s+\d+\s+obj[\b\s<])$/,r=new Uint8Array([116,114,97,105,108,101,114]),n=new Uint8Array([115,116,97,114,116,120,114,101,102]),s=new Uint8Array([111,98,106]),a=new Uint8Array([47,88,82,101,102]);this._entries.length=0,this._cacheMap.clear();var o=this._stream;o.position=0;for(var h=o.getBytes(),c=h.length,_=o.start,d=[],l=[];_<c;){var f=h[_];if(9!==f&&10!==f&&13!==f&&32!==f)if(37!==f){var p=this._readToken(h,_),u=void 0;if(p.startsWith("xref")&&(4===p.length||/\s/.test(p[4])))_+=this._skipUntil(h,_,r),d.push(_),_+=this._skipUntil(h,_,n);else if(u=t.exec(p)){var g=0|u[1],y=0|u[2],b=void 0,v=_+p.length,w=!1;if(this._entries[g]){if(this._entries[g].gen===y)try{var S=o.makeSubStream(v,o.length-v),P=new zn(S);(B=new Un(P,null)).getObject(),w=!0}catch(t){w=!(t instanceof Wr)}}else w=!0;if(w){var A=new Gn;A.offset=_-o.start,A.gen=y,A.uncompressed=!0,this._entries[g]=A}for(;v<h.length;){var x=v+this._skipUntil(h,v,s)+4;b=x-_;var k=Math.max(x-25,v),C=m(h.subarray(k,x));if(e.test(C))break;var T=i.exec(C);if(T&&T[1]){b-=T[1].length;break}v=x}var R=h.subarray(_,_+b),F=this._skipUntil(R,0,a);F<b&&R[F+5]<64&&(l.push(_-o.start),this._crossReferencePosition[_-o.start]=1),_+=b}else p.startsWith("trailer")&&(7===p.length||/\s/.test(p[7]))?(d.push(_),_+=this._skipUntil(h,_,n)):_+=p.length+1}else do{if(++_>=c)break;f=h[_]}while(10!==f&&13!==f);else++_}for(D=0;D<l.length;++D)this._startXRefQueue.push(l[D]),this._readXRef(!0);for(var L,D=0;D<d.length;++D){o.position=d[D];var B=new Un(new zn(o),this,!0,!0);if(ie(B.getObject(),"trailer")){var O=B.getObject();if(O instanceof $r){try{var I=O.get("Root");if(!(I instanceof $r))continue;var M=I.get("Pages");if(!(M instanceof $r))continue;var N=M.get("Count");if(void 0===N||!Number.isInteger(N))continue}catch(t){continue}if(O.has("ID"))return O;L=O}}}if(L)return L;if(this._topDictionary)return this._topDictionary;throw new zr("Invalid PDF structure.","InvalidPDFException")},e.prototype._processXRefTable=function(t){if(void 0===this._tableState){var e=new Kn;e.entryNum=0,e.streamPos=t.lexicalOperator.stream.position,e.parserBuf1=t.first,e.parserBuf2=t.second,this._tableState=e}if(!ie(this._readXRefTable(t),"trailer"))throw new Ur("Invalid XRef table: could not find trailer dictionary");var i,r=t.getObject();if(r&&(r instanceof $r?i=r:r instanceof rn&&r.dictionary&&(i=r.dictionary)),!i)throw new Ur("Invalid cross reference: could not parse trailer dictionary");return this._tableState=void 0,i},e.prototype._readXRefTable=function(t){var e=t.lexicalOperator.stream;e.position=this._tableState.streamPos,t.first=this._tableState.parserBuf1,t.second=this._tableState.parserBuf2;for(var i;;){if(void 0===this._tableState.firstEntryNum||void 0===this._tableState.entryCount){if(i=t.getObject(),ie(i,"trailer"))break;this._tableState.firstEntryNum=i,this._tableState.entryCount=t.getObject()}var r=this._tableState.firstEntryNum,n=this._tableState.entryCount;if(!Number.isInteger(r)||!Number.isInteger(n))throw new Ur("Invalid cross reference: wrong types in subsection header");for(var s=this._tableState.entryNum;s<n;s++){this._tableState.streamPos=e.position,this._tableState.entryNum=s,this._tableState.parserBuf1=t.first,this._tableState.parserBuf2=t.second;var a=new Gn;a.offset=t.getObject(),a.gen=t.getObject();var o=t.getObject();if(o)switch(o.command){case"f":a.free=!0;break;case"n":a.uncompressed=!0}if(!Number.isInteger(a.offset)||!Number.isInteger(a.gen)||!a.free&&!a.uncompressed)throw new Ur("Invalid entry in cross reference subsection: "+r+", "+n);0===s&&a.free&&1===r&&(r=0),this._entries[s+r]||(this._entries[s+r]=a)}this._tableState.entryNum=0,this._tableState.streamPos=e.position,this._tableState.parserBuf1=t.first,this._tableState.parserBuf2=t.second,this._tableState.firstEntryNum=void 0,this._tableState.entryCount=void 0}if(this._entries[0]&&!this._entries[0].free)throw new Ur("Invalid XRef table: unexpected first object");return i},e.prototype._processXRefStream=function(t){if(void 0===this._streamState){var e=t.dictionary,i=new Xn,r=e.getArray("Index");r||(r=[0,e.get("Size")]),i.entryRanges=r,i.byteWidths=e.getArray("W"),i.entryNum=0,i.streamPos=t.position,this._streamState=i}return this._readXRefStream(t),this._streamState=void 0,t.dictionary},e.prototype._readXRefStream=function(t){t.position=this._streamState.streamPos;for(var e=this._streamState.byteWidths[0],i=this._streamState.byteWidths[1],r=this._streamState.byteWidths[2],n=this._streamState.entryRanges;n.length>0;){var s=n[0],a=n[1];if(!Number.isInteger(s)||!Number.isInteger(a))throw new Ur("Invalid XRef range fields: "+s+", "+a);if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r))throw new Ur("Invalid XRef entry fields length: "+s+", "+a);for(var o=this._streamState.entryNum;o<a;++o){this._streamState.entryNum=o,this._streamState.streamPos=t.position;for(var h=0,c=0,_=0,d=0;d<e;++d){var l=t.getByte();if(-1===l)throw new Ur("invalid cross reference byte width type.");h=h<<8|l}0===e&&(h=1);for(d=0;d<i;++d){var f=t.getByte();if(-1===f)throw new Ur("invalid cross reference byte width offset.");c=c<<8|f}for(d=0;d<r;++d){var p=t.getByte();if(-1===p)throw new Ur("invalid cross reference byte width generation.");_=_<<8|p}var u=new Gn;switch(u.offset=c,u.gen=_,h){case 0:u.free=!0;break;case 1:u.uncompressed=!0;break;case 2:break;default:throw new Ur("Invalid XRef entry type: "+h)}this._entries[s+o]||(this._entries[s+o]=u)}this._streamState.entryNum=0,this._streamState.streamPos=t.position,n.splice(0,2)}},e.prototype._getCatalogObj=function(){return this._root},e.prototype._save=function(){var e=[37,80,68,70,45];if(this._writeString(""+this._version+this._newLine,e),e.push(37,131,146,250,254),this._writeString(this._newLine,e),this._document.fileStructure.isIncrementalUpdate){this._currentLength=this._stream.length;var i=[37,80,68,70,45];this._writeString(""+this._version+this._newLine,i),i.push(37,131,146,250,254),this._writeString(this._newLine,i),this._document._fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream?this._saveAsStream(this._currentLength,i):this._saveAsTable(this._currentLength,i);var r=new Uint8Array(this._stream.length+i.length);return r.set(this._stream.bytes),r.set(i,this._stream.length),r}this._currentLength=0;var n=new Qn(this);this._writeObjectCollection(n._mainObjectCollection,e);var s=new nn(e);return this._stream=s,this._document._stream=s,(r=new Uint8Array(this._stream.length)).set(this._stream.bytes),r.set(e,0),r},e.prototype._saveAsStream=function(t,e){var i=this,r=new Map;this._indexes=[],this._indexes.push(0,1),this._offsets=[],this._cacheMap.forEach(function(r,n){if(r instanceof rn){var s=r.dictionary;if(s&&s._updated&&(!s.isCatalog||i._allowCatalog)&&!s._isProcessed){var a=void 0;i._encrypt&&(a=i._encrypt._createCipherTransform(n.objectNumber,n.generationNumber)),i._updatedDictionary(t,n,e,r,a),s._isProcessed=!0}}}),this._cacheMap.forEach(function(n,s){if(n instanceof $r)!n._updated||n.isCatalog||n._isProcessed?n._updated&&(n.isCatalog||i._allowCatalog)&&i._updatedDictionary(t,s,e,n):i._writeArchiveStream(r,s,n);else if(n instanceof rn){var a=n.dictionary;!a||!a._updated||a.isCatalog&&!i._allowCatalog||a._isProcessed||i._updatedDictionary(t,s,e,n)}}),this._objectStream=void 0,this._objectStreamCollection=r,this._writeXrefStream(e)},e.prototype._updatedDictionary=function(t,e,i,r,n){this._indexes.push(e.objectNumber,1),this._offsets.push(t+i.length),this._writeObject(r,i,e,n),r._updated=!1},e.prototype._writeXrefStream=function(t){var e=this;this._objectStreamCollection.forEach(function(i,r){var n;i._save(t,e._currentLength),Array.isArray(i._collection)&&(n=e._indexes).push.apply(n,i._collection),e._indexes.push(r.objectNumber,1)});var i=Math.max(Mt(this._currentLength+t.length),Mt(this._nextReferenceNumber)),r=this._getNextReference();this._indexes.push(r.objectNumber,1);var n=this._currentLength+t.length,s=new $r(this);s.set("Type",Xr.get("XRef")),s.set("Index",this._indexes),s.set("W",[1,i,1]),this._copyTrailer(s),this._ids&&this._ids.length>0&&s.update("ID",[this._ids[0],this._computeMessageDigest(n)]);var a=[];if(this._writeLong(0,1,a),this._writeLong(0,i,a),this._writeLong(-1,1,a),this._offsets.length>0)for(var o=0;o<this._offsets.length;o++)this._writeLong(1,1,a),this._writeLong(this._offsets[o],i,a),this._writeLong(0,1,a);this._objectStreamCollection.size>0&&this._objectStreamCollection.forEach(function(t,r){for(var n=0;n<t._length;n++)e._writeLong(2,1,a),e._writeLong(r.objectNumber,i,a),e._writeLong(n,1,a);e._writeLong(1,1,a),e._writeLong(t._archiveOffset,i,a),e._writeLong(0,1,a)}),this._writeLong(1,1,a),this._writeLong(n,i,a),this._writeLong(0,1,a),s.set("Length",a.length);var h,c=new nn(a,s,0,a.length);this._encrypt&&(h=this._encrypt._createCipherTransform(r.objectNumber,r.generationNumber)),this._writeObject(c,t,r,h,!0),this._writeString("startxref"+this._newLine+n+this._newLine+"%%EOF"+this._newLine,t)},e.prototype._saveAsTable=function(t,e){var i=this,r="";this._cacheMap.forEach(function(n,s){var a;if(n instanceof $r?a=n:n instanceof rn&&(a=n.dictionary),a&&a._updated&&(!a.isCatalog||i._allowCatalog)){var o=i._processString((t+e.length).toString(),10),h=i._processString(s.generationNumber.toString(),5);r+=s.objectNumber+" 1"+i._newLine+o+" "+h+" n"+i._newLine,i._writeObject(n,e,s)}});var n=e.length+t;this._writeString("xref"+this._newLine+"0 1"+this._newLine+"0000000000 65535 f"+this._newLine,e),this._writeXref(e,r,n)},e.prototype._writeXref=function(t,e,i){this._writeString(e,t),this._writeString("trailer"+this._newLine,t);var r=new $r(this);this._copyTrailer(r),this._writeDictionary(r,t,this._newLine),this._writeString("startxref"+this._newLine+i+this._newLine+"%%EOF"+this._newLine,t)},e.prototype._writeXrefTable=function(t){var e=this,i="",r=this._getSortedReferences(this._offsetReference);r.forEach(function(t,r){var n=e._processString(t.toString(),10),s=e._processString(r.generationNumber?"0":"",5);i+=0!==t?n+" "+s+" n"+e._newLine:n+" "+s+" f"+e._newLine});var n=t.length,s="xref"+this._newLine,a="0 "+(r.size+1)+this._newLine,o="0000000000 65535 f"+this._newLine;this._writeString(s+a+o,t),this._writeXref(t,i,n)},e.prototype._processString=function(t,e){for(;t.length<e;)t="0"+t;return t},e.prototype._copyTrailer=function(t){var e=this._getNextReference();t.set("Size",e.objectNumber),this._document.fileStructure.isIncrementalUpdate&&t.set("Prev",this._prevXRefOffset);var i=this._trailer.getRaw("Root");void 0!==i&&null!==i&&t.set("Root",i);var r=this._trailer.getRaw("Info");void 0!==r&&null!==r&&t.set("Info",r);var n=this._trailer.getRaw("Encrypt");void 0!==n&&null!==n&&t.set("Encrypt",n)},e.prototype._computeMessageDigest=function(t){var e=this,i=[Math.floor(Date.now()/1e3).toString(),"",t.toString()],r=this._trailer.getRaw("Info"),n=new $r;r&&r instanceof $r&&r.forEach(function(t,e){e&&"string"==typeof e&&n.set(t,f(e))}),n.forEach(function(t,e){i.push(e)});var s=[];return i.forEach(function(t){e._writeString(t,s)}),m((new kn).hash(new Uint8Array(s)))},e.prototype._getNextReference=function(){var t=new Qr(this._nextReferenceNumber++,0);return t._isNew=!0,t},e.prototype._writeObject=function(t,e,i,r,n){var s=this;i&&i instanceof Qr&&this._writeString(i.objectNumber+" "+i.generationNumber+" obj"+this._newLine,e),t instanceof $r?this._writeDictionary(t,e,this._newLine,r,n):t instanceof rn?this._writeStream(t,e,r,n):Array.isArray(t)&&t.length>0?(this._writeString("[ ",e),t.forEach(function(i,a){if(i instanceof Qr)s._writeString(i.objectNumber+" "+i.generationNumber+" R",e);else if(Array.isArray(i))s._writeString("[ ",e),i.forEach(function(t){t instanceof Qr?s._writeString(t.objectNumber+" "+t.generationNumber+" R",e):t instanceof Xr?s._writeString("/"+q(t.name),e):s._writeString(t+" ",e)}),s._writeString("]",e);else if(i instanceof Xr)s._writeString("/"+q(i.name),e);else if(i instanceof $r)s._writeDictionary(i,e,s._newLine,r,n);else if("string"==typeof i)if(qt(i)){var o=w(p(i));s._writeString("<",e),s._writeString(""+o,e),s._writeString(">",e)}else s._writeString(i+"\n",e);else s._writeString(i+"\n",e);a<t.length-1&&s._writeString(" ",e)}),this._writeString("]",e),this._writeString("\n",e)):"number"==typeof t&&this._writeString(t+"\n",e),i&&i instanceof Qr&&this._writeString("endobj"+this._newLine,e)},e.prototype._writeDictionary=function(t,e,i,r,n){var s=this;t._currentObj&&t._currentObj._beginSave(),t._isFont&&this._writeFontDictionary(t),this._writeString("<<"+i,e),t.forEach(function(t,a){s._writeString("/"+q(t)+" ",e),s._writeValue(a,e,r,n),s._writeString(i,e)}),this._writeString(">>"+this._newLine,e)},e.prototype._writeFontDictionary=function(t){if(t.has("DescendantFonts")){e=t.get("DescendantFonts");if(!Array.isArray(e)){i=this._getNextReference();this._cacheMap.set(i,e),t.update("DescendantFonts",[i])}}if(t.has("ToUnicode")&&!((e=t.get("ToUnicode"))instanceof Qr)){i=this._getNextReference();this._cacheMap.set(i,e),t.update("ToUnicode",i)}if(t.has("FontFile2")){var e=t.get("FontFile2"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("FontFile2",i)}if(t.has("FontDescriptor")){var e=t.get("FontDescriptor"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("FontDescriptor",i)}},e.prototype._writeStream=function(t,e,i,r){var n,s=[];r?n=t.getString():(n=t._isCompress&&!t._isImage?Ht(t):t.getString(),i&&(n=i.encryptString(n))),this._writeString(n,s),t.dictionary.update("Length",s.length),this._writeDictionary(t.dictionary,e,this._newLine,i,r),this._writeString("stream"+this._newLine,e),this._writeBytes(s,e),this._writeString(this._newLine+"endstream"+this._newLine,e)},e.prototype._writeValue=function(t,e,i,r){if(t instanceof Xr)-1!==t.name.indexOf(" ")&&(t.name=t.name.replace(/ /g,"#20")),this._writeString("/"+t.name,e);else if(t instanceof Qr)this._writeString(t.toString()+" R",e);else if(Array.isArray(t)){this._writeString("[",e);for(var n=!0,s=0,a=t;s<a.length;s++){var o=a[s];n?n=!1:this._writeString(" ",e),this._writeValue(o,e,i,r)}this._writeString("]",e)}else if("string"==typeof t){!r&&i&&(t=i.encryptString(t));for(var h=!1,c=0;c<t.length;c++)if(t.charCodeAt([c])>255){h=!0;break}h?this._writeUnicodeString(t,e):this._writeString("("+this._escapeString(t)+")",e)}else"number"==typeof t?this._writeString(g(t),e):"boolean"==typeof t?this._writeString(t.toString(),e):t instanceof $r?this._writeDictionary(t,e,this._newLine,i,r):t instanceof rn?this._writeStream(t,e,i,r):null===t&&this._writeString("null",e)},e.prototype._writeUnicodeString=function(t,e){var i=Nt(t);i.unshift(254,255);var r=[];i.forEach(function(t){switch(t){case 40:case 41:r.push(92),r.push(t);break;case 13:r.push(92),r.push(114);break;case 92:r.push(92),r.push(t);break;default:r.push(t)}}),e.push(255&"(".charCodeAt(0)),r.forEach(function(t){e.push(255&t)}),e.push(255&")".charCodeAt(0))},e.prototype._writeString=function(t,e){for(var i=0;i<t.length;i++)e.push(255&t.charCodeAt(i))},e.prototype._writeBytes=function(t,e){for(var i=0;i<t.length;i++)e.push(t[i])},e.prototype._writeLong=function(t,e,i){for(var r=e-1;r>=0;--r)i.push(t>>(r<<3)&255)},e.prototype._escapeString=function(t){return t.replace(/([()\\\n\r])/g,function(t){return"\n"===t?"\\n":"\r"===t?"\\r":"\\"+t})},e.prototype._destroy=function(){this._entries=void 0,this._pendingRefs&&(this._pendingRefs.clear(),this._pendingRefs=void 0),this._cacheMap&&this._cacheMap.clear(),this._offsetReference&&this._offsetReference.clear(),this._objectStreamCollection&&this._objectStreamCollection.clear(),this._offsets=[],this._startXRefQueue=[],this._root=void 0,this._startXRefQueue=void 0,this._stream=void 0,this._streamState=void 0,this._tableState=void 0,this._topDictionary=void 0,this._trailer=void 0,this._version=void 0,this._crossReferencePosition=void 0},e.prototype._writeObjectCollection=function(e,i){var r=this,n=new Map;this._indexes=[],this._indexes.push(0,1),e.forEach(function(t,e){r._writeObjectToBuffer(e,t,i,n)}),this._cacheMap.size>e.size&&this._cacheMap.forEach(function(t,s){e.has(s)||r._writeObjectToBuffer(s,t,i,n)}),this._document.fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream?(this._objectStream=void 0,this._objectStreamCollection=n,this._writeXrefStream(i)):this._writeXrefTable(i)},e.prototype._writeArchiveStream=function(t,e,i){if(void 0===this._objectStream||100===this._objectStream._length){var r=new qn(this);t.set(r._reference,r),this._objectStream=r}this._objectStream._writeObject(e,i)},e.prototype._writeObjectToBuffer=function(e,i,r,n){var s;if(i instanceof $r&&i.isCatalog)this._writeToBuffer(r,e,i);else if(i instanceof $r){var a=i.get("Filter"),o=a&&"Standard"===a.name;this._document.fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream?o?this._writeToBuffer(r,e,i):this._writeArchiveStream(n,e,i):(this._offsetReference.set(e,r.length),this._indexes.push(e.objectNumber,1),this._writeObject(i,r,e))}else{if(i instanceof rn){var h=i.dictionary;h&&h._updated&&!h.isCatalog&&(this._encrypt&&(s=this._encrypt._createCipherTransform(e.objectNumber,e.generationNumber)),h._updated=!1)}else if((!Array.isArray(i)||0===i.length)&&"number"!=typeof i)return;this._writeToBuffer(r,e,i,s)}},e.prototype._writeToBuffer=function(t,e,i,r){this._offsets.push(t.length),this._offsetReference.set(e,t.length),this._indexes.push(e.objectNumber,1),this._writeObject(i,t,e,r)},e.prototype._getSortedReferences=function(t){var e=[];t.forEach(function(t,i){e.push([i,t])}),e.sort(function(t,e){return t[0].objectNumber-e[0].objectNumber});for(var i=new Map,r=1,n=0,s=e;n<s.length;n++){for(var a=s[n],o=a[0],h=a[1],c=o.objectNumber;r<c;)i.set({objectNumber:r},0),r++;i.set(o,h),r=c+1}return i},e}(),Gn=function(){function t(){}return t}(),Kn=function(){function t(){}return t}(),Xn=function(){function t(){}return t}(),qn=function(){function t(t){this._indexes="",this._length=0,this._crossReference=t,this._reference=t._getNextReference(),this._archiveXRef="",this._updatedStream=[],this._collection=[]}return t.prototype._writeObject=function(t,e){this._archiveXRef+=t.objectNumber+" "+this._updatedStream.length+this._crossReference._newLine,this._collection.push(t.objectNumber,1),this._crossReference._writeObject(e,this._updatedStream),this._length++},t.prototype._save=function(t,e){var i=[];this._crossReference._writeString(this._archiveXRef,i),this._crossReference._writeBytes(this._updatedStream,i);var r=new $r(this._crossReference);r.set("Type",Xr.get("ObjStm")),r.set("N",this._length),r.set("First",this._archiveXRef.length),r.set("Length",i.length);var n=new nn(i,r,0,i.length);this._archiveOffset=e+t.length;var s;this._crossReference._encrypt&&(s=this._crossReference._encrypt._createCipherTransform(this._reference.objectNumber,this._reference.generationNumber)),this._crossReference._writeObject(n,t,this._reference,s)},t}(),Qn=function(){function t(t){var e=this;if(this._pointer=0,!(t._cacheMap instanceof Map))throw new Error("Expected _cacheMap to be a Map.");this._reference=[],this._cache=t._cacheMap,this._mainObjectCollection=new Map;var i=!1;this._crossReference=t,this._cache.forEach(function(t,r){!i&&t instanceof $r&&t.isCatalog&&(e._addToMainObjectCollection(r,t),i=!0)}),this._parseObjectCollection()}return t.prototype._parseObjectCollection=function(){for(var t=this,e=this;this._pointer<this._mainObjectCollection.size;)!function(){var i=new Map,r=0;e._mainObjectCollection.forEach(function(e,n){r===t._pointer&&(i.set(n,e),t._parse(n,e)),r++}),e._pointer++}();return this._addReferencesToMainCollection(),this._mainObjectCollection},t.prototype._addToMainObjectCollection=function(t,e){this._reference.push(t),this._mainObjectCollection.set(t,e)},t.prototype._parseFetchValue=function(t){var e=this._crossReference._fetch(t);this._parse(t,e)},t.prototype._parse=function(t,e){var i=this;e instanceof $r?this._parseDictionary(e):e instanceof rn?this._parseStream(t,e):e instanceof Qr?this._parseFetchValue(e):Array.isArray(e)&&e.length>0?e.every(function(t){return t instanceof Qr})?e.forEach(function(t){return i._parseFetchValue(t)}):(e.forEach(function(t){t instanceof Qr&&i._parseFetchValue(t)}),-1!==this._reference.indexOf(t)||this._mainObjectCollection.has(t)||this._addToMainObjectCollection(t,e)):"number"==typeof e&&(-1!==this._reference.indexOf(t)||this._mainObjectCollection.has(t)||this._addToMainObjectCollection(t,e))},t.prototype._addReferencesToMainCollection=function(){var t=this,e=[];this._cache.forEach(function(i,r){t._mainObjectCollection.has(r)||e.push({key:r,value:i})}),e.forEach(function(e){var i=e.key,r=e.value;t._addToMainObjectCollection(i,r)})},t.prototype._parseDictionary=function(t){var e=this;t.forEach(function(t,i){var r=function(t){if(!e._mainObjectCollection.has(t)&&-1===e._reference.indexOf(t)){var i=e._crossReference._fetch(t);i instanceof Qr&&(i=e._crossReference._fetch(i)),i instanceof rn?e._parseStream(t,i):e._addToMainObjectCollection(t,i)}};i instanceof Qr?r(i):Array.isArray(i)?i.forEach(function(t){t instanceof Qr?r(t):t instanceof $r&&e._parseDictionary(t)}):i instanceof $r&&e._parseDictionary(i)})},t.prototype._parseStream=function(t,e){if(this._parseDictionary(e.dictionary),-1===this._reference.indexOf(t)&&!this._mainObjectCollection.has(t)){var i=e.dictionary.get("Type"),r=e.dictionary.get("Subtype"),n=void 0;e.dictionary._updated||i&&("XObject"===i.name||"Metadata"===i.name)&&("Form"===r.name||"XML"===r.name)?n=this._crossReference._fetch(t):(n=this._crossReference._fetch(t,!0))._isCompress=!1,this._addToMainObjectCollection(t,n)}},t}(),Jn=function(){function e(e,i){this._isDefaultAppearance=!1,this._hasKids=!1,this._setAppearance=!1,this._exportEmptyFields=!1,this._fieldCollection=[],this._signFlag=t._SignatureFlag.none,this._isNeedAppearances=!1,this._formNames=[],this._dictionary=e,this._crossReference=i,this._parsedFields=new Map,this._fields=[],this._createFields()}return Object.defineProperty(e.prototype,"count",{get:function(){return this._fields.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needAppearances",{get:function(){return this._dictionary.has("NeedAppearances")&&(this._needAppearances=this._dictionary.get("NeedAppearances")),this._needAppearances},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportEmptyFields",{get:function(){return this._exportEmptyFields},set:function(t){this._exportEmptyFields=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_signatureFlag",{get:function(){return this._signFlag},set:function(t){t!==this._signFlag&&(this._signFlag=t,this._dictionary.update("SigFlags",t))},enumerable:!0,configurable:!0}),e.prototype.fieldAt=function(t){if(t<0||t>=this._fields.length)throw Error("Index out of range.");var e;if(this._parsedFields.has(t))e=this._parsedFields.get(t),this._isNeedAppearances=!0;else{var i=void 0,r=this._fields[t];r&&r instanceof Qr&&(i=this._crossReference._fetch(r)),i&&(e=this._parseFields(i,r),this._parsedFields.set(t,e),e&&e instanceof fi&&(e._annotationIndex=t))}return e},e.prototype._parseFields=function(e,i){var r;if(e){var n=R(e,"FT",!1,!0),s=0,a=R(e,"Ff",!1,!0);if(void 0!==a&&(s=a),n)switch(n.name.toLowerCase()){case"tx":r=pi._load(this,e,this._crossReference,i);break;case"btn":r=0!=(s&t._FieldFlag.pushButton)?ui._load(this,e,this._crossReference,i):0!=(s&t._FieldFlag.radio)?yi._load(this,e,this._crossReference,i):gi._load(this,e,this._crossReference,i);break;case"ch":r=0!=(s&t._FieldFlag.combo)?bi._load(this,e,this._crossReference,i):vi._load(this,e,this._crossReference,i);break;case"sig":r=wi._load(this,e,this._crossReference,i)}}return r},e.prototype.add=function(e){return this._fields.push(e._ref),this._dictionary.update("Fields",this._fields),this._parsedFields.set(this._fields.length-1,e),e._form=this,this._crossReference._root._updated=!0,e instanceof wi&&(e._form._signatureFlag=t._SignatureFlag.signatureExists|t._SignatureFlag.appendOnly),this._isNeedAppearances=!0,this._fields.length-1},e.prototype.removeField=function(t){var e=this._fields.indexOf(t._ref);e>=0&&this.removeFieldAt(e)},e.prototype.removeFieldAt=function(t){var e=this.fieldAt(t);if(e){if(e._kidsCount>0)for(var i=e._kidsCount-1;i>=0;i--){var r=e.itemAt(i),n=void 0;r&&(n=r._getPage())&&n._removeAnnotation(r._ref)}else e._dictionary.has("Subtype")&&"Widget"===e._dictionary.get("Subtype").name&&(n=e.page)&&n._removeAnnotation(e._ref);this._parsedFields.delete(t),this._reorderParsedAnnotations(t)}this._fields.splice(t,1);var s=this._crossReference._document,a=s._catalog;0===this._fields.length&&s&&a&&a._catalogDictionary&&(a._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0),this._dictionary.set("Fields",this._fields),this._dictionary._updated=!0},e.prototype._reorderParsedAnnotations=function(t){var e=new Map;this._parsedFields.forEach(function(i,r){r>t?e.set(r-1,i):e.set(r,i)}),this._parsedFields=e},e.prototype.setDefaultAppearance=function(t){this._setAppearance=!t,this._needAppearances=t,this._isDefaultAppearance=t},e.prototype.orderFormFields=function(e){var i=this;if(null===e||void 0===e)this.orderFormFields(new Map);else{var r,n,s=this._crossReference._document;if(e&&e instanceof Map){var a=!0;e.size>0?this._tabCollection=e:(a=!1,this._tabCollection=e);var o=new Map;if(this._fieldCollection=this._getFields(),Ut(this._fieldCollection)&&this._fieldCollection.length>0&&this._fieldCollection[0].page&&s){this._fieldCollection.forEach(function(t){if(t.page){var e=_(s,i._sortItemByPageIndex(t,!0)._pageDictionary);if(e>=0){o.has(e)?(n=o.get(e)).push(t):((n=[]).push(t),o.set(e,n));var r=s.getPage(e);i._tabCollection.has(e)||i._tabCollection.set(e,r.tabOrder),a&&(r.tabOrder=i._tabCollection.get(e))}}});var h=0;o.forEach(function(e,r){if(i._tabOrder=i._tabCollection.get(r),i._tabOrder!==t.PdfFormFieldsTabOrder.structure){var n=e;n.sort(function(t,e){return i._compareFields(t,e)}),n.forEach(function(t,e){var r=i._fieldCollection.indexOf(t);if(-1!==r&&r!==h+e){var n=i._fieldCollection[r];i._fieldCollection.splice(r,1),i._fieldCollection.splice(h+e,0,n)}})}h+=e.length})}}else this._tabOrder=e,r=this._getOrder(this._tabOrder),this._fieldCollection=this._getFields(),this._fieldCollection.sort(function(t,e){return i._compareFields(t,e)});this._parsedFields.clear(),this._fieldCollection.forEach(function(t,e){i._parsedFields.set(e,t),i._fields[e]=t._ref,r&&t.page._pageDictionary.update("Tabs",r)}),this._dictionary.update("Fields",this._fields)}},e.prototype._createFields=function(){var t,e=this,i=new Map;this._dictionary&&this._dictionary.has("Fields")&&(t=this._dictionary.get("Fields"));for(var r=0,n=[],s=[];t&&t.length>0;){for(var a=this;r<t.length;r++)!function(){var o=t[r],h=void 0;o&&o instanceof Qr&&(h=a._crossReference._fetch(o))&&i.set(h,o);var c=void 0;if(h&&h.has("Kids")&&(c=h.get("Kids"))&&c.length>0&&c.forEach(function(t){if(t instanceof Qr){var r=e._crossReference._fetch(t);r&&(i.set(r,t),r.has("Parent")||r.update("Parent",o))}}),c){if(!h.has("FT")||a._isNode(c))n.push({fields:t,count:r}),a._hasKids=!0,r=-1,t=c;else if(s.push(h),h.has("T")){_=h.get("T");-1===a._formNames.indexOf(_)&&a._formNames.push(_)}}else if(h&&-1===s.indexOf(h)&&(s.push(h),h.has("T"))){var _=h.get("T");-1===a._formNames.indexOf(_)&&a._formNames.push(_)}}();if(0===n.length)break;var o=n.pop();t=o.fields,r=o.count+1}this._createFieldCollection(s,i)},e.prototype._createFieldCollection=function(t,e){var i=new Map,r=this._crossReference._document,n=[];if(r)for(l=0;l<r.pageCount;l++){var s=r.getPage(l);if(s&&s._pageDictionary){var a=s._pageDictionary,o=[];a&&a.has("Annots")&&(o=a.getRaw("Annots"))instanceof Qr&&(o=this._crossReference._fetch(o));for(var h=[],c=0;c<o.length;c++){var _=o[c];if(_&&_ instanceof Qr){n.push(_);var d=this._crossReference._fetch(_);d&&d.has("Subtype")&&"Widget"===d.get("Subtype").name&&h.push(d)}}i.set(l,h)}}for(var l=0;l<t.length;l++){var f=t[l],p=e.get(f);p&&this._removeInvalidFields(f,i,p,n)&&-1===this._fields.indexOf(p)&&this._fields.push(p)}t.length>0&&this._processRemainingWidgets()},e.prototype._processRemainingWidgets=function(){for(var t=this._crossReference._document,e=0;e<t.pageCount;e++){var i=t.getPage(e);if(i&&i._pageDictionary){var r=i._pageDictionary,n=[];r.has("Annots")&&(n=r.getRaw("Annots"))instanceof Qr&&(n=this._crossReference._fetch(n));for(var s=0;s<n.length;s++){var a=n[s];if(a&&a instanceof Qr&&-1===this._fields.indexOf(a)){var o=this._crossReference._fetch(a);o&&o.has("FT")&&o.has("Subtype")&&"Widget"===o.get("Subtype").name&&o.has("T")&&o.has("P")&&-1===this._formNames.indexOf(o.get("T"))&&this._fields.push(a)}}}}},e.prototype._hasValidKids=function(t){var e=t.get("Kids");return e&&e.length>0},e.prototype._removeInvalidFields=function(t,e,i,r){if(!t)return!1;if(t.has("Kids")&&this._hasValidKids(t)){for(var n=t.get("Kids"),s=[],a=!1,o=0;o<n.length;o++){var h=void 0,c=n[o];if(c instanceof Qr?h=this._crossReference._fetch(c):c instanceof $r&&(h=c),h){if(h.has("P")){var _=h.get("P"),d=void 0;if(_ instanceof Qr?d=this._crossReference._fetch(_):_ instanceof $r&&(d=_),d&&d.has("Annots")){var l=d.get("Annots");if(l instanceof Qr&&(l=this._crossReference._fetch(l)),l&&Array.isArray(l)&&!(-1!==l.indexOf(c))){s.push(o);continue}}}this._removeInvalidFields(h,e,c,r)?a=!0:s.push(o)}else s.push(o)}for(o=s.length-1;o>=0;o--)n.splice(s[o],1);return!!(n.length>0&&a)&&(t.update("Kids",n),!0)}return this._validateField(t,e,i,r)},e.prototype._validateField=function(t,e,i,r){var n=this;if(!t||!e)return!1;if(t.has("P")&&t.has("Rect"))return!0;if(r&&-1!==r.indexOf(i))return!0;var s=!1;return e.forEach(function(e,i){if(!s&&e&&e.length>0)for(var r=0;r<e.length;r++){var a=e[r];if(a&&n._compareWidgets(a,t)&&n._crossReference&&n._crossReference._document){var o=n._crossReference._document.getPage(i);if(o&&o._ref&&t.has("FT"))return t.update("P",o._ref),void(s=!0)}}}),s},e.prototype._compareWidgets=function(t,e){if(!t||!e)return!1;var i,r;if(t.has("FT")&&(i=t.get("FT")),e.has("FT")&&(r=e.get("FT")),i&&r&&i.name!==r.name)return!1;var n,s;if(t.has("T")&&(n=t.get("T")),e.has("T")&&(s=e.get("T")),n&&s&&n!==s)return!1;var a,o;return t.has("V")&&(a=t.get("V")),e.has("V")&&(o=e.get("V")),"string"==typeof a&&"string"==typeof o&&a===o},e.prototype._isNode=function(t){var e=!1;if(Ut(t)&&t.length>0){var i=t[0],r=void 0;if(Ut(i)&&(i instanceof $r?r=i:i instanceof Qr&&(r=this._crossReference._fetch(i))),r&&r.has("Subtype")){var n=r.get("Subtype");n&&"Widget"!==n.name&&(e=!0)}}return e},e.prototype._parseWidgetReferences=function(){var t=this;return void 0===this._widgetReferences&&this.count>0&&(this._widgetReferences=[],this._fields.forEach(function(e){var i=t._crossReference._fetch(e);if(i)if(i.has("Kids")){var r=i.get("Kids");r&&r.length>0&&r.forEach(function(e){var i;if(e&&e instanceof $r?i=e:e&&e instanceof Qr&&(i=t._crossReference._fetch(e)),i&&i.has("Subtype")){var r=i.get("Subtype");r&&"Widget"===r.name&&t._widgetReferences.push(e)}})}else t._widgetReferences.push(e)})),this._widgetReferences},e.prototype._doPostProcess=function(e,i){for(var r=this.count-1;r>=0;r--){var n=this.fieldAt(r);if(n&&!n._isLoaded&&void 0!==n._tabIndex&&n._tabIndex>=0){var s=n._page;if(s&&s._pageDictionary.has("Annots")&&(s.tabOrder===t.PdfFormFieldsTabOrder.manual||this._tabOrder===t.PdfFormFieldsTabOrder.manual)){var a=s._pageDictionary.get("Annots"),o=new or(a,this._crossReference,s);s._annotations=o;for(var h=0;h<n.itemsCount;h++){var c=n.itemAt(h);if(c&&c instanceof Ji){var _=a.indexOf(c._ref);if(_<0&&(_=n._annotationIndex),_>=0){var d=s.annotations._reArrange(n._ref,n._tabIndex,_);s._pageDictionary.update("Annots",d),s._pageDictionary._updated=!0}}}}}n&&(i&&n.page===i||!i)&&(i&&(n._isImport=!0),n._doPostProcess(e||n.flatten),(!e&&n.flatten||e&&i&&n.page===i)&&this.removeFieldAt(r))}},e.prototype._getFieldIndex=function(t){var e=-1;if(this.count>0){this._fieldNames||(this._fieldNames=[]),this._indexedFieldNames||(this._indexedFieldNames=[]),this._actualFieldNames||(this._actualFieldNames=[]),this._indexedActualFieldNames||(this._indexedActualFieldNames=[]);for(var i=0;i<this.count;i++){var r=this.fieldAt(i);if(r){var n=r.name;n&&(this._fieldNames.push(n),this._indexedFieldNames.push(n.split("[")[0]));var s=r.actualName;s&&(this._actualFieldNames.push(s),this._indexedActualFieldNames.push(s.split("[")[0]))}}var a=this._fieldNames.indexOf(t);-1!==a?e=a:-1!==(a=this._indexedFieldNames.indexOf(t))?e=a:-1!==(a=this._actualFieldNames.indexOf(t))?e=a:-1!==(a=this._indexedActualFieldNames.indexOf(t))&&(e=a)}return e},e.prototype._getFields=function(){for(var t=[],e=0;e<this._fields.length;e++){var i=this.fieldAt(e);i&&i instanceof fi&&t.push(i)}return t},e.prototype._getOrder=function(e){if(e!==t.PdfFormFieldsTabOrder.none){var i="";return e===t.PdfFormFieldsTabOrder.row?i="R":e===t.PdfFormFieldsTabOrder.column?i="C":e===t.PdfFormFieldsTabOrder.structure&&(i="S"),Xr.get(i)}return null},e.prototype._compareFields=function(e,i){var r,n,s=0,a=e.page,o=i.page;if(a&&!a._isNew&&a instanceof pr&&o&&!o._isNew&&o instanceof pr){var h=this._sortItemByPageIndex(e,!1)._pageIndex,c=this._sortItemByPageIndex(i,!1)._pageIndex,_=void 0;_=e._dictionary.has("Kids")?this._getItemRectangle(e):this._getRectangle(e._dictionary);var d=void 0;d=i._dictionary.has("Kids")?this._getItemRectangle(i):this._getRectangle(i._dictionary);var l=_[3]-_[1],f=d[3]-d[1];if(_&&_.length>=2&&d&&d.length>=2){var p=_[0],u=_[1],g=d[0],y=d[1];if("number"==typeof p&&"number"==typeof g&&"number"==typeof u&&"number"==typeof y)if(n=h-c,this._tabOrder===t.PdfFormFieldsTabOrder.row){if(0!==(r=this._compare(y,u))){var m=-1===r&&u>y&&u-l/2<y;(m=m||1===r&&y>u&&y-f/2<u)&&(r=0)}s=0!==n?n:0!==r?r:this._compare(p,g)}else if(this._tabOrder===t.PdfFormFieldsTabOrder.column)r=this._compare(p,g),s=0!==n?n:0!==r?r:this._compare(y,u);else if((this._tabOrder===t.PdfFormFieldsTabOrder.manual||this._tabOrder===t.PdfFormFieldsTabOrder.none||this._tabOrder===t.PdfFormFieldsTabOrder.structure||this._tabOrder===t.PdfFormFieldsTabOrder.widget)&&e instanceof fi&&i instanceof fi){var b=e.tabIndex,v=i.tabIndex;r=this._compare(b,v),s=0!==n?n:r}}}return s},e.prototype._getRectangle=function(t){var e;return t&&t.has("Rect")&&(e=t.getArray("Rect")),e},e.prototype._getItemRectangle=function(t){var e,i=t._dictionary;if(i.has("Kids")){var r=i.getArray("Kids");Ut(r)&&r.length>=1&&(e=1===r.length?this._getRectangle(r[0]):t&&t.itemsCount>1?this._getRectangle(t.itemAt(0)._dictionary):this._getRectangle(r[0]))}return e},e.prototype._compare=function(t,e){return t>e?1:t<e?-1:0},e.prototype._compareKidsElement=function(e,i){var r,n=this._crossReference._fetch(e),s=this._crossReference._fetch(i),a=this._getRectangle(n),o=this._getRectangle(s);if(a&&a.length>=2&&o&&o.length>=2){var h=a[0],c=a[1],_=o[0],d=o[1];if("number"==typeof h&&"number"==typeof _&&"number"==typeof c&&"number"==typeof d){var l=void 0;return r=this._tabOrder===t.PdfFormFieldsTabOrder.row?0!==(l=this._compare(d,c))?l:this._compare(h,_):this._tabOrder===t.PdfFormFieldsTabOrder.column?0!==(l=this._compare(h,_))?l:this._compare(d,c):0}}return r},e.prototype._sortItemByPageIndex=function(t,e){var i=t.page,r=this._tabOrder;return this._tabOrder=e?t.page.tabOrder:r,this._sortFieldItems(t),t._isLoaded&&t._kidsCount>1&&(i=t.itemAt(0).page),this._tabOrder=r,void 0===i&&(i=t.page),i},e.prototype._sortFieldItems=function(t){var e=this;if(t._isLoaded&&(t instanceof pi||t instanceof vi||t instanceof gi||t instanceof yi)){var i=t._parseItems();i.sort(function(t,i){return e._compareFieldItem(t,i)}),t._parsedItems.clear(),i.forEach(function(e,i){t._parsedItems.set(i,e)})}},e.prototype._compareFieldItem=function(e,i){var r=0;if(void 0!==e&&void 0!==i){var n=e.page,s=i.page,a=this._getRectangle(e._dictionary),o=this._getRectangle(i._dictionary);if(a&&o){var h=a[0],c=a[1],_=o[0],d=o[1],l=void 0;this._tabOrder===t.PdfFormFieldsTabOrder.row?r=0!==(l=this._compare(n._pageIndex,s._pageIndex))?l:0!==(l=this._compare(d,c))?l:this._compare(h,_):this._tabOrder===t.PdfFormFieldsTabOrder.column&&(r=0!==(l=this._compare(n._pageIndex,s._pageIndex))?l:0!==(l=this._compare(h,_))?l:this._compare(d,c))}}return r},e.prototype._clear=function(){this._fields=[],this._parsedFields=new Map},e}(),Yn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Zn=function(t){function i(e){var i=t.call(this)||this;return i._annotationObjects=new Map,i._specialCharacters="âãÏÓ",null!==e&&void 0!==e&&(i._fileName=e),i}return Yn(i,t),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},i.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=X(),this._save()},i.prototype._save=function(){var t=this,e=0,i=[];if(!this._isAnnotationExport){this._asPerSpecification?(this.fdfString+="%FDF-1.2\n%"+this._specialCharacters+"\r\n1 0 obj\r<</FDF<</F(",this.fdfString+=this._fileName+")",this.fdfString+="/Fields["):this.fdfString+="%FDF-1.2\n";var r=this._document.form;if(null!==r&&void 0!==r){this._exportEmptyFields=r.exportEmptyFields;for(var n=this._document.form.count,s=this,a=0;a<n;a++)!function(r){var n=s._document.form.fieldAt(r),a=s._exportFormFieldsData(n);(n instanceof pi||n instanceof vi||n instanceof bi||n instanceof yi||n instanceof gi)&&e++,s._asPerSpecification?n instanceof pi||n instanceof vi||n instanceof bi?(i.push(e),s.fdfString+="<</T("+n.name+")/V","string"==typeof a||Array.isArray(a)&&1===a.length?s.fdfString+="("+(Array.isArray(a)?a[0]:a)+")":Array.isArray(a)&&(s.fdfString+="[",a.forEach(function(e,i){t.fdfString+="("+e+")",i!==a.length-1&&(t.fdfString+=" ")}),s.fdfString+="]"),s.fdfString+=">>"):(n instanceof yi||n instanceof gi)&&(i.push(e),s.fdfString+="<</T("+n.name+")/V/"+a+">>"):n instanceof pi||n instanceof vi||n instanceof bi?(i.push(e),s.fdfString+=e+" 0 obj<</T <"+s._stringToHexString(n.name)+"> /V ","string"==typeof a||Array.isArray(a)&&1===a.length?s.fdfString+="<"+s._stringToHexString(Array.isArray(a)?a[0]:a)+">":Array.isArray(a)&&(s.fdfString+="[",a.forEach(function(e,i){t.fdfString+="<"+t._stringToHexString(e)+">",i!==a.length-1&&(t.fdfString+=" ")}),s.fdfString+="]"),s.fdfString+=" >>endobj\n"):(n instanceof yi||n instanceof gi)&&(i.push(e),s.fdfString+=e+" 0 obj<</T <"+s._stringToHexString(n.name)+"> /V /",s.fdfString+=a+" >>endobj\n")}(a)}if(this._asPerSpecification)this.fdfString+="]",this.fdfString+="/ID[]/UF("+this._fileName+")>>/Type/Catalog>>\rendobj\rtrailer\r\n<</Root 1 0 R>>\r\n",this.fdfString+="%%EOF\r\n";else{this.fdfString+=this._table.size+1+" 0 obj<</F <"+this._stringToHexString(this._fileName)+"> /Fields [";for(a=0;a<this._table.size;a++){var o=this._document.form.fieldAt(a);null!==o&&void 0!==o&&o.export&&(this.fdfString+=i[a]+" 0 R ")}this.fdfString+="]>>endobj\n",this.fdfString+=i.length+2+" 0 obj<</Version /1.4 /FDF "+(i.length+1)+" 0 R>>endobj\n",this.fdfString+="trailer\n<</Root "+(i.length+2)+" 0 R>>"}}var h=new ArrayBuffer(1*this.fdfString.length),c=new Uint8Array(h);return c.forEach(function(e,i){c[i]=t.fdfString.charCodeAt(i)}),c},i.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(m(e));var i=new nn(e);this._isAnnotationImport=!0;var r=new Un(new zn(i,!0),null,!0,!1);this._readFdfData(r),Ut(this._annotationObjects)&&this._annotationObjects.size>0&&this._annotationObjects.clear(),Ut(this._table)&&this._table.size>0&&this._table.clear()},i.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(m(e));var i=new nn(e),r=new Un(new zn(i,!0),null,!1,!1);this._readFdfData(r)},i.prototype._readFdfData=function(t){var e=this,i=t.getObject();if(this._isAnnotationImport){for(var r="";null!==i&&void 0!==i&&"EOF"!==i;)i instanceof $r?(this._table.set(r,i),r=""):i instanceof nn||i instanceof vn?(this._table.set(r,i),r=""):i instanceof Xr||Array.isArray(i)?(this._table.set(r,i),r=""):null!==i&&Number.isInteger(i)&&0!==i?t.first>=0&&(r=i.toString()+" "+t.first.toString()):i instanceof qr&&null!==i.command&&void 0!==i.command&&"trailer"===i.command&&(r=i.command),i=t.getObject();this._annotationObjects=this._parseAnnotationData(),this._annotationObjects.forEach(function(t,i){var r=t;if(e._parseDictionary(r),r._crossReference=e._crossReference,r._updated=!0,r&&r.has("Page")){var n=r.get("Page");if(null!==n&&void 0!==n){var s=n;if(s<e._document.pageCount){var a=e._document.getPage(s),o=a._pageDictionary;if(o){var h=a.annotations,c=h._parseAnnotation(r);if(null!==c&&void 0!==c){c._isImported=!0;var _=e._crossReference._getNextReference();e._crossReference._cacheMap.set(_,r),(r.has("NM")||r.has("IRT"))&&e._addReferenceToGroup(_,r),c._ref=_;var d=h._annotations.length;if(!c._dictionary.has("P")&&"Popup"!==c._dictionary.get("Subtype").name){var l=o.objId.split(" ").map(Number),f=l[0],p=l[1];c._dictionary.update("P",Qr.get(f,p))}if(delete c._dictionary._map.Page,h._annotations.push(_),h._comments&&h._comments.length>0&&(h._comments=[]),o.set("Annots",h._annotations),o._updated=!0,h._parsedAnnotations.set(d,c),e._handlePopup(h,_,r,o),c instanceof Mi&&c._dictionary.has("Parent")){var u=c._dictionary.getRaw("Parent");if(u&&u instanceof Qr){var g=e._crossReference._cacheMap.get(u);if(g&&g instanceof $r&&g.has("Popup")){var y=g.get("Popup");y instanceof $r&&y.has("Parent")&&g.update("Popup",_)}}}}}}}}}),this._groupHolders&&this._groupHolders.length>0&&this._groupHolders.forEach(function(t){if(t&&t.has("IRT")){var i=t.get("IRT");i&&(e._groupReferences&&e._groupReferences.has(i)?t.update("IRT",e._groupReferences.get(i)):delete t._map.IRT)}}),this._groupHolders=[],this._groupReferences=new Map}else{if(i=t.getObject(),this._asPerSpecification)for(;null!==i&&void 0!==i&&"EOF"!==i;)i instanceof $r&&null!==i&&null!==i._map.FDF&&void 0!==i._map.FDF&&(i=i._map.FDF)instanceof $r&&null!==i._map.Fields&&void 0!==i._map.Fields&&null!==(i=i._map.Fields)&&void 0!==i&&i.forEach(function(t){if(t instanceof $r&&null!==t&&void 0!==t){var i=t.getArray("T"),r=void 0;r=t._map&&t._map.V instanceof Xr?t.get("V").name:t.getArray("V"),null!==i&&void 0!==i&&i.length>0&&e._table.set(i,r)}}),i=t.getObject();else for((i=t.getObject())instanceof qr&&null!==i.command&&(i=i.command);null!==i&&void 0!==i&&"EOF"!==i;){if(i instanceof $r){var n=i.getArray("T"),s=void 0;s=i._map&&i._map.V instanceof Xr?i.get("V").name:i.getArray("V"),null!==n&&void 0!==n&&n.length>0&&this._table.set(n,s)}i=t.getObject()}this._importField()}},i.prototype._parseDictionary=function(t){var e=this;null!=t&&t.size>0&&t.forEach(function(i,r){"Parent"!==i&&"P"!==i&&"Page"!==i&&e._parseDictionaryData(t,i)})},i.prototype._parseDictionaryData=function(t,e){var i=t.get(e);if(i instanceof $r)this._parseDictionary(i);else if(i instanceof vn)this._parseDictionary(i.dictionary);else if(Array.isArray(i))this._parseArray(i);else if(i instanceof Qr){var r=i;if(r){var n=r.objectNumber+" "+r.generationNumber;if(this._annotationObjects.has(n))t.update(e,this._annotationObjects.get(n));else if(this._table.has(n)){var s=this._table,a=s.get(n);if(a instanceof nn||a instanceof vn){this._parseDictionary(a.dictionary);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),a.dictionary._updated=!0,t.update(e,o),s.set(n,o)}else if(a instanceof $r){this._parseDictionary(a);var h=this._crossReference._getNextReference();this._crossReference._cacheMap.set(h,a),t.update(e,h),s.set(n,h)}else if(a instanceof Qr)t.update(e,a);else if(a instanceof Xr){var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,a),t.update(e,c),s.set(n,c)}else if(Array.isArray(a)){this._parseArray(a);var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,a),t.update(e,_),s.set(n,_)}}else delete t._map[e.toString()]}}},i.prototype._parseArray=function(t){if(Array.isArray(t)&&t.length>0)for(var e=t.length,i=0;i<e;i++){var r=t[Number.parseInt(i.toString(),10)];if(r&&r instanceof Qr){var n=r.objectNumber+" "+r.generationNumber;if(this._annotationObjects.has(n))t[Number.parseInt(i.toString(),10)]=this._annotationObjects.get(n);else if(this._table.has(n)){var s=this._table,a=s.get(n);if(a instanceof Qr)t[Number.parseInt(i.toString(),10)]=a;else if(a instanceof $r||a instanceof nn){var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),t[Number.parseInt(i.toString(),10)]=o,s.set(n,o)}}}}},i.prototype._parseAnnotationData=function(){var t=new Map,e=new Map;if(null!==(t=this._table)&&void 0!==t&&t.size>0&&t.has("trailer")){var i=t.get("trailer");if(i instanceof $r&&null!==i&&void 0!==i&&i.has("Root")){var r=i.getRaw("Root");if(null!==r&&void 0!==r){var n=r.objectNumber.toString()+" "+r.generationNumber.toString();if(t.has(n)){var s=t.get(n);if(null!==s&&void 0!==s&&s.has("FDF")){var a=s.get("FDF");if(null!==a&&void 0!==a&&a.has("Annots"))for(var o=0,h=a.get("Annots")||[];o<h.length;o++){var c=h[o],_=c.objectNumber+" "+c.generationNumber,d=t.get(_);if(d){if(d instanceof $r&&d.has("Parent")&&d.has("Subtype")){var l=d.get("Subtype"),f=d._get("Parent");if("Popup"===l.name&&f.objectNumber===c.objectNumber)continue}e.set(_,d)}t.delete(_)}}}t.delete(n)}}t.delete("trailer")}return e},i.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._table.forEach(function(r,n){var s;t._table.size>0&&t._table.has(n)&&(s=t._table.get(n));var a=e._getFieldIndex(n);if(-1!==a&&a<i){var o=e.fieldAt(a);if(o){s&&""!==s&&o._dictionary.update("RV",s);var h=[];Array.isArray(r)?h=r:h.push(r),t._importFieldData(o,h)}}})},i.prototype._exportAnnotationData=function(t,e){var i=ke._whiteSpace+"0"+ke._whiteSpace;this.fdfString+="%FDF-1.2\r\n";for(var r=2,n=new Array,s=this.exportAppearance,a=0;a<e;a++){var o=t.getPage(a);if(null!==o&&void 0!==o&&o.annotations.count>0)for(var h=0;h<o.annotations.count;h++){var c=o.annotations.at(h);if(null!==c&&void 0!==c&&!(c instanceof Ni||c instanceof Vi||c instanceof ji||c instanceof Ei)){if(c instanceof Mi&&c._dictionary.has("Parent"))continue;if(c instanceof Gi||c instanceof Li)r=(_=this._exportAnnotation(c,this.fdfString,r,n,a,!0)).index,n=_.annot;else{var _=this._exportAnnotation(c,this.fdfString,r,n,a,s);r=_.index,n=_.annot}}}}if(2!==r){var d="1"+i;this.fdfString+=d+"obj\r\n<</FDF<</Annots[";for(a=0;a<n.length-1;a++)this.fdfString+=n[a]+i+"R ";this.fdfString+=n[n.length-1]+i+"R]/F("+this._fileName+")/UF(",this.fdfString+=this._fileName+")>>/Type/Catalog>>\r\nendobj\r\n",this.fdfString+="trailer\r\n<</Root "+d+"R>>\r\n%%EOF\r\n"}},i.prototype._exportAnnotation=function(t,e,i,r,n,s){this.fdfString=e;var a=new $n,o=t._dictionary,h=ke._whiteSpace+"0"+ke._whiteSpace+"obj\r\n",c="\r\nendobj\r\n";this._annotationID=i.toString(),this.fdfString+=i+h+"<<";var _=new Map,d=new Array;r.push(this._annotationID),o.set("Page",n);var l=this._getEntries(_,d,i,o,this.fdfString,s);i=l.index,_=l.list,d=l.streamReference,delete o._map.Page,this.fdfString+=">>"+c;for(var f=this;_.size>0;)!function(){var t=Array();_.forEach(function(e,i){t.push(i)});for(var e=0;e<t.length;e++){var a=t[e];if(_.get(a)instanceof $r||_.get(a)instanceof nn||_.get(a)instanceof sn||_.get(a)instanceof vn){if(null!==(o=_.get(a)instanceof $r?_.get(a):_.get(a).dictionary)&&void 0!==o){if(o instanceof $r&&o.has("Type")){var l=o.get("Type");null!==l&&void 0!==l&&"Annot"===l.name&&(r.push(a.toString()),o.set("Page",n))}f.fdfString+=a+h+"<<";u=f._getEntries(_,d,i,o,f.fdfString,s);_=u.list,d=u.streamReference,i=u.index,o instanceof $r&&o.has("Page")&&delete o._map.Page,f.fdfString+=">>",null!==d&&void 0!==d&&-1!==d.indexOf(a)&&f._appendStream(_.get(a),f.fdfString),f.fdfString+=c}}else if(_.get(a)instanceof Xr)f.fdfString+=a+h,f.fdfString+="/"+_.get(a).name,f.fdfString+=c;else if(Array.isArray(_.get(a))){f.fdfString+=a+h;var p=_.get(a),u=f._appendArray(p,f.fdfString,i,s,_,d);i=u.index,f.fdfString+=c}else"boolean"==typeof _.get(a)?(f.fdfString+=a+h,f.fdfString+=" "+(_.get(a)?"true":"false"),f.fdfString+=c):"string"==typeof _.get(a)&&(f.fdfString+=a+h,f.fdfString+="("+f._getFormattedString(_.get(a))+")",f.fdfString+=c);_.delete(a)}}();return i++,a.index=i,a.annot=r,a},i.prototype._appendStream=function(t,i){var r=t;if(this.fdfString=i,(t instanceof vn||t instanceof nn||t instanceof sn)&&(r=t instanceof vn?t.stream:t),t instanceof vn||t instanceof nn||t instanceof sn){var n=void 0,s=void 0,a=void 0;if(t instanceof sn)s=r.getString();else if(t instanceof vn||t instanceof nn)n=r.getByteRange(r.start,r.end),s=m(a=new Uint8Array(n));else{n=r.getBytes(),a=new Uint8Array(n);var o=new e.CompressedStreamWriter;o.write(a,0,a.length),o.close(),s=o.getCompressedString}this.fdfString+="stream\r\n",this.fdfString+=s,this.fdfString+="\r\nendstream"}},i.prototype._getEntries=function(t,e,i,r,n,s){var a=this,o=!1,h=new $n;this.fdfString=n;var c=t;return r.forEach(function(t,n){if(s||"AP"!==t){"P"!==t&&(a.fdfString+="/"+t),("Sound"===t||"F"===t||s)&&(o=!0);var h=n;if("string"==typeof h)a.fdfString+="("+a._getFormattedString(h)+")";else if(h instanceof Xr)a.fdfString+="/"+h.name;else if(h instanceof Array){h=h;var _=a._appendArray(h,a.fdfString,i,o,c,e);c=_.list,e=_.streamReference,i=_.index}else if("number"==typeof h)a.fdfString+=" "+h.toString();else if("boolean"==typeof h)a.fdfString+=" "+(h?"true":"false");else if(h instanceof $r){a.fdfString+="<<",h=h;var d=a._getEntries(c,e,i,h,a.fdfString,s);c=d.list,e=d.streamReference,i=d.index,a.fdfString+=">>"}else if(h instanceof Qr){var l=r.get("Page");if("Parent"===t)a.fdfString+=" "+a._annotationID+" 0 R",a.fdfString+="/Page "+l;else if("IRT"===t){if(a._crossReference&&a._crossReference._fetch&&h){var f=a._crossReference._fetch(h);if(f&&f.has("NM")){var p=f.get("NM");null!==p&&void 0!==p&&(a.fdfString+="("+a._getFormattedString(p)+")")}}}else if("P"!==t){var u=h;null!==u&&void 0!==u&&(i++,a.fdfString+=" "+i+" 0 R",o&&e.push(i),r._crossReference||r.assignXref(a._crossReference),c.set(i,r.get(t)))}}o=!1}}),h.list=c,h.streamReference=e,h.index=i,h},i.prototype._appendArray=function(t,e,i,r,n,s){this.fdfString=e,this.fdfString+="[";var a=new $n,o=n;if(Ut(t)&&t.length>0)for(var h=t.length,c=0;c<h;c++){var _=t[c];0!==c&&("number"==typeof _||_ instanceof Qr||"boolean"==typeof _)&&(this.fdfString+=" ");var d=this._appendElement(_,this.fdfString,i,r,o,s);o=d.list,s=d.streamReference,i=d.index}return this.fdfString+="]",a.list=o,a.streamReference=s,a.index=i,a},i.prototype._appendElement=function(t,e,i,r,n,s){this.fdfString=e;var a=new $n,o=n;if("number"==typeof t)this.fdfString+=t.toString();else if(t instanceof Xr)this.fdfString+="/"+t.name.toString();else if(t instanceof Array)t=t,o=(h=this._appendArray(t,this.fdfString,i,r,o,s)).list,s=h.streamReference,i=h.index;else if(t instanceof $r){this.fdfString+="<<",t=t;var h=this._getEntries(o,s,i,t,this.fdfString,r);o=h.list,s=h.streamReference,i=h.index,this.fdfString+=">>"}else if(t instanceof Qr){var c=t;null!==c&&void 0!==c&&(i++,this.fdfString+=" "+i+" 0 R",r&&s.push(i),o.set(i,this._crossReference._cacheMap.get(t)))}else"boolean"==typeof t?this.fdfString+=" "+(t?"true":"false"):"string"==typeof t&&(this.fdfString+="("+this._getFormattedString(t)+")");return a.list=o,a.streamReference=s,a.index=i,a},i.prototype._getFormattedString=function(t){for(var e="",i=0;i<t.length;i++){var r=t.charCodeAt(i);40!==r&&41!==r||(e+="'"),e+=String.fromCharCode(r)}return e},i.prototype._checkFdf=function(t){if((t.includes(this._specialCharacters)||t.includes("âãÃÃ"))&&(this._asPerSpecification=!0),t.startsWith("%")&&"FDF-"!==t.substring(1,5))throw new Error("Invalid FDF file.")},i.prototype._stringToHexString=function(t){var e="";return null!==t&&void 0!==t&&t.length>0&&(e=w(p(t))),e},i}(he),$n=function(){function t(){}return t}(),ts=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),es=function(t){function e(e){var i=t.call(this)||this;return null!==e&&void 0!==e&&(i._fileName=e),i}return ts(e,t),e.prototype._exportAnnotations=function(){throw new Error("Method not implemented.")},e.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._format="XML",this._key=X(),this._save()},e.prototype._save=function(){var t=new re;t._writeStartDocument(),this._asPerSpecification?(t._writeStartElement("fields"),t._writeAttributeString("xfdf","http://ns.adobe.com/xfdf-transition/","xmlns",null)):t._writeStartElement("Fields");var e=this._document.form;if(null!==e&&void 0!==e){this._exportEmptyFields=e.exportEmptyFields;for(var i=this._document.form.count,r=0;r<i;r++){var n=this._document.form.fieldAt(r);null!==n&&void 0!==n&&n.export&&this._exportFormFieldData(n)}this._writeFormFieldData(t,this._asPerSpecification)}var s=t._save();return t._destroy(),s},e.prototype._writeFormFieldData=function(t,e){void 0===e&&(e=!1),e?this._table.forEach(function(e,i){if(i.includes(" ")){var r=i.replace(/ /g,"");t._writeStartElement(r.toString()),t._writeAttributeString("original",i.toString(),"xfdf",null)}else t._writeStartElement(i.toString());t._writeString(e.toString()),t._writeEndElement()}):this._table.forEach(function(e,i){i.includes(" ")&&(i=i.replace(/ /g,"_x0020_")),t._writeStartElement(i.toString()),t._writeString(e.toString()),t._writeEndElement()}),t._writeEndElement()},e.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var i=m(e);i=(i=i.replace(/(\r\n|\n|\r)/gm,"")).replace(/[^\x20-\x7E]/g,""),this._xmlDocument=(new DOMParser).parseFromString(i,"text/xml"),this._checkXml(this._xmlDocument),this._xmlImport=!0,this._parseFormData(this._xmlDocument.documentElement),this._xmlImport=!1},e.prototype._parseFormData=function(t){var e=t.childNodes;if(null!==e&&void 0!==e&&e.length>0)for(var i=0;i<e.length;i++){var r=e.item(i);if(null!==r&&void 0!==r&&1===r.nodeType){var n=r,s="";if(null!==n.attributes&&void 0!==n.attributes&&n.attributes.length>0){var a=n.attributes.item(0);null!==a&&void 0!==a&&"xfdf:original"===a.name&&(s=a.value)}else s=n.tagName;var o=n.textContent;null!==s&&void 0!==s&&s.length>0&&this._table.set(s,o)}}this._importField()},e.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._table.forEach(function(r,n){var s;t._table.size>0&&t._table.has(n)&&(s=t._table.get(n));var a=n.toString();-1!==a.indexOf("_x0020_")&&(a=a.replace(/_x0020_/g," "));var o=e._getFieldIndex(a);if(-1!==o&&o<i){var h=e.fieldAt(o);if(h&&null!==h&&void 0!==h){s&&""!==s&&h._dictionary.update("RV",s);var c=[];c.push(r),t._importFieldData(h,c)}}})},e.prototype._checkXml=function(t){if(t.getElementsByTagName("parsererror").length>0)throw new Error("Invalid XML file.")},e}(he),is=function(){function t(){this._incrementalUpdate=!0}return Object.defineProperty(t.prototype,"crossReferenceType",{get:function(){return this._crossReferenceType},set:function(t){this._crossReferenceType=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isIncrementalUpdate",{get:function(){return this._incrementalUpdate},set:function(t){this._incrementalUpdate=t},enumerable:!0,configurable:!0}),t}(),rs=function(){function t(){this._optimizeResources=!0,this._groupFormFields=!1}return Object.defineProperty(t.prototype,"targetIndex",{get:function(){return this._targetIndex},set:function(t){this._targetIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"optimizeResources",{get:function(){return this._optimizeResources},set:function(t){this._optimizeResources=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"groupFormFields",{get:function(){return this._groupFormFields},set:function(t){this._groupFormFields=t},enumerable:!0,configurable:!0}),t}(),ns=function(){function e(t,e,i,r,n){this._namedDestinations=[],this._bookmarks=[],this._fields=[],this._pageReference=new Map,this._bookmarksPageLinkReference=new Map,this._destination=[],this._newList=new Map,this._annotationLayer=new Map,this._isLayersPresent=!1,this._fieldNames=[],this._options=new rs,this._kidsReference=[],this._formFieldsCollection=new Map,this._formFields=[],this._isDuplicatePage=!1,this._fieldCount=0,this._crossReference=t,this._destinationDocument=e,this._sourceDocument=i,this._pageReference=r,void 0!==n&&(this._options=n),this._copier=new ss(this._crossReference,this._sourceDocument._crossReference)}return e.prototype._importPages=function(t,e,i,r,n,s){var a,o,h,c=this,_=t._pageDictionary;if(this._isDuplicatePage=r,this._options.rotation=n?n.rotation:t.rotation,h="number"==typeof e?this._insertNewPage(t,e):this._isDuplicatePage?this._insertNewPage(t,t._pageIndex+1):this._insertNewPage(t),(r||s)&&this._options.optimizeResources){var d=[];_.forEach(function(t,e){if("Contents"===t&&0===d.length){var i=e;if(i instanceof Qr){var r=s?c._copier._copy(i):i;h._pageDictionary.update(t,r)}else i instanceof Array&&(i.forEach(function(t){var e=s?c._copier._copy(t):t;d.push(e)}),h._pageDictionary.update(t,d))}else if("Resources"===t&&e){var n=s?c._copier._copy(e):e;n&&h._pageDictionary.update(t,n)}else"Resources"!==t&&"MediaBox"!==t&&"CropBox"!==t&&"Parent"!==t&&"Annots"!==t&&"Contents"!==t&&"Rotate"!==t&&h._pageDictionary.update(t,e)})}else o=t._contentTemplate,h.graphics.drawTemplate(o,{x:0,y:0,width:o._size[0],height:o._size[1]}),o._content.dictionary.update("Resources",this._copier._copy(_.getRaw("Resources"))),this._pageReference.set(_,h),r||this._bookmarksPageLinkReference.set(t._ref,h._pageIndex);if(_.has("Annots")&&(this._importAnnotation(t,h),void 0!==this._options&&this._options.groupFormFields&&this._sourceDocument._catalog._catalogDictionary.has("AcroForm")?this._formFieldsGroupingSupport(this._sourceDocument.form,t,h):this._sourceDocument._catalog._catalogDictionary.has("AcroForm")&&this._importFormField(t,this._sourceDocument.form,h,this._sourceDocument._crossReference)),!r){var l=this._sourceDocument._parseBookmarkDestination();if(l&&l.has(t)){var f=l.get(t);(a=this._bookmarks).push.apply(a,f)}}(!r&&i||!this._options.optimizeResources)&&this._mergeLayer(h._pageDictionary,_,this._sourceDocument._crossReference),h._pageDictionary._updated=!0},e.prototype._importAnnotation=function(t,e){var i,r=this,n=[],s=!1;t.annotations._annotations.forEach(function(t,a){if(t){var o=r._sourceDocument._crossReference._fetch(t);if(o){if(o.has("Dest")){i=[];var h=o.get("Dest"),c=o._get("Dest");Array.isArray(h)?(i.push.apply(i,h),s=!0):c instanceof Qr&&i.push(c)}if(i&&i.length>0&&r._destination.push(i),o.has("OC")){var _=o.getRaw("OC");_ instanceof Qr&&r._annotationLayer.set(a,_)}var d=r._copier._copy(t),l=r._destinationDocument._crossReference._fetch(d);s&&l.update("Dest",i),l.update("P",e._ref),r._crossReference._cacheMap.set(d,l),n.push(d)}}s=!1,i=[]}),n.length>0&&e._pageDictionary.update("Annots",n)},e.prototype._formFieldsGroupingSupport=function(t,e,i){var r,n=[],s=[],a=[],o=t._dictionary.get("DR");if(t._dictionary.has("DR")&&(o=t._dictionary.get("DR")),i._pageDictionary.has("Annots")&&(n=i._pageDictionary.get("Annots")),e._pageDictionary.has("Annots")&&(a=e._pageDictionary.get("Annots")),!this._isDuplicatePage){r=this._destinationDocument.form,this._fieldCount=r.count;for(var h=0;h<this._fieldCount;h++)s.push(r.fieldAt(h).name)}for(var c=0;c<t.count;c++){var _=t.fieldAt(c),d=void 0,l=[],f=_._dictionary.get("Kids");if(-1!==s.indexOf(_.name)||this._isDuplicatePage){if(this._isDuplicatePage?(d=_,l=f):(d=r.fieldAt(s.indexOf(_.name)))._dictionary.get("Kids")&&(l=d._dictionary.get("Kids")),_._isDuplicatePage=!0,_ instanceof wi&&d instanceof wi||!(_ instanceof wi))if(void 0!==f&&f.length>0)for(var p=0;p<f.length;p++){var u=_.itemAt(p);u.page===e&&(d._page=i,n=this._groupFormFieldsKids(d,_,a,l,f,i._ref,n,p,c,o,u))}else n=this._groupFormFieldsKids(d,_,a,l,f,i._ref,n,0,c,o)}else n=this._insertFormFields(c,t._crossReference,_,t,i._ref,n,a)}n.length>0&&i._pageDictionary.update("Annots",n)},e.prototype._groupFormFieldsKids=function(t,e,i,r,n,s,a,o,h,c,_){if(e._dictionary.has("Kids")&&t._dictionary.has("Kids")){if(null!==o&&void 0!==o&&o>=0&&n.length>o){var d=n[o];if(d&&-1!==i.indexOf(d)){var l=e._crossReference._fetch(d),f=this._copier._copyDictionary(l,!this._isDuplicatePage);f.update("P",s);u=this._crossReference._getNextReference();this._crossReference._cacheMap.set(u,f),a.push(u),f.update("Parent",t._ref),r.push(u),f._updated=!0,t._dictionary._updated=!0,this._isDuplicatePage||((t instanceof pi||t instanceof ui||t instanceof bi)&&f.has("AS")&&delete f._map.AS,this._createAppearance(t,e,l,f,c,_))}}}else if(e._dictionary.has("Kids")&&!t._dictionary.has("Kids")||this._isDuplicatePage){g=this._copier._copyDictionary(t._dictionary,!this._isDuplicatePage);this._updateFieldsWithKids(t,e,g,o,h,s,n,a,c,t._dictionary)}else if(!e._dictionary.has("Kids")&&t._dictionary.has("Kids")){var p=this._copier._copyDictionary(e._dictionary);this._updateFieldDictionary(p,s,t._ref);var u=this._crossReference._getNextReference();this._crossReference._cacheMap.set(u,p),r.push(u),a.push(u),t._dictionary._updated=!0,this._createAppearance(t,e,e._dictionary,p,c,_)}else if(!e._dictionary.has("Kids")&&!t._dictionary.has("Kids")){var g=this._copier._copyDictionary(t._dictionary),y=this._copier._copyDictionary(e._dictionary,!this._isDuplicatePage);this._removeFieldDictionary(y,["Parent","FT","T","Ff"]),y.update("P",s),this._updateFieldsWithKids(t,e,g,o,h,s,n,a,c,y)}return a},e.prototype._updateFieldsWithKids=function(t,e,i,r,n,s,a,o,h,c){var _=this._crossReference._getNextReference(),d=this._createNewFieldDictionary(i,t._dictionary);d.objId=_.toString(),this._crossReference._cacheMap.set(_,d);var l=this._destinationDocument.form._parseFields(d,_);t._dictionary.update("Parent",_),l._dictionary._updated=!0,this._updateFieldDictionary(i,s,_),this._destinationDocument.form._dictionary._updated=!0;var f;f=void 0!==a&&a.length>0&&void 0!==r&&null!==r&&a.length>r&&r>=0?e._crossReference._fetch(a[r]):c;var p=this._copier._copyDictionary(f,!this._isDuplicatePage);(t instanceof pi||t instanceof ui||t instanceof bi)&&p.has("AS")&&delete p._map.AS;var u=this._crossReference._getNextReference();this._crossReference._cacheMap.set(u,p),p.update("P",s),o.push(u),p.update("Parent",l._ref);var g=[];g.push(t._ref),g.push(u),p._updated=!0,t._dictionary._updated=!0,d.update("Kids",g),l._kids=g,this._formFieldsCollection.set(n,_),this._destinationDocument.form._parsedFields.set(n,l),this._isDuplicatePage||this._createAppearance(l,e,f,p,h),d._updated=!0},e.prototype._removeFieldDictionary=function(t,e){return e.forEach(function(e){t.has(e)&&delete t._map[e]}),t},e.prototype._updateFieldDictionary=function(t,e,i){(t=this._removeFieldDictionary(t,["Parent","FT","T","Ff"])).update("P",e),t.update("Parent",i),t._updated=!0},e.prototype._createNewFieldDictionary=function(t,e){var i=new $r(this._crossReference);return["Parent","FT","T","V","Ff","TU","Opt","I"].forEach(function(r){t.has(r)&&(i.update(r,t.get(r)),delete t._map[r],delete e._map[r])}),i},e.prototype._getItemStyle=function(t,e){var i=t._dictionary.get("MK");i&&i.has("CA")?t._styleText=i.get("CA").charAt(0):t._styleText=e instanceof yi?"l":"4"},e.prototype._createAppearance=function(t,e,i,r,n,s){var a,o=t._kidsCount-1;if(t instanceof gi)(h=t.itemAt(o))._enableGrouping=!0,this._getItemStyle(h,t),e instanceof yi?(h._dictionary.update("AS",Xr.get("Off")),a=Z(i)):h._postProcess(t.checked?"Yes":"Off"),t._drawAppearance(h,a);else if(t instanceof yi){h=t.itemAt(o);this._getItemStyle(h,t),h._dictionary.has("AS")?h._postProcess(h._dictionary.get("AS").name):h._postProcess("Off"),h._enableGrouping=!0,t._enableGrouping=!0,t._drawAppearance(h)}else if(t instanceof mi){var h=t.itemAt(o);if(void 0!==s&&(h.rotationAngle=s.rotationAngle),h&&!t._checkFieldFlag(h._dictionary)){h._enableGrouping=!0;var c=t._createAppearance(h);t._addAppearance(h._dictionary,c,"N"),h._dictionary._updated=!0}}else if(t instanceof pi||t instanceof ui||t instanceof wi){var _=Ji._load(r,this._crossReference);if(void 0!==s&&null!==s&&t instanceof wi)t._createAppearance(s,!1);else{_.setAppearance(!0),_._enableGrouping=!0;var d=void 0;d=void 0!==s&&null!==s?this._obtainFont(s._dictionary,n):this._obtainFont(r,n),_._pdfFont=d,t instanceof wi?t._createAppearance(_,!1):t._postProcess(!1,_)}}},e.prototype._obtainFont=function(e,i){var r,n="",s=8;if(e&&(e.has("DS")||e.has("DA")))if(e.has("DS"))e.get("DS").split(";").forEach(function(t){var e=t.split(":");if(-1!==t.indexOf("font-family"))n=e[1];else if(-1===t.indexOf("font-style")&&-1!==t.indexOf("font")){for(e[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(n+=t+" ")});" "!==n&&n.endsWith(" ");)n=n.substring(0,n.length-2);-1!==n.indexOf(",")&&(n=n.split(",")[0])}});else{var a=e.get("DA");if(a&&""!==a&&-1!==a.indexOf("Tf")){var o=a.split(" ");o.forEach(function(t,e){if(-1!==t.indexOf("Tf")){for(n=o[e-2];""!==n&&n.length>1&&"/"===n[0];)n=n.substring(1);s=Number.parseFloat(o[e-1])}}),0===s&&(s=8)}}n=n.trim();var h,c=t.PdfFontStyle.regular;if(void 0!==i&&i.has("Font")){var _=i.get("Font").get(n);void 0!==_&&(h=_.get("BaseFont").name,c=this._getFontStyle(h))}switch(n){case"Helv":r=new ti(t.PdfFontFamily.helvetica,s,c);break;case"Courier":case"Cour":r=new ti(t.PdfFontFamily.courier,s,c);break;case"Symb":r=new ti(t.PdfFontFamily.symbol,s,c);break;case"TiRo":case"TiIt":r=new ti(t.PdfFontFamily.timesRoman,s,c);break;case"ZaDb":r=new ti(t.PdfFontFamily.zapfDingbats,s,c);break;default:r=new ti(t.PdfFontFamily.helvetica,s,c)}return r},e.prototype._getFontStyle=function(e){var i=t.PdfFontStyle.regular;return e.includes("Bold")?i=t.PdfFontStyle.bold:e.includes("Italic")&&(i=t.PdfFontStyle.italic),i},e.prototype._importFormField=function(t,e,i,r){var n=this._destinationDocument.form,s=[];i&&i._pageDictionary&&i._pageDictionary.has("Annots")&&(s=i._pageDictionary.get("Annots"));var a=[],o=[];if(this._destinationDocument.form._dictionary.has("Fields")){var h=this._destinationDocument.form;this._fieldCount=h.count;for(var c=0;c<this._fieldCount;c++){var _=h.fieldAt(c).name;this._fieldNames.push(_)}}t._pageDictionary.has("Annots")&&(o=t._pageDictionary.get("Annots"));for(var d=e.count,l=0;l<d;++l){var f=e.fieldAt(l);if(f._dictionary.has("Kids"))if((a=f._dictionary.get("Kids")).length>1){for(var p=0;p<a.length;p++)if(f.itemAt(p).page===t){s=this._insertFormFields(l,r,f,n,i._ref,s,o);break}}else 1===a.length&&f.page===t&&(s=this._insertFormFields(l,r,f,n,i._ref,s,o));else f.page===t&&(s=this._insertFormFields(l,r,f,n,i._ref,s,o))}if(e._dictionary.has("DR")){var u=e._dictionary.get("DR"),g=this._copier._copyDictionary(u),y=void 0;if(g.has("Font")&&(y=g.get("Font")),this._destinationDocument.form._dictionary.has("DR")){var m=this._destinationDocument.form._dictionary.get("DR");if(m.has("Font")){var b=m.get("Font");y&&y.forEach(function(t,e){b.set(t,e)}),b._updated=!0}}else this._destinationDocument.form._dictionary.update("DR",g)}s.length>0&&i._pageDictionary.update("Annots",s)},e.prototype._insertFormFields=function(t,e,i,r,n,s,a){var o=this,h=new $r;i._dictionary.has("Kids")?i._dictionary.forEach(function(t,e){"Kids"!==t&&h.update(t,e)}):h=this._copier._copyDictionary(i._dictionary);var c=this._crossReference._getNextReference();h.objId=c.toString();var _=r._parseFields(h,n);if(this._crossReference._cacheMap.set(c,_._dictionary),i._dictionary.has("Kids")){var d=[];i._dictionary.get("Kids").forEach(function(t){if(-1!==a.indexOf(t)){var e=i._crossReference._fetch(t),r=o._copier._copyDictionary(e);r.update("P",n),r.update("Parent",c),r._updated=!0;var h=o._crossReference._getNextReference();o._crossReference._cacheMap.set(h,r),s.push(h),d.push(h)}}),h.update("Kids",d),_._kids=d}else _._dictionary.update("P",n),s.push(c);_._dictionary._updated=!0;for(var l=0,f=_.name,p=!1;-1!==this._fieldNames.indexOf(f);)f=_.name+l,p=!0,++l;return p&&(_._dictionary.update("T",f),_._name=f),_._dictionary._updated=!0,this._fieldCount>0?(this._destinationDocument.form._parsedFields.set(this._fieldCount,_),_._annotationIndex=this._fieldCount,this._fieldCount++):(this._destinationDocument.form._parsedFields.set(t,_),_._annotationIndex=t),this._destinationDocument.form._fields.push(c),s},e.prototype._mergeFormFieldsWithDocument=function(){var t;this._formFieldsCollection.size>0?(t=this._destinationDocument.form._dictionary.get("Fields"),this._formFieldsCollection.forEach(function(e,i){t[i]=e})):t=this._destinationDocument.form._fields,this._destinationDocument.form._dictionary.get("NeedAppearances")&&this._destinationDocument.form._dictionary.set("NeedAppearances",!1),this._destinationDocument.form._dictionary.set("Fields",t),this._destinationDocument.form._fields=t,this._destinationDocument.form._dictionary._updated=!0},e.prototype._importLayers=function(t,e){if(this._isLayersPresent=e,this._isLayersPresent&&this._destinationDocument._catalog._catalogDictionary.has("OCProperties")){var i=this._destinationDocument._catalog._catalogDictionary.get("OCProperties"),r=t.get("OCProperties");if(i.has("OCGs")){var n=i.get("OCGs"),s=r.get("OCGs");n.length>0&&n.push.apply(n,s)}if(i._updated=!0,i.has("D")&&r.has("D")){var a=i.get("D"),o=r.get("D");if(a&&o){if(a.has("Order")&&o.has("Order")){var h=a.get("Order"),c=o.get("Order");h.length>0&&c.length>0&&h.push.apply(h,c)}else o.has("Order")&&a.set("Order",o.get("Order"));if(a.has("RBGroups")&&o.has("RBGroups")){var _=a.get("RBGroups"),d=o.get("RBGroups");_.length>0&&d.length>0&&_.push.apply(_,d)}else o.has("RBGroups")&&(a.set("RBGroups",o.get("RBGroups")),a._updated=!0);if(a.has("ON")&&o.has("ON")){var l=a.get("ON"),f=o.get("ON");l.length>0&&f.length>0&&l.push.apply(l,f)}else o.has("ON")&&a.set("ON",o.get("ON"));if(a.has("AS")&&o.has("AS")){var p=a.get("AS"),u=o.get("AS");if(p.length>0&&u.length>0){var g=u[0],y=p[0];if(g instanceof Qr&&y instanceof Qr&&(g=this._crossReference._fetch(g),y=this._crossReference._fetch(y)),g.has("OCGs")&&y.has("OCGs")){var m=g.get("OCGs"),b=y.get("OCGs");m.length>0&&b.length>0&&b.push.apply(b,m)}p.push.apply(p,u)}}else o.has("AS")&&a.set("AS",o.get("AS"));if(a.has("OFF")&&o.has("OFF")){var v=a.get("OFF"),w=o.get("OFF");v.length>0&&w.length>0&&v.push.apply(v,w)}else o.has("OFF")&&a.set("OFF",o.get("OFF"))}if(a.has("Locked")&&o.has("Locked")){var S=a.get("Locked"),P=o.get("Locked");S.length>0&&P.length>0&&S.push.apply(S,P)}else o.has("Locked")&&a.set("Locked",o.get("Locked"))}else r.has("D")&&i.set("D",r.get("D"));i._updated=!0,this._destinationDocument._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0}else this._isLayersPresent&&(this._destinationDocument._catalog._catalogDictionary.update("OCProperties",t.get("OCProperties")),this._destinationDocument._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0)},e.prototype._mergeLayer=function(t,e,i){var r,n=this,s=t.get("Resources").get("XObject");s&&s.forEach(function(t,e){r=n._crossReference._fetch(e)});var a;r&&(a=r.dictionary.get("Resources"));var o,h,c=new Map,_=e.get("Resources");if(_.has("Properties")){_.get("Properties").forEach(function(t,e){c.set(t,e)});var d=new $r(this._crossReference);c.forEach(function(t,e){n._newList.forEach(function(i,r){t===r&&d.set(e,i)})}),a.set("Properties",d),a._updated=!0,d._updated=!0}else _.has("XObject")&&(o=a.get("XObject"),_.get("XObject").forEach(function(t,e){e instanceof Qr&&(h=i._fetch(e)).dictionary.forEach(function(e,i){"OC"===e&&n._newList.forEach(function(r,n){if(n===i&&o.has(t)){var s=o.get(t);s.dictionary.set(e,r),s._updated=!0}})})}));if(this._annotationLayer.size>0){var l=t._get("Annots");this._annotationLayer.forEach(function(t,e){var i=l[e],r=n._crossReference._fetch(i);n._newList.forEach(function(e,i){t===i&&r.set("OC",e)})})}},e.prototype._exportBookmarks=function(t,e){var i=this;if(this._bookmarks.length>0){var r=this._bookmarks,n=this._destinationDocument.bookmarks,s=t.bookmarks,a=void 0;if(s){var o=[],h={index:0,base:n,kids:s._bookMarkList};t.pageCount!==e&&(h={index:0,base:n,kids:r},a=[]);do{for(var c=this;h.index<h.kids.length;)!function(){if(s=h.kids[h.index],-1!==r.indexOf(s)&&void 0!==a&&-1===a.indexOf(s.title)){var _=s,d=n.add(_.title),l=_.destination;d.color=_.color,d.textStyle=_.textStyle;var f=null,p=null,u=null;if(b=_.namedDestination){if(b.destination&&(u=b.destination.page,c._bookmarksPageLinkReference.forEach(function(t,e){u._ref===e&&(p=i._destinationDocument.getPage(t))}),p)){v=c._getNamedDestination(b,p);d.namedDestination=v,delete d._dictionary._map.C,c._namedDestinations.push(v._title);var g=c._crossReference._getNextReference();c._crossReference._cacheMap.set(g,v._dictionary),c._namedDestinations.push(g)}}else l&&(u=l.page,c._bookmarksPageLinkReference.forEach(function(t,e){u._ref===e&&(p=i._destinationDocument.getPage(t))}),p&&((f=new ur(p,l.location)).mode=l.mode,f.zoom=l.zoom,f.location=l.location,d.destination=f));n=d,a.push(d.title)}else if(void 0===a||void 0!==a&&-1===a.indexOf(s.title)){var l=(_=s).destination,f=null,y=null,m=null,b=_.namedDestination;if(t.pageCount===e){d=n.add(_.title);if(_._dictionary.has("A")&&d._dictionary.update("A",_._dictionary.get("A")),d.textStyle=_.textStyle,d.color=_.color,b){if(b._destination&&(m=b.destination.page,c._bookmarksPageLinkReference.forEach(function(t,e){m._ref===e&&(y=i._destinationDocument.getPage(t))}),y)){var v=c._getNamedDestination(b,y);d.namedDestination=v,delete d._dictionary._map.C,c._namedDestinations.push(v._title);var w=c._crossReference._getNextReference();c._crossReference._cacheMap.set(w,v._dictionary),c._namedDestinations.push(w)}}else l&&(m=l.page,c._bookmarksPageLinkReference.forEach(function(t,e){m._ref===e&&(y=i._destinationDocument.getPage(t))}),y&&((f=new ur(y,l.location)).mode=l.mode,f.zoom=l.zoom,f.location=l.location,d.destination=f));n=d}}h.index+=1,s.count>0?(o.push(h),h={index:0,base:n,kids:s._bookMarkList}):n=h.base}();if(o.length>0){for(h=o.pop();h.index===h.kids.length&&o.length>0;)h=o.pop();n=h.base}}while(h.index<h.kids.length)}var _=void 0;if(this._namedDestinations.length>0){var d=new $r(this._crossReference);d.update("Names",this._namedDestinations),_=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(_,d),(d=new $r(this._crossReference)).update("Dests",_),_=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(_,d),this._destinationDocument._catalog._catalogDictionary.set("Names",_)}this._destinationDocument._catalog._catalogDictionary._updated=!0,this._destinationDocument._catalog._catalogDictionary.isCatalog=!0,this._crossReference._allowCatalog=!0}},e.prototype._getNamedDestination=function(t,e){var i=new lr(t.title);return i.destination=this._getDestination(e,t.destination),i},e.prototype._getDestination=function(t,e){var i=new ur(t,e.location);return i._location=e._location,i.mode=e.mode,i.zoom=e.zoom,i.location=e.location,i},e.prototype._writeObject=function(t,e,i,r,n,s,a){if(i instanceof Xr||"string"==typeof i||"number"==typeof i||"boolean"==typeof i)this._writeDictionary(i,e,n,s,a,null);else if(Array.isArray(i)){var o=[];this._writeArray(t,o,i,r),this._writeDictionary(null,e,n,s,a,o)}else if(i instanceof $r){var h=new $r(this._crossReference);this._writePropertiesDictionary(t,h,i),this._writeDictionary(null,e,n,s,a,h)}else i instanceof Qr&&this._crossReference?this._writeObject(t,e,t._crossReference._fetch(i),r,n,s,i):null!==i&&void 0!==i||this._writeDictionary("null",e,n,s,a,null)},e.prototype._writeDictionary=function(t,e,i,r,n,s){if(i&&t)e.set(i,t);else if(i&&s)e.set(i,s);else if(s&&!n)r.push(s);else if(t)r.push(t);else if(n){var a;if(this._newList&&this._newList.size>0&&this._newList.forEach(function(t,e){e===n&&(a=t)}),a)r.push(a);else{var o=s;a=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(a,o),o._updated=!0,r.push(a),this._newList.set(n,a)}}},e.prototype._writeArray=function(t,e,i,r){var n=this;i.forEach(function(i){n._writeObject(t,null,i,r,null,e)})},e.prototype._writePropertiesDictionary=function(t,e,i){var r=this;i&&i.size>0&&i.forEach(function(n,s){r._writeObject(t,e,s instanceof Qr?i.get(n):s,i,n)})},e.prototype._fixDestinations=function(t){var e=this._pageReference;this._destination.length>0&&this._destination.forEach(function(i){if(i instanceof Array){var r=i;if(r.length>0&&r[0]&&r[0]instanceof Qr){var n=t._crossReference._fetch(r[0]),s=e.get(n);n&&e.has(n)&&null!==s&&(r[0]=s._ref),n&&e.has(n)&&null===s&&(r[0]=null)}}})},e.prototype._insertNewPage=function(e,i){var r,n=new ls;n.size=e.size,n.margins.left=0,n.margins.top=0,n.margins.right=0,n.margins.bottom=0,void 0!==this._options&&void 0!==this._options.rotation?n.rotation=this._options.rotation:n.rotation=e.rotation,n.orientation=e.size[0]>e.size[1]?t.PdfPageOrientation.landscape:t.PdfPageOrientation.portrait,r=void 0!==i?this._destinationDocument.addPage(i,n):this._destinationDocument.addPage(n);var s=e._pageDictionary;if(s._get("MediaBox")){var a=s._get("MediaBox");r._pageDictionary.update("MediaBox",a)}if(s._get("CropBox")){var o=s._get("CropBox");r._pageDictionary.update("CropBox",o)}if(void 0!==this._options.rotation||e._pageDictionary.has("Rotate")){var h=void 0;h=(h=void 0!==this._options.rotation?90*Math.floor(this._options.rotation):90*Math.floor(e.rotation))>=360?h%360:h,r._pageDictionary.update("Rotate",h)}return r},e.prototype._objectDispose=function(){this._bookmarkHashTable=new Map,this._namedDestinations=[],this._bookmarks=[],this._pageReference=new Map,this._bookmarksPageLinkReference.clear(),this._destination=[],this._newList=new Map,this._annotationLayer=new Map,this._fieldNames=[],this._destinationDocument&&this._destinationDocument._form&&this._destinationDocument._form._widgetReferences&&(this._destinationDocument._form._widgetReferences=[])},e}(),ss=function(){function t(t,e){this._traversedObjects=new Map,this._isGroupingSupport=!1,this._targetCrossReference=t,this._sourceCrossReference=e}return t.prototype._copy=function(t){var e;return t instanceof $r?e=this._copyDictionary(t):Array.isArray(t)?e=this._copyArray(t):t instanceof rn?e=this._copyStream(t):t instanceof Qr?e=this._copyReference(t):(t instanceof Xr||"number"==typeof t||"string"==typeof t||"boolean"==typeof t)&&(e=t),e},t.prototype._copyDictionary=function(t,e){var i=this,r=new $r(this._targetCrossReference);return t&&t.size>0&&t.forEach(function(t,n){if("OC"===t&&n instanceof Array||"P"!==t&&"Parent"!==t&&"Dest"!==t&&"OC"!==t&&("AP"!==t||!e)){var s=i._copy(n);null!==s&&void 0!==s&&r.update(t,s)}}),r._updated=!0,r},t.prototype._copyArray=function(t){var e=this,i=[];return t.forEach(function(t){i.push(e._copy(t))}),i},t.prototype._copyStream=function(t){var e,i=!1,r=t;if(t.dictionary.has("Subtype")&&"Image"===t.dictionary.get("Subtype").name)if(i=!0,t instanceof nn)e=t.getByteRange(t.offset,t.end);else if(t&&r.stream&&r.stream instanceof nn)if("boolean"==typeof r._initialized&&r._cipher){s=r.stream.end-r.stream.start;r.getBytes(s),e=r.buffer.subarray(0,r.bufferLength)}else e=(a=r.stream).getByteRange(a.start,a.end);else if(r.stream&&r.stream.stream){var n=r.stream;if(n.stream instanceof nn&&"boolean"==typeof n._initialized&&n._cipher){var s=n.stream.end-n.stream.start;n.getBytes(s),e=n.buffer.subarray(0,n.bufferLength)}else if(n.stream&&n.stream instanceof nn){var a=n.stream;e=a.getByteRange(a.start,a.end)}else e=[]}else(!(e=t.getBytes())||0===e.length)&&t instanceof sn&&(e=t._bytes);else(!(e=t.getBytes())||0===e.length)&&t instanceof sn&&(e=t._bytes);var o=new sn(Array.from(e));return o._isImage=i,o.dictionary=this._copyDictionary(t.dictionary),o.dictionary._updated=!0,o},t.prototype._copyReference=function(t){if(this._traversedObjects.has(t))return this._traversedObjects.get(t);this._traversedObjects.set(t,null);var e=this._sourceCrossReference._fetch(t),i=this._copy(e);if(i instanceof $r||i instanceof rn){var r=this._addToDestination(i);return this._traversedObjects.set(t,r),r}return this._traversedObjects.set(t,i),i},t.prototype._addToDestination=function(t){var e=this._targetCrossReference._getNextReference();return this._targetCrossReference._cacheMap.set(e,t),t.objId=e.objectNumber+" "+e.generationNumber,e},t}(),as=function(){function e(){this._visible=!0,this._printState=t.PdfPrintState.printWhenVisible,this._isEndState=!1,this._dictionary=new $r,this._pages=[],this._subLayer=[],this._locked=!1,this._parentLayer=[],this._child=[],this._graphicsCollection=new Map,this._pageGraphics=new Map,this._pageParsed=!1,this._xObject=[],this._content=new sn([])}return Object.defineProperty(e.prototype,"_layerPage",{get:function(){return this._pageParsed||this._parseLayerPage(),this._page},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_layerId",{get:function(){return this._pageParsed||this._parseLayerPage(),this._id},set:function(t){this._id=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name||""},set:function(t){this._name=t,this._dictionary&&this._name&&""!==this.name&&this._dictionary.update("Name",this._name)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){if(this._dictionary){var t=this._dictionary.get("Visible");"boolean"==typeof t&&(this._visible=t)}return this._visible},set:function(t){this._visible=t,this._dictionary&&this._dictionary.update("Visible",t),this._setVisibility(t),this._document._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"locked",{get:function(){return this._locked},set:function(t){this._locked=t,"boolean"==typeof t&&this._setLock(t),this._document._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"printState",{get:function(){return this._printState},set:function(e){this._printState=e,this._printOption?this.printState===t.PdfPrintState.alwaysPrint?this._printOption.update("PrintState",new Xr("ON")):this.printState===t.PdfPrintState.neverPrint&&this._printOption.update("PrintState",new Xr("OFF")):this._setPrintState()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"layers",{get:function(){return this._layers||(this._layers=new os(this._document,this._layer),this._layers._subLayer=!0),this._layers},enumerable:!0,configurable:!0}),e.prototype.createGraphics=function(t){return this._graphics&&!this._needInitializeGraphics||(this._page=t,this._crossReference=t._crossReference,this._parseGraphics()),this._graphics},e.prototype._parseGraphics=function(){this._loadContents();var t=new sn([32,113,32,10]),e=this._crossReference._getNextReference();this._crossReference._cacheMap.set(e,t),this._page._contents.splice(0,0,e);var i=new sn([32,81,32,10]),r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,i),this._page._contents.push(r);var n=new sn([]),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),this._page._contents.push(s),this._page._pageDictionary.set("Contents",this._page._contents),this._page._pageDictionary._updated=!0,this._initializeGraphics(n),this._initializeProperties()},e.prototype._initializeProperties=function(){var t=this._graphics._resourceObject;if(t&&t.has("Properties"))if(i=t.get("Properties"))i.update(this._id,this._referenceHolder);else{var e=new $r;e.update(this._id,this._referenceHolder),t.update("Properties",e)}else{var i=new $r;i.update(this._id,this._referenceHolder),t.update("Properties",i)}},e.prototype._loadContents=function(){var t,e=this._page._pageDictionary.getRaw("Contents");e&&e&&e instanceof Qr&&(t=e,e=this._crossReference._fetch(t)),e&&e instanceof rn?this._page._contents=[t]:e&&Array.isArray(e)?this._page._contents=e:this._page._contents=[]},e.prototype._initializeGraphics=function(e){var i=!1,r=0,n=0,s=0,a=0,o=this._page.size,h=this._page.mediaBox;h&&h.length>=4&&(r=h[0],n=h[1],s=h[2],a=h[3]);var c;if(this._page._pageDictionary.has("CropBox"))if((c=this._page.cropBox)&&c.length>=4){var _=c[0],d=c[1],l=c[2],f=c[3];(_<0||d<0||l<0||f<0)&&Math.floor(Math.abs(d))===Math.floor(Math.abs(o[1]))&&Math.floor(Math.abs(_))===Math.floor(Math.abs(o[0]))?this._graphics=new br([Math.max(_,l),Math.max(d,f)],e,this._crossReference,this._page):(this._graphics=new br(o,e,this._crossReference,this._page),this._graphics._cropBox=c)}else this._graphics=new br(o,e,this._crossReference,this._page);else if((r<0||n<0||s<0||a<0)&&Math.floor(Math.abs(n))===Math.floor(Math.abs(o[1]))&&Math.floor(Math.abs(s))===Math.floor(Math.abs(o[0]))){var p=Math.max(r,s),u=Math.max(n,a);(p<=0||u<=0)&&(i=!0,r<0&&(r=-r),n<0&&(n=-n),s<0&&(s=-s),a<0&&(a=-a),p=Math.max(r,s),u=Math.max(n,a)),this._graphics=new br([p,u],e,this._crossReference,this._page)}else this._graphics=new br(o,e,this._crossReference,this._page);this._page._pageDictionary.has("MediaBox")&&(this._graphics._mediaBoxUpperRightBound=i?-n:a),this._graphicsState=this._graphics.save();var g=this._page._origin;if(g[0]>=0&&g[1]>=0||Math.sign(g[0])!==Math.sign(g[1])?this._graphics._initializeCoordinates():this._graphics._initializeCoordinates(this._page),!this._page._isNew){var y=this._page.rotation;if(!Number.isNaN(y)&&(y!==t.PdfRotationAngle.angle0||this._page._pageDictionary.has("Rotate"))){var m=void 0;m=this._page._pageDictionary.has("Rotate")?this._page._pageDictionary.get("Rotate"):90*y;var b=this._graphics._clipBounds;90===m?(this._graphics.translateTransform(0,o[1]),this._graphics.rotateTransform(-90),this._graphics._clipBounds=[b[0],b[1],o[0],o[1]]):180===m?(this._graphics.translateTransform(o[0],o[1]),this._graphics.rotateTransform(-180)):270===m&&(this._graphics.translateTransform(o[0],0),this._graphics.rotateTransform(-270),this._graphics._clipBounds=[b[0],b[1],o[1],o[0]])}}if(this._page._isNew&&this._page._pageSettings){var v=this._page._getActualBounds(this._page._pageSettings);this._graphics._clipTranslateMargins(v)}this._needInitializeGraphics=!1,this._graphicsCollection.has(this._graphics)||this._graphicsCollection.set(this._graphics,this._graphics),this._pageGraphics.has(this._page)||this._pageGraphics.set(this._page,this._graphics),-1===this._pages.indexOf(this._page)&&this._pages.push(this._page),this._graphics._layer=this},e.prototype._beginLayer=function(t){var e=this;if(this._graphicsCollection&&(this._graphicsCollection.has(t)?this._graphics=this._graphicsCollection.get(t):this._graphics=t),this._graphics&&this._name&&""!==this._name){this._graphics._isEmptyLayer=!0,0!==this._parentLayer.length&&this._parentLayer.forEach(function(t){t._id&&""!==t._layerId&&e._graphics._sw._write("/OC /"+t._id+" BDC")});var i="/OC /"+this._id+" BDC";this.name&&""!==this.name?(this._graphics._sw._write(i),this._isEndState=!0):this._content.write(i)}},e.prototype._setVisibility=function(t){var e,i=this._document._catalog._catalogDictionary;if(i.has("OCProperties")&&((e=i.get("OCProperties"))||(e=new $r(this._crossReference))),e){var r=void 0,n=void 0,s=e.get("D");if(s||(s=new $r(this._crossReference)),s){if(s.has("ON")&&((n=s.get("ON"))||(n=[])),s.has("OFF")&&((r=s.get("OFF"))||(r=[])),this._referenceHolder)if(t){if(r&&-1!==(a=r.indexOf(this._referenceHolder))&&r.splice(a,1),n){var a=n.indexOf(this._referenceHolder);-1!==a&&n.splice(a)}n.push(this._referenceHolder)}else n&&-1!==(a=n.indexOf(this._referenceHolder))&&n.splice(a,1),r&&-1!==(a=r.indexOf(this._referenceHolder))&&r.splice(a),r.push(this._referenceHolder);s._updated=!0}e._updated=!0}},e.prototype._setLock=function(t){var e,i=this._document._catalog._catalogDictionary;if(i.has("OCProperties")&&((e=i.get("OCProperties"))||(e=new $r(this._crossReference))),e){var r=e.get("D");if(r||(r=new $r(this._crossReference)),r){var n=r.get("Locked");if(this._referenceHolder)if(t)n?-1===n.indexOf(this._referenceHolder)&&n.push(this._referenceHolder):(this._lock=[],this._lock.push(this._referenceHolder),r.update("Locked",this._lock));else if(n){var s=n.indexOf(this._referenceHolder);-1!==s&&n.splice(s,1)}r._updated=!0}e._updated=!0}},e.prototype._parseLayerPage=function(){if(this._document)for(var t=0;t<this._document.pageCount;t++){var e=this._document.getPage(t)._pageDictionary,i=this._document.getPage(t);if(e.has("Resources")){var r=e.get("Resources");if(r&&(r.has("Properties")||r.has("XObject"))){var n=r.get("Properties"),s=r.get("XObject");if(n){_=n._map;for(var a in _)if(_[String(a)]instanceof Qr){var o=_[String(a)],h=this._crossReference._fetch(o),c=a;if(f=this._parseDictionary(h,o,i,c))break}}if(s){var _=s._map;for(var a in _)if(_[String(a)]instanceof Qr){o=_[String(a)];if((h=this._crossReference._fetch(o).dictionary).has("OC")){var d=a,l=h.getRaw("OC");h=this._crossReference._fetch(l);var f=this._parseDictionary(h,l,i,d);if(f){this._layer._xObject.push(d);break}}}}}}}},e.prototype._parseDictionary=function(t,e,i,r){var n=this,s=!1;if(t.has("Name")&&t.has("OCGs")){var a=t.get("OCGs");a?a.forEach(function(a){a instanceof Qr&&(e=a,t=n._crossReference._fetch(e),s=n._setLayerPage(e,i,r))}):(e=t.getRaw("OCGs"),(t=t.get("OCGs"))&&t.has("Name")&&(s=this._setLayerPage(e,i,r)))}else t.has("Name")&&(s=this._setLayerPage(e,i,r));return s},e.prototype._setLayerPage=function(t,e,i){var r=!1;return this._layer._referenceHolder&&this._layer._referenceHolder===t&&(this._layer._pageParsed=!0,r=!0,this._layer._layerId=i,this._layer._page=e,-1===this._layer._pages.indexOf(e)&&this._layer._pages.push(e)),r},e.prototype._setPrintState=function(){var e,i,r=this._document._catalog._catalogDictionary;r.has("OCProperties")&&((e=r.get("OCProperties"))||(e=new $r(this._crossReference)));var n=e.get("OCGs");n||(n=[]),i=this._dictionary.has("Usage")?this._dictionary.get("Usage"):new $r,this._layer._printOption=new $r,this._layer._printOption.update("Subtype",new Xr("Print")),this._layer._printState===t.PdfPrintState.neverPrint?this._layer._printOption.update("PrintState",new Xr("OFF")):this._layer.printState===t.PdfPrintState.alwaysPrint&&this._layer._printOption.update("PrintState",new Xr("ON"));var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,this._layer._printOption),i.update("Print",s),this._layer._usage=i,this._dictionary.update("Usage",this._layer._usage);var a=[];a.push(new Xr("Print"));var o=new $r;o.update("Category",a),o.update("OCGs",n),o.update("Event",new Xr("Print"));var h=[];s=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(s,o),h.push(s);var c=e.get("D");c||(c=new $r(this._crossReference)),c.update("D",h)},e}(),os=function(){function e(t,e){var i=this;if(this._subLayer=!1,this._isLayerContainsResource=!1,this._layerDictionary=new Map,this._bdcCount=0,this._list||(this._list=[]),this._crossReference=t._crossReference,this._catalog=t._catalog,this._document=t,e)this._parent=e;else{var r,n;if(this._document&&this._document._catalog&&this._document._catalog._catalogDictionary&&this._document._catalog._catalogDictionary.has("OCProperties")){var s=this._document._catalog._catalogDictionary.get("OCProperties");if(s&&s.has("OCGs")){var a=s.get("OCGs");a&&Array.isArray(a)&&a.forEach(function(e){if((n=e)instanceof Qr){r=i._crossReference._fetch(n);var s=new as;if(r){if(r.has("Name")){var a=r.get("Name");s.name=a,s._dictionary=r,s._crossReference=i._document._crossReference,s._referenceHolder=n;var o=r.get("LayerID");o&&(s._layerId=o.name);var h=r.getRaw("Usage");if(h&&h instanceof $r){var c=h.get("Print");c&&c instanceof $r&&(s._printOption=c,c.has("PrintState")&&i._setPrintState(c,s)),(p=h.get("View"))&&p instanceof $r&&p.has("ViewState")&&"OFF"===(u=p.get("ViewState")).name&&(s.visible=!1)}if(h&&h instanceof Qr){var _=i._crossReference._fetch(h);if(_&&_ instanceof $r){var d=_.getRaw("Print");if(d&&d instanceof Qr){var l=i._crossReference._fetch(d);l&&l instanceof $r&&(s._printOption=l,l.has("PrintState")&&i._setPrintState(l,s))}var f=_.getRaw("View");if(f&&f instanceof Qr){var p=i._crossReference._fetch(f);if(p&&p instanceof $r&&p.has("ViewState")){var u=p.get("ViewState");"OFF"===u.name&&(s.visible=!1)}}}}}s._document=t,s._layer=s,i._layerDictionary.set(n,s),i._list.push(s)}}}),this._checkLayerLock(s),this._checkLayerVisible(s),this._checkParentLayer(s),this._createLayerHierarchical(s)}}}}return Object.defineProperty(e.prototype,"_isSkip",{get:function(){return this._bdcCount>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._list.length},enumerable:!0,configurable:!0}),e.prototype.at=function(t){return this._list[t]},e.prototype.add=function(t,e){var i=new as;return i._document=this._document,i._crossReference=this._document._crossReference,i.name=t,null!==e&&void 0!==e&&(i.visible=e),i._layerId="OCG_"+X(),i._subLayerPosition=0,i._layer=i,this._addLayer(i),i},e.prototype.contains=function(t){if(!t)throw new Error("Layer cannot be null or undefined");return"string"==typeof t?this._list.some(function(e){return e.name===t}):t instanceof as&&-1!==this._list.indexOf(t)},e.prototype.clear=function(){for(var t=this._list.length-1;t>-1;t--){var e=this._list[t];this._removeLayer(e,!0)}this._list.length=0},e.prototype.indexOf=function(t){if(!t)throw new Error("Layer cannot be null or undefined");return this._list.indexOf(t)},e.prototype.move=function(t,e){if(t<0||t>=this._list.length)throw new Error("Index cannot be less than 0 or greater than array length");if(!e)throw new Error("Layer cannot be null or undefined");for(var i,r=0;r<this._list.length;r++)if(this._list[r]===e){i=this.indexOf(this._list[r]);break}null!==i&&void 0!==i&&i!==t&&(this._list.splice(i,1),this._list.splice(t,0,e),this._insertLayer(t,e))},e.prototype.removeAt=function(t,e){if(t<0||t>=this._list.length)throw new Error("Index cannot be less than 0 or greater than array length");var i=this._list[t];if(this._list.splice(t,1),i&&(this._removeLayer(i,e||!1),i._child.length>0))for(var r=0,n=i._child;r<n.length;r++){var s=n[r];this._removeLayer(s,!1);var a=this._list.indexOf(s);-1!==a&&this._list.splice(a,1)}},e.prototype.remove=function(t,e){if(t instanceof as){r=t;-1!==(n=this._list.indexOf(r))&&this.removeAt(n,e||!1)}else if("string"==typeof t)for(var i=0;i<this._list.length;i++){var r=this._list[i],n=this._list.indexOf(r);r.name===t&&-1!==n&&(this.removeAt(n,e||!1),i-=1)}},e.prototype._setPrintState=function(e,i){var r=e.get("PrintState");r&&r instanceof Xr&&("ON"===r.name?i.printState=t.PdfPrintState.alwaysPrint:i.printState=t.PdfPrintState.neverPrint)},e.prototype._addLayer=function(t){this._list.push(t);var e=this._list.length-1;return this._document instanceof cs&&this._createLayer(t),t._layer=t,e},e.prototype._createLayer=function(t){var e=this,i=new $r(this._crossReference),r=this._createOptionalContentDictionary(t),n=!1;if(this._document&&this._document._catalog&&this._document._catalog._catalogDictionary.has("OCProperties")&&this._isLayerContainsResource){var s=this._document._catalog._catalogDictionary.get("OCProperties");if(s&&s.has("OCGs")){var a=s.get("OCGs");if(a&&r){n=!0;for(var o=0,h=r;o<h.length;o++){var c=h[o];-1===a.indexOf(c)&&a.push(c)}}if(s.has("D")){var _=s.get("D");if(_){var d=void 0,l=void 0,f=void 0;_.has("Order")||_.update("Order",this._document._order),_.has("OFF")&&(l=_.get("OFF")),_.has("ON")&&(d=_.get("ON")),_.has("AS")&&(f=_.get("AS")),f&&f.forEach(function(i){var n,s=i;if(s instanceof Qr&&(n=e._crossReference._fetch(s))&&n instanceof $r){var a=n.get("OCGs");a&&r&&-1===a.indexOf(t._referenceHolder)&&a.push(t._referenceHolder)}}),t.visible?d&&r&&-1===d.indexOf(t._referenceHolder)&&d.push(t._referenceHolder):l&&r&&-1===l.indexOf(t._referenceHolder)&&l.push(t._referenceHolder)}}this._document._catalog._catalogDictionary._updated=!0}}n||(i.update("OCGs",r),i.update("D",this._createOptionalContentViews()),this._catalog._catalogDictionary.update("OCProperties",i)),this._crossReference._allowCatalog=!0},e.prototype._createOptionalContentDictionary=function(e){var i=new $r(this._crossReference),r=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(r,i),i.update("Name",e.name),i.update("Type",new Xr("OCG")),i.update("LayerID",new Xr(e._layerId)),i.update("Visible",e.visible),e.printState===t.PdfPrintState.alwaysPrint||e.printState===t.PdfPrintState.neverPrint||e.printState===t.PdfPrintState.printWhenVisible){var n=this._setPrintOption(e);i.update("Usage",n),this._document._printLayer.push(r)}this._document._optionalContentDictionaries.push(r),e._dictionary=i,e._referenceHolder=r;var s=this._document._catalog._catalogDictionary.get("OCProperties");return this._createSublayer(s,r,e),e.visible?this._document._on.push(r):this._document._off.push(r),this._isLayerContainsResource=!0,this._document._optionalContentDictionaries},e.prototype._createOptionalContentViews=function(){var t=new $r;t.update("Name","Layers"),t.update("Order",this._document._order),t.update("ON",this._document._on),t.update("OFF",this._document._off);var e=[];e.push(new Xr("Print"));var i=new $r;i.update("Category",e),i.update("OCGs",this._document._printLayer),i.update("Event",new Xr("Print"));var r=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(r,i),this._document._as.push(r),t.update("AS",this._document._as),t},e.prototype._setPrintOption=function(e){var i=new $r,r=new $r,n=this._crossReference._getNextReference(),s=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(n,i),this._crossReference._cacheMap.set(s,r),r.update("Subtype",new Xr("Print")),e.printState===t.PdfPrintState.neverPrint?r.update("PrintState",new Xr("OFF")):e.printState===t.PdfPrintState.alwaysPrint&&r.update("PrintState",new Xr("ON")),e._usage=i,e._printOption=r,i.update("Print",s),n},e.prototype._createSublayer=function(t,e,i){if(this._subLayer){if(i._parent=this._parent,t){var r=void 0,n=t.get("D");n&&(r=n.get("Order")),this._document._order&&r&&(this._document._order=r)}if(0===this._parent._child.length)this._parent._subLayer.push(e);else if(-1!==this._document._order.indexOf(this._parent._referenceHolder)){h=this._document._order.indexOf(this._parent._referenceHolder);this._document._order.splice(h+1,1),this._parent._subLayer.push(e)}else this._parent._subLayer.push(e);if(-1!==this._document._order.indexOf(this._parent._referenceHolder)){h=this._document._order.indexOf(this._parent._referenceHolder);this._document._order.splice(h+1,0,this._parent._subLayer)}else if(this._parent._parent){if(-1!==this._parent._parent._subLayer.indexOf(this._parent._referenceHolder)){h=this._parent._parent._subLayer.indexOf(this._parent._referenceHolder);if(1===this._parent._subLayer.length&&this._parent._parent._subLayer.splice(h+1,0,this._parent._subLayer),-1!==this._document._order.indexOf(this._parent._parent._referenceHolder)){var s=this._document._order.indexOf(this._parent._parent._referenceHolder);this._document._order.splice(s+1,1),this._document._order.splice(s+1,0,this._parent._parent._subLayer)}}}else if(document instanceof cs)for(var a=0;a<document._order.length;a++)if(Array.isArray(document._order[a])){var o=document._order[a];if(-1!==o.indexOf(this._parent._referenceHolder)){var h=o.indexOf(this._parent._referenceHolder);if(1===this._parent._subLayer.length){o.splice(h+1,0,this._parent._subLayer);break}}}-1===this._parent._child.indexOf(i)&&this._parent._child.push(i),0===this._parent._parentLayer.length?i._parentLayer.push(this._parent):(this._parent._parentLayer.forEach(function(t){-1===i._parentLayer.indexOf(t)&&i._parentLayer.push(t)}),-1===i._parentLayer.indexOf(this._parent)&&i._parentLayer.push(this._parent))}else if(t){r=void 0;(n=t.get("D"))&&(r=n.get("Order")),r&&(this._document._order=r),this._document._order.push(e)}else this._document._order.push(e)},e.prototype._checkLayerLock=function(t){var e,i=this,r=t.get("D");r&&r.has("Locked")&&(e=r.get("Locked")),e&&e.forEach(function(t){if(t&&t instanceof Qr){var e=i._layerDictionary.get(t);e&&(e.locked=!0)}})},e.prototype._checkLayerVisible=function(t){var e,i=this,r=this._document;if(r._catalog&&r._catalog._catalogDictionary.has("OCProperties")){var n=t.get("D");n&&n.has("OFF")&&(e=n.get("OFF")),e&&e.forEach(function(t){if(t instanceof Qr){var e=i._layerDictionary;if(e&&e.size>0&&t&&e.has(t)){var r=e.get(t);r&&(r.visible=!1,r._dictionary&&r._dictionary.has("Visible")&&r._dictionary.set("Visible",!1))}}})}},e.prototype._checkParentLayer=function(t){var e=t.get("D");if(e){var i=e.get("Order");i&&this._parsingLayerOrder(null,i,this._layerDictionary)}},e.prototype._parsingLayerOrder=function(t,e,i){for(var r,n,s=0;s<e.length;s++)if((r=e[s])instanceof Qr){if(i.has(r)&&(n=i.get(r)),n&&(t&&(-1===t._child.indexOf(n)&&t._child.push(n),0===t._parentLayer.length?(n._parentLayer.push(t),n._parent=t):(t._parentLayer.forEach(function(t){-1===n._parentLayer.indexOf(t)&&(t instanceof as||!t||n._parentLayer.push(t))}),n._parentLayer.push(t),n._parent=t)),e.length>s+1&&Array.isArray(e[s+1]))){var a=e[++s];n._subLayer=a,this._parsingLayerOrder(n,a,i)}}else if(Array.isArray(e[s])){var o=e[s];if(!o||0===o.length)return;"string"==typeof o[0]?(t=null,this._parsingLayerOrder(t,o,i)):(t=null,this._parsingLayerOrder(t,e[s],i))}},e.prototype._createLayerHierarchical=function(t){var e=this,i=t.get("D");i&&i.has("Order")&&this._layerDictionary&&this._layerDictionary.size>0&&(this._list.splice(0,this._list.length),this._layerDictionary.forEach(function(t,i){t instanceof as&&i instanceof Qr&&(t._parent||-1!==e._list.indexOf(t)?t._child.length>0?e._addChildLayer(t._parent):t._parent&&0===t._child.length&&!t._parent.layers.contains(t)&&t._parent.layers._addNestedLayer(t):e._list.push(t))}))},e.prototype._addChildLayer=function(t){t._child.forEach(function(e){-1===t.layers.indexOf(e)&&t.layers._addNestedLayer(e)})},e.prototype._addNestedLayer=function(t){this._list.push(t);var e=this._list.length-1;return t._layer=t,e},e.prototype._removeLayer=function(t,e){var i;if(t&&this._document){if((i=this._document._catalog._catalogDictionary)&&i.has("OCProperties")){var r=i.get("OCProperties");if(r){var n=r.get("OCGs");if(n&&this._removeOCG(t,n),r.has("D")){var s=r.get("D");if(s){var a=void 0,o=void 0;if(s.has("Order")){var h=s.get("Order");if(h){var c=[];this._removeOrder(t,h,c)}}if(s.has("Locked")){var _=s.get("Locked");_&&this._removeLocked(t,_)}if(s.has("OFF")&&(o=s.get("OFF")),s.has("ON")&&(a=s.get("ON")),s.has("AS")){var d=s.get("AS");d&&this._removeUsage(t,d)}this._removeVisible(t,a,o)}s._updated=!0}if(t._layerPage){var l=t._layerPage._pageDictionary.get("Resources");if(l.has("Properties")){var f=l.get("Properties");f&&f.has(t._layerId)&&delete f._map[t._layerId]}}var p=this._crossReference._cacheMap;if(p.has(t._referenceHolder)){var u=this._crossReference._cacheMap.get(t._referenceHolder);if(u){var g=u.getRaw("Usage");if(g instanceof Qr&&(u=this._crossReference._cacheMap.get(g))){var y=u.getRaw("Print");p.delete(t._referenceHolder),p.delete(g),p.delete(y)}}}r._updated=!0,i._updated=!0}this._crossReference._allowCatalog=!0}e&&this._removeLayerContent(t)}},e.prototype._removeOCG=function(t,e){e&&-1!==e.indexOf(t._referenceHolder)&&e.splice(e.indexOf(t._referenceHolder),1)},e.prototype._removeUsage=function(t,e){if(e)for(var i=!1,r=0;r<e.length;r++){var n=e[r];if(n){var s=void 0;if(n instanceof Qr&&(s=this._crossReference._fetch(e[r])),n instanceof $r&&(s=n),s){var a=s.get("OCGs");if(a&&(-1!==a.indexOf(t._referenceHolder)&&(a.splice(a.indexOf(t._referenceHolder),1),i=!0),i))break}}}},e.prototype._removeOrder=function(t,e,i){var r=!1;if(e)for(s=0;s<e.length;s++){var n=e[s];if(n&&n instanceof Qr&&n===t._referenceHolder){if(s!==e.length-1){if(Array.isArray(e[s+1])){e.splice(s,2),r=!0;break}e.splice(s,1),r=!0;break}e.splice(s,1),r=!0;break}Array.isArray(n)&&i.push(e[s])}if(!r&&i)for(var s=0;s<i.length;s++)e=i[s],i.splice(s,1),s-=1,this._removeOrder(t,e,i)},e.prototype._removeVisible=function(t,e,i){if(t.visible)e&&-1!==e.indexOf(t._referenceHolder)&&(r=e.indexOf(t._referenceHolder))>-1&&e.splice(r,1);else if(i&&-1!==i.indexOf(t._referenceHolder)){var r=i.indexOf(t._referenceHolder);r>-1&&i.splice(r,1)}},e.prototype._removeLocked=function(t,e){e&&-1!==e.indexOf(t._referenceHolder)&&e.splice(e.indexOf(t._referenceHolder),1)},e.prototype._removeLayerContent=function(t){var e,i,r=!1;if(t._layerPage)for(var n=0;n<t._pages.length;n++){var s=t._pages[n]._pageDictionary.get("Resources");if(s&&(e=s.get("Properties"),i=s.get("XObject"),e&&t._layerId.trim().length>0&&e.has(t._layerId)&&delete e._map[t._layerId],i&&t._xObject.length>0)){for(var a=i._map,o=0,h=a;o<h.length;o++){var c=h[o];if(-1!==t._xObject.indexOf(a[String(c)])){delete i._map[String(c)];break}}-1!==t._xObject.indexOf(t._layerId)&&t._xObject.splice(t._xObject.indexOf(t._layerId),1)}for(var _=t._pages[n]._pageDictionary.getArray("Contents"),d=0;d<_.length;d++){for(var l=new sn([]),f=_[d],p=f.dictionary.objId,u=f.getBytes(),g=void 0,y=(g=new on(f instanceof sn?f._bytes:u))._readContent(),m=0;m<y.length;m++){var b=y[m],v=b._operator;if("BMC"===v||"EMC"===v||"BDC"===v){var w=b._operands;this._processBeginMarkContent(t,v,w,l,p),r=!0}"Do"===v&&-1!==t._xObject.indexOf(b._operands[0])&&(r=!0),"q"===v||"Q"===v||"w"===v||"J"===v||"j"===v||"M"===v||"d"===v||"ri"===v||"i"===v||"gs"===v||"g"===v||"cm"===v||"G"===v||"rg"===v||"RG"===v||"k"===v||"K"===v||"cs"===v||"CS"===v||"scn"===v||"SCN"===v||"sc"===v||"SC"===v?(r||this._streamWrite(b._operands,v,!1,l),r=!1):(r||this._streamWrite(b._operands,v,!0,l),r=!1)}if(l.length>0&&!p){var S=t._pages[n]._contents[d],P=this._crossReference._fetch(S);P._bytes.length=0,P.write(l.getString())}}t._pages[n]._pageDictionary._updated=!0}},e.prototype._processBeginMarkContent=function(t,e,i,r,n){if("BDC"===e){var s=void 0;if(i.length>1&&"OC"===i[0].substring(1)&&(s=i[1].substring(1)),this._bdcCount>0)return void this._bdcCount++;if(s&&s===t._layerId){this._bdcCount++;var a=t._pages[0]._pageDictionary.getRaw("Contents");if(n){var o=n.split(" "),h=a.indexOf(Qr.get(Number(o[0]),Number(o[1])));t._pages[0]._pageDictionary.getRaw("Contents").splice(h,1)}}}this._streamWrite(i,e,!0,r),"EMC"===e&&this._bdcCount>0&&this._bdcCount--},e.prototype._streamWrite=function(t,e,i,r){var n;if(!i||!this._isSkip){if(t)for(var s=0,a=t;s<a.length;s++)n=a[s],r.write(n),r.write(" ");n=e,r.write(n),r.write("\r\n")}},e.prototype._insertLayer=function(t,e){var i=e._referenceHolder;if(this._document){var r=this._document._catalog._catalogDictionary;if(r.has("OCProperties")){var n=r.get("OCProperties");if(n){var s=n.get("OCGs");if(n.has("D")){var a=n.get("D");if(a){var o=a.get("Order");if(o&&s&&-1!==o.indexOf(i)&&t<o.length&&o[t]instanceof Qr&&t+1<o.length&&t+2<o.length){var h=t+2;if(o[t+1]instanceof Qr&&o[h]instanceof Qr){var c=o.indexOf(i);if(o.splice(c,1),o.splice(t,0,i),-1!==s.indexOf(i)){var _=s.indexOf(i);s.splice(_,1),s.splice(t,0,i)}}}}}}}}},e}(),hs=function(){function t(t,e){this._pageCount=0,this._document=t,this._crossReference=t._crossReference;var i=new $r(this._crossReference);i.update("Type",Xr.get("Pages")),this._pageSettings=e,Xt(i,e);var r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,i),i.objId=r.toString(),i.update("Kids",[]),i.update("Count",0),this._dictionary=i,this._reference=r;var n=this._document.pageCount;if(0===n){var s=this._document._catalog._catalogDictionary._get("Pages"),a=this._document._catalog._topPagesDictionary;a&&(a.has("Kids")?(c=a.get("Kids"))&&(c.push(r),a.update("Kids",c),i.update("Parent",s)):(a.update("Kids",[r]),i.update("Parent",s)))}else{var o=this._document.getPage(n-1);if(o&&o._pageDictionary){var s=o._pageDictionary._get("Parent"),h=this._crossReference._fetch(s);if(h&&h.has("Kids")){var c=h.get("Kids");c&&(c.push(r),h.update("Kids",c),i.update("Parent",s))}}}}return t.prototype.addPage=function(){var t=0===this._document.pageCount?0:this._document.pageCount,e=new $r(this._crossReference);e.update("Type",Xr.get("Page"));var i=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(i,e),e.objId=i.toString(),e.update("Parent",this._reference),this._dictionary.has("Kids")){var r=this._dictionary.get("Kids");r&&(r.push(i),this._dictionary.update("Kids",r),Kt(this._dictionary,1),this._document._pageCount++)}else this._dictionary.update("Kids",[i]),Kt(this._dictionary,1),this._document._pageCount=1;this._pageCount++;var n=new pr(this._crossReference,t,e,i);return n._pageSettings=this._pageSettings,n._isNew=!0,this._document._pages.set(t,n),n},t}(),cs=function(){function e(e,i){if(this._headerSignature=new Uint8Array([37,80,68,70,45]),this._startXrefSignature=new Uint8Array([115,116,97,114,116,120,114,101,102]),this._endObjSignature=new Uint8Array([101,110,100,111,98,106]),this._version="",this._permissions=t.PdfPermissionFlag.default,this._isEncrypted=!1,this._isUserPassword=!1,this._hasUserPasswordOnly=!1,this._encryptOnlyAttachment=!1,this._encryptMetaData=!1,this._isExport=!1,this._allowCustomData=!1,this._isDuplicatePage=!1,this._isSplitDocument=!1,this._optionalContentDictionaries=[],this._order=[],this._on=[],this._off=[],this._as=[],this._printLayer=[],this._isLoaded=!0,e){this._stream=new nn("string"==typeof e?k(e):e),this._fileStructure=new is,this._crossReference=new Hn(this,i),this._pages=new Map,this._checkHeader(),this._crossReference._setStartXRef(this._startXRef);try{this._parse(!1)}catch(t){if("XRefParseException"!==t.name)throw t;this._parse(!0)}this._crossReference._version=this._version}else{this._isLoaded=!1,this._stream=new nn([]),this._version="1.4",this._fileStructure=new is,this._fileStructure.isIncrementalUpdate=!1,this._crossReference=new Hn(this),this._crossReference._version=this._version,this._crossReference._nextReferenceNumber=1;var r=new $r(this._crossReference);r.update("Type",Xr.get("Catalog"));var n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,r);var s=new $r;s.update("Root",n),this._crossReference._trailer=s,this._crossReference._root=r;var a=new $r(this._crossReference);a.update("Type",Xr.get("Pages")),a.update("Kids",[]),a.update("Count",0);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),r.update("Pages",o),this._catalog=new wn(this._crossReference),this._pages=new Map}}return Object.defineProperty(e.prototype,"_allowImportCustomData",{get:function(){return this._allowCustomData},set:function(t){this._allowCustomData=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_linearization",{get:function(){if(!this._linear){var t=void 0;try{t=new Wn(this._stream)}catch(t){}this._linear=t}return this._linear},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startXRef",{get:function(){var t=this._stream,e=0;if(this._linearization&&this._linearization.isValid)t.reset(),this._find(t,this._endObjSignature)&&(e=t.position+6-t.start);else{for(var i=this._startXrefSignature.length,r=!1,n=t.end;!r&&n>0;)(n-=1024-i)<0&&(n=0),t.position=n,r=this._find(t,this._startXrefSignature,1024,!0);if(r){t.skip(9);var s=void 0;do{s=t.getByte()}while(A(s));for(var a="";s>=32&&s<=57;)a+=String.fromCharCode(s),s=t.getByte();e=parseInt(a,10),isNaN(e)&&(e=0)}}return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEncrypted",{get:function(){return this._isEncrypted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUserPassword",{get:function(){return this._isUserPassword},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageCount",{get:function(){return void 0===this._pageCount&&(this._pageCount=0,this._linearization&&this._linearization.isValid?this._pageCount=this._linearization.pageCount:this._pageCount=this._catalog.pageCount),this._pageCount},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{get:function(){return void 0===this._form&&(this._form=new Jn(this._catalog.acroForm,this._crossReference)),this._form},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"permissions",{get:function(){if(this._crossReference){var t=this._crossReference._permissionFlags;void 0!==t&&(this._permissions=3903&t)}return this._permissions},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bookmarks",{get:function(){var t=this._catalog;if(t)if(t._catalogDictionary.has("Outlines")){i=t._catalogDictionary._get("Outlines");(e=t._catalogDictionary.get("Outlines"))&&(this._bookmarkBase=new _r(e,this._crossReference),this._bookmarkBase._reference=i,e.has("First")&&this._bookmarkBase._reproduceTree())}else{var e=new $r(this._crossReference),i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,e),t._catalogDictionary.update("Outlines",i),this._crossReference._allowCatalog=!0,this._bookmarkBase=new _r(e,this._crossReference),this._bookmarkBase._reference=i}return this._bookmarkBase},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fileStructure",{get:function(){return this._fileStructure},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"layers",{get:function(){return this._layers||(this._layers=new os(this)),this._layers},enumerable:!0,configurable:!0}),e.prototype.getPage=function(t){if(t<0||t>=this.pageCount)throw new Error("Invalid page index");var e=this._pages.get(t);if(e)return e;var i,r=this,n=r._catalog,s=r._linearization;i=s&&s.isValid&&s.pageFirst===t?this._getLinearizationPage(t):n.getPageDictionary(t);var a=new pr(this._crossReference,t,i.dictionary,i.reference);return this._pages.set(t,a),a},e.prototype.addPage=function(t,e){var i,r;void 0!==e?(i=e,r=t,this._checkPageNumber(r)):void 0===t?(i=new ls,r=this.pageCount):t instanceof ls?(i=t,r=this.pageCount):(i=new ls,r=t,this._checkPageNumber(r));var n=new $r(this._crossReference);n.update("Type",Xr.get("Pages")),n.update("Count",1),Xt(n,i);var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),n.objId=s.toString();var a=new $r(this._crossReference);a.update("Type",Xr.get("Page"));var o=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(o,a),a.objId=o.toString(),a.update("Parent",s),n.update("Kids",[o]),0===this.pageCount){if((_=this._catalog._catalogDictionary._get("Pages"))&&this._catalog._topPagesDictionary){var h=!1;this._catalog._topPagesDictionary.has("Kids")&&(l=this._catalog._topPagesDictionary.get("Kids"))&&(l.push(s),this._catalog._topPagesDictionary.update("Kids",l),h=!0),h||this._catalog._topPagesDictionary.update("Kids",[s]),this._catalog._topPagesDictionary.update("Count",1),n.update("Parent",_)}else this._catalog._catalogDictionary.update("Pages",s);this._pages=new Map,this._pageCount=1}else{var c=this.getPage(r===this.pageCount?r-1:r);if(c&&c._pageDictionary){var _=c._pageDictionary._get("Parent"),d=this._crossReference._fetch(_);if(d&&d.has("Kids")){var l=d.get("Kids");if(l){if(r===this.pageCount)l.push(s);else{var f=[];l.forEach(function(t){t===c._ref&&f.push(s),f.push(t)}),l=f,this._updatePageCache(r)}d.update("Kids",l),n.update("Parent",_),Kt(d,1),this._pageCount=this.pageCount+1}}}}var p=new pr(this._crossReference,r,a,o);return p._pageSettings=i,p._isNew=!0,this._pages.set(r,p),p},e.prototype.addSection=function(t){var e;if(!this._isLoaded){var i=t||new ls;e=new hs(this,i)}return e},e.prototype.removePage=function(t){var e=t instanceof pr?t:this.getPage(t);this._removePage(e)},e.prototype._checkPageNumber=function(t){if(t<0||t>this.pageCount)throw new Error("Index out of range")},e.prototype._updatePageCache=function(t,e){void 0===e&&(e=!0);for(var i=new Map,r=this.pageCount-1;r>=0;r--){var n=this.getPage(r);e?r>=t?(i.set(r+1,n),n._pageIndex=r+1):i.set(r,n):r>t?(i.set(r-1,n),n._pageIndex=r-1):r!==t&&i.set(r,n)}this._pages=i,e||(this._pageCount=this._pages.size)},e.prototype._removePage=function(t){var e=this._parseBookmarkDestination();if(e&&e.has(t)){var i=e.get(t);i&&i.forEach(function(t){t&&t._dictionary&&t._dictionary&&(t._dictionary.has("A")&&t._dictionary.update("A",null),t._dictionary.update("Dest",null))})}this._removePageTemplates(t);for(var r=this.form.count-1;r>=0;--r){var n=this.form.fieldAt(r);n&&n.page===t&&this.form.removeFieldAt(r)}this._updatePageCache(t._pageIndex,!1),this._removeParent(t._ref,t._pageDictionary),this._crossReference._cacheMap.has(t._ref)&&(t._pageDictionary._updated=!1),0===this.pageCount&&this._catalog._topPagesDictionary.update("Kids",[])},e.prototype._removeParent=function(t,e){if(e.has("Parent")){var i=e._get("Parent"),r=this._crossReference._fetch(i);if(r&&r.has("Kids")){var n=r.get("Kids");Ut(n)&&1===n.length&&r&&"Pages"===r.get("Type").name?this._removeParent(i,r):(n=n.filter(function(e){return e!==t}),r.update("Kids",n),Kt(r,-1))}}},e.prototype._parseBookmarkDestination=function(){var t=this.bookmarks;if(void 0===this._bookmarkHashTable&&t){this._bookmarkHashTable=new Map;var e=[],i={index:0,kids:t._bookMarkList};do{for(;i.index<i.kids.length;){var r=(t=i.kids[i.index]).namedDestination;if(r){if(r.destination){s=r.destination.page;(a=this._bookmarkHashTable.get(s))||(a=[]),a.push(t),this._bookmarkHashTable.set(s,a)}}else{var n=t.destination;if(n){var s=n.page,a=this._bookmarkHashTable.get(s);a||(a=[]),a.push(t),this._bookmarkHashTable.set(s,a)}}i.index+=1,t.count>0&&(e.push(i),i={index:0,kids:t._bookMarkList})}if(e.length>0)for(i=e.pop();i.index===i.kids.length&&e.length>0;)i=e.pop()}while(i.index<i.kids.length)}return this._bookmarkHashTable},e.prototype._removePageTemplates=function(t){var e;this._catalog._catalogDictionary.has("Names")&&(e=this._catalog._catalogDictionary.get("Names"))&&(this._removeInternalTemplates(e,"Pages",t),this._removeInternalTemplates(e,"Templates",t))},e.prototype._removeInternalTemplates=function(t,e,i){if(t.has(e)){var r=t.get(e);if(r&&r.has("Names")){var n=r.getArray("Names");if(n&&n.length>0){var s=this._getUpdatedPageTemplates(n,i),a=new $r(this._crossReference);a.update("Names",s);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),a.objId=o.toString(),t.update(e,o)}}}},e.prototype._getUpdatedPageTemplates=function(t,e){if(t.length>0)for(var i=1;i<=t.length;i+=2){var r=t[i];if(r&&e._pageDictionary===r)return t.pop(),t.pop(),t}return t},e.prototype.reorderPages=function(t){var e=this;t.forEach(function(t){e._checkPageNumber(t)});for(var i=this._sortedArray(t),r=t.slice().sort(function(t,e){return t-e}),n=Array.from({length:this.pageCount},function(t,e){return e}).filter(function(t){return-1===i.indexOf(t)}),s=n.length-1;s>=0;s--)this.removePage(n[s]);var a=[],o=new Map,h=this._catalog._catalogDictionary._get("Pages");if(i.forEach(function(t,i){var n=e.getPage(r.indexOf(t));n._pageIndex=i,o.set(i,n);var s=new $r(e._crossReference);s.update("Type",Xr.get("Pages")),s.update("Count",1),s.update("Parent",h);var c=e._crossReference._getNextReference();s.objId=c.toString(),s.update("Kids",[n._ref]),a.push(c);for(var _=n._pageDictionary.get("Parent");_&&"Pages"===_.get("Type").name&&(_.forEach(function(t,i){switch(t){case"Parent":case"Kids":case"Type":case"Count":break;case"Resources":e._cloneResources(_.get("Resources"),s);break;default:s.has(t)||s.update(t,i)}}),_.has("Parent"));)_=_.get("Parent");e._crossReference._cacheMap.set(c,s),e._crossReference._fetch(n._ref).update("Parent",c)}),this._pages=o,this._catalog){var c=this._catalog._topPagesDictionary;if(c&&c.has("Kids")){var _=c.get("Kids");_=a,c.update("Kids",_)}}},e.prototype._sortedArray=function(t){var e=[];return t.forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),e},e.prototype._cloneResources=function(t,e){var i=this;if(e.has("Resources")){var r=e.get("Resources");t.forEach(function(t,e){r.has(t)?i._cloneInnerResources(t,e,r):r.update(t,e)})}else e.update("Resources",t)},e.prototype._cloneInnerResources=function(t,e,i){if(e instanceof $r){var r=i.get(t);if(r){var n=!1;r.forEach(function(t,e){r.has(t)||(r.update(t,e),n=!0)}),n&&(i._updated=!0)}else i.update(t,e)}else if(Array.isArray(e)){var s=i.get(t);if(s){var a=!1;e.forEach(function(t){-1===s.indexOf(t)&&(s.push(t),a=!0)}),a&&(i._updated=!0)}else i.update(t,e)}},e.prototype.save=function(t){if(this._isLoaded||0!==this.pageCount||this.addSection().addPage(),this._doPostProcess(this._flatten),"string"!=typeof t)return this._crossReference._save();i.Save.save(t,new Blob([this._crossReference._save()],{type:"application/pdf"}))},e.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e){e({blobData:new Blob([t._crossReference._save()],{type:"application/pdf"})})})},e.prototype.exportAnnotations=function(e,r){this._isExport=!0,this._doPostProcessOnAnnotations();var n,s;if(e&&e instanceof _s?s=e:r&&r instanceof _s&&(s=r),s){if(s.dataFormat===t.DataFormat.xfdf)n=new ce;else if(s.dataFormat===t.DataFormat.json)n=new le;else{if(s.dataFormat!==t.DataFormat.fdf)return;n=new Zn}n.exportAppearance=s.exportAppearance}else n=new ce;var a=n._exportAnnotations(this);if(!e||"string"!=typeof e)return a;i.Save.save(e,new Blob([a],{type:"text/plain"}))},e.prototype.exportFormData=function(e,r){this._doPostProcessOnFormFields();var n,s;if(e&&e instanceof ds?s=e:r&&r instanceof ds&&(s=r),s){if(s.dataFormat===t.DataFormat.xfdf)n=new ce(s.exportName);else if(s.dataFormat===t.DataFormat.json)n=new le(s.exportName);else if(s.dataFormat===t.DataFormat.fdf)n=new Zn(s.exportName);else{if(s.dataFormat!==t.DataFormat.xml)return;n=new es(s.exportName)}n._asPerSpecification=s.asPerSpecification}else(n=new ce)._asPerSpecification=!1;if(!e||"string"!=typeof e)return n._exportFormFields(this);i.Save.save(e,new Blob([n._exportFormFields(this)],{type:"text/plain"}))},e.prototype.importAnnotations=function(e,i){i===t.DataFormat.xfdf?(new ce)._importAnnotations(this,"string"==typeof e?k(e):e):i===t.DataFormat.json?(new le)._importAnnotations(this,"string"==typeof e?k(e):e):i===t.DataFormat.fdf&&(new Zn)._importAnnotations(this,"string"==typeof e?k(e):e)},e.prototype.importFormData=function(e,i){this.form.count>0&&(i===t.DataFormat.xfdf?(new ce)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.json?(new le)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.fdf?(new Zn)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.xml&&(new es)._importFormData(this,"string"==typeof e?k(e):e))},e.prototype.destroy=function(){this._crossReference&&(this._crossReference._destroy(),this._crossReference=void 0),this._catalog&&(this._catalog._destroy(),this._catalog=void 0),this._endObjSignature=void 0,this._headerSignature=void 0,this._pages&&this._pages.size>0&&this._pages.forEach(function(t){t._destroy()}),this._pages&&(this._pages.clear(),this._pages=void 0),this._startXrefSignature=void 0,this._stream=void 0,this._form=void 0,te(),this._mergeHelperCache&&(this._mergeHelperCache.size>0&&this._mergeHelperCache.forEach(function(t){t&&t._objectDispose()}),this._mergeHelperCache.clear(),this._mergeHelperCache=void 0)},Object.defineProperty(e.prototype,"_destinationCollection",{get:function(){if(null===this._namedDestinationCollection||void 0===this._namedDestinationCollection)if(this._catalog._catalogDictionary.has("Names")){var t=this._catalog._catalogDictionary.get("Names");this._namedDestinationCollection=new fr(t,this._crossReference)}else this._namedDestinationCollection=new fr;return this._namedDestinationCollection},enumerable:!0,configurable:!0}),e.prototype._getLinearizationPage=function(t){var e=this,i=e._catalog,r=e._linearization,n=e._crossReference,s=Qr.get(r.objectNumberFirst,0);try{var a=n._fetch(s);if(a instanceof $r&&(ee(a.get("Type"),"Page")||!a.has("Type")&&!a.has("Kids")))return i.pageKidsCountCache.has(s)||i.pageKidsCountCache.put(s,1),i.pageIndexCache.has(s)||i.pageIndexCache.put(s,0),{dictionary:a,reference:s};throw new Ur("The Linearization dictionary does not point to a valid Page dictionary.")}catch(e){return i.getPageDictionary(t)}},e.prototype._checkHeader=function(){var t=this._stream;if(t.reset(),this._find(t,this._headerSignature)){t.moveStart();for(var e="",i=t.getByte();i>32&&!(e.length>=12);)e+=String.fromCharCode(i),i=t.getByte();this._version||(this._version=e.substring(5))}},e.prototype._parse=function(t){this._crossReference._parse(t),this._catalog=new wn(this._crossReference),this._catalog.version&&(this._version=this._catalog.version)},e.prototype._find=function(t,e,i,r){void 0===i&&(i=1024),void 0===r&&(r=!1);var n=e.length,s=t.peekBytes(i),a=s.length-n;if(a<=0)return!1;if(r)for(var o=n-1,h=s.length-1;h>=o;){for(c=0;c<n&&s[h-c]===e[o-c];)c++;if(c>=n)return t.position+=h-o,!0;h--}else for(h=0;h<=a;){for(var c=0;c<n&&s[h+c]===e[c];)c++;if(c>=n)return t.position+=h,!0;h++}return!1},e.prototype._doPostProcess=function(t){void 0===t&&(t=!1),this._doPostProcessOnFormFields(t),this._doPostProcessOnAnnotations(t)},e.prototype._doPostProcessOnFormFields=function(t){if(void 0===t&&(t=!1),this._catalog._catalogDictionary.has("AcroForm")){if(this.form._doPostProcess(t),t){var e=this._catalog._catalogDictionary.getRaw("AcroForm"),i=new $r(this._crossReference);i._updated=!0,e instanceof Qr?this._crossReference._cacheMap.set(e,i):(this.form._dictionary=i,this._crossReference._allowCatalog=!0),this.form._clear()}this.form._isDefaultAppearance?this.form._dictionary.update("NeedAppearances",this.form._isDefaultAppearance):!this.form._isDefaultAppearance&&this.form._dictionary.has("NeedAppearances")&&this.form._isNeedAppearances?this.form._dictionary.update("NeedAppearances",!1):!this.form._isDefaultAppearance&&this.form._dictionary.has("NeedAppearances")&&this.form._dictionary.update("NeedAppearances",this.form.needAppearances)}},e.prototype._doPostProcessOnAnnotations=function(t){void 0===t&&(t=!1);for(var e=0;e<this.pageCount;e++){var i=this.getPage(e);i.annotations._isExport=this._isExport,i.annotations._doPostProcess(t),t&&(i._pageDictionary.has("Annots")&&(delete i._pageDictionary._map.Annots,i._pageDictionary._updated=!0),i.annotations._clear())}},e.prototype._addWatermarkText=function(){if(this.pageCount>0)for(var e=0;e<this._pageCount;e++){var i=this.getPage(e);if(i)try{var r=i.graphics;r.save(),r.setTransparency(.2),r.drawRectangle(0,0,i.size[0],33.75,new Ar([255,255,255])),r.restore(),r.save(),r.setTransparency(.5);var n=new ti(t.PdfFontFamily.helvetica,12,t.PdfFontStyle.regular),s=new pe(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle);r.drawString("Created with a trial version of Syncfusion Essential PDF",n,[0,0,i.size[0],33.75],null,new Ar([0,0,0]),s),r.restore()}catch(t){}}},e.prototype.importPageRange=function(t,e,i,r){if(e>i||e>=t.pageCount)throw new Error("The start index is greater then the end index, which might indicate the error in the program.");this._importPages(t,e,i,r)},e.prototype._importPages=function(t,e,i,r){var n,s,a=0;if(void 0!==r&&"number"==typeof r.targetIndex){if(r.targetIndex>this.pageCount)throw new Error("The target index is out of range.");this._targetIndex=r.targetIndex}var o=new Map;if(!this._isDuplicatePage)for(var h=0;h<t.pageCount;h++){var c=t.getPage(h);o.set(c._pageDictionary,null)}var _;this._mergeHelperCache||(this._mergeHelperCache=new Map),t._uniqueID||(t._uniqueID=X()),this._mergeHelperCache.has(t._uniqueID)?_=this._mergeHelperCache.get(t._uniqueID):(_=new ns(this._crossReference,this,t,o,r),this._mergeHelperCache.set(t._uniqueID,_));var d=!1;(!this._isDuplicatePage&&t._catalog._catalogDictionary.has("OCProperties")||void 0!==r&&!r.optimizeResources)&&(d=!0,n=t._catalog._catalogDictionary.get("OCProperties"),s=new $r(this._crossReference),_._writeObject(t,s,n,n,"OCProperties",null,null),s._updated=!0);for(var l=e;l<=i;l++){var f=t.getPage(l);t.form._doPostProcess(t.flatten,f),f.annotations.count>0&&(f.annotations._doPostProcess(t.flatten),t.flatten&&(f._pageDictionary.has("Annots")&&(delete f._pageDictionary._map.Annots,f._pageDictionary._updated=!0),f.annotations._clear())),t._isSplitDocument?_._importPages(f,this._targetIndex,d,this._isDuplicatePage,r,t._isSplitDocument):_._importPages(f,this._targetIndex,d,this._isDuplicatePage,r),a++,"number"==typeof this._targetIndex&&++this._targetIndex}this._isDuplicatePage||_._fixDestinations(t),_._exportBookmarks(t,a),_._mergeFormFieldsWithDocument(),(d&&!this._isDuplicatePage||void 0!==r&&!r.optimizeResources)&&_._importLayers(s,!0),_._objectDispose(),this._isDuplicatePage=!1},e.prototype.importPage=function(t,i,r){if("number"==typeof t)this._isDuplicatePage=!0,i instanceof rs?this._importPages(this,t,t,i):this._importPages(this,t,t);else if(t instanceof pr&&i instanceof e){var n=t._pageIndex;this.importPageRange(i,n,n,r)}},e.prototype.split=function(){this.splitByFixedNumber(1)},e.prototype.splitByFixedNumber=function(t){var e=this.pageCount;if(!(this.splitEvent&&e>=t&&t>0))throw new Error("Invalid split number. Split number should be greater than zero and less than or equal to page count.");for(var i=0,r=0;r<e;r+=t){var n=Math.min(r+t-1,e-1),s=this._importDocumentPages(r,n);this._invokeSplitEvent(i,s),i++}},e.prototype.splitByPageRanges=function(t){var e=this,i=this.pageCount;if(this.splitEvent){var r=0;t.forEach(function(t){if(Array.isArray(t)&&t.length<2)throw new Error("Invalid page range. Start and end page indexes should be specified.");var n=t[0],s=t[1];if(n<0||s<0||n>=i||s>=i||n>s)throw new Error("Invalid page range: start ("+n+") and end ("+s+").");var a=e._importDocumentPages(n,s);e._invokeSplitEvent(r,a),r++})}},e.prototype._importDocumentPages=function(t,i){this._isSplitDocument=!0;for(var r=new e,n=t;n<=i;n++){var s=this.getPage(n);r.importPage(s,this)}var a=r.save();return r.destroy(),a},e.prototype._invokeSplitEvent=function(t,e){var i=new ps(t,e);this.splitEvent(this,i)},e}(),_s=function(){function e(){this._format=t.DataFormat.xfdf,this._exportAppearance=!1}return Object.defineProperty(e.prototype,"dataFormat",{get:function(){return this._format},set:function(t){this._format=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportAppearance",{get:function(){return this._exportAppearance},set:function(t){this._exportAppearance=t},enumerable:!0,configurable:!0}),e}(),ds=function(){function e(){this._format=t.DataFormat.xfdf,this._exportName="",this._asPerSpecification=!0}return Object.defineProperty(e.prototype,"dataFormat",{get:function(){return this._format},set:function(t){this._format=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportName",{get:function(){return this._exportName},set:function(t){this._exportName=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"asPerSpecification",{get:function(){return this._asPerSpecification},set:function(t){this._asPerSpecification=t},enumerable:!0,configurable:!0}),e}(),ls=function(){function e(){this._size=[595,842],this._isOrientation=!1,this._orientation=t.PdfPageOrientation.portrait,this._size=[595,842],this._margins=new fs,this._rotation=t.PdfRotationAngle.angle0}return Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){this._isOrientation=!0,this._orientation!==t&&(this._orientation=t,this._updateSize(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},set:function(t){this._isOrientation?this._updateSize(t):(this._size=t,this._updateOrientation())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"margins",{get:function(){return this._margins},set:function(t){this._margins=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation=t,t>=4&&(this._rotation=t%4)},enumerable:!0,configurable:!0}),e.prototype._updateSize=function(e){var i,r;Array.isArray(e)?(i=this.orientation,r=e):(i=e,r=this._size),i===t.PdfPageOrientation.portrait?this._size=[Math.min(r[0],r[1]),Math.max(r[0],r[1])]:this._size=[Math.max(r[0],r[1]),Math.min(r[0],r[1])]},e.prototype._updateOrientation=function(){this._orientation=this._size[1]>=this._size[0]?t.PdfPageOrientation.portrait:t.PdfPageOrientation.landscape},e.prototype._getActualSize=function(){return[this._size[0]-(this._margins._left+this._margins._right),this._size[1]-(this._margins._top+this._margins._bottom)]},e}(),fs=function(){function t(t){this._left=this._right=this._top=this._bottom=void 0===t?40:t}return Object.defineProperty(t.prototype,"left",{get:function(){return this._left},set:function(t){this._left=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this._right},set:function(t){this._right=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this._top},set:function(t){this._top=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this._bottom},set:function(t){this._bottom=t},enumerable:!0,configurable:!0}),t}(),ps=function(){function t(t,e){this._index=t,this._pdfData=e}return Object.defineProperty(t.prototype,"pdfData",{get:function(){return this._pdfData},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),t}(),us=function(){function t(t,e,i,r){this._left=0,this._right=0,this._top=0,this._bottom=0,void 0===t?(this._left=.5,this._right=.5,this._top=.5,this._bottom=.5):(this._left=t,this._right=i,this._top=e,this._bottom=r)}return t}(),gs=function(){function e(e){this._boundSet=!1,this._paginateBounds=[],e?(this.break=e.break,this.layout=e.layout,this.paginateBounds=e.paginateBounds,this._boundSet=e._boundSet):(this.layout=t.PdfLayoutType.paginate,this.break=t.PdfLayoutBreakType.fitPage)}return Object.defineProperty(e.prototype,"layout",{get:function(){return this._layout},set:function(t){this._layout=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"break",{get:function(){return this._break},set:function(t){this._break=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paginateBounds",{get:function(){return this._paginateBounds},set:function(t){this._paginateBounds=t,this._boundSet=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usePaginateBounds",{get:function(){return this._boundSet},enumerable:!0,configurable:!0}),e}(),ys=function(){function t(t,e){this._page=t,this._bounds=e}return Object.defineProperty(t.prototype,"Page",{get:function(){return this._page},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bounds",{get:function(){return this._bounds},enumerable:!0,configurable:!0}),t}(),ms=function(){function t(){this.markerWrote=!1,this.markerWidth=0,this.markerX=0}return t}(),bs=function(){function t(){}return t}(),vs=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ws=function(e){function i(t){var i=e.call(this)||this;return i._imageStatus=!0,i._initializeAsync(t),i}return vs(i,e),i.prototype._initializeAsync=function(t){var e=new Uint8Array(t.length);null!==t&&void 0!==t&&"string"==typeof t?e=k(t,!1):t instanceof Uint8Array&&(e=t),this._decoder=h(e),this.height=this._decoder._height,this.width=this._decoder._width,this._bitsPerComponent=this._decoder._bitsPerComponent},i.prototype._save=function(){if(this._imageStatus=!0,this._imageStream=this._decoder._getImageDictionary(),this._decoder&&this._decoder instanceof Nr){var t=this._decoder;this._maskStream=t._maskStream,t._isDecode?t._colorSpace&&this._setColorSpace():this._setColorSpace()}else this._setColorSpace()},i.prototype._setColorSpace=function(){var e,i=this._imageStream.dictionary,r=i.get("ColorSpace");if("DeviceCMYK"===r.name?e=t._PdfColorSpace.cmyk:"DeviceGray"===r.name&&(e=t._PdfColorSpace.grayScale),this._decoder instanceof Nr){var n=this._decoder._colorSpace;void 0!==n&&null!==n&&(e=t._PdfColorSpace.indexed)}switch(e){case t._PdfColorSpace.cmyk:i.update("Decode",[1,0,1,0,1,0,1,0]),i.update("ColorSpace",Xr.get("DeviceCMYK"));break;case t._PdfColorSpace.grayScale:i.update("Decode",[0,1]),i.update("ColorSpace",Xr.get("DeviceGray"));break;case t._PdfColorSpace.rgb:i.update("Decode",[0,1,0,1,0,1]),i.update("ColorSpace",Xr.get("DeviceRGB"));break;case t._PdfColorSpace.indexed:i.update("ColorSpace",this._decoder._colorSpace)}},i}(mr),Ss=function(){function t(t,e){if(this._textIndent=0,null===t||void 0===t)throw new Error("Text cannot be null or undenfied.");this._text=t,e&&(e.font&&(this._font=e.font),e.format&&(this._stringFormat=e.format),e.pen&&(this._pen=e.pen),e.brush&&(this._brush=e.brush))}return Object.defineProperty(t.prototype,"brush",{get:function(){return this._brush},set:function(t){this._brush=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pen",{get:function(){return this._pen},set:function(t){this._pen=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stringFormat",{get:function(){return this._stringFormat},set:function(t){this._stringFormat=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textIndent",{get:function(){return this._textIndent},set:function(t){this._textIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subList",{get:function(){return this._subList},set:function(t){this._subList=t},enumerable:!0,configurable:!0}),t}(),Ps=function(){function t(t){var e=this;this._listItems||(this._listItems=[]),t&&t.forEach(function(t){e.add(new Ss(t))})}return Object.defineProperty(t.prototype,"count",{get:function(){return this._listItems.length},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){if(!t)throw new Error("item should not be null");this._listItems.push(t),e&&(t.textIndent=e)},t.prototype.at=function(t){if(null===t)throw new Error("index should not be null");return this._listItems[t]},t.prototype.remove=function(t){if(!t)throw new Error("item should not be null");for(var e=!1,i=0;i<this._listItems.length;i++)if(this._listItems[i]===t){e=!0,this._listItems.splice(i,1);break}if(!e)throw new Error("item collection does not contain the given content")},t.prototype.removeAt=function(t){if(t<0||t>=this._listItems.length)throw new Error("The index should be less than items count or equal to 0");this._listItems.splice(t,1)},t.prototype.clear=function(){this._listItems=[]},t.prototype.insert=function(t,e,i){if(t<0||t>this._listItems.length)throw new Error("Index should be within the range of items count (inclusive).");if(!e)throw new Error("Item cannot be null.");i&&(e.textIndent=i),this._listItems.splice(t,0,e)},t.prototype.indexOf=function(t){if(!t)throw new Error("Item should be defined.");return this._listItems.indexOf(t)},t}(),As=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),xs=function(){function e(){this._textIndent=5,this._indent=10,this._alignment=t.PdfListMarkerAlignment.left,this._delimiter=".",this._suffix=".",this._enableHierarchy=!1,this._currentIndex=0,this._size=[0,0],this._defaultFont=new ti(t.PdfFontFamily.helvetica,8)}return Object.defineProperty(e.prototype,"brush",{get:function(){return this._brush},set:function(t){this._brush=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pen",{get:function(){return this._pen},set:function(t){this._pen=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stringFormat",{get:function(){return this._stringFormat},set:function(t){this._stringFormat=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"indent",{get:function(){return this._indent},set:function(t){this._indent=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textIndent",{get:function(){return this._textIndent},set:function(t){this._textIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delimiter",{get:function(){return this._delimiter},set:function(t){this._delimiter=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"suffix",{get:function(){return this._suffix},set:function(t){this._suffix=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableHierarchy",{get:function(){return this._enableHierarchy},set:function(t){this._enableHierarchy=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this._alignment},set:function(t){this._alignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._itemCollection},set:function(t){this._itemCollection=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_markerRightToLeft",{get:function(){return this._alignment===t.PdfListMarkerAlignment.right},enumerable:!0,configurable:!0}),e.prototype.draw=function(t,e,i,r,n,s){if(t instanceof pr){if(t._isNew)return this._drawInternal(t,e,i,r,n,s);new Rs(this).layout(t.graphics,[e,i,0,0])}else new Rs(this).layout(t,[e,i,0,0])},e.prototype._drawInternal=function(t,e,i,r,n,s){var a=new bs;return a._page=t,null===r||void 0===r?(a._bounds=[e,i,0,0],a._format=new gs):"number"==typeof r?(a._bounds=[e,i,r,n],a._format=s||new gs):r instanceof gs&&(a._bounds=[e,i,0,0],a._format=r),this._layout(a)},e.prototype._layout=function(t){return new Rs(this).layoutInternal(t)},e}(),ks=function(e){function i(i,r){var n=e.call(this)||this;return n._startNumber=1,n._itemCollection=i||new Ps,r?(r.font&&(n._font=r.font),r.format&&(n._stringFormat=r.format),r.pen&&(n._pen=r.pen),r.brush&&(n._brush=r.brush),r.style?n._style=r.style:n._style=t.PdfNumberStyle.numeric,r.indent&&(n._indent=r.indent),r.textIndent&&(n._textIndent=r.textIndent),r.alignment&&(n._alignment=r.alignment),r.delimiter&&(n._delimiter=r.delimiter),r.suffix&&(n._suffix=r.suffix)):n._style=t.PdfNumberStyle.numeric,n}return As(i,e),Object.defineProperty(i.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"startNumber",{get:function(){return this._startNumber},set:function(t){if(t<=0)throw new Error("Start number should be greater than 0.");this._startNumber=t},enumerable:!0,configurable:!0}),i.prototype._getNumber=function(){return Et(this._startNumber+this._currentIndex,this._style)},i}(xs),Cs=function(e){function i(i,r){var n=e.call(this)||this;return n._itemCollection=i||new Ps,r?(r.font&&(n._font=r.font),r.format&&(n._stringFormat=r.format),r.pen&&(n._pen=r.pen),r.brush&&(n._brush=r.brush),r.style?n._style=r.style:n._style=t.PdfUnorderedListStyle.disk,r.indent&&(n._indent=r.indent),r.textIndent&&(n._textIndent=r.textIndent),r.alignment&&(n._alignment=r.alignment),r.delimiter&&(n._delimiter=r.delimiter),r.suffix&&(n._suffix=r.suffix)):n._style=t.PdfUnorderedListStyle.disk,n}return As(i,e),Object.defineProperty(i.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),i.prototype._getStyledText=function(){switch(this._style){case t.PdfUnorderedListStyle.disk:return"l";case t.PdfUnorderedListStyle.square:return"n";case t.PdfUnorderedListStyle.asterisk:return"]";case t.PdfUnorderedListStyle.circle:return"m";default:return""}},i.prototype._draw=function(t,e,i,r,n){var s=new fe([0,0,this._size[0],this._size[1]],t._crossReference),a=[0,0,0,0];n&&(a[0]=a[0]+n._width,a[1]=a[1]+n._width),s.graphics.drawString(this._getStyledText(),this._unicodeFont,a,n,r),t.drawTemplate(s,{x:e,y:i,width:s.size[0],height:s.size[1]})},i}(xs),Ts=function(){function t(t,e,i){this._list=t,this._index=e,this._number=i}return t}(),Rs=function(){function e(t){this._indent=0,this._information=[],this._markerMaxWidth=0,this._finish=!1,this._usePaginateBounds=!0,this._resultHeight=0,this._size=[0,0],this._index=0,this._element=t}return e.prototype.layout=function(e,i){this._graphics=e;var r=new bs;r._bounds=i,r._format=new gs,r._format.layout=t.PdfLayoutType.onePage,this.layoutInternal(r)},e.prototype.layoutInternal=function(e){if(this._currentPage=e._page,this._bounds=e._bounds.slice(),this._currentPage){if(0===e._bounds[2]&&0===e._bounds[3]){n=this._currentPage.graphics.clientSize;this._bounds[2]=n[0]-this._bounds[0],this._bounds[3]=n[1]-this._bounds[1]}this._graphics=this._currentPage.graphics}var i=new ms;i.broken=!1,i.y=this._bounds[1],this._curList=this._element,this._indent=this._curList.indent,this._setCurrentParameters(this._curList),this._curList.brush||(this._currentBrush=new Ar([0,0,0])),this._curList.font||(this._currentFont=this._curList._defaultFont),this._curList instanceof ks&&(this._markerMaxWidth=this._getMarkerMaxWidth(this._curList,this._information));for(var r=e._format.layout===t.PdfLayoutType.onePage;!this._finish&&(i.y=this._bounds[1],i=this._layoutOnPage(i),!r);){if(this._currentPage&&!this._finish&&(this._currentPage=this._getNextPage(this._currentPage)),this._graphics=this._currentPage.graphics,0===e._bounds[2]&&0===e._bounds[3]){var n=this._currentPage.graphics.clientSize;this._bounds[2]=n[0]-this._bounds[0],this._bounds[3]=n[1]-this._bounds[1]}e._format&&e._format.usePaginateBounds&&this._usePaginateBounds&&(this._bounds=e._format._paginateBounds)}this._information=[];var s=[this._bounds[0],i.y,this._bounds[2],this._resultHeight],a=new ys(this._currentPage,s);return this._currentFormat&&(this._currentFormat._isList=!1),a},e.prototype._layoutOnPage=function(t){var e=0,i=0,r=this._bounds[1],n=this._bounds[0];for(this._size=[this._bounds[2]-this._indent,this._bounds[3]];;){for(;this._index<this._curList.items.count;++this._index){var s=this._curList.items.at(this._index),a=this._drawItem(t,n,this._curList,this._index,this._indent,this._information,s,e,r);if(t=a.pageResult,e=a.height,r=a.y,i+=e,t.broken)return t;if(t.markerWrote=!1,s.subList&&s.subList.items.count>0){if(this._curList instanceof ks){var o=this._curList;o._currentIndex=this._index,(h=new Ts(this._curList,this._index,o._getNumber()))._brush=this._currentBrush,h._font=this._currentFont,h._format=this._currentFormat,h._pen=this._currentPen,h._markerWidth=this._markerMaxWidth,this._information.push(h)}else{var h=new Ts(this._curList,this._index);h._brush=this._currentBrush,h._font=this._currentFont,h._format=this._currentFormat,h._pen=this._currentPen,this._information.push(h)}this._curList=s.subList,this._curList instanceof ks&&(this._markerMaxWidth=this._getMarkerMaxWidth(this._curList,this._information)),this._index=-1,this._indent+=this._curList.indent,this._size[0]=this._size[0]-this._curList.indent,this._setCurrentParameters(s),this._setCurrentParameters(this._curList)}}if(0===this._information.length){this._resultHeight=i,this._finish=!0;break}var c=this._information.pop();this._index=c._index+1,this._indent-=this._curList.indent,this._size[0]=this._size[0]+this._curList.indent,this._markerMaxWidth=c._markerWidth,this._currentBrush=c._brush,this._currentPen=c._pen,this._currentFont=c._font,this._currentFormat=c._format,this._curList=c._list}return t},e.prototype._drawItem=function(e,i,r,n,s,a,o,h,c){var _,d,l=new Pe,f=r.textIndent,p=h+c,u=s+i,g=0,y=this._size,m=o.text,b=this._currentBrush,v=0;o.brush&&(b=o.brush);var w=this._currentPen;o.pen&&(w=o.pen);var S=this._currentFont;o.font&&(S=o.font);var P=this._currentFormat;if(o.stringFormat&&(P=o.stringFormat),(this._size[0]<=0||this._size[0]<S.size)&&this._currentPage)throw new Error("There is not enough space to layout list.");this._size[1]=this._size[1]-h,e.broken&&(m=e.itemText,d=e.markerText);var A=!0,x=this._createMarkerResult(n,r,a,o);if(x?(r instanceof ks?(u+=this._markerMaxWidth,e.markerWidth=this._markerMaxWidth):(u+=x._actualSize[0],e.markerWidth=x._actualSize[0]),v=x._actualSize[1],this._currentPage&&(A=v<this._size[1]),x._empty&&(A=!1)):(u+=r._size[0],e.markerWidth=r._size[0],v=r._size[1],this._currentPage&&(A=v<this._size[1])),d&&""!==d||(A=!0),m&&A){if(y=this._size,y[0]=y[0]-e.markerWidth,0===o.textIndent?y[0]=y[0]-f:y[0]=y[0]-o.textIndent,(y[0]<=0||y[0]<S.size)&&this._currentPage)throw new Error("Not enough space to layout the text. The marker is too long or there is not enough space to draw it.");var k=u;r._markerRightToLeft?(k-=e.markerWidth,!P||P.alignment!==t.PdfTextAlignment.right&&P.alignment!==t.PdfTextAlignment.center||(k-=s)):0===o.textIndent?k+=f:k+=o.textIndent,!this._currentPage&&P&&((P=Object.assign({},P)).alignment=t.PdfTextAlignment.left),_=l._layout(m,S,P,y);var C=[k,p,y[0],y[1]];this._graphics._drawStringLayoutResult(_,S,w,b,C,P),c=p,g=_._actualSize[1]}if(h=g<v?v:g,_&&_._remainder&&""!==_._remainder||x&&x._remainder&&""!==x._remainder||!A?(c=0,h=0,_?(e.itemText=_._remainder,_._remainder===o.text&&(A=!1)):e.itemText=A?void 0:o.text,e.markerText=x?x._remainder:void 0,e.broken=!0,e.y=0,this._bounds[1]=0):e.broken=!1,_){if(e.markerX=u,P)switch(P.alignment){case t.PdfTextAlignment.right:e.markerX=u+y[0]-_._actualSize[0];break;case t.PdfTextAlignment.center:e.markerX=u+y[0]/2-_._actualSize[0]/2}r._markerRightToLeft&&(e.markerX+=_._actualSize[0],0===o.textIndent?e.markerX+=f:e.markerX+=o.textIndent,!P||P.alignment!==t.PdfTextAlignment.right&&P.alignment!==t.PdfTextAlignment.center||(e.markerX-=s))}return A&&!e.markerWrote&&(e.markerWrote=this._drawMarker(r,o,x,p,e.markerX),e.markerWidth=r instanceof ks?x._actualSize[0]:r._size[0]),{pageResult:e,height:h,y:c}},e.prototype._createMarkerResult=function(t,e,i,r){return e instanceof ks?this._createOrderedMarkerResult(e,r,t,i,!1):this._createUnorderedMarkerResult(e,r)},e.prototype._drawMarker=function(t,e,i,r,n){return t instanceof ks?t.font&&i&&(t.font.size>i._actualSize[1]&&(r+=t.font.size/2-i._actualSize[1]/2,i._actualSize[1]=i._actualSize[1]+r),this._drawOrderedMarker(t,i,e,n,r)):(t.font&&i&&t.font.size>i._actualSize[1]&&(r+=t.font.size/2-i._actualSize[1]/2,i._actualSize[1]=i._actualSize[1]+r),this._drawUnorderedMarker(t,i,e,n,r)),!0},e.prototype._drawUnorderedMarker=function(e,i,r,n,s){var a=this._getMarkerFont(e,r),o=this._getMarkerPen(e,r),h=this._getMarkerBrush(e,r);i?(e._size=i._actualSize,e._unicodeFont=new ti(t.PdfFontFamily.zapfDingbats,a.size),e._draw(this._graphics,n-i._actualSize[0],s,h,o)):(e._size=[a.size,a.size],e._draw(this._graphics,n-a.size,s,h,o))},e.prototype._drawOrderedMarker=function(t,e,i,r,n){var s=this._getMarkerFont(t,i),a=this._getMarkerPen(t,i),o=this._getMarkerBrush(t,i),h=[r-this._markerMaxWidth,n,this._markerMaxWidth,e._actualSize[1]],c=this._setMarkerStringFormat(t,this._getMarkerFormat(t,i));this._graphics._drawStringLayoutResult(e,s,a,o,h,c)},e.prototype._setCurrentParameters=function(t){t.brush&&(this._currentBrush=t.brush),t.pen&&(this._currentPen=t.pen),t.font&&(this._currentFont=t.font),t.stringFormat&&(this._currentFormat=t.stringFormat,t instanceof xs&&(this._currentFormat._isList=!0))},e.prototype._getMarkerMaxWidth=function(t,e){for(var i=-1,r=0;r<t.items.count;r++){var n=this._createOrderedMarkerResult(t,t.items.at(r),r+t.startNumber,e,!0);i<n._actualSize[0]&&(i=n._actualSize[0])}return i},e.prototype._createUnorderedMarkerResult=function(e,i){var r=this._getMarkerFont(e,i),n=new Pe,s=new ti(t.PdfFontFamily.zapfDingbats,r.size),a=n._layout(e._getStyledText(),s,null,this._size);return e._size=a._actualSize,e.pen&&(a._size=[a._actualSize[0]+2*e.pen._width,a._actualSize[1]+2*e.pen._width]),a},e.prototype._createOrderedMarkerResult=function(e,i,r,n,s){e._currentIndex=r;var a="";if(e.style!==t.PdfNumberStyle.none&&(a=e._getNumber()+e.suffix),e.enableHierarchy)for(var o=n.slice(),h=0;h<o.length;h++){var c=o[h],_=c._list;if(!(_&&_ instanceof ks&&_.style!==t.PdfNumberStyle.none))break;if(a=c._number+_.delimiter+a,!_.enableHierarchy)break}var d=new Pe,l=this._getMarkerFont(e,i),f=this._getMarkerFormat(e,i),p=[0,0];return s||(p[0]=this._markerMaxWidth,f=this._setMarkerStringFormat(e,f)),d._layout(a,l,f,p)},e.prototype._setMarkerStringFormat=function(e,i){return i=i?Object.assign({},i):new pe,e.stringFormat||(i.alignment=t.PdfTextAlignment.right,e._markerRightToLeft&&(i.alignment=t.PdfTextAlignment.left)),!this._currentPage&&i&&((i=Object.assign({},i)).alignment=t.PdfTextAlignment.left),i},e.prototype._getMarkerFont=function(t,e){var i=t.font;return i||(i=e.font)||(i=this._currentFont),t.font=i,i},e.prototype._getMarkerFormat=function(t,e){var i=t.stringFormat;return i||(i=e.stringFormat)||(i=this._currentFormat),i},e.prototype._getMarkerPen=function(t,e){var i=t.pen;return i||(i=e.pen)||(i=this._currentPen),i},e.prototype._getMarkerBrush=function(t,e){var i=t.brush;return i||(i=e.brush)||(i=this._currentBrush),i},e.prototype._getNextPage=function(t){var e=t._crossReference._document;return t._pageIndex<e.pageCount-1?e.getPage(t._pageIndex+1):e.addPage()},e}();return t.BaseException=zr,t.Dictionary=Zr,t.FormatError=Ur,t.ParserEndOfFileException=Wr,t.Pdf3DAnnotation=Ui,t.PdfAction=ci,t.PdfAngleMeasurementAnnotation=Oi,t.PdfAnnotation=xi,t.PdfAnnotationBorder=rr,t.PdfAnnotationCaption=tr,t.PdfAnnotationCollection=or,t.PdfAnnotationExportSettings=_s,t.PdfAnnotationLineEndingStyle=er,t.PdfAppearance=Pi,t.PdfAttachmentAnnotation=zi,t.PdfBitmap=ws,t.PdfBookmark=dr,t.PdfBookmarkBase=_r,t.PdfBorderEffect=nr,t.PdfBrush=Ar,t.PdfButtonField=ui,t.PdfCheckBoxField=gi,t.PdfCircleAnnotation=Ti,t.PdfCjkStandardFont=ei,t.PdfComboBoxField=bi,t.PdfComment=ki,t.PdfDestination=ur,t.PdfDocument=cs,t.PdfDocumentLinkAnnotation=ji,t.PdfDocumentSplitEventArgs=ps,t.PdfEllipseAnnotation=Ri,t.PdfField=fi,t.PdfFieldActions=di,t.PdfFileLinkAnnotation=Ni,t.PdfFileStructure=is,t.PdfFont=$e,t.PdfForm=Jn,t.PdfFormFieldExportSettings=ds,t.PdfFreeTextAnnotation=Xi,t.PdfGoToAction=_i,t.PdfGraphics=br,t.PdfGraphicsState=Sr,t.PdfImage=mr,t.PdfInkAnnotation=Ii,t.PdfInteractiveBorder=ir,t.PdfLayer=as,t.PdfLayerCollection=os,t.PdfLayoutFormat=gs,t.PdfLayoutResult=ys,t.PdfLineAnnotation=Ci,t.PdfList=xs,t.PdfListBoxField=vi,t.PdfListField=mi,t.PdfListFieldItem=$i,t.PdfListItem=Ss,t.PdfListItemCollection=Ps,t.PdfMargins=fs,t.PdfNamedDestination=lr,t.PdfOrderedList=ks,t.PdfPage=pr,t.PdfPageImportOptions=rs,t.PdfPageSettings=ls,t.PdfPath=oi,t.PdfPen=xr,t.PdfPolyLineAnnotation=Bi,t.PdfPolygonAnnotation=Di,t.PdfPopupAnnotation=Mi,t.PdfPopupAnnotationCollection=hr,t.PdfPredictorStream=Pn,t.PdfRadioButtonListField=yi,t.PdfRadioButtonListItem=Zi,t.PdfRectangleAnnotation=Li,t.PdfRedactionAnnotation=qi,t.PdfRichMediaAnnotation=Qi,t.PdfRubberStampAnnotation=Gi,t.PdfSection=hs,t.PdfSignatureField=wi,t.PdfSoundAnnotation=Ki,t.PdfSquareAnnotation=Fi,t.PdfStandardFont=ti,t.PdfStateItem=Yi,t.PdfStringFormat=pe,t.PdfTemplate=fe,t.PdfTextBoxField=pi,t.PdfTextMarkupAnnotation=Wi,t.PdfTextWebLinkAnnotation=Vi,t.PdfTrueTypeFont=ii,t.PdfUnorderedList=Cs,t.PdfUriAnnotation=Ei,t.PdfWatermarkAnnotation=Hi,t.PdfWidgetAnnotation=Ji,t._AdvancedEncryption=Dn,t._AdvancedEncryption128Cipher=Mn,t._AdvancedEncryption256Cipher=Nn,t._AdvancedEncryptionBaseCipher=In,t._ArabicShape=qe,t._ArabicShapeRenderer=Xe,t._BasicEncryption=Ln,t._Bidirectional=Qe,t._BigEndianWriter=Ge,t._Cipher=Bn,t._CipherTransform=jn,t._CjkDifferentWidth=Se,t._CjkSameWidth=we,t._CjkWidth=ve,t._CjkWidthTable=be,t._ContentLexer=hn,t._ContentParser=on,t._DecompressedOutput=Lr,t._DeflateStream=Ir,t._EncryptionKey=Fn,t._ExportHelper=he,t._FdfDocument=Zn,t._FdfHelper=$n,t._FontStructure=_e,t._HuffmanTree=Br,t._ImageDecoder=Cr,t._InBuffer=Dr,t._Inflater=Or,t._JpegDecoder=Rr,t._JsonDocument=le,t._LineInfo=xe,t._Linearization=Wn,t._MD5=kn,t._Matrix=wr,t._Namespace=ne,t._NormalCipherFour=On,t._NullCipher=En,t._PageLayoutResult=ms,t._PaintParameter=sr,t._PdfBaseStream=rn,t._PdfCatalog=wn,t._PdfCjkFontDescriptorFactory=si,t._PdfCjkStandardFontMetricsFactory=ni,t._PdfCommand=qr,t._PdfContentStream=sn,t._PdfCopier=ss,t._PdfCrossReference=Hn,t._PdfDecodeStream=dn,t._PdfDecryptStream=fn,t._PdfDefaultAppearance=Si,t._PdfDestinationHelper=gr,t._PdfDictionary=$r,t._PdfEncryptor=xn,t._PdfFlateStream=vn,t._PdfFontMetrics=ge,t._PdfLayoutParameters=bs,t._PdfLexicalOperator=zn,t._PdfListInfo=Ts,t._PdfListLayouter=Rs,t._PdfMergeHelper=ns,t._PdfName=Xr,t._PdfNamedDestinationCollection=fr,t._PdfNull=tn,t._PdfNullStream=an,t._PdfPaddings=us,t._PdfParser=Un,t._PdfRecord=cn,t._PdfReference=Qr,t._PdfReferenceSet=Jr,t._PdfReferenceSetCache=Yr,t._PdfStandardFontMetricsFactory=ri,t._PdfStream=nn,t._PdfStreamWriter=yr,t._PdfStringLayoutResult=Ae,t._PdfStringLayouter=Pe,t._PdfTransformationMatrix=vr,t._PdfUnitConvertor=kr,t._PngDecoder=Nr,t._RtlCharacters=Je,t._RtlRenderer=Ye,t._Sha256=Cn,t._Sha512=Tn,t._StandardWidthTable=me,t._StringTokenizer=ke,t._TrueTypeAppleCmapSubTable=Me,t._TrueTypeCmapSubTable=Ie,t._TrueTypeCmapTable=Oe,t._TrueTypeGlyph=Ue,t._TrueTypeGlyphHeader=He,t._TrueTypeHeadTable=Be,t._TrueTypeHorizontalHeaderTable=De,t._TrueTypeLocaTable=We,t._TrueTypeLongHorMetric=ze,t._TrueTypeMetrics=Ve,t._TrueTypeMicrosoftCmapSubTable=Le,t._TrueTypeNameRecord=je,t._TrueTypeNameTable=Fe,t._TrueTypeOS2Table=Te,t._TrueTypePostTable=Re,t._TrueTypeReader=Ee,t._TrueTypeTableInfo=Ce,t._TrueTypeTrimmedCmapSubTable=Ne,t._UnicodeLine=ai,t._UnicodeTrueTypeFont=Ke,t._WidthTable=ye,t._Word64=Rn,t._XfdfDocument=ce,t._XmlAttribute=ae,t._XmlDocument=es,t._XmlElement=se,t._XmlWriter=re,t._addProcSet=K,t._annotationFlagsToString=d,t._appendChar=zt,t._arabicToLetter=Vt,t._arabicToRoman=jt,t._areArrayEqual=u,t._areNotEqual=y,t._byteArrayToHexString=w,t._bytesToString=m,t._calculateBounds=L,t._checkComment=St,t._checkField=Y,t._checkInkPoints=Bt,t._checkReview=wt,t._checkRotation=c,t._checkType=o,t._clearPrimitiveCaches=te,t._compressStream=Ht,t._convertNumber=Et,t._convertToColor=I,t._convertToHex=Yt,t._copyRange=a,t._createFontStream=Qt,t._decode=k,t._decodeFontFamily=Zt,t._decodeText=It,t._decodeUnicodeBytes=b,t._defaultToString=Ct,t._defineProperty=Wt,t._emptyPdfData="JVBERi0xLjQNCiWDkvr+DQoxIDAgb2JqDQo8PA0KL1R5cGUgL0NhdGFsb2cNCi9QYWdlcyAyIDAgUg0KL0Fjcm9Gb3JtIDMgMCBSDQo+Pg0KZW5kb2JqDQoyIDAgb2JqDQo8PA0KL1R5cGUgL1BhZ2VzDQovS2lkcyBbNCAwIFJdDQovQ291bnQgMQ0KL1Jlc291cmNlcyA8PD4+DQoNCi9NZWRpYUJveCBbLjAwIC4wMCA1OTUuMDAgODQyLjAwXQ0KL1JvdGF0ZSAwDQo+Pg0KZW5kb2JqDQozIDAgb2JqDQo8PA0KL0ZpZWxkcyBbXQ0KPj4NCmVuZG9iag0KNCAwIG9iag0KPDwNCi9Db3VudCAxDQovVHlwZSAvUGFnZXMNCi9LaWRzIFs1IDAgUl0NCi9QYXJlbnQgMiAwIFINCj4+DQplbmRvYmoNCjUgMCBvYmoNCjw8DQovVHlwZSAvUGFnZQ0KL1BhcmVudCA0IDAgUg0KPj4NCmVuZG9iag0KeHJlZg0KMCA2DQowMDAwMDAwMDAwIDY1NTM1IGYNCjAwMDAwMDAwMTcgMDAwMDAgbg0KMDAwMDAwMDA4OSAwMDAwMCBuDQowMDAwMDAwMjE4IDAwMDAwIG4NCjAwMDAwMDAyNTUgMDAwMDAgbg0KMDAwMDAwMDMzNCAwMDAwMCBuDQp0cmFpbGVyDQo8PA0KL1Jvb3QgMSAwIFINCi9TaXplIDYNCj4+DQoNCnN0YXJ0eHJlZg0KMzg3DQolJUVPRg0K",t._encode=T,t._encodeValue=bt,t._escapePdfName=q,t._findPage=J,t._floatToString=G,t._fromRectangle=B,t._getBezierArc=Q,t._getColorValue=tt,t._getCommentsOrReview=vt,t._getDecoder=h,t._getFontFromDescriptor=Dt,t._getFontStyle=Rt,t._getInheritableProperty=R,t._getItemValue=Z,t._getLatinCharacter=mt,t._getNewGuidString=X,t._getPageIndex=_,t._getSize=Mt,t._getSpecialCharacter=yt,t._getStateTemplate=$,t._getUpdatedBounds=O,t._hasUnicodeCharacters=qt,t._hexStringToByteArray=S,t._hexStringToString=P,t._isCommand=ie,t._isName=ee,t._isNullOrUndefined=Ut,t._isRightToLeftCharacters=Gt,t._isUnicode=Jt,t._isWhiteSpace=A,t._mapAnnotationIntent=ut,t._mapAnnotationState=dt,t._mapAnnotationStateModel=ft,t._mapAttachmentIcon=pt,t._mapBlendMode=H,t._mapBorderEffectStyle=E,t._mapBorderStyle=N,t._mapFont=Ft,t._mapGraphicsUnit=ot,t._mapHighlightMode=z,t._mapLineEndingStyle=V,t._mapMarkupAnnotationType=st,t._mapMeasurementUnit=nt,t._mapPopupIcon=ct,t._mapRubberStampIcon=ht,t._numberToString=g,t._obtainFontDetails=Tt,t._parseColor=M,t._parseRectangle=F,t._removeDuplicateFromResources=xt,t._removeDuplicateReference=At,t._removeReferences=kt,t._reverseMapAnnotationState=_t,t._reverseMapAnnotationStateModel=lt,t._reverseMapBlendMode=W,t._reverseMapEndingStyle=j,t._reverseMapHighlightMode=U,t._reverseMapPdfFontStyle=gt,t._reverseMarkupAnnotationType=at,t._setMatrix=et,t._stringToAnnotationFlags=l,t._stringToBigEndianBytes=Nt,t._stringToBytes=p,t._stringToPdfString=f,t._stringToStyle=rt,t._stringToUnicodeArray=v,t._styleToString=it,t._toRectangle=D,t._toSigned16=n,t._toSigned32=s,t._toUnsigned=r,t._tryParseFontStream=Lt,t._updateBounds=Ot,t._updateDashedBorderStyle=$t,t._updatePageCount=Kt,t._updatePageSettings=Xt,t._updateVisibility=Pt,t}({},ej.compression,ej.fileutils),this.ejs=ej;
//# sourceMappingURL=ej2-pdf.min.js.map